Intersection of a Line and a Convex Hull of Points Cloud

An algorithm for intersection a line and a convex hull of points cloud is presented. The algorithm doesn't require the convex hull construction. The points cloud can be arbitrary and not sorted, no topology, face list or edge list is known. The algorithm uses only vertices coordinates. Standard transformation of coordinates is performed and the points cloud is bisected by two perpendicular planes. Yielded 1D points set lies at the line. Bounds of the set are intersection points of the points cloud and the line. The algorithm was compared against the obvious algorithm which uses intersection of the line and all possible faces (sets of three points). Presented algorithm is much faster than the obvious one.


Introduction
Intersection of lines, rays and segments against various geometrical objects is widely used in radiative heat transfer, computational geometry and computer graphics.In radiative heat transfer such objects are metal bars, furnace walls and mechanical assemblies.In computer graphics such objects are buildings, interior objects and animated characters [6].
In usual applications static geometrical models are used which are represented by planar (triangle, quadrilateral, polygon) or volumetric (tetrahedron, hexahedron, cube, sphere) objects.For such models the topology -face list, edge list or a graph -is already known or can be determined once before all operations with the model.Here, face list is a table containing vertices numbers for each face, edge list is a table containing vertices numbers for each edge.The topology can be determined by construction of the convex hull.There are many algorithms of convex hull construction in 2D, 3D and kD: Graham's method, «divide and conquer» method, «gift wrapping» and others -see classic book [5].But really determining the topology is often not needed because it consumes too much time and because it is often used only as a preprocessing step before intersection tests.Such case can be occurred in animation and visualization of non rigid objects.For such objects their topology can't be determined beforehand, so handling of non rigid objects becomes more and more actual problem [11].
This paper presents an algorithm of intersection a line and a convex hull of points cloud without the convex hull construction.The paper is organized as following: 1) Known algorithms of intersection of a line and convex polyhedron are described; 2) Obvious approach for line -convex hull intersection is given.The algorithm intersects a line against all combinations of 3 points assuming each 3 points may be a face of the convex hull (face representation); 3) A new approach for line -convex hull intersection is given.In contrast to face representation, the algorithm assumes that each 2 points may be an edge of the convex hull (edge representation); 4) Performance comparison of the algorithms 2 and 3.

Known algorithms of line -convex polyhedron intersection
The Cyrus-Beck algorithm [1] uses the fact that a convex polyhedron can be understood as the intersection of halfspaces.Boundaries of these halfspaces are formed by planes in which faces of the polyhedron lie.Suppose we have a convex polyhedron and a line with some parametrization.Searching for the intersection of these geometrical objects, we can divide the bounding planes of the polyhedron into two groups according to the orientation of their normal vectors.Among the planes oriented towards the observer, we search for the point of intersection with the maximal parameter value t l .Among planes of the other group, the minimal parameter value t 2 is found.If t l > t 2 , the intersection of the polyhedron with the given line does not exist.If t l ≤ t 2 , we compute the points of intersection [1].This process is illustrated in fig. 1 for 2D case.
The CB algorithm uses point coordinates O at the line, the direction vector D, faces normals N i : i=1…N, a list of d i such that d i = -N i •P i , and the number of faces N as input data.The outputs are t 1 ,t 2 , and the intersection points Point 1 and Point 2 .Each face is presented by a halfspace in this algorithm, so, the Cyrus-Beck algorithm needs the face list.

Plane tested algorithms
The main idea to accelerate two early algorithms is to reject polyhedron faces before the main computing.The one of possible ways is to test linebounding volume intersection first.However, this strategy is applied usually to all geometry but not to individual polyhedron faces.
Another idea was proposed by V. Skala in [7] for triangular faces.A line L 1 can be defined as an intersection of two nonparallel planes p 1 and p 2 .If the line L 1 intersects the given triangle then planes p 1 and p 2 intersect the given triangle, too, but if planes p 1 and p 2 intersect the triangle then the line can intersect (line L 1 and planes p 1 and p 2 ) or miss the triangle (line L 2 and planes p 3 and p 4 ), see fig. 2. Then we can test each triangle of the given polyhedron against p 1 and p 2 planes before detailed line -triangle or line -halfspace intersection computation.If both planes intersect the given triangle (facet) then use detailed intersection test.The intersection of the given plane p i and the triangle exists if and only if two vertices x j and x k of the triangle exist so that ( ) ( ) This test can be applying with direct computational algorithm or with Cyrus-Beck algorithm and computing time may be decreased 2-4 times for 100 polyhedron faces or 34 -6.1 times for 1000 polyhedron faces [2].

Fig. 2 Usage of two planes for line definition
The rejection test allows one to determine an edge intersected by planes p 1 or p 2 and next triangle shared by this edge.Thus we can test not all triangles against plains p 1 and p 2 , but only ring of triangles which intersected by plane p 1 .By following from one triangle to next triangle with common edge (see fig. 3) we can test only ) ( N O triangles.This algorithm described in details in [10].
Fig. 3 Testing sequence of triangles with common edge

Dual space algorithms
A line in E 2 can be described by an equation 0 = + + c by ax and rewritten as It means, that the line L in E 2 can be represented using an asymmetrical model of dual space [3] representation as a point This is a great advancement for solving the problem if a large time for precomputing is available and the face list is known.Anyway, dual space algorithms also use the face list of polyhedron.

The obvious algorithm
Potentially any three points may be a face of the convex hull.Obvious algorithm intersects a line and each potential face and calculates the value of t idistance from point on the line to the intersection point.Max and min of all t i represent two intersections point of the line and the convex hull of points cloud.Loop over each set of three points (3 nested loops over point number) leads to ) ( 3 N O complexity.This algorithm can be simplified if coordinates of intersection points are not needed.In this case the algorithm will be terminated if first line-triangle intersection is found.

New algorithm
The main ideas of the algorithm are refusing of face representation of convex hull and construction of sections of the points cloud.First section of the points cloud by a plane containing the given line is constructed.A new planar points cloud is obtained.Intersection points of the line and initial points cloud are the same as intersection points of the line and obtained planar points cloud.New section of the planar points cloud by the given line is constructed.As a result, a 1D points set belonging to the line is obtained.Bounds of the 1D point set are the intersection points of the line and the convex hull of initial points cloud.

The algorithm:
1. Let us consider the line . Use transformation of coordinates to place O in the origin and on the z-axis.In practice, x or y axis may be used.2. Separate points into two groups: .Here z parameter is the same as parameter t in algorithms that use parametric line equation Illustration of the algorithm executing for non-convex points set is given in fig. 5. ( ) . Total points clouds were used, the clouds were inscribed into the cube that has minimal bounds x,y,z = -1 and maximal bounds x,y,z = +1.For each N and for each points cloud, 2•10 5 lines were used, so 2•10 7 lines used for each N. Data sets of two points that define a line were generated such that first and second points of each line lie on two different cube faces, see fig. 6.Such lines and points arrangement is the most right and practical one because in practice line -object intersection calculation should be always the second step after intersection the line with object's bounding box.
Runtimes of algorithms in seconds per million lines are given in table 1.All tests were implemented in Fortran on Intel Pentium II 1.83 GHz.The algorithm described in [4] was used as the line-triangle intersection test in the obvious algorithm.It can be seen that both for calculation of intersection points and for intersection test the proposed algorithm is faster than the obvious one for N>4.If N=4 then the points cloud is a tetrahedron and its topology is really known: each three points form a face of the tetrahedron and each two points form an edge.If only intersection test is required, the proposed algorithm is 10 times faster than the obvious one if N=18 and it is 34 times faster if N=100.If calculation of intersection points is required, performance of the proposed algorithm grows as N increases to 16 (5.9times superiority), but further the performance decreases.

Conclusions
The algorithm for intersection a line and a convex hull of points cloud is presented.The algorithm doesn't require of convex hull construction.The algorithm is interesting for computer graphics, readiative heat transfer and compu-tational geometry.The main ideas of the algorithm are refusing of face representation of convex hull and construction of sections of the points cloud.The proposed algorithm was tested against the obvious algorithm which intersects a line and each set of three points (each potential face).It is shown that the proposed algorithm has superior performance especially for intersection tests.Possible subject for future work is application of the algorithm for convex polyhedron with known edge list and unknown face list.It is expected that the algorithm will have O(N) complexity and its performance will be comparable with those of known line -convex polyhedron intersection algorithms.
coordinate not less than zero.If one of two groups is empty then L doesn't intersect the points cloud (its convex hull).3lie at the polyhedron section by plane y = 0 (fig.4a).The set 0 = y P is non convex, therefore 2D algorithms of line-polygon intersection can't be used.coordinate not less than zero (fig.4b).If one of two groups is empty then L doesn't intersect the points cloud (its convex hullat the line L and have only z coordinate.6. Find min z and max z coordinate of points 0 , = y x P

Fig. 6
Fig. 6 Lines and points arrangement.Data sets of two points that define a line are located in the bounding box of points cloud us to transform a line -polyhedron intersection test into point in polygon test problem.Dual space representation was used for line clipping in [2,3,8].V. Skala proposed a line clipping algorithm with O(1) complexity [9].The line clipping problem is reduced into point in polygon problem.And point in polygon problem is solved by constant time search on uniform grid.

Table 1 .
Algorithms performance