image/svg+xml
Intersection ProjectMichael Sloan
Layer 1: Curve
Curve: A continuous 2d function on the interval [0,1], with precise start and end points
Layer 2: Path & Region
0
1
Crossing: A location where two curves cross. This is a subset of the intersections of the curves. Crossings are stored as two time values and a boolean indicating the relationship between the curves.This relationship is defined by the 'direction' of the curves at the intersection, and is quite useful in the later layers. When the curves are portions of paths with the same winding, this relation boolean indicates whether the first path is exiting (true), or leaving (false).In curve terms it is the orientation of the derivatives and the origin.
At = 0.4
A
B
Bt = 0.15
Path: A series of connected Curves, implicitly closed with a final line segment. For some applications, however, this line segment must be treated specially, such that if it is still expressed, it is the last segment of the path. In some cases this is impossible. 0
1
2
3
4
5
6
Union
Fix
One problem with storing crossings as a time value is that the locations on the two paths may not perfectly coincide. To maintain continuity, the output portions must be tweaked.
The Crossing data type is also valid on Paths, where a particular time value corresponds to the point on curve i at f, where i is the integral part, and f is the fractional part. The crossings function for paths is the basis of the important path_boolean function. Layer 3: Shape
Region: A simple path (a path with no self-intersection), specifying a subset of the plane. Such a path also has a defined winding direction which specifies what the boundary means - a region of 'fill' will have a counter-clockwise wind, whereas a region of 'non-fill' will have a clockwise wind. Reversing the direction of the region's path will give the boolean complement of the region.
(Outer box represents the plane)
This behavior is mainly important for the main region boolean function, which takes two regions and performs an operation. The operation which is performed is specified by a bool which indicates either union (false) or intersection (true).This operation may be considered from the standpoint of regular path booleans: Union
A
B
Fill
Hole
A+B
A-B
B-A
H
F
H
F
H
AxB
H
Fill
Hole
Intersection
A
B
Fill
Hole
AxB
B-A
A-B
F
F
A+B
H
Fill
Hole
F
F
F
Though not on the chart, fill subtraction and hole subtraction may be performed by reversing one of the arguments.