new CAG()
Class CAG
Holds a solid area geometry like CSG but 2D.
Each area consists of a number of sides.
Each side is a line between 2 points.
Methods
(static) circle(optionsopt) → {CAG}
Construct a circle.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
options for construction
Properties
|
Returns:
new CAG object
- Type
- CAG
(static) ellipse(optionsopt) → {CAG}
Construct a ellispe.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
options for construction
Properties
|
Returns:
new CAG object
- Type
- CAG
(static) fromCompactBinary(bin) → {CAG}
Reconstruct a CAG from the output of toCompactBinary().
Parameters:
Name | Type | Description |
---|---|---|
bin |
CompactBinary | see toCompactBinary() |
Returns:
new CAG object
- Type
- CAG
(static) fromObject(obj) → {CAG}
Reconstruct a CAG from an object with identical property names.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | anonymous object, typically from JSON |
Returns:
new CAG object
- Type
- CAG
(static) fromPoints(points) → {CAG}
Construct a CAG from a list of points (a polygon).
The rotation direction of the points is not relevant.
The points can define a convex or a concave polygon.
The polygon must not self intersect.
Parameters:
Name | Type | Description |
---|---|---|
points |
Array.<points> | list of points in 2D space |
Returns:
new CAG object
- Type
- CAG
(static) fromSides(sides) → {CAG}
Construct a CAG from a list of `CAG.Side` instances.
Parameters:
Name | Type | Description |
---|---|---|
sides |
Array.<CAG.Side> | list of sides |
Returns:
new CAG object
- Type
- CAG
(static) rectangle(optionsopt) → {CAG}
Construct a rectangle.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
options for construction
Properties
|
Returns:
new CAG object
- Type
- CAG
(static) roundedRectangle(optionsopt) → {CAG}
Construct a rounded rectangle.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
options for construction
Properties
|
Returns:
new CAG object
- Type
- CAG
Example
var r = CSG.roundedRectangle({
center: [0, 0],
radius: [5, 10],
roundradius: 2,
resolution: 36,
});
rotateExtrude(options) → {CSG}
Extrude to into a 3D solid by rotating the origin around the Y axis.
(and turning everything into XY plane)
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | options for construction
Properties
|
Returns:
new 3D solid
- Type
- CSG
toCompactBinary() → {CompactBinary}
Convert to compact binary form.
See CAG.fromCompactBinary.
Returns:
- Type
- CompactBinary