View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Rapidly find the points lying inside a cut-off radius

Be the first to rate this file! 8 Downloads (last 30 days) File Size: 776 KB File ID: #35791 Version: 1.0
image thumbnail

Rapidly find the points lying inside a cut-off radius



This completely vectorized code helps you find all points within a cut-off radius from given point.

| Watch this File

File Information

Say, in applications such as Molecular Dynamics, you may be required to find out which atoms lye within a cut-off radius (for example, the Van-der Waals distance of interaction, or say that interaction distance for the Tersoff Brenner Potential, etc..).

In any other applications, you may be required to identify a set of points lying within a circle.

This code helps you do that job, very fast. This code is completely vectorized and is fast.

Please try the code testrun.m to know how to use this code. Thank you.

Required Products MATLAB
MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
10 Dec 2014 Ingrid

Ingrid (view profile)

doesn't the build in function rangesearch do exactly the same?

Comment only
23 Mar 2012 Jan Simon

Jan Simon (view profile)

You compare the distances twice:
in = find(dist<radius); ...
out = find(dist>radius);
Logical indexing would be more efficient:
in = (dist <= radius);
out = ~in;
This would include the points on the radius in addition.

Comment only

Contact us