Algorithms for Line and Plane Intersection with a Convex Polyhedron with complexity in E3. Vaclav Skala. University of West Bohemia, Faculty of Applied ...
Algorithms for Line and Plane Intersection with a Convex Polyhedron with complexity in E3 Vaclav Skala University of West Bohemia, Faculty of Applied Sciences CZ 306 14 Plzen, Czech Republic http://www.VaclavSkala.eu 1. Introduction Efficiency of intersection algorithms is fundamental for solving many problems in computer graphics, e.g. line and polygon clipping etc. For a line clipping by a convex polyhedron the well known Cyrus-Beck’s algorithm is usually used. This algorithm is of complexity, where is a number of facets. However, for a plane clipping by a convex polyhedron algorithms used are of complexity, e.g. Cyrus-Beck’s algorithm. It is known that in the case there is no “ordering” information. On the contrary, in the case the order is given by indexes of the polygon vertices, which leads to computational complexity, e.g. to the algorithm for a line clipping by a convex polygon in with complexity [Skala 1994]. However, an intersection of a plane and a convex polyhedron, given as a triangular mesh, results to a convex polyline lying on a plane in a general position in .
2. Exposition Let us assume a convex polyhedron intersected by a plane in , Fig.1. It can be seen that if a plane intersects the given polyhedron, the intersection curve is convex and vertices are given as intersections of the given plane and edges of the polyhedron. The Cyrus-Beck’s algorithm for line clipping is not working on a triangular mesh, i.e. does not take the knowledge of knowing neighbors of the given triangle. It can be shown that number of intersected edges by a plane is of expected complexity, where is the number of edges. If we imagine a sphere parameterized in spherical coordinates by a mesh in and , we get approx. of triangles to be tested for an intersection, but a plane intersects approx. triangles. It means that expected speed up is In our case of triangles, the expected speed up is . Let us explore an algorithm for a line intersection with a convex polyhedron first and then an algorithm for a plane-convex polyhedron intersection.
2.1 Line - Convex polyhedron intersection in Let us assume that a line in is given by two points. If we take any point on the given polyhedron, e.g. center of gravity of an arbitrary triangle for the sake of robustness, we have three noncollinear points defining a plane (the line lies on it), Fig.1. Now, an orthogonal plane on which the given line lies can be determined. The point can be taken as a starting point and the triangle’s edges give neighbor triangles intersected by the plane . If the triangle is intersected by the planes and , then a detailed test for intersection of the triangle and the line has to be performed, as the line can pass outside of the tested triangle. It can be seen that an algorithm for a line – convex polyhedron given as a triangular mesh with expected complexity is obtained due to use of the triangle’s connectivity information.
Figure 1. Convex polyhedron intersection.
Figure 2. Detailed test
2.2 Plane - Convex polyhedron intersection in This algorithm is actually very similar to the previous one. Any arbitrary point on the polyhedron surface is selected and gradually closest vertices to the plane are selected. This step is of expected complexity. When a triangle intersected by the plane is found, the starting point is received as an intersection of the plane and an edge of this triangle. The rest of the algorithm is the same as in the previous one with a small modification that all the intersections forming a convex planar polygon have to be found instead of two intersection points only. It can be seen that the whole algorithm is of expected complexity, too.
3. Conclusions The presented algorithms for a line and plane clipping by a convex polyhedron are clearly of expected computational complexity. Algorithms are simple to implement and robust as well. Algorithm efficiency is reached by using all the properties of the convex polyhedron, i.e. convexity and connectivity, i.e. known tessellation of the convex polyhedron surface. Expected speed up is actually “close” to complexity expected in the case. Experiments made proved expected speed up expected of the proposed algorithm for . The presented approach can be applied also for the intersection of two convex polyhedrons and expected complexity can be achieved (within the “expectable” interval of , ). A similar approach can be applied also for intersection computations with a non-convex polyhedron.
References EBERLY, D. 2008. Clipping a Mesh Against a Plane, Geometric Tools, http://www.geometrictools.com/. SKALA, V. 1994. O(lg N) Line Clipping Algorithm in E2, Computers & Graphics, Pergamon Press, Vol.18(4), 517-524 SKALA,V. 1996. An Efficient Algorithm for Line Clipping by Convex and Non-Convex Polyhedra in E3, Computer Graphics Forum, Vol.15(1), 61-68. Supported by the MSMT CR projects No.LH12181 and LG13047