"Robert Phillips" <phillir1@my.erau.edu> wrote in message <icsnoc$75h$1@fred.mathworks.com>...
> I have points in 3D space, stored in astrd_surf, a mby3 matrix.
> I have 3 mutually orthogonal vectors a_S, b_S, & c_S, whose tails all lie at point S.
> I want to collect the points of astrd_surf which happen to lie inside of the cylinder, of radius r, along a_S.
> ........
        
You will need a point S lying along the cylinder's central axis to do this problem. Let P be an arbitrary point in a row of 'astrd_surf'. Then the orthogonal distance from P to this central axis is
norm(cross(a_S,PS))/norm(a_S).
The numerator is the length of vector a_S times the length of vector PS times the sine of the angle between them, and the denominator is the length of vector a_S. This makes the ratio of the norms equal to the orthogonal distance from P to the central axis.
Therefore you need to test whether or not this is less than or equal to r. Assuming the cylinder is infinitely long, that determines whether it lies within the cylinder.
If you wish to make this a vectorized logical expression, you will probably have to avoid using 'norm' in the numerator and replace it with the correct expression for the square root of the sum of the squares of the three components of the cross product. The 'norm' function doesn't vectorize the way you would like.
Roger Stafford
