- #1

- 54

- 0

I need to determine if a given point (x,y,z) is inside the confines of this cylinder. And and all help is appreciated.

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- #1

- 54

- 0

I need to determine if a given point (x,y,z) is inside the confines of this cylinder. And and all help is appreciated.

- #2

Science Advisor

Homework Helper

- 2,842

- 0

- #3

- 54

- 0

It is not defined on the axes :(

- #4

- 1,714

- 6

- #5

Science Advisor

Homework Helper

- 2,842

- 0

It is not defined on the axes :(

Then I'd have to know how it's defined to answer that. If you have two systems of axes, you need to convert between them; if you have a parametric equation to define the cylinder, just check if it holds as an inequality.

- #6

- 697

- 2

If the points at the centers of the caps are (ax,ay,az) and (bx,by,bz), you can write a parametric equation for the center line as x(t) = ax + t (bx-ax), y(t) = ay + t (by-ay), z(t) = az + t (bz-az), where t=0 or 1 will give you back the cap points.

The distance from a given point (px,py,pz) to*any* point in the line is given by the function d(t) = sqrt ( (x(t)-px)^2 + (y(t)-py)^2 + (z(t)-pz)^2 ). The *closest* point on the line (the proyection of your point onto the line) is found by minimizing d, that is, by setting d'(t) = 0 and solving for t. (You could do it by hand, using a math package, or using www.quickmath.com, menus Calculus/Differentiate and Equations/Solve).

Now, with the obtained t_min value, you can: (a) determine if t_min is <0 or >1 (or <=, >= to exclude the border), which would mean the given point was below one cap or above the other; and (b) calculate d(t_min), the distance from the line to your point, that will tell you if the point is farther than the cylinder's radius.

Edit:

Here, I was bored. (C source only.)

The distance from a given point (px,py,pz) to

Now, with the obtained t_min value, you can: (a) determine if t_min is <0 or >1 (or <=, >= to exclude the border), which would mean the given point was below one cap or above the other; and (b) calculate d(t_min), the distance from the line to your point, that will tell you if the point is farther than the cylinder's radius.

Edit:

Here, I was bored. (C source only.)

Last edited:

Share:

- Replies
- 8

- Views
- 564

- Replies
- 2

- Views
- 351

- Replies
- 6

- Views
- 950

- Replies
- 10

- Views
- 839

- Replies
- 35

- Views
- 2K

- Replies
- 0

- Views
- 410

- Replies
- 4

- Views
- 859

- Replies
- 8

- Views
- 1K

- Replies
- 29

- Views
- 747

- Replies
- 10

- Views
- 676