Boolean Operations on Polygons Presented by Kevin Hardy George Boole (1815-1864) • Born Lincoln, England, on November 2, 1815. • Boole's work in symbolic logic is collectively known as "Boolean algebra" • Truth Tables/Logic Circuits • Everyday usage- The use of "And, Or, and Not" when selecting the appropriate options for connecting search terms to find information in search engines What is a Polygon • A polygon is a closed figure made by joining line segments, where each line segment intersects exactly two others. • The points at where these line segments join together are called vertices. Picture of Polygons The Boolean Operations with Polygons • Union • Intersection • Difference Union Definition • If A is a Polygon and B is a Polygon then by the union of A with B we mean all of the the points contained in A and all of the points contained in B. • The union of A with B will sometimes be denoted by A (the "cup" union sign) B and sometimes by A+B. Union Picture A B A “UNION” B Union Algorithm • Build a list of vertices for each polygon A and B (must be in order) • Find all the intersection points of the edges of A and B Union Algorithm • Rebuild lists including intersecting points in the order they arrive in the polygon • Find a point on the boundary polygon of A that is outside of B Union Algorithm • Starting at that point, trace the boundary of A to the first intersection point with B (in the order of your list) • At the intersection point, continue to trace the polygon according to list B Union Algorithm • Following this pattern, once you get to the next intersection point, continue to trace the polygon according to list A again • The Algorithm is complete when you return to the initial starting point Intersection Definiton • If A is a Polygon and B is a Polygon then by the intersection of A with B we mean all of the points contained within Polygon A which are also contained within Polygon B. • The intersection of A with B will sometimes be denoted by A (the "cap" intersection sign) B and sometimes by A*B. Intersection Picture A B A “INTERSECT” B Intersection Algorithm • Build a list of vertices for each polygon A and B (must be in order) • Find all the intersection points of the edges of A and B • Rebuild lists including intersecting points in the order they arrive in the polygon • Find a point on the boundary polygon A that is also on the boundary polygon of B (an intersecting point) Intersection Algorithm • Starting at that point, trace the boundary of A (according to list A) to the next intersection point with B • At the intersection point, continue to trace the polygon according to list B • The Algorithm is complete when you return to the initial starting point Difference Definition • If A is a Polygon and B is a Polygon then by the difference of A with B is meant all of the points contained within Polygon A without all of the points contained within Polygon B • The of of A with B will sometimes be denoted by A-B Difference Picture A B A-B B-A Difference Algorithm • Build a list of vertices for each polygon A and B (must be in order) • Find all the intersection points of the edges of A and B • Rebuild lists including intersecting points in the order they arrive in the polygon Difference Algorithm • Find a point on the boundary polygon of A that is outside of B • Starting at point that point, trace the boundary of A (according to the list) to the next intersection point with B Difference Algorithm • At that intersection point, like the Union and Intersection algorithms, continue to trace according to list B, BUT in reverse order until the next intersection point with A • At that Intersection point, continue to follow A, going forward through the list. • Repeat this pattern. The algorithm is complete when you reach the original point. Recapping Boolean Operations on Polygons • Union- All of the points contained within Polygon A, and all of the points contained within Polygon B – Like logical operator OR • Intersection- Takes all of the points within A that are also contained within B – Like logical operator AND • Difference- Takes all of the points within A that are not also within B – Like logical operator NOT