Class TransformationGeom
Represents a geometric transformation that can be applied to a geometry object. This class combines a transformer with a target geometry to produce transformed geometric results.
public class TransformationGeom : IStlSource, IGetStl, IMakeXmlSource, IGeomProperty, IExpandToBox3d, IDuplicate
- Inheritance
-
TransformationGeom
- Implements
- Inherited Members
- Extension Methods
Remarks
The TransformationGeom class provides functionality to:
- Apply geometric transformations to STL geometry
- Support XML serialization and deserialization
- Handle duplication of transformation configurations
- Manage transformation matrices and their application to geometry
Constructors
TransformationGeom()
Initializes a new instance of the TransformationGeom class with default values.
public TransformationGeom()
TransformationGeom(IGetStl)
Initializes a new instance of the TransformationGeom class with a specified geometry.
public TransformationGeom(IGetStl geom)
Parameters
geom
IGetStlThe geometry object to be transformed.
TransformationGeom(XElement, string)
Initializes a new instance of the TransformationGeom class from XML data.
public TransformationGeom(XElement src, string baseDirectory)
Parameters
src
XElementThe XML element containing the transformation data.
baseDirectory
stringThe base directory for resolving relative paths.
Remarks
This constructor deserializes both the transformer and geometry data from the provided XML. If either element is missing or invalid, the corresponding property will be null.
Properties
Geom
Gets or sets the target geometry that will be transformed.
public IGetStl Geom { get; set; }
Property Value
Remarks
This property represents the base geometry object that will have the transformation applied to it. If null, operations involving this geometry will return null results.
Transformer
Gets or sets the transformer that defines the geometric transformation. The transformation is applied from left (first element) to right (last element), with the target geometry being on the left side.
public ITransformer Transformer { get; set; }
Property Value
Remarks
The transformer can be null, in which case no transformation is applied to the geometry.
XName
Gets the XML element name used for serialization.
public static string XName { get; }
Property Value
- string
The string “TransformationGeom”.
Methods
Duplicate(params object[])
Creates a deep copy of the current TransformationGeom instance.
public object Duplicate(params object[] res)
Parameters
res
object[]Additional resources for duplication (not used in current implementation).
Returns
- object
A new TransformationGeom instance with copied transformer and geometry data.
Remarks
The duplication process creates new instances of both the transformer and geometry objects if they implement the appropriate cloning interfaces.
ExpandToBox3d(Box3d)
Expands the given box to include the bounds of the transformed geometry.
public void ExpandToBox3d(Box3d dst)
Parameters
dst
Box3dThe box to expand.
Remarks
This method updates the provided box to encompass the transformed geometry. If the geometry or its STL representation is null, no expansion occurs.
GetStl()
Gets the transformed STL representation of the geometry.
public Stl GetStl()
Returns
- Stl
The transformed STL if both geometry and transformer are valid; the original STL if transformer is null; null if geometry is null or produces null STL.
Remarks
If the transformer is null, the method returns the untransformed geometry. If the geometry is null or produces a null STL, the method returns null.
MakeXmlSource(string, string)
Creates an XML representation of the current TransformationGeom instance.
public XElement MakeXmlSource(string baseDirectory, string relFile)
Parameters
baseDirectory
stringThe base directory for resolving relative paths.
relFile
stringThe relative file path (not used in current implementation).
Returns
- XElement
An XElement containing the serialized data of this instance.
Remarks
The generated XML includes both the transformer and geometry data if they are available. Null properties are handled gracefully and will not cause errors in the XML generation.