Encarnacao's Priority Method.

Copyright (c) Susan Laflin. August 1999.

O	Input Data in 3D is the set of triangular facets making 
	up the object (the vertices of a triangle have to be coplanar).
I	Intermediate data is the set of ordered pairs (ti,Ti) 
	used to determine priority.
S	Output data in 2D is the set of visible line-segments 
	which make up the drawing of the object.
T	the transition functions to be used in the algorithm.
	PM	parallel projection on to z=0.
	IS 	intersection of triangles.
	CT 	vertex within triangle.
	DT	distance from z=0 plane.
	VT	visibility depends on priority.
M	method - as described below. 

The object is represented as a set of triangular facets in 3D, denoted by S = (S1, S2, ..... , Sm) and the triangles are numbered and specified by the coordinates of their vertices. The triangle ti in the plane z=0 is the projection of the facet Si.

The first step is to compare each triangle with all the other triangles and build up the list Ti of all other triangles which have priority over it. Another triangle tj has priority over ti if one of the vertices of tj lies inside ti and the z-coordinate of the vertex is greater then all the z-coordinates of ti. If the z-coordinate of the vertex lies within the range of z-coordinates of ti, then further tests must be applied to subdivide one of the triangles and give extra triangles whose priority is unambiguous.

Having carried out these comparisons and built up this set Ti for each triangle ti, we must then test to see how much of ti is visible.

Any triangle ti, for which the set Ti is empty, is completely visible. For simple objects, there will be many triangles for which this is true.

If the set Ti is not empty, then frequently we shall find the triangle is completely covered. In a few cases, some parts of some sides will be visible, and we must now carry out tests to identify these if they exist.

Now for every triangle tj in Ti, we have to test each side e{ik} of the triangle ti to determine how much of it is visible. The figure shows one of the triangles tj and one side e{ik} of the triangle ti. To decide which case applies, the end-points of the side must be tested against the triangle. If the triangle ti is found to have no visible segments before the list Ti is exhausted, the process may be terminated. We are not interested in finding how many other triangles cover ti, only in finding whether any of it is visible.