Mesh Module
Triangulation and polygon mesh handling.
LightOcct::LPolygon2d
Light OCCT wrapper for OCCT Poly_Polygon2D class.
Provides a polygon in 2D space (parametric space), typically as an approximate representation of a curve. A Polygon2D is defined by a table of 2D nodes (points). If the polygon is closed, the point of closure is repeated at the end of the table. Follows Light OCCT architecture: Enum + Handle pattern for type-safe OCCT object storage POD structures for cross-language data exchange Wrapper methods hide OCCT implementation details No OCCT types exposed in public interface
#include <light-occt/mesh/LPolygon2d.hxx>Quick Reference
Fields: myType
Factory Methods: CreateEmpty(), CreateFromNodes()
Methods: LPolygon2d(), LPolygon2d(), operator=(), ~LPolygon2d(), GetType(), IsValid(), GetNbNodes(), GetDeflection(), SetDeflection(), GetNode(), SetNode(), GetAllNodes(), SetAllNodes(), Copy(), GetPolygonData(), SetPolygonData()
Enums: PolygonType
Types: TypeEnum
Fields
myType
PolygonType myType;Polygon type.
Methods
Factory Methods
CreateEmpty
Create empty polygon with specified capacity.
static LPolygon2d CreateEmpty(int nbNodes);nbNodes Number of nodes to allocate New polygon instance
Parameters:
nbNodes- Number of nodes to allocate New polygon instance
CreateFromNodes
Create polygon from node array.
static LPolygon2d CreateFromNodes(const std::vector< > & Point2d nodes);nodes Array of 2D node positions New polygon instance
Parameters:
nodes- Array of 2D node positions New polygon instance
Instance Methods
LPolygon2d
Default constructor - creates undefined polygon.
LPolygon2d() const;LPolygon2d
Copy constructor.
LPolygon2d(const & LPolygon2d other) const;other Polygon to copy from
Parameters:
other- Polygon to copy from
operator=
Assignment operator.
& LPolygon2d operator=(const & LPolygon2d other) const;other Polygon to copy from Reference to this polygon
Parameters:
other- Polygon to copy from Reference to this polygon
~LPolygon2d
Destructor.
~LPolygon2d() const;GetType
Get polygon type.
PolygonType GetType() const;Polygon type enumeration
IsValid
Check if polygon is valid (not undefined).
bool IsValid() const;True if polygon is valid
GetNbNodes
Get number of nodes in polygon.
int GetNbNodes() const;Number of nodes
GetDeflection
Get deflection value.
double GetDeflection() const;Maximum deflection from original curve
SetDeflection
Set deflection value.
void SetDeflection(double deflection) const;deflection Maximum deflection from original curve
Parameters:
deflection- Maximum deflection from original curve
GetNode
Get 2D node position.
Point2d GetNode(int index) const;index Node index (1-based) 2D point coordinates
Parameters:
index- Node index (1-based) 2D point coordinates
SetNode
Set 2D node position.
void SetNode(int index, const & Point2d point) const;index Node index (1-based) point 2D point coordinates
Parameters:
index- Node index (1-based) point 2D point coordinatespoint- 2D point coordinates
GetAllNodes
Get all node positions efficiently.
std::vector< > Point2d GetAllNodes() const;of all 2D node positions Vector
SetAllNodes
Set all node positions efficiently.
void SetAllNodes(const std::vector< > & Point2d nodes) const;nodes of 2D node positions Vector
Parameters:
nodes- of 2D node positions Vector
Copy
Create copy of this polygon.
LPolygon2d Copy() const;New polygon instance
GetPolygonData
Get complete polygon data as POD structure.
Polygon2DData GetPolygonData() const;Structure with all polygon data
SetPolygonData
Set polygon data from POD structure.
void SetPolygonData(const & Polygon2DData data) const;data Structure with polygon data
Parameters:
data- Structure with polygon data
Enumerations
PolygonType
Polygon type enumeration.
enum PolygonType {
POLYGON2D_STANDARD, // Standard polygon with Handle(Poly_Polygon2D)
POLYGON2D_UNDEFINED, // Invalid/undefined polygon.
};Type Definitions
TypeEnum
PolygonType TypeEnum;LightOcct::LPolygon3d
Light OCCT wrapper for OCCT Poly_Polygon3D class.
Provides a polygon in 3D space, typically as an approximate representation of a curve. A Polygon3D is defined by a table of 3D nodes (points) and optional curve parameters. If the polygon is closed, the point of closure is repeated at the end of the table. Follows Light OCCT architecture: Enum + Handle pattern for type-safe OCCT object storage POD structures for cross-language data exchange Wrapper methods hide OCCT implementation details No OCCT types exposed in public interface
#include <light-occt/mesh/LPolygon3d.hxx>Quick Reference
Fields: myType
Factory Methods: CreateEmpty(), CreateFromNodes(), CreateWithParameters()
Methods: LPolygon3d(), LPolygon3d(), operator=(), ~LPolygon3d(), GetType(), IsValid(), GetNbNodes(), HasParameters(), GetDeflection(), SetDeflection(), GetNode(), SetNode(), GetParameter(), SetParameter(), GetAllNodes(), GetAllParameters(), SetAllNodes(), SetAllParameters(), Copy(), GetPolygonData(), SetPolygonData()
Enums: PolygonType
Types: TypeEnum
Fields
myType
PolygonType myType;Polygon type.
Methods
Factory Methods
CreateEmpty
Create empty polygon with specified capacity.
static LPolygon3d CreateEmpty(int nbNodes, bool hasParameters);nbNodes Number of nodes to allocate hasParameters Whether to allocate parameter storage New polygon instance
Parameters:
nbNodes- Number of nodes to allocate hasParameters Whether to allocate parameter storage New polygon instancehasParameters- Whether to allocate parameter storage New polygon instance
CreateFromNodes
Create polygon from node array.
static LPolygon3d CreateFromNodes(const std::vector< > & Point nodes);nodes Array of 3D node positions New polygon instance
Parameters:
nodes- Array of 3D node positions New polygon instance
CreateWithParameters
Create polygon from nodes and parameters.
static LPolygon3d CreateWithParameters(const std::vector< > & Point nodes, const std::vector< double > & parameters);nodes Array of 3D node positions parameters Array of curve parameters for each node New polygon instance
Parameters:
nodes- Array of 3D node positions parameters Array of curve parameters for each node New polygon instanceparameters- Array of curve parameters for each node New polygon instance
Instance Methods
LPolygon3d
Default constructor - creates undefined polygon.
LPolygon3d() const;LPolygon3d
Copy constructor.
LPolygon3d(const & LPolygon3d other) const;other Polygon to copy from
Parameters:
other- Polygon to copy from
operator=
Assignment operator.
& LPolygon3d operator=(const & LPolygon3d other) const;other Polygon to copy from Reference to this polygon
Parameters:
other- Polygon to copy from Reference to this polygon
~LPolygon3d
Destructor.
~LPolygon3d() const;GetType
Get polygon type.
PolygonType GetType() const;Polygon type enumeration
IsValid
Check if polygon is valid (not undefined).
bool IsValid() const;True if polygon is valid
GetNbNodes
Get number of nodes in polygon.
int GetNbNodes() const;Number of nodes
HasParameters
Check if polygon has curve parameters.
bool HasParameters() const;True if parameters are available
GetDeflection
Get deflection value.
double GetDeflection() const;Maximum deflection from original curve
SetDeflection
Set deflection value.
void SetDeflection(double deflection) const;deflection Maximum deflection from original curve
Parameters:
deflection- Maximum deflection from original curve
GetNode
Get 3D node position.
Point GetNode(int index) const;index Node index (1-based) 3D point coordinates
Parameters:
index- Node index (1-based) 3D point coordinates
SetNode
Set 3D node position.
void SetNode(int index, const & Point point) const;index Node index (1-based) point 3D point coordinates
Parameters:
index- Node index (1-based) point 3D point coordinatespoint- 3D point coordinates
GetParameter
Get curve parameter at node.
double GetParameter(int index) const;index Node index (1-based) Curve parameter value
Parameters:
index- Node index (1-based) Curve parameter value
SetParameter
Set curve parameter at node.
void SetParameter(int index, double parameter) const;index Node index (1-based) parameter Curve parameter value
Parameters:
index- Node index (1-based) parameter Curve parameter valueparameter- Curve parameter value
GetAllNodes
Get all node positions efficiently.
std::vector< > Point GetAllNodes() const;of all 3D node positions Vector
GetAllParameters
Get all curve parameters efficiently.
std::vector< double > GetAllParameters() const;of all curve parameters (empty if no parameters) Vector
SetAllNodes
Set all node positions efficiently.
void SetAllNodes(const std::vector< > & Point nodes) const;nodes of 3D node positions Vector
Parameters:
nodes- of 3D node positions Vector
SetAllParameters
Set all curve parameters efficiently.
void SetAllParameters(const std::vector< double > & parameters) const;parameters of curve parameters Vector
Parameters:
parameters- of curve parameters Vector
Copy
Create copy of this polygon.
LPolygon3d Copy() const;New polygon instance
GetPolygonData
Get complete polygon data as POD structure.
Polygon3DData GetPolygonData() const;Structure with all polygon data
SetPolygonData
Set polygon data from POD structure.
void SetPolygonData(const & Polygon3DData data) const;data Structure with polygon data
Parameters:
data- Structure with polygon data
Enumerations
PolygonType
Polygon type enumeration.
enum PolygonType {
POLYGON_STANDARD, // Standard polygon with Handle(Poly_Polygon3D)
POLYGON_UNDEFINED, // Invalid/undefined polygon.
};Type Definitions
TypeEnum
PolygonType TypeEnum;LightOcct::LTriangulation
Light OCCT wrapper for OCCT Poly_Triangulation class.
Provides a triangulation for surfaces or shapes using the enum + Handle pattern. A triangulation consists of: A table of 3D nodes (points on the surface) A table of triangles (each triangle has three node indices) Optional 2D nodes (UV parameters on the surface) Optional surface normals at nodes Deflection value (maximum distance from surface to triangulation) Follows Light OCCT architecture: Enum + Handle pattern for type-safe OCCT object storage POD structures for cross-language data exchange Wrapper methods hide OCCT implementation details No OCCT types exposed in public interface
#include <light-occt/mesh/LTriangulation.hxx>Quick Reference
Fields: myType
Factory Methods: CreateEmpty(), CreateFromArrays(), CreateWithUV()
Methods: LTriangulation(), LTriangulation(), operator=(), ~LTriangulation(), GetType(), IsValid(), GetNbNodes(), GetNbTriangles(), HasUVNodes(), HasNormals(), GetDeflection(), SetDeflection(), GetNode(), SetNode(), GetUVNode(), SetUVNode(), GetNormal(), SetNormal(), GetTriangle(), SetTriangle(), GetAllNodes(), GetAllTriangles(), SetAllNodes(), SetAllTriangles(), AddUVNodes(), RemoveUVNodes(), AddNormals(), RemoveNormals(), ComputeNormals(), Clear(), GetBoundingBox(), Copy(), GetTriangulationData(), GetNodeData()
Enums: TriangulationType
Types: TypeEnum
Fields
myType
TriangulationType myType;Triangulation type.
Methods
Factory Methods
CreateEmpty
Create empty triangulation with specified capacity.
static LTriangulation CreateEmpty(int nbNodes, int nbTriangles, bool hasUVNodes, bool hasNormals);nbNodes Number of nodes to allocate nbTriangles Number of triangles to allocate hasUVNodes Whether to allocate UV node storage hasNormals Whether to allocate normal storage New triangulation instance
Parameters:
nbNodes- Number of nodes to allocate nbTriangles Number of triangles to allocate hasUVNodes Whether to allocate UV node storage hasNormals Whether to allocate normal storage New triangulation instancenbTriangles- Number of triangles to allocate hasUVNodes Whether to allocate UV node storage hasNormals Whether to allocate normal storage New triangulation instancehasUVNodes- Whether to allocate UV node storage hasNormals Whether to allocate normal storage New triangulation instancehasNormals- Whether to allocate normal storage New triangulation instance
CreateFromArrays
Create triangulation from node and triangle arrays.
static LTriangulation CreateFromArrays(const std::vector< > & Point nodes, const std::vector< > & TriangleData triangles);nodes Array of 3D node positions triangles Array of triangle data (node indices) New triangulation instance
Parameters:
nodes- Array of 3D node positions triangles Array of triangle data (node indices) New triangulation instancetriangles- Array of triangle data (node indices) New triangulation instance
CreateWithUV
Create triangulation with UV nodes.
static LTriangulation CreateWithUV(const std::vector< > & Point nodes, const std::vector< > & Point2d uvNodes, const std::vector< > & TriangleData triangles);nodes Array of 3D node positions uvNodes Array of 2D UV positions triangles Array of triangle data (node indices) New triangulation instance
Parameters:
nodes- Array of 3D node positions uvNodes Array of 2D UV positions triangles Array of triangle data (node indices) New triangulation instanceuvNodes- Array of 2D UV positions triangles Array of triangle data (node indices) New triangulation instancetriangles- Array of triangle data (node indices) New triangulation instance
Instance Methods
LTriangulation
Default constructor - creates undefined triangulation.
LTriangulation() const;LTriangulation
Copy constructor.
LTriangulation(const & LTriangulation other) const;other Triangulation to copy from
Parameters:
other- Triangulation to copy from
operator=
Assignment operator.
& LTriangulation operator=(const & LTriangulation other) const;other Triangulation to copy from Reference to this triangulation
Parameters:
other- Triangulation to copy from Reference to this triangulation
~LTriangulation
Destructor.
~LTriangulation() const;GetType
Get triangulation type.
TriangulationType GetType() const;Triangulation type enumeration
IsValid
Check if triangulation is valid (not undefined).
bool IsValid() const;True if triangulation is valid
GetNbNodes
Get number of nodes in triangulation.
int GetNbNodes() const;Number of nodes
GetNbTriangles
Get number of triangles in triangulation.
int GetNbTriangles() const;Number of triangles
HasUVNodes
Check if triangulation has UV nodes.
bool HasUVNodes() const;True if UV nodes are available
HasNormals
Check if triangulation has surface normals.
bool HasNormals() const;True if normals are available
GetDeflection
Get deflection value.
double GetDeflection() const;Maximum deflection from surface
SetDeflection
Set deflection value.
void SetDeflection(double deflection) const;deflection Maximum deflection from surface
Parameters:
deflection- Maximum deflection from surface
GetNode
Get 3D node position.
Point GetNode(int index) const;index Node index (1-based) 3D point coordinates
Parameters:
index- Node index (1-based) 3D point coordinates
SetNode
Set 3D node position.
void SetNode(int index, const & Point point) const;index Node index (1-based) point 3D point coordinates
Parameters:
index- Node index (1-based) point 3D point coordinatespoint- 3D point coordinates
GetUVNode
Get UV node position.
Point2d GetUVNode(int index) const;index Node index (1-based) 2D UV coordinates
Parameters:
index- Node index (1-based) 2D UV coordinates
SetUVNode
Set UV node position.
void SetUVNode(int index, const & Point2d point) const;index Node index (1-based) point 2D UV coordinates
Parameters:
index- Node index (1-based) point 2D UV coordinatespoint- 2D UV coordinates
GetNormal
Get surface normal at node.
Vector GetNormal(int index) const;index Node index (1-based) Surface normal vector
Parameters:
index- Node index (1-based) Surface normal vector
SetNormal
Set surface normal at node.
void SetNormal(int index, const & Vector normal) const;index Node index (1-based) normal Surface normal vector (should be normalized)
Parameters:
index- Node index (1-based) normal Surface normal vector (should be normalized)normal- Surface normal vector (should be normalized)
GetTriangle
Get triangle data.
TriangleData GetTriangle(int index) const;index Triangle index (1-based) Triangle with three node indices
Parameters:
index- Triangle index (1-based) Triangle with three node indices
SetTriangle
Set triangle data.
void SetTriangle(int index, const & TriangleData triangle) const;index Triangle index (1-based) triangle Triangle with three node indices
Parameters:
index- Triangle index (1-based) triangle Triangle with three node indicestriangle- index (1-based) triangle Triangle with three node indices
GetAllNodes
Get all node data efficiently.
TriangulationNodesData GetAllNodes() const;Structure with all node arrays
GetAllTriangles
Get all triangle data efficiently.
TriangulationTrianglesData GetAllTriangles() const;Structure with all triangle data
SetAllNodes
Set all node data efficiently.
void SetAllNodes(const & TriangulationNodesData nodesData) const;nodesData Structure with all node arrays
Parameters:
nodesData- Structure with all node arrays
SetAllTriangles
Set all triangle data efficiently.
void SetAllTriangles(const & TriangulationTrianglesData trianglesData) const;trianglesData Structure with all triangle data
Parameters:
trianglesData- Structure with all triangle data
AddUVNodes
Add UV node storage if not already present.
void AddUVNodes() const;RemoveUVNodes
Remove UV node storage.
void RemoveUVNodes() const;AddNormals
Add normal storage if not already present.
void AddNormals() const;RemoveNormals
Remove normal storage.
void RemoveNormals() const;ComputeNormals
Compute smooth normals by averaging triangle normals.
void ComputeNormals() const;Clear
Clear all mesh data.
void Clear() const;GetBoundingBox
Get bounding box of triangulation.
BoundingBox GetBoundingBox() const;Axis-aligned bounding box
Copy
Create copy of this triangulation.
LTriangulation Copy() const;New triangulation instance
GetTriangulationData
Get triangulation metadata.
TriangulationData GetTriangulationData() const;Structure with triangulation properties
GetNodeData
Get specific node data.
MeshNodeData GetNodeData(int index) const;index Node index (1-based) Node data with position, UV, and normal
Parameters:
index- Node index (1-based) Node data with position, UV, and normal
Enumerations
TriangulationType
Triangulation type enumeration.
enum TriangulationType {
TRIANGULATION_STANDARD, // Standard triangulation with Handle(Poly_Triangulation)
TRIANGULATION_UNDEFINED, // Invalid/undefined triangulation.
};Type Definitions
TypeEnum
TriangulationType TypeEnum;