Class GeometricElement
An element with a geometric representation.
Inheritance
Implements
Inherited Members
Namespace: Elements
Assembly: Hypar.Elements.dll
Syntax
[JsonConverter(typeof(JsonInheritanceConverter), new object[]{"discriminator"})]
public class GeometricElement : Element, INotifyPropertyChanged
Constructors
GeometricElement(Transform, Material, Representation, Boolean, Guid, String)
Create a geometric element.
Declaration
[JsonConstructor]
public GeometricElement(Transform transform = null, Material material = null, Representation representation = null, bool isElementDefinition = false, Guid id = default(Guid), string name = null)
Parameters
Type | Name | Description |
---|---|---|
Transform | transform | The element's transform. |
Material | material | The element's material. |
Representation | representation | |
System.Boolean | isElementDefinition | |
System.Guid | id | |
System.String | name |
Properties
Bounds
The element's bounds. The bounds are only available when the geometry has been updated using UpdateBoundsAndComputeSolid(),
Declaration
[JsonIgnore]
public BBox3 Bounds { get; }
Property Value
Type | Description |
---|---|
BBox3 |
IsElementDefinition
When true, this element will act as the base definition for element instances, and will not appear in visual output.
Declaration
[JsonProperty("IsElementDefinition", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
public bool IsElementDefinition { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Material
The element's material.
Declaration
[JsonProperty("Material", Required = Required.AllowNull)]
public Material Material { get; set; }
Property Value
Type | Description |
---|---|
Material |
ModifyVertexAttributes
A function used to modify vertex attributes of the object's mesh during tesselation. Each vertex is passed to the modifier as the object is tessellated.
Declaration
[JsonIgnore]
public Func<(Vector3 position, Vector3 normal, UV uv, Color? color), (Vector3 position, Vector3 normal, UV uv, Color? color)> ModifyVertexAttributes { get; set; }
Property Value
Type | Description |
---|---|
System.Func<System.ValueTuple<Vector3, Vector3, UV, System.Nullable<Color>>, System.ValueTuple<Vector3, Vector3, UV, System.Nullable<Color>>> |
Representation
The element's representation.
Declaration
[JsonProperty("Representation", Required = Required.AllowNull)]
public Representation Representation { get; set; }
Property Value
Type | Description |
---|---|
Representation |
Transform
The element's transform.
Declaration
[JsonProperty("Transform", Required = Required.AllowNull)]
public Transform Transform { get; set; }
Property Value
Type | Description |
---|---|
Transform |
Methods
CreateInstance(Transform, String)
Create an instance of this element. Instances will point to the same instance of an element.
Declaration
public ElementInstance CreateInstance(Transform transform, string name)
Parameters
Type | Name | Description |
---|---|---|
Transform | transform | The transform for this element instance. |
System.String | name | The name of this element instance. |
Returns
Type | Description |
---|---|
ElementInstance |
HasGeometry()
Does this geometric element have geometry?
Declaration
public bool HasGeometry()
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(Plane, out Dictionary<Guid, List<Polygon>>, out Dictionary<Guid, List<Polygon>>, out Dictionary<Guid, List<Line>>)
Does this element intersect the provided plane?
Declaration
public bool Intersects(Plane plane, out Dictionary<Guid, List<Polygon>> intersectionPolygons, out Dictionary<Guid, List<Polygon>> beyondPolygons, out Dictionary<Guid, List<Line>> lines)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The plane of intersection. |
System.Collections.Generic.Dictionary<System.Guid, System.Collections.Generic.List<Polygon>> | intersectionPolygons | A collection of polygons representing the intersections of the plane and the element's solid geometry. |
System.Collections.Generic.Dictionary<System.Guid, System.Collections.Generic.List<Polygon>> | beyondPolygons | A collection of polygons representing coplanar faces beyond the plane of intersection. |
System.Collections.Generic.Dictionary<System.Guid, System.Collections.Generic.List<Line>> | lines | A collection of lines representing intersections of zero-thickness elements with the plane. |
Returns
Type | Description |
---|---|
System.Boolean | True if an intersection occurs, otherwise false. |
ToMesh(Boolean)
Get the mesh representing the this Element's geometry. By default it will be untransformed.
Declaration
public Mesh ToMesh(bool transform = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | transform | Should the mesh be transformed into its final location? |
Returns
Type | Description |
---|---|
Mesh |
TryToGraphicsBuffers(out List<GraphicsBuffers>, out String, out Nullable<MeshPrimitive.ModeEnum>)
Get graphics buffers and other metadata required to modify a GLB.
Declaration
public virtual bool TryToGraphicsBuffers(out List<GraphicsBuffers> graphicsBuffers, out string id, out MeshPrimitive.ModeEnum? mode)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<GraphicsBuffers> | graphicsBuffers | |
System.String | id | |
System.Nullable<glTFLoader.Schema.MeshPrimitive.ModeEnum> | mode |
Returns
Type | Description |
---|---|
System.Boolean | True if there is graphicsbuffers data applicable to add, false otherwise. Out variables should be ignored if the return value is false. |
UpdateBoundsAndComputeSolid(Boolean)
Update the computed solid and the bounding box of the element.
Declaration
public void UpdateBoundsAndComputeSolid(bool transformed = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | transformed |
UpdateRepresentations()
This method provides an opportunity for geometric elements to adjust their solid operations before tesselation. As an example, a floor might want to clip its opening profiles out of the profile of the floor.
Declaration
public virtual void UpdateRepresentations()