Tutorial :Determine if 3D point is inside 2D Circle



Question:

I wish to determine if a Point P(x,y,z) is inside a 2D circle in 3D space defined by its center C (cx, cy, cz), radius R, and normal to the plane the circle lies on N.

I know that a point P lying on a 2D circle in 3D space is defined by:

P = R*cos(t)U + Rsin(t)*( N x U ) + C

where U is a unit vector from the center of the circle to any point on the circle. But given a point Q, how do I know if Q is on or inside the circle? What is the appropriate parameter t to choose? And which coordinates do I compare the point Q to see if they are within the circle?

Thanks.


Solution:1

Project P onto the plane containing the circle, call that P'. P will be in the circle if and only if |P - P'| = 0 and |P' - C| < R.


Solution:2

I'd do this by breaking it into two parts:

  1. Find out if the point is on the same plane as the circle (ie. see if the dot product of the vector going from the center to the point and the normal is zero)

  2. Find out if it's inside the sphere containing the circle (ie. see if the distance from the center to the point is smaller than the radius).


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »