View Full Version : Sphere cutting

Temo_koki

08-23-2010, 11:11 AM

Hi everybody,

Does anybody know method or algorithm how to cut sphere with plane?

I can delete all vertices above plane, but sphere remains open and I can't cap it?

nickels

08-23-2010, 01:33 PM

What about looping through the triangles, checking the vertices: if you are about to delete some (but not all) of the vertices of a triangle, instead of deleting them just project then onto the plane. Project them in the tangent direction to the sphere, i.e. along the edges.

Some details in the projection, but topologically should be simple...

Temo_koki

08-24-2010, 01:36 AM

Yes it is very simple, but in that case there will be many unused vertices and triangles. I want to delete them and fill again triangles array

david_f_knight

08-25-2010, 10:54 AM

I like nickels' idea; very clever.

You know that the intersection of a sphere and a plane is either null, a point, or a circle. Dealing with the null and point intersection cases are trivial (you don't cut anything away from the sphere). In the circle intersection case, you can easily and efficiently define the geometry of the circle with a triangular fan topology that lies on the plane. It shouldn't be hard to find or derive the formula for the radius of the circle, or its center point.

(Your math will be simpler if you first rotate the plane and sphere so that the plane is parallel to one of the XY, XZ, or YZ planes. Your final step will be to rotate everything back to its original orientation.)

All that's left is defining a smooth edge on the sphere where it is cut. There are a few ways you could approach that. The simplest might be something like nickels suggested. If you carefully read what nickels wrote, there need not be any unused vertices or triangles. nickels wrote if a triangle on the sphere straddles the intersection plane, then project the one or two vertices that are on the wrong side of the plane onto the plane (and also onto the perimeter of the circle). (If you've rotated everything so the intersection plane is parallel to the XY, XZ, or YZ planes then this projection is trivial.) If the entire triangle is on the wrong side of the plane, then delete it entirely. No extra vertices or triangles at all.

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.