Members
(constant) arc
Function to create arc equivalent to "new" constructor
- Source:
(constant) CCW :boolean
Global constant CCW defines counter clockwise direction of arc
- Source:
Type:
-
boolean
(constant) CW :boolean
Global constant CW defines clockwise direction of arc
- Source:
Type:
-
boolean
DP_TOL :number
DP_TOL is used for comparison of floating point numbers.
It is set to 0.000001.
- Source:
Type:
-
number
(constant) line
Function to create line equivalent to "new" constructor
- Source:
(constant) matrix
Function to create matrix equivalent to "new" constructor
- Source:
(constant) ORIENTATION :Object
Defines orientation for face of the polygon: clockwise, counter clockwise
or not orientable in the case of self-intersection
- Source:
Type:
-
Object
(constant) point
Function to create point equivalent to "new" constructor
- Source:
(constant) vector
Function to create vector equivalent to "new" constructor
- Source:
Methods
contain(shape1, shape2) → {boolean}
Returns true shape1's interior contains shape2
Same as inside(shape2, shape1)
Same as inside(shape2, shape1)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape1 |
||
shape2 |
Returns:
- Type:
-
boolean
cover(shape1, shape2) → {boolean}
Returns true shape1's cover shape2, same as shape2 covered by shape1
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape1 |
||
shape2 |
Returns:
- Type:
-
boolean
covered(shape1, shape2) → {boolean}
Returns true if every point in shape1 lies in the interior or on the boundary of shape2
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape1 |
||
shape2 |
Returns:
- Type:
-
boolean
disjoint(shape1, shape2) → {boolean}
Returns true if shapes have no points in common neither in interior nor in boundary
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape1 |
||
shape2 |
Returns:
- Type:
-
boolean
EQ() → {boolean}
Returns *true* if two values are equal up to DP_TOL
- Source:
Returns:
- Type:
-
boolean
EQ_0() → {boolean}
Returns *true* if value comparable to zero
- Source:
Returns:
- Type:
-
boolean
equal(shape1, shape2) → {boolean}
Returns true is shapes topologically equal: their interiors intersect and
no part of the interior or boundary of one geometry intersects the exterior of the other
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape1 |
||
shape2 |
Returns:
- Type:
-
boolean
GE() → {boolean}
Returns *true* if first argument greater than or equal to second argument up to DP_TOL
- Source:
Returns:
- Type:
-
boolean
GT() → {boolean}
Returns *true* if first argument greater than second argument up to DP_TOL
- Source:
Returns:
- Type:
-
boolean
inside(shape1, shape2) → {boolean}
Returns true shape1 lies in the interior of shape2
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape1 |
||
shape2 |
Returns:
- Type:
-
boolean
intersect(polygon1, polygon2) → {Flatten.Polygon}
Intersect two polygons and returns new polygon
Point belongs to the resultes polygon is it belongs to the first AND to the second polygon
- Source:
Parameters:
Name | Type | Description |
---|---|---|
polygon1 |
Flatten.Polygon
|
first operand |
polygon2 |
Flatten.Polygon
|
second operand |
Returns:
- Type:
-
Flatten.Polygon
intersect(shape1, shape2) → {boolean}
Returns true is shapes have at least one point in common, same as "not disjoint"
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape1 |
||
shape2 |
Returns:
- Type:
-
boolean
inverse(shape, inversion_circle) → {Line|Circle}
Inversion is a transformation of the Euclidean plane that maps generalized circles
(where line is considered as a circle with infinite radius) into generalized circles
See also https://en.wikipedia.org/wiki/Inversive_geometry and
http://mathworld.wolfram.com/Inversion.html
Inversion also may be considered as a reflection of the point in the plane with respect to inversion circle so that R^2 = OP * OP', where
O - center of inversion circle
R - radius of inversion circle
P - point of plane
P' - inversion of the point P
Inversion also may be considered as a reflection of the point in the plane with respect to inversion circle so that R^2 = OP * OP', where
O - center of inversion circle
R - radius of inversion circle
P - point of plane
P' - inversion of the point P
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape |
Line
|
Circle
|
shape to be transformed |
inversion_circle |
Circle
|
inversion circle |
LE() → {boolean}
Returns *true* if first argument less than or equal to second argument up to DP_TOL
- Source:
Returns:
- Type:
-
boolean
LT() → {boolean}
Returns *true* if first argument less than second argument up to DP_TOL
- Source:
Returns:
- Type:
-
boolean
relate(shape1, shape2) → {DE9IM}
Returns relation between two shapes as intersection 3x3 matrix, where each
element contains relevant intersection as array of shapes.
If there is no intersection, element contains empty array
If intersection is irrelevant it left undefined. (For example, intersection
between two exteriors is usually irrelevant)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape1 |
||
shape2 |
Returns:
- Type:
-
DE9IM
relateLine2Box(line, box) → {DE9IM}
Return intersection between lines and box as intersection matrix
Intersection between line interior and box interior is a segment Intersection between line interior and box boundary may be one point, two points or segment Intersection between line interior and box exterior are two rays Intersection between line exterior and box interior are two polygons Other relations are irrelevant
Intersection between line interior and box interior is a segment Intersection between line interior and box boundary may be one point, two points or segment Intersection between line interior and box exterior are two rays Intersection between line exterior and box interior are two polygons Other relations are irrelevant
- Source:
Parameters:
Name | Type | Description |
---|---|---|
line |
Line
|
|
box |
Box
|
Returns:
- Type:
-
DE9IM
relateLine2Circle(line, circle) → {DE9IM}
Return intersection between lines and circle as intersection matrix
Intersection between line interior abd circle boundary are one or two intersection points Intersection between line interior and circle interior is a line segment inside circle Intersection between line interior and circle exterior are two rays outside circle Intersection between line exterior and circle interior are two circle segments cut by lines Other relations are irrelevant
Intersection between line interior abd circle boundary are one or two intersection points Intersection between line interior and circle interior is a line segment inside circle Intersection between line interior and circle exterior are two rays outside circle Intersection between line exterior and circle interior are two circle segments cut by lines Other relations are irrelevant
- Source:
Parameters:
Name | Type | Description |
---|---|---|
line |
Line
|
|
circle |
Circle
|
Returns:
- Type:
-
DE9IM
relateLine2Line(line1, line2) → {DE9IM}
Return intersection between 2 lines as intersection matrix
Note, the lines has no boundary so intersection between boundaries is irrelevant
Note, the lines has no boundary so intersection between boundaries is irrelevant
- Source:
Parameters:
Name | Type | Description |
---|---|---|
line1 |
Line
|
|
line2 |
Line
|
Returns:
- Type:
-
DE9IM
relateLine2Polygon(line, polygon) → {DE9IM}
Relate line to polygon
- Source:
Parameters:
Name | Type | Description |
---|---|---|
line |
||
polygon |
Returns:
- Type:
-
DE9IM
relatePolygon2Polygon(polygon1, polygon2) → {DE9IM}
Relate polygon to polygon
- Source:
Parameters:
Name | Type | Description |
---|---|---|
polygon1 |
||
polygon2 |
Returns:
- Type:
-
DE9IM
relateShape2Polygon(shape, polygon) → {DE9IM}
Relate Segment or Arc to polygon
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape |
Shape
|
|
polygon |
Polygon
|
Returns:
- Type:
-
DE9IM
subtract(polygon1, polygon2) → {Flatten.Polygon}
Subtract second polygon from the first and returns new polygon
Point belongs to the resulted polygon if it belongs to the first polygon AND NOT to the second polygon
- Source:
Parameters:
Name | Type | Description |
---|---|---|
polygon1 |
Flatten.Polygon
|
first operand |
polygon2 |
Flatten.Polygon
|
second operand |
Returns:
- Type:
-
Flatten.Polygon
touch(shape1, shape2) → {boolean}
Returns true if shapes have at least one point in common, but their interiors do not intersect
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape1 |
||
shape2 |
Returns:
- Type:
-
boolean
unify(polygon1, polygon2) → {Flatten.Polygon}
Unify two polygons polygons and returns new polygon.
Point belongs to the resulted polygon if it belongs to the first OR to the second polygon
Point belongs to the resulted polygon if it belongs to the first OR to the second polygon
- Source:
Parameters:
Name | Type | Description |
---|---|---|
polygon1 |
Flatten.Polygon
|
first operand |
polygon2 |
Flatten.Polygon
|
second operand |
Returns:
- Type:
-
Flatten.Polygon