Class Solid
Boolean operations on solids.
Inheritance
Implements
Inherited Members
Namespace: Elements.Geometry.Solids
Assembly: Hypar.Elements.dll
Syntax
public class Solid : ITessellate
Constructors
Solid()
Construct a solid.
Declaration
public Solid()
Properties
Edges
The edges of the solid.
Declaration
public Dictionary<long, Edge> Edges { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.Int64, Edge> |
Faces
The Faces of the Solid.
Declaration
public Dictionary<long, Face> Faces { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.Int64, Face> |
Vertices
The vertices of the solid.
Declaration
public Dictionary<long, Vertex> Vertices { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.Int64, Vertex> |
Methods
AddEdge(Vertex, Vertex)
Add an edge to the solid.
Declaration
public Edge AddEdge(Vertex from, Vertex to)
Parameters
Type | Name | Description |
---|---|---|
Vertex | from | The start vertex. |
Vertex | to | The end vertex. |
Returns
Type | Description |
---|---|
Edge | The newly added edge. |
AddEdges(Polygon)
Creates a series of edges from a polygon.
Declaration
public Edge[] AddEdges(Polygon p)
Parameters
Type | Name | Description |
---|---|---|
Polygon | p |
Returns
Type | Description |
---|---|
Edge[] |
AddFace(Polygon, IList<Polygon>, Boolean, Transform, Boolean)
Add a Face to the Solid.
Declaration
public Face AddFace(Polygon outer, IList<Polygon> inner = null, bool mergeVerticesAndEdges = false, Transform transform = null, bool reverse = false)
Parameters
Type | Name | Description |
---|---|---|
Polygon | outer | A polygon representing the perimeter of the face. |
System.Collections.Generic.IList<Polygon> | inner | An array of polygons representing the holes in the face. |
System.Boolean | mergeVerticesAndEdges | Should existing vertices / edges in the solid be used for the added face? |
Transform | transform | An optional transform which is applied to the polygon. |
System.Boolean | reverse | Should the loop be reversed? |
Returns
Type | Description |
---|---|
Face | The newly added face. |
AddFace(Loop, Loop[])
Add a face to the solid. Provided edges are expected to be wound CCW for outer, and CW for inner. The face will be linked to the edges.
Declaration
public Face AddFace(Loop outer, Loop[] inner = null)
Parameters
Type | Name | Description |
---|---|---|
Loop | outer | The outer Loop of the Face. |
Loop[] | inner | The inner Loops of the Face. |
Returns
Type | Description |
---|---|
Face | The newly added Face. |
AddVertex(Vector3)
Add a Vertex to the Solid.
Declaration
public Vertex AddVertex(Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position |
Returns
Type | Description |
---|---|
Vertex | The newly added vertex. |
Cap(Edge[][], Boolean)
Create a face from edges. The first edge array is treated as the outer edge. Additional edge arrays are treated as holes.
Declaration
protected void Cap(Edge[][] edges, bool reverse = true)
Parameters
Type | Name | Description |
---|---|---|
Edge[][] | edges | |
System.Boolean | reverse |
CreateLamina(Polygon, IList<Polygon>)
Declaration
public static Solid CreateLamina(Polygon perimeter, IList<Polygon> voids = null)
Parameters
Type | Name | Description |
---|---|---|
Polygon | perimeter | |
System.Collections.Generic.IList<Polygon> | voids |
Returns
Type | Description |
---|---|
Solid |
CreateLamina(Profile)
Declaration
public static Solid CreateLamina(Profile profile)
Parameters
Type | Name | Description |
---|---|---|
Profile | profile |
Returns
Type | Description |
---|---|
Solid |
CreateLamina(IList<Vector3>)
Construct a lamina solid.
Declaration
public static Solid CreateLamina(IList<Vector3> perimeter)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<Vector3> | perimeter | The perimeter of the lamina's faces. |
Returns
Type | Description |
---|---|
Solid |
Difference(Solid, Transform, Solid, Transform)
Compute the difference of two solids.
Declaration
public static Solid Difference(Solid a, Transform aTransform, Solid b, Transform bTransform)
Parameters
Type | Name | Description |
---|---|---|
Solid | a | The first solid. |
Transform | aTransform | A local transformation of a. |
Solid | b | The second solid. |
Transform | bTransform | A local transformation of b. |
Returns
Type | Description |
---|---|
Solid | A solid which is the difference of a and b. |
Difference(SolidOperation, SolidOperation)
Compute the difference of two solid operations.
Declaration
public static Solid Difference(SolidOperation a, SolidOperation b)
Parameters
Type | Name | Description |
---|---|---|
SolidOperation | a | The first solid. |
SolidOperation | b | The second solid. |
Returns
Type | Description |
---|---|
Solid | A solid which is the difference of a and b. |
Intersection(Solid, Transform, Solid, Transform)
Compute the intersection of two solids.
Declaration
public static Solid Intersection(Solid a, Transform aTransform, Solid b, Transform bTransform)
Parameters
Type | Name | Description |
---|---|---|
Solid | a | The first solid. |
Transform | aTransform | A local transformation of a. |
Solid | b | The second solid. |
Transform | bTransform | A local transformation of b. |
Returns
Type | Description |
---|---|
Solid | A solid which is the the intersection of a and b. |
Intersection(SolidOperation, SolidOperation)
Compute the intersection of two solid operations.
Declaration
public static Solid Intersection(SolidOperation a, SolidOperation b)
Parameters
Type | Name | Description |
---|---|---|
SolidOperation | a | The first solid. |
SolidOperation | b | The second solid. |
Returns
Type | Description |
---|---|
Solid | A solid which is the the intersection of a and b. |
Intersects(Plane, out List<Polygon>)
Intersect this solid with the provided plane.
Declaration
public bool Intersects(Plane p, out List<Polygon> result)
Parameters
Type | Name | Description |
---|---|---|
Plane | p | The plane of intersection. |
System.Collections.Generic.List<Polygon> | result | A collection of polygons resulting from the intersection or null if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | True if an intersection occurred, otherwise false. |
LoopFromPolygon(Polygon, Boolean, Transform, Boolean)
Declaration
protected Loop LoopFromPolygon(Polygon p, bool mergeVerticesAndEdges = false, Transform transform = null, bool reverse = false)
Parameters
Type | Name | Description |
---|---|---|
Polygon | p | |
System.Boolean | mergeVerticesAndEdges | |
Transform | transform | |
System.Boolean | reverse |
Returns
Type | Description |
---|---|
Loop |
SweepFace(Polygon, IList<Polygon>, Vector3, Double, Boolean, Double)
Construct a solid by sweeping a face in a direction.
Declaration
public static Solid SweepFace(Polygon perimeter, IList<Polygon> holes, Vector3 direction, double distance, bool bothSides = false, double rotation = 0)
Parameters
Type | Name | Description |
---|---|---|
Polygon | perimeter | The perimeter of the face to sweep. |
System.Collections.Generic.IList<Polygon> | holes | The holes of the face to sweep. |
Vector3 | direction | The direction in which to sweep. |
System.Double | distance | The distance to sweep. |
System.Boolean | bothSides | Should the sweep start offset by direction distance/2? |
System.Double | rotation | An optional rotation in degrees of the perimeter around the direction vector. |
Returns
Type | Description |
---|---|
Solid | A solid. |
SweepFace(Polygon, IList<Polygon>, Double, Boolean, Double)
Construct a solid by sweeping a face.
Declaration
public static Solid SweepFace(Polygon perimeter, IList<Polygon> holes, double distance, bool bothSides = false, double rotation = 0)
Parameters
Type | Name | Description |
---|---|---|
Polygon | perimeter | The perimeter of the face to sweep. |
System.Collections.Generic.IList<Polygon> | holes | The holes of the face to sweep. |
System.Double | distance | The distance to sweep. |
System.Boolean | bothSides | Should the sweep start offset by direction distance/2? |
System.Double | rotation | An optional rotation in degrees of the perimeter around the z axis. |
Returns
Type | Description |
---|---|
Solid | A solid. |
SweepFaceAlongCurve(Polygon, IList<Polygon>, IBoundedCurve, Double, Double, Double)
Construct a solid by sweeping a face along a curve.
Declaration
public static Solid SweepFaceAlongCurve(Polygon perimeter, IList<Polygon> holes, IBoundedCurve curve, double startSetback = 0, double endSetback = 0, double profileRotation = 0)
Parameters
Type | Name | Description |
---|---|---|
Polygon | perimeter | The perimeter of the face to sweep. |
System.Collections.Generic.IList<Polygon> | holes | The holes of the face to sweep. |
IBoundedCurve | curve | The curve along which to sweep. |
System.Double | startSetback | The setback distance of the sweep from the start of the curve. |
System.Double | endSetback | The setback distance of the sweep from the end of the curve. |
System.Double | profileRotation | The rotation of the profile. |
Returns
Type | Description |
---|---|
Solid | A solid. |
Tessellate(ref Mesh, Transform, Color)
Triangulate this solid.
Declaration
public void Tessellate(ref Mesh mesh, Transform transform = null, Color color = default(Color))
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | The mesh to which the solid's tessellated data will be added. |
Transform | transform | An optional transform used to transform the generated vertex coordinates. |
Color | color | An optional color to apply to the vertex. |
ToMesh()
Get the Mesh of this Solid.
Declaration
public Mesh ToMesh()
Returns
Type | Description |
---|---|
Mesh |
ToString()
Get the string representation of the solid.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
Union(Solid, Transform, Solid, Transform)
Compute the union of two solids.
Declaration
public static Solid Union(Solid a, Transform aTransform, Solid b, Transform bTransform)
Parameters
Type | Name | Description |
---|---|---|
Solid | a | The first solid. |
Transform | aTransform | A local transformation of a. |
Solid | b | The second solid. |
Transform | bTransform | A local transformation of b. |
Returns
Type | Description |
---|---|
Solid | A solid which is the union of a and b. |
Union(SolidOperation, SolidOperation)
Compute the union of two solid operations.
Declaration
public static Solid Union(SolidOperation a, SolidOperation b)
Parameters
Type | Name | Description |
---|---|---|
SolidOperation | a | The first solid. |
SolidOperation | b | The second solid. |
Returns
Type | Description |
---|---|
Solid | A solid which is the union of a and b. |