Reading: An approach for line clipping against a convex polyhedron

Download

A- A+
dyslexia friendly

Articles

An approach for line clipping against a convex polyhedron

Authors:

K. R. Wijeweera ,

Department of Computer Science, Faculty of Science, University of Ruhuna, LK
X close

S. R. Kodituwakku

Department of Statistics and Computer Science, Faculty of Science, University of Peradeniya, LK
X close

Abstract

Line clipping operation is a bottleneck in most of computer graphics applications. There are situations when millions of line segments need to be clipped against convex polyhedrons with millions of facets. An algorithm to clip line segments against a convex polyhedron is proposed in this work. The salient feature of the proposed algorithm is that it minimizes the number of computations by ignoring unnecessary intersection calculations. The other advantage of the proposed algorithm is that it needs minimum details about the convex polyhedron; the equations of the facets and the centroid. Therefore, it improves the efficiency of the algorithm. The line segment may have zero length (a point) or positive length. When line segment is just a point which is outside with respect to at least one facet, it should be rejected as the line segment is outside the convex polyhedron. When the line segment is parallel to a facet and one of its end points is outside, that line segment is also completely outside and it should also be rejected. Unless the line segment belongs to none of the above two cases, it should be pruned against each facet in a certain order. In this case, the intersection points with only some of the facets need to be computed and some other intersection calculations can be ignored. If the line segment is completely outside then it becomes a single point. That means the two end points coincide. But due to the precision error they do not exactly coincide. Therefore, approximate equality should be tested. By using this property, completely outside line segments can be identified. Having two end points outside does not necessarily keep the line segment completely outside. The widely used Cyrus Beck algorithm computes all the intersection points with each facet of the polyhedron while the proposed algorithm successfully avoids some of the intersection point calculations. In the best case; it is capable of avoiding all the unnecessary intersection calculations. An experimental comparison between the Cyrus Beck algorithm and the proposed algorithm was carried out. Random polyhedrons were created with different number of facets. Random points were generated and they were considered as end points of line segments. For a given polyhedron, the number of clock cycles consumed to clip 108 number of line segments was computed using the Cyrus Beck algorithm and the proposed algorithm. For a polyhedron with four vertices, the proposed algorithm is 1.02 times faster than the Cyrus Beck algorithm. For a polyhedron with nine vertices, the proposed algorithm is 1.16 times faster than the Cyrus Beck algorithm. When the number of facets is large, then the performance of the proposed algorithm is significantly faster since more intersection calculations are avoided. The Skala algorithm is also an efficient algorithm which requires the order of facets also as the input to the algorithm.  The proposed algorithm is faster than Skala algorithm when the number of facets of the polyhedron is less than 100 according to the experimental results. The proposed approach could be very useful for applications where large number of lines to be clipped. It can also be applied in linear programming as well since it can be extended to arbitrary dimensions.
How to Cite: Wijeweera, K.R. & Kodituwakku, S.R., (2016). An approach for line clipping against a convex polyhedron. Ruhuna Journal of Science. 7(1), pp.12–20. DOI: http://doi.org/10.4038/rjs.v7i1.15
Published on 30 Jun 2016.
Peer Reviewed

Downloads

  • PDF (EN)

    comments powered by Disqus