Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Points Within Cylindrical Region

Subject: Points Within Cylindrical Region

From: Robert Phillips

Date: 28 Nov, 2010 05:02:04

Message: 1 of 3

I have points in 3D space, stored in astrd_surf, a m-by-3 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.

I've collected points which lie within a cubic region using logical indexing before, but I do not know how to describe a cylinder along an arbitrary axis and I don't know how to describe in Matlab an inequality (or someting) which would provide the condition for taking points that do in fact lie inside the cylinder.

I understand this is random so if additional clarification is necessary feel free to ask.

Subject: Points Within Cylindrical Region

From: Roger Stafford

Date: 28 Nov, 2010 05:52:03

Message: 2 of 3

"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 m-by-3 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,P-S))/norm(a_S).

The numerator is the length of vector a_S times the length of vector P-S 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

Subject: Points Within Cylindrical Region

From: Robert Phillips

Date: 28 Nov, 2010 15:33:05

Message: 3 of 3

"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 m-by-3 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.
>
> I've collected points which lie within a cubic region using logical indexing before, but I do not know how to describe a cylinder along an arbitrary axis and I don't know how to describe in Matlab an inequality (or someting) which would provide the condition for taking points that do in fact lie inside the cylinder.
>
> I understand this is random so if additional clarification is necessary feel free to ask.

Thanks for the quick reply, I'll try it out!

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us