Class Solid
Represents a solid geometry object with display, collision detection, and STL capabilities. Provides thread-safe access to geometry data and caching mechanisms.
public class Solid : IGetTriTree, ICollidable, IGetCollidable, IDisplayee, IExpandToBox3d, IDisposable, IGetSolid, IUpdateByContent, IClearCache, IStlSource, IGetStl, IMakeXmlSource
- Inheritance
-
Solid
- Implements
- Inherited Members
- Extension Methods
Constructors
Solid()
Initializes a new instance of the Solid class.
public Solid()
Solid(IGetStl)
Initializes a new instance of the Solid class with the specified STL geometry source.
public Solid(IGetStl geom)
Parameters
geom
IGetStlThe STL geometry source.
Solid(XElement, string)
Initializes a new instance of the Solid class from XML.
public Solid(XElement src, string baseDirectory)
Parameters
src
XElementThe XML source element.
baseDirectory
stringThe base directory for resolving relative paths.
Fields
XName
Gets the XML element name for serialization.
public static string XName
Field Value
Properties
CollisionFlag
Gets or sets the collision flag indicating the collision state of this solid.
public CollisionFlag CollisionFlag { get; set; }
Property Value
Geom
Gets or sets the STL geometry source. Setting this property will clear the cached data.
public IGetStl Geom { get; set; }
Property Value
NativeSmoothTopoStl
Gets the native smooth topology STL representation. The data is created from the STL representation when first accessed.
public NativeTopoStld NativeSmoothTopoStl { get; }
Property Value
NativeStl
Gets the native STL representation. The data is created from the STL representation when first accessed.
public NativeStl NativeStl { get; }
Property Value
Prepared
Gets or sets whether the solid geometry is prepared for use. Setting this to true will ensure all necessary data structures are initialized. Setting this to false will clear the cached data.
public bool Prepared { get; set; }
Property Value
Stl
Gets the STL representation of the solid geometry. The STL data is cached after first access.
public Stl Stl { get; }
Property Value
TriTree
Gets the triangle tree representation for collision detection. The tree is built from the native STL data when first accessed.
public TriTree TriTree { get; }
Property Value
Methods
ClearCache()
Manually clears the cached data if the content of Geom has changed. The cache determines the behavior of the Solid.
public void ClearCache()
Display(Bind)
Display function called in DispEngine rendering loop.
public void Display(Bind bind)
Parameters
bind
BindBind with DispEngine. See Bind.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Releases the unmanaged resources and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposing
booltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
ExpandToBox3d(Box3d)
Expands the destination box. This function is usually used to compute the bounding box of elements.
public void ExpandToBox3d(Box3d dst)
Parameters
dst
Box3dDestination box
GetCollidable()
Get ICollidable.
public ICollidable GetCollidable()
Returns
- ICollidable
The collidable object.
GetCollidee()
Get ICollidee.
public ICollidee GetCollidee()
Returns
GetSolid()
Gets the solid geometry object.
public Solid GetSolid()
Returns
- Solid
The solid geometry object.
GetSourceGeom()
Gets the source geometry object.
public IGetStl GetSourceGeom()
Returns
- IGetStl
The source geometry object.
GetStl()
Gets the STL geometry data.
public Stl GetStl()
Returns
- Stl
The STL geometry object
GetTriTree()
Get TriTree.
public TriTree GetTriTree()
Returns
MakeXmlSource(string, string)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile)
Parameters
baseDirectory
stringThe base directory for resolving relative paths
relFile
stringThe relative file path for the XML source
Returns
- XElement
An XML element representing the object's state
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
UpdateByContent()
Updates the object based on its current content.
public void UpdateByContent()