Circle Slicing Cylinder: 3 Dimensions, 3 Approaches
Date: 08/10/2016 at 06:23:14 From: Amol Subject: Cylinder Circle intersection in 3D I have a question about finding the intersection of a circle and an infinite cylinder in three dimensions. How can I get the intersecting points of these two? I thought of cutting the cylinder with the circle's plane, then finding the intersection of this newly formed ellipse and the circle ... but I don't know how to do that. The circle is defined by its center, plane, and radius. The cylinder is defined by its axis and radius.
Date: 08/10/2016 at 15:50:12 From: Doctor George Subject: Re: Cylinder Circle intersection in 3D Hi Amol, Thanks for writing to Doctor Math. There is more than one way to attack this problem, and yours would work. But this is not a simple problem, no matter what approach is used. The important thing is to be organized. I suggest a vector-based approach, especially since it sounds like you already have vectors associated with the circle and cylinder. Let's start by defining notation for the circle. 1. c1: the coordinates of the circle center 2. r1: the radius of the circle 3. W1: a unit vector normal to the plane 4. U1: a unit vector in plane of the circle (use anything convenient) 5. V1: a unit vector perpendicular to W1 and U1 U1, V1 and W1 form a coordinate system positioned at c1. And now for the plane. 1. c2: any point on the cylinder axis 2. r2: the radius of the cylinder 3. W2: a unit vector in the direction of the cylinder axis 4. U2: a unit vector perpendicular to W2 (use anything convenient) 5. V2: a unit vector perpendicular to W2 and U2 U2, V2, and W2 form a coordinate system positioned at c2. Now then, we can parameterize the circle as the set of all points p1, such that p1 = c1 + r1 cos(alpha1) U1 + r1 sin(alpha1) V1 Here, alpha1 is an angle parameter on [0, 2pi). With slightly more complexity, we can parameterize the cylinder as the set of all points p2, such that p2 = c2 + r2 cos(alpha2) U2 + r2 sin(alpha2) V2 + k W2 Here, alpha2 is an angle parameter on [0, 2pi), and k a location parameter along the cylinder axis. To find the intersection points, we need to find where p1 = p2. That means that p1 and p2 must have equal x, y, and z components. But instead of setting the x, y, and z components equal, we get simpler equations by setting the components equal along the U2, V2, and W2 directions. 1. c1.U2 + r1 cos(alpha1) U1.U2 + r1 sin(alpha1) V1.U2 = c2.U2 + r2 cos(alpha2) 2. c1.V2 + r1 cos(alpha1) U1.V2 + r1 sin(alpha1) V1.V2 = c2.V2 + r2 sin(alpha2) 3. c1.W2 + r1 cos(alpha1) U1.W2 + r1 sin(alpha1) V1.W2 = c2.W2 + k The three unknowns are alpha1, alpha2, and k. There is a lot going on here, so let's stop to see if you are following the approach thus far. Of course, if you see how to solve the system, go ahead and finish it. As I alluded to earlier, there are other ways to attack this problem. But I hope that the organization of this method, if nothing else, will help. Let me know if you need more assistance. - Doctor George, The Math Forum at NCTM http://mathforum.org/dr.math/
Date: 08/10/2016 at 22:26:58 From: Amol Subject: Thank you (Cylinder Circle intersection in 3D) Thanks for answering this question on very short notice. You said that there is more than one approach to do this. Would you please explain some others? I ask because I have to implement this problem statement in C++, and something which can be coded with minimal complexity would be a great help. Thanks once again.
Date: 08/12/2016 at 11:03:33 From: Doctor George Subject: Re: Thank you (Cylinder Circle intersection in 3D) Here are two more ways to think about the problem. If we went with your original approach, we would need to find the intersection of the cylinder axis with the plane of the circle to find the center of the ellipse. Considering the relationship between the cylinder axis and plane vector leads to the ellipse major/minor axes. By continuing with this strategy, we can construct the ellipse and then find its intersection with the circle. Another approach would be to use a parameterization of the circle and find where the distance from a point on the circle to the cylinder axis equals the cylinder radius. (Comparing squared distances is actually simpler.) Now think about the circle and ellipse intersection. There are five possible results -- from 0 to 4 intersections. What this suggests is that no matter how you attack it, the closed form solution will eventually come down to finding the roots of a quartic (4th order) polynomial. Based on your knowledge of the real world problem being solved, you may know how many solutions you expect, and which ones are of most interest to you. As for programming, solving the quartic equation can be framed as an Eigenvalue problem. If you have a linear algebra library available, that is the approach you should probably take. It will find all of the solutions. If that is not an option, I would use the last approach that I proposed. It has just one variable: an angle parameter. Applying Newton's method, you could find the values of the angle that correspond to intersection points. Of course, you would need some familiarity with these additional topics. I hope this is helping you make progress. - Doctor George, The Math Forum at NCTM http://mathforum.org/dr.math/
Search the Dr. Math Library:
Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.