ShapeBuilder
Description
Helper class for building geometric shapes.
To build a geometric shape, perform the following steps:
-
Create a shape builder via Shape.Geometry or call Clear on an existing builder for starting from scratch.
-
Configure the shape builder flags via Flags.
-
Configure the geo-reference via Georef.
-
Configure a transformation via Transform.
-
Add geometric primitives:
-
Vertices (see
Vertex*
methods) -
Edges (see
Edge*
methods) -
Triangles (see
Triangle*
methods)
-
-
Add pre-defined geometric shapes:
-
Splines (see Curve)
-
Boxes (see Rectangle1)
-
-
Finish shape building by calling one of the following methods:
- See also
Public / Constructors
Build
Creates a new instance of IShape from the specified vertices (see Vertex1), edges (see Edge2) and/or triangles (see Triangle2).
This method only delegates to other methods, in the following order:
Hull
Creates a new instance of IShape that represents the convex hull of the specified vertices (see Vertex1).
The returned shape is a convex polygon that contains all specified vertices (the signed distance from the vertex to the shape is less than or equal to zero).
Polygon
The signed area of a polygon can be used to determine the parity, if the vertex winding is not intended to be relevant (see Geometric.AreaPolygon1).
Public / Methods
Add
2 overloads
Adds all vertices, edges and triangles of the given shape.
When flip opt is true
, edges (A,B)
resp. triangles (A,B,C) are added as (B,A)
resp. (C,B,A)
.
Adds all vertices, edges and triangles of the given shape.
When flip in is true
, edges (A,B)
resp. triangles (A,B,C) are added as (B,A)
resp. (C,B,A)
.
Area
2 overloads
Computes the signed area of the simple polygon defined by the sequence of vertices that have been added to this builder.
- See also
Computes the signed area of the simple polygon defined by the given sequence of vertices.
- See also
Clear
Clears all geometry data in the shape builder.
After calling this method, the following lists will be empty:
ClearEdges
Clears geometry data in the shape builder.
After calling this method, the following lists will be empty:
ClearTriangles
Clears geometry data in the shape builder.
After calling this method, the following lists will be empty:
ClearValues
Clears geometry data in the shape builder.
After calling this method, the following lists will be empty:
-
Values, for the given values opt
ClearVertices
Clears geometry data in the shape builder.
After calling this method, the following lists will be empty:
Curve
Builds geometry follows the given curve and adds it to this shape builder.
Curve-space is defined as follows:
-
The coordinate origin coincides with the result of ICurve.Compute2D for the control point index zero.
-
The X-axis represents the control point indices in the range [0..N], where N is ICurve.Count minus one.
-
The Y-axis is perpendicular to the curve, where the Y-coordinate zero always lies on the curve. The sign of the Y-axis is chosen so that the points A, B and C form a triangle, according to IShape.TriangleAt:
A = (X,0) B = (X + epsilon,0) C = (X, epsilon)
where
X
is an X-coordinate value andepsilon
is some sufficiently small value. The orientation of the Y-axis depends on the X-coordinate.
The geometry extend along the X-axis is defined with range in. The extend along the Y-axis is computed from the Vec4D.Z values, which are obtained from ICurve.Compute3D:
y1 = y1m * Z + y1b y2 = y2m * Z + y2b
Depending on the parameter values, the following geometry is generated:
-
If range in has non-zero length and, y1b in != y2b in or y1m opt != y2m opt:
A polygon contour with negative parity (y1b in < y2b in) or positive parity ( y1b in > y2b in), see ShapeType.Polygon -
Otherwise, if range in has zero length and y1b in = y2b in and y1m opt = y2m opt:
A point, see ShapeType.Points. -
Otherwise:
A polyline which is either perpendicular to the curve or parallel to it, see ShapeType.Graph
Edge
3 overloads
Specifies an edge when building a graph shape (see Graph).
This method uses the three most recently specified vertices (N-2, N-1)
, where N
is the value of Index when this method is called.
EdgeList
6 overloads
Specifies a sequence of connected edges (polyline) when building a graph shape (see Graph) or polygon shape (see Polygon).
An edge is generated for each pair of consecutive vertices. When this method is called multiple times, edges are generated only for newly specified vertices.
Specifies a sequence of connected edges (polyline) when building a graph shape (see Graph) or polygon shape (see Polygon).
The vertex sequence can be reversed by swapping a in and b in.
Specifies a sequence of connected edges (polyline) when building a graph shape (see Graph) or polygon shape (see Polygon).
Specifies a series of edges.
Specifies a series of edges.
Specifies a series of edges.
Rectangle
3 overloads
Specifies a rectangle.
This method delegates to Rectangle3,
Specifies a rectangle.
This method delegates to Rectangle3,
Specifies a rectangle.
This method calls Vertex1 in this order:
-
(x0 in, y0 in)
-
(x1 in, y0 in)
-
(x1 in, y1 in)
-
(x0 in, y1 in)
Then, the EdgeList1 method is called.
Transform
Applies the given coordinate transform while building shapes.
When a coordinate transform is given, the specified vertices are expected to be in the source coordinate system (see CoordinateSystemTransform.Source). The built shapes will have the target coordinate system as geo-reference (see IShapeInfo.Georef). So it is not necessary to call Georef when using a transform.
All existing geometry is cleared by this method.
- See also
Triangle
3 overloads
Specifies a triangle when building a mesh shape (see Mesh).
This method uses the three most recently specified vertices (N-3, N-2, N-1)
, where N
is the value of Index when this method is called.
If necessary, the given triangle vertices will be adjusted to meet the requirements of IShape.TriangleAt.
Specifies a triangle when building a mesh shape (see Mesh).
If necessary, the given triangle vertices will be adjusted to meet the requirements of IShape.TriangleAt.
Specifies a triangle when building a mesh shape (see Mesh).
If necessary, the given triangle vertices will be adjusted to meet the requirements of IShape.TriangleAt.
TriangleList
3 overloads
Specifies a series of triangles.
Specifies a series of triangles.
Specifies a series of triangles.
Value
2 overloads
Specifies the custom value for the vertex that will be added next (see Index).
Custom values may be specified for vertices that have not yet been added to the shape builder and will be dropped silently if no vertex is specified for them.
- See also
Specifies the custom value for the given vertex.
Custom values may be specified for vertices that have not yet been added to the shape builder and will be dropped silently if no vertex is specified for them.
- See also
Public / Attributes
Geocentric
In geocentric mode (see Transform), returns the helper object that is used for geocentric computations.