


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



The problem being addressed is to compute regularized Boolean regions between two triangles in 2D. Given triangles T1 and T2, we have to determine the region of intersection, union and difference between T1 and T2.
The approach we adopted was to determine the points of intersection between the triangles. These will then be used to generate edge segments, of which the correct ones will be chosen depending on which Boolean set is being generated. This approach follows from the Diminishing Boundary Principle [2].
In order to generate the intersection points in a cyclic manner, we modified an existing established algorithm in Computer Graphics, the Cohen-Sutherland algorithm for polygon clipping [1]. A stepwise description is given below:
(a) Intersection of T1 and T2:
(i) Consider T1 as the polygon to be clipped and T2 as the clip window. (ii) Using modified Cohen-Sutherland algorithm [3] (defined below), find the intersection points of T1 and T2. (iii) Form a closed polygon of these points and fill it. This is the required intersection.
Modified Cohen-Sutherland algorithm: In the established algorithm, the clip window is rectangular. However, the algorithm can easily be extended for a convex polygonal clip window. Since a triangle is convex by geometry, it is possible to use this algorithm.
Initialize Polygon := T For each edge E of the clip window T2: Define TempPoly := NULL Do Process each edge AB of Polygon: If ( A is outside and B is inside )
(b) Union of T1 and T2:
(i) For each edge E of T1 and T2, find points in the intersection which lie on E. Use the intersection found above. (ii) Order the points from lowest parameter value (t) to highest. (iii) Alternate segments lie in the union (See Figure 1). Enter them in a common set.
Figure 1: Union includes alternate edge segments of the original edges (iv) In order to form the output set of edges, start with an edge. (v) Search for another edge with the starting point same as the ending point of the current edge. (vi) Continue this till all edges are exhausted. (vii) Output the Union Set and fill it.
Madhav V. Deshpande, College of Computing, Georgia Institute of Technology
(c) Set Difference of T1 and T2 (T1 – T2):
(i) For each edge E of T1, find intersection points with T2. (ii) Order them in ascending order of parameter values (t). (iii) Find the edge segments which have at least one point outside of T2. Add them to a candidate output set. (iv) For each edge in the intersection set (from above), find if that edge coincides with an edge of T2. If it does, add it to the candidate set, else discard it (see Figure 2). (v) Sort them as in the union. There might be two or more disconnected regions. (vi) Output the set of polygons forming the difference.
Figure 2: Edge segments coincident with edges of T2 lie in the difference T1 – T
ILLUSTRATIONS We ran the algorithm for various cases. The figures below show the screenshots of the output with the case description.
Figure 3: Basic scenario where Triangles ABC and DEF intersect.
Figure 4: Partial intersection of Triangles ABC and DEF
Figure 5: Triangle DEF lies completely inside Triangle ABC
Figure 6: Triangles ABC and DEF are completely disjoint
This same algorithm can be extended for n- sided convex polygonal regions, since it is generic and does not make any special assumptions about triangles.
In this manner, the algorithms for finding the regularized Booleans between two triangles in 2D were developed and implemented. The major hurdle was the limitation of floating point calculations. Aside of that, the important step in the algorithm is to order the set of vertices and edges.
[1] Computer Graphics – C Version, 2nd^ Edition (Book) Chapter 6 on “Polygonal Clipping” D. Hearn & N.P. Baker
[2] Presentation on “Booleans” http://www.gvu.gatech.edu/~jarek/graphics/index. html J. Rossignac
[3] “An Algorithm for Computing the Union, Intersection or Difference of Two Polygons” A. Margalit & G. Knott Comput. & Graphics, Vol. 13, No 2, pp 167-183, 1983