Enzo
Loading...
Searching...
No Matches
enzo::geo::Geometry Class Reference

Attribute based geometry container exchanged and modified by nodes. More...

#include <Geometry.h>

Public Member Functions

 Geometry (const Geometry &other)
 
Geometryoperator= (const Geometry &rhs)
 Assignment operator. Performs a deep copy of another Geometry.
 
ga::AttributeHandle< bt::intT > addIntAttribute (ga::AttributeOwner owner, std::string name)
 Adds an integer attribute to the geometry.
 
ga::AttributeHandleBool addBoolAttribute (ga::AttributeOwner owner, std::string name)
 Adds a boolean attribute to the geometry.
 
ga::AttributeHandle< bt::Vector3 > addVector3Attribute (ga::AttributeOwner owner, std::string name)
 Adds a 3D vector attribute to the geometry.
 
std::shared_ptr< ga::AttributegetAttribByName (ga::AttributeOwner owner, std::string name)
 Retrieves an attribute by its name.
 
const size_t getNumAttributes (const ga::AttributeOwner owner) const
 Gets the number of attributes owned by a specific element type.
 
std::weak_ptr< const ga::AttributegetAttributeByIndex (ga::AttributeOwner owner, unsigned int index) const
 Retrieves an attribute by its index.
 
HeMesh computeHalfEdgeMesh ()
 Computes per-point normals for the geometry.
 
void addFace (const std::vector< ga::Offset > &pointOffsets, bool closed=true)
 Adds a polygonal face to the geometry.
 
void addPoint (const bt::Vector3 &pos)
 Adds a point to the geometry.
 
std::set< ga::Offset >::const_iterator soloPointsBegin ()
 Iterator to the beginning of the set of solo (isolated) points.
 
std::set< ga::Offset >::const_iterator soloPointsEnd ()
 Iterator to the end of the set of solo (isolated) points.
 
void setPointPos (const ga::Offset offset, const bt::Vector3 &pos)
 Sets the position of a point.
 
ga::Offset getPrimStartVertex (ga::Offset primOffset) const
 Gets the first vertex of a primitive.
 
bt::Vector3 getPosFromVert (ga::Offset vertexOffset) const
 Gets the 3 dimensional position from a vertex offset.
 
bt::Vector3 getPointPos (ga::Offset pointOffset) const
 Gets the position of a point.
 
unsigned int getPrimVertCount (ga::Offset primOffset) const
 Gets the number of vertices in a primitive.
 
ga::Offset getVertexPrim (ga::Offset vertexOffset) const
 Gets the primitive that owns a given vertex.
 
ga::Offset getNumPrims () const
 Gets the number of primitives in the geometry.
 
ga::Offset getNumVerts () const
 Gets the number of vertices in the geometry.
 
ga::Offset getNumPoints () const
 Gets the number of points in the geometry.
 
ga::Offset getNumSoloPoints () const
 Gets the number of isolated points in the geometry. Isolated points are points that are not connnected to any other point and don't belong to a primitive.
 
bt::boolT isClosed (ga::Offset primOffset) const
 Checks if a primitive is closed or open.
 
void merge (Geometry &other)
 Merges another geometry into this one.
 
void computePrimStartVertices () const
 Computes the starting vertex for each primitive in the geometry.
 

Detailed Description

Attribute based geometry container exchanged and modified by nodes.

The Geometry class represents the core data being passed between nodes in the engine. It is the operand of the network. Nodes read, modify, and output geometry, which is then used to populate the viewport and the geometry spreadsheet. Geometry is stored in an attribute based structure, similar to a spreadsheet, where each column is an attribute owned by points, vertices, primitives, or the global context. Most geometry information, including built in properties such as positions and connectivity, is stored through this same system. These built in attributes are intrinsic, but they share the same base as user-defined attributes to keep the data model consistent.

The class provides methods for constructing and querying geometry, including adding points and faces, computing normals, and building a CGAL half-edge mesh representation. It also exposes accessors for reading positions, primitive connectivity, and vertex data, while tracking special cases such as isolated points.

Postcondition
Geometry in instatiated with some intrinsic attributes required to construct geometry, such as P (position) on point attributes, vertexCount and closed on primitive attributes, and point on vertices. It is recommended not to modify these directy but instead use the helper functions.

Member Function Documentation

◆ addBoolAttribute()

ga::AttributeHandleBool geo::Geometry::addBoolAttribute ( ga::AttributeOwner owner,
std::string name )

Adds a boolean attribute to the geometry.

Parameters
ownerThe attribute owner (point, vertex, primitive, detail).
nameThe name of the attribute.
Returns
Handle to the created boolean attribute.

◆ addFace()

void geo::Geometry::addFace ( const std::vector< ga::Offset > & pointOffsets,
bool closed = true )

Adds a polygonal face to the geometry.

Parameters
pointOffsetsOffsets of the points forming the face.
closedWhether the face is closed (default true).

◆ addIntAttribute()

ga::AttributeHandleInt geo::Geometry::addIntAttribute ( ga::AttributeOwner owner,
std::string name )

Adds an integer attribute to the geometry.

Parameters
ownerThe attribute owner (point, vertex, primitive, detail).
nameThe name of the attribute.
Returns
Handle to the created integer attribute.

◆ addPoint()

void geo::Geometry::addPoint ( const bt::Vector3 & pos)

Adds a point to the geometry.

Parameters
posPosition of the new point.

◆ addVector3Attribute()

ga::AttributeHandle< bt::Vector3 > geo::Geometry::addVector3Attribute ( ga::AttributeOwner owner,
std::string name )

Adds a 3D vector attribute to the geometry.

Parameters
ownerThe attribute owner (point, vertex, primitive, detail).
nameThe name of the attribute.
Returns
Handle to the created Vector3 attribute.

◆ computeHalfEdgeMesh()

enzo::geo::HeMesh geo::Geometry::computeHalfEdgeMesh ( )

Computes per-point normals for the geometry.

Returns
Vector of computed normals corresponding to each point.

Builds a CGAL half-edge mesh representation of the geometry.

Returns
The constructed half-edge mesh.

◆ computePrimStartVertices()

void geo::Geometry::computePrimStartVertices ( ) const

Computes the starting vertex for each primitive in the geometry.

Todo
Automatically lazy evaluate when requested (make thread safe)

◆ getAttribByName()

std::shared_ptr< ga::Attribute > geo::Geometry::getAttribByName ( ga::AttributeOwner owner,
std::string name )

Retrieves an attribute by its name.

Parameters
ownerThe attribute owner.
nameThe name of the attribute.
Returns
Shared pointer to the attribute if found, otherwise nullptr.

◆ getAttributeByIndex()

std::weak_ptr< const ga::Attribute > geo::Geometry::getAttributeByIndex ( ga::AttributeOwner owner,
unsigned int index ) const

Retrieves an attribute by its index.

Parameters
ownerThe attribute owner.
indexIndex of the attribute.
Returns
Weak pointer to the attribute.

◆ getNumAttributes()

const size_t geo::Geometry::getNumAttributes ( const ga::AttributeOwner owner) const

Gets the number of attributes owned by a specific element type.

Parameters
ownerThe attribute owner.
Returns
Number of attributes.

◆ getNumPoints()

ga::Offset geo::Geometry::getNumPoints ( ) const

Gets the number of points in the geometry.

Returns
Number of points.

◆ getNumPrims()

ga::Offset geo::Geometry::getNumPrims ( ) const

Gets the number of primitives in the geometry.

Returns
Number of primitives.

◆ getNumSoloPoints()

ga::Offset geo::Geometry::getNumSoloPoints ( ) const

Gets the number of isolated points in the geometry. Isolated points are points that are not connnected to any other point and don't belong to a primitive.

Returns
Number of solo points.

◆ getNumVerts()

ga::Offset geo::Geometry::getNumVerts ( ) const

Gets the number of vertices in the geometry.

Returns
Number of vertices.

◆ getPointPos()

bt::Vector3 geo::Geometry::getPointPos ( ga::Offset pointOffset) const

Gets the position of a point.

Parameters
pointOffsetOffset of the point.
Returns
Position of the point.

◆ getPosFromVert()

bt::Vector3 geo::Geometry::getPosFromVert ( ga::Offset vertexOffset) const

Gets the 3 dimensional position from a vertex offset.

Parameters
vertexOffsetOffset of the vertex.
Returns
Position of the vertex.

◆ getPrimStartVertex()

ga::Offset geo::Geometry::getPrimStartVertex ( ga::Offset primOffset) const

Gets the first vertex of a primitive.

Parameters
primOffsetOffset of the primitive.
Returns
Offset of the first vertex.

◆ getPrimVertCount()

unsigned int geo::Geometry::getPrimVertCount ( ga::Offset primOffset) const

Gets the number of vertices in a primitive.

Parameters
primOffsetOffset of the primitive.
Returns
Number of vertices.

◆ getVertexPrim()

ga::Offset geo::Geometry::getVertexPrim ( ga::Offset vertexOffset) const

Gets the primitive that owns a given vertex.

Parameters
vertexOffsetOffset of the vertex.
Returns
Offset of the owning primitive.

◆ isClosed()

bt::boolT geo::Geometry::isClosed ( ga::Offset primOffset) const

Checks if a primitive is closed or open.

Open primitives are treated and rendered as curves.

Parameters
primOffsetOffset of the primitive.
Returns
True if the primitive is closed, false otherwise.

◆ merge()

void enzo::geo::Geometry::merge ( Geometry & other)

Merges another geometry into this one.

Parameters
otherThe geometry to merge.

◆ operator=()

enzo::geo::Geometry & enzo::geo::Geometry::operator= ( const Geometry & rhs)

Assignment operator. Performs a deep copy of another Geometry.

Parameters
rhsThe Geometry object to copy from.
Returns
Reference to this Geometry.

◆ setPointPos()

void geo::Geometry::setPointPos ( const ga::Offset offset,
const bt::Vector3 & pos )

Sets the position of a point.

Parameters
offsetOffset of the point.
posNew position.

◆ soloPointsBegin()

std::set< ga::Offset >::const_iterator geo::Geometry::soloPointsBegin ( )

Iterator to the beginning of the set of solo (isolated) points.

Returns
Const iterator to the first solo point.

◆ soloPointsEnd()

std::set< ga::Offset >::const_iterator geo::Geometry::soloPointsEnd ( )

Iterator to the end of the set of solo (isolated) points.

Returns
Const iterator past the last solo point.

The documentation for this class was generated from the following files: