cegprakash
cegprakash

Reputation: 3125

How to find whether a point in a 3D space lies inside a truncated cone?

How can I detect if a point is inside a cone or not, in 3D space? will not help because a truncated cone can be a cylinder.

I tried another method which involves too many calculations and is huge.

I'm looking for easier ways to find the presence/absence of a point inside a truncated cone.

Mid point of bottom of the truncated cone -> x,y,z
Mid point of top of the truncated cone -> x, y2, z
BottomRadius = r1
TopRadius = r2

Upvotes: 1

Views: 1577

Answers (2)

PhilLab
PhilLab

Reputation: 5017

Sorry for the sloppy formulation but I would proceed as follows:

  1. Compute the center points c_1, c_2 of both cone circles.
  2. Compute a line going through c_1 and c_2
  3. Compute the distance of your point p to this line and during this, calculate the point q on the line being closest to p (see the Wikipedia article)
  4. If q is not between c_1 and c_2, p lies outside
  5. If q is between c_1 and c_2, the distance dist(p,q) has to be smaller than the radius of the cone at point q. Maybe the radius can be calculated something like this: r(q) := dist(q,c_1)/dist(c_1, c_2) * r_1 + dist(q,c_2)/dist(c_1, c_2) * r_2 with r_1 being the circle radius at c_1 and r_2 the radius of the other circle.
  6. So if dist(p,q) > r(q) , the point lies outside

So two conditions have to be tested

Upvotes: 1

Deleted User
Deleted User

Reputation: 2541

It seems it would be sufficient to test for two conditions, which both must be true:

  • the point must be above the cone base, and below cone top. A one dimensional test. Use distance from cone base for next step, to be performed only if the result of this step was found to be true.
  • the point must be within circumference of the circular cone slice, as determined by the distance from base. Again a relatively simple, also one-dimensional test (distance of point from cone axis compared against slice radius)

Seems pretty straightforward, or am I missing something?

Upvotes: 2

Related Questions