Graphite  Version 3
An experimental 3D geometry processing program
OGF::MeshGrobEditor Class Reference

A wrapper to script low-level editing operations on a MeshGrob. More...

#include <OGF/mesh/interfaces/mesh_grob_editor_interface.h>

Inheritance diagram for OGF::MeshGrobEditor:
OGF::Interface OGF::Object GEO::Counted

Public Member Functions

 MeshGrobEditor ()
 MeshGrobEditor constructor.
 
 ~MeshGrobEditor () override
 MeshGrobEditor destrutor.
 
MeshGrobmesh_grob () const
 Gets the wrapped MeshGrob. More...
 
index_t get_dimension () const
 Gets the dimension. More...
 
index_t get_nb_vertices () const
 Gets the number of vertices. More...
 
index_t get_nb_edges () const
 Gets the number of edges. More...
 
index_t get_nb_facets () const
 Gets the number of facets. More...
 
index_t get_nb_cells () const
 Gets the number of cells. More...
 
NL::Vectorcreate_attribute (const std::string &attribute_name, index_t dimension=1, MetaType *type=nullptr)
 Creates an attribute. More...
 
NL::Vectorfind_or_create_attribute (const std::string &attribute_name, index_t dimension=1, MetaType *type=nullptr)
 Creates an attribute. More...
 
bool has_attribute (const std::string &attribute_name) const
 Tests whether the mesh has an attribute. More...
 
NL::Vectorget_points ()
 Gets the points. More...
 
NL::Vectorget_triangles () const
 If the surface mesh is triangulated, gets the array of triangles. More...
 
NL::Vectorget_triangle_adjacents () const
 If the surface mesh is triangulated, gets the array of triangles. More...
 
NL::Vectorget_tetrahedra () const
 If the volume mesh is tetrahedralized, gets the array of tetrahedra. More...
 
NL::Vectorget_tetrahedra_adjacents () const
 If the volume mesh is tetrahedralized, gets the array of tetrahedra adjacencies. More...
 
void clear ()
 clears this mesh.
 
index_t create_vertex (double x=0.0, double y=0.0, double z=0.0)
 Creates a new vertex. More...
 
void set_vertex (index_t v, double x=0.0, double y=0.0, double z=0.0)
 Sets the coordinates of an existing vertex. More...
 
index_t create_vertices (index_t nb)
 Creates multiple vertices. More...
 
index_t create_facet (index_t nb_vertices)
 Creates a facet. More...
 
index_t create_triangle (index_t v1, index_t v2, index_t v3)
 Creates a triangle. More...
 
index_t create_quad (index_t v1, index_t v2, index_t v3, index_t v4)
 Creates a quad. More...
 
index_t create_edge (index_t v1, index_t v2)
 Creates an edge. More...
 
void connect_facets ()
 Computes facet adjacencies.
 
index_t facet_nb_vertices (index_t f) const
 Gets the number of vertices in a facet. More...
 
index_t facet_vertex (index_t f, index_t lv) const
 Gets a vertex in a facet. More...
 
void set_facet_vertex (index_t f, index_t lv, index_t v)
 Sets a vertex of the facet. More...
 
void delete_vertices (NL::Vector *to_delete)
 Deletes a set of vertices. More...
 
void delete_edges (NL::Vector *to_delete, bool delete_isolated_vertices=true)
 Deletes a set of edges. More...
 
void delete_facets (NL::Vector *to_delete, bool delete_isolated_vertices=true)
 Deletes a set of facets. More...
 
void delete_cells (NL::Vector *to_delete, bool delete_isolated_vertices=true)
 Deletes a set of cells. More...
 
- Public Member Functions inherited from OGF::Interface
 Interface ()
 Interface constructor.
 
 ~Interface () override
 Interface destructor.
 
Grobgrob () const
 Gets the Grob. More...
 
SceneGraphscene_graph () const
 Gets the SceneGraph. More...
 
Grobget_grob () const
 Gets the current Grob. More...
 
- Public Member Functions inherited from OGF::Object
 Object (bool transient=false)
 Object constructor. More...
 
virtual ~Object ()
 Object destructor.
 
virtual MetaClassmeta_class () const
 Gets the meta class. More...
 
virtual void set_meta_class (MetaClass *mclass)
 Sets the meta class. More...
 
unsigned int id () const
 Gets the identifier of this object. More...
 
std::string string_id () const
 Gets the unique string identifier. More...
 
bool has_method (const std::string &method_name) const
 Tests whether a method is defined. More...
 
virtual bool invoke_method (const std::string &method_name, const ArgList &args, Any &ret_val)
 Invokes a method by method name and argument list, and gets the return value. More...
 
bool invoke_method (const std::string &method_name, const ArgList &args)
 Invokes a method by method name and argument list. More...
 
bool invoke_method (const std::string &method_name)
 Invokes a method by method name. More...
 
bool has_property (const std::string &prop_name) const
 Tests whether a property is defined. More...
 
virtual bool get_property (const std::string &prop_name, std::string &prop_value) const
 Gets a property. More...
 
virtual Connectionconnect_signal_to_slot (const std::string &signal_name, Object *to, const std::string &slot_name)
 Connects a signal with a slot of another object. More...
 
virtual void add_connection (Connection *connection)
 Adds a connection to this object. More...
 
virtual void remove_connection (Connection *connection)
 Removes a connection to this object. More...
 
virtual void get_element (index_t i, Any &value) const
 Gets an element by index. More...
 
virtual void set_element (index_t i, const Any &value)
 Sets an element by index. More...
 
virtual void search (const std::string &needle, const std::string &path="")
 Displays the names of all objects that contain a substring. More...
 
bool get_signals_enabled () const
 Tests wheter signals are enabled. More...
 
void set_signals_enabled (bool value)
 Enables or disables signals. More...
 
bool get_slots_enabled () const
 Tests wheter slots are enabled. More...
 
void set_slots_enabled (bool value)
 Enables or disables slots. More...
 
MetaClassget_meta_class () const
 Gets the meta class. More...
 
std::string get_string_id () const
 Gets the unique string identifier. More...
 
virtual std::string get_doc () const
 Gets the documentation. More...
 
virtual Sign compare (const Object *other) const
 Compares this object with another one. More...
 
virtual bool is_a (const MetaType *type) const
 Tests whether this object inherits a given type. More...
 
void disconnect ()
 Removes all connections from signals of this objects. More...
 
void enable_signals ()
 Enables signals.
 
void disable_signals ()
 Disables signals.
 
void enable_slots ()
 Enables slots.
 
void disable_slots ()
 Disables slots.
 
void set_properties (const ArgList &args)
 Sets several properties in a single call. More...
 
virtual bool set_property (const std::string &name, const std::string &value)
 Sets an individual property. More...
 
void help () const
 Displays some help about this object. More...
 
virtual bool set_property (const std::string &name, const Any &value)
 Sets an individual property. More...
 
virtual bool get_property (const std::string &prop_name, Any &prop_value) const
 Gets a property. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 

Public Attributes

 __pad0__: void set_dimension(index_t dim)
 
 __pad1__: NL::Vector* find_attribute( const std::string& attribute_name
 
bool quiet
 
- Public Attributes inherited from OGF::Interface
 __pad0__: virtual void set_grob(Grob* value)
 
- Public Attributes inherited from OGF::Object
 __pad0__: virtual index_t get_nb_elements() const
 
 __pad1__: bool equals(const Object* other) const
 

Protected Member Functions

bool check_mesh_grob () const
 Checks whether MeshGrob is valid. More...
 
bool check_vertex_index (index_t v) const
 Checks whether a vertex index is valid. More...
 
bool check_facet_index (index_t f) const
 Checks whether a facet index is valid. More...
 
void update ()
 Redisplays the wrapped MeshGrob.
 
- Protected Member Functions inherited from OGF::Object
virtual bool emit_signal (const std::string &signal_name, const ArgList &args, bool called_from_slot=false)
 Emits a signal and calls the slots it is connected to. More...
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from OGF::Object
static Objectid_to_object (unsigned int id)
 Gets an object from a unique object id. More...
 
- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 

Detailed Description

A wrapper to script low-level editing operations on a MeshGrob.

Definition at line 56 of file mesh_grob_editor_interface.h.

Member Function Documentation

◆ check_facet_index()

bool OGF::MeshGrobEditor::check_facet_index ( index_t  f) const
protected

Checks whether a facet index is valid.

Displays an error message if not.

Return values
trueif facet index is valid.
falseotherwise.

◆ check_mesh_grob()

bool OGF::MeshGrobEditor::check_mesh_grob ( ) const
protected

Checks whether MeshGrob is valid.

Displays an error message if not.

Return values
trueif MeshGrob is not nullptr.
falseotherwise.

◆ check_vertex_index()

bool OGF::MeshGrobEditor::check_vertex_index ( index_t  v) const
protected

Checks whether a vertex index is valid.

Displays an error message if not.

Return values
trueif vertex index is valid.
falseotherwise.

◆ create_attribute()

NL::Vector* OGF::MeshGrobEditor::create_attribute ( const std::string &  attribute_name,
index_t  dimension = 1,
MetaType type = nullptr 
)

Creates an attribute.

Parameters
[in]attribute_namethe name of the attribute, preceded by the elements (e.g., "vertices.attr_name", "edges.attr_name" etc...).
[in]dimensionnumber of elements per item. Default is 1.
[in]typeoptional meta type for the attribute elements. Default is double precision number.
Returns
a wrapper around the newly created attribute.

◆ create_edge()

index_t OGF::MeshGrobEditor::create_edge ( index_t  v1,
index_t  v2 
)

Creates an edge.

Parameters
[in]v1,v2the two extremities of the edge, in 0..nb_vertices()-1
Returns
the index of the newly created edge.

◆ create_facet()

index_t OGF::MeshGrobEditor::create_facet ( index_t  nb_vertices)

Creates a facet.

The vertices of the facet are left uninitialized.

Parameters
[in]nb_verticesnumber of vertices in facet.
Returns
the index of the newly created vertex.

◆ create_quad()

index_t OGF::MeshGrobEditor::create_quad ( index_t  v1,
index_t  v2,
index_t  v3,
index_t  v4 
)

Creates a quad.

Parameters
[in]v1,v2,v3,v4the indices of the vertices, in 0..nb_vertices()-1
Returns
the index of the newly created quad.

◆ create_triangle()

index_t OGF::MeshGrobEditor::create_triangle ( index_t  v1,
index_t  v2,
index_t  v3 
)

Creates a triangle.

Parameters
[in]v1,v2,v3the indices of the vertices, in 0..nb_vertices()-1
Returns
the index of the newly created triangle.

◆ create_vertex()

index_t OGF::MeshGrobEditor::create_vertex ( double  x = 0.0,
double  y = 0.0,
double  z = 0.0 
)

Creates a new vertex.

If this is a 2D mesh, z is ignored.

Parameters
[in]x,y,zthe coordinates of the vertex.
Returns
the index of the newly created vertex.

◆ create_vertices()

index_t OGF::MeshGrobEditor::create_vertices ( index_t  nb)

Creates multiple vertices.

Parameters
[in]nbthe number of vertices to create.
Returns
the index of the first created vertex.

◆ delete_cells()

void OGF::MeshGrobEditor::delete_cells ( NL::Vector to_delete,
bool  delete_isolated_vertices = true 
)

Deletes a set of cells.

Parameters
[in]to_deletea vector of type unsigned int or index_t.
[in]delete_isolated_verticesif set, all vertices that have no mesh element incident to them are deleted.

to_delete needs to have the same size as the number of cells in the mesh. A non-zero entry in to_delete means that the associated cell should be deleted.

◆ delete_edges()

void OGF::MeshGrobEditor::delete_edges ( NL::Vector to_delete,
bool  delete_isolated_vertices = true 
)

Deletes a set of edges.

Parameters
[in]to_deletea vector of type unsigned int or index_t.
[in]delete_isolated_verticesif set, all vertices that have no mesh element incident to them are deleted.

to_delete needs to have the same size as the number of edges in the mesh. A non-zero entry in to_delete means that the associated edge should be deleted.

◆ delete_facets()

void OGF::MeshGrobEditor::delete_facets ( NL::Vector to_delete,
bool  delete_isolated_vertices = true 
)

Deletes a set of facets.

Parameters
[in]delete_isolated_verticesif set, all vertices that have no mesh element incident to them are deleted.
[in]to_deletea vector of type unsigned int or index_t.

to_delete needs to have the same size as the number of facets in the mesh. A non-zero entry in to_delete means that the associated facet should be deleted.

◆ delete_vertices()

void OGF::MeshGrobEditor::delete_vertices ( NL::Vector to_delete)

Deletes a set of vertices.

Parameters
[in]to_deletea vector of type unsigned int or index_t.

to_delete needs to have the same size as the number of vertices in the mesh. A non-zero entry in to_delete means that the associated vertex should be deleted.

◆ facet_nb_vertices()

index_t OGF::MeshGrobEditor::facet_nb_vertices ( index_t  f) const

Gets the number of vertices in a facet.

Parameters
[in]fthe index of the facet.
Returns
the number of vertices in f.

◆ facet_vertex()

index_t OGF::MeshGrobEditor::facet_vertex ( index_t  f,
index_t  lv 
) const

Gets a vertex in a facet.

Parameters
[in]fthe facet index.
[in]lvthe local index of the vertex in the facet.
Returns
the global index of the vertex.

◆ find_or_create_attribute()

NL::Vector* OGF::MeshGrobEditor::find_or_create_attribute ( const std::string &  attribute_name,
index_t  dimension = 1,
MetaType type = nullptr 
)

Creates an attribute.

Parameters
[in]attribute_namethe name of the attribute, preceded by the elements (e.g., "vertices.attr_name", "edges.attr_name" etc...).
[in]dimensionnumber of elements per item. Default is 1.
[in]typeoptional meta type for the attribute elements. Default is double precision number.
Returns
a wrapper around the attribute.

◆ get_dimension()

index_t OGF::MeshGrobEditor::get_dimension ( ) const

Gets the dimension.

Returns
the dimension of the vertices, one of 2,3

◆ get_nb_cells()

index_t OGF::MeshGrobEditor::get_nb_cells ( ) const

Gets the number of cells.

Returns
the number of cells.

◆ get_nb_edges()

index_t OGF::MeshGrobEditor::get_nb_edges ( ) const

Gets the number of edges.

Returns
the number of edges explicitly stored (facets and cell edges do not count).

◆ get_nb_facets()

index_t OGF::MeshGrobEditor::get_nb_facets ( ) const

Gets the number of facets.

Returns
the number of facets.

◆ get_nb_vertices()

index_t OGF::MeshGrobEditor::get_nb_vertices ( ) const

Gets the number of vertices.

Returns
the number of vertices.

◆ get_points()

NL::Vector* OGF::MeshGrobEditor::get_points ( )
inline

Gets the points.

Returns
a pointer to a new NL::Vector referring to the array of points

Definition at line 172 of file mesh_grob_editor_interface.h.

◆ get_tetrahedra()

NL::Vector* OGF::MeshGrobEditor::get_tetrahedra ( ) const

If the volume mesh is tetrahedralized, gets the array of tetrahedra.

Returns
a pointer to a new NL::Vector referring to the array of tetrahedra or nullptr if the volume mesh is not tetrahedralized.

◆ get_tetrahedra_adjacents()

NL::Vector* OGF::MeshGrobEditor::get_tetrahedra_adjacents ( ) const

If the volume mesh is tetrahedralized, gets the array of tetrahedra adjacencies.

Returns
a pointer to a new NL::Vector referring to the array of tetrahedra adjacencies or nullptr if the volume mesh is not tetrahedralized.

◆ get_triangle_adjacents()

NL::Vector* OGF::MeshGrobEditor::get_triangle_adjacents ( ) const

If the surface mesh is triangulated, gets the array of triangles.

Returns
a pointer to a new NL::Vector referring to the array of adjacent facets of each triangle or nullptr if the surface is not triangulated.

◆ get_triangles()

NL::Vector* OGF::MeshGrobEditor::get_triangles ( ) const

If the surface mesh is triangulated, gets the array of triangles.

Returns
a pointer to a new NL::Vector referring to the array of triangles or nullptr if the surface is not triangulated.

◆ has_attribute()

bool OGF::MeshGrobEditor::has_attribute ( const std::string &  attribute_name) const

Tests whether the mesh has an attribute.

Parameters
[in]attribute_namethe name of the attribute, preceded by the elements (e.g., "vertices.attr_name", "edges.attr_name" etc...).
Return values
trueif the mesh has an attribute of the specified name.
falseotherwise.

◆ mesh_grob()

MeshGrob* OGF::MeshGrobEditor::mesh_grob ( ) const
inline

Gets the wrapped MeshGrob.

Returns
a pointer to the MeshGrob or nullptr.

Definition at line 72 of file mesh_grob_editor_interface.h.

◆ set_facet_vertex()

void OGF::MeshGrobEditor::set_facet_vertex ( index_t  f,
index_t  lv,
index_t  v 
)

Sets a vertex of the facet.

Parameters
[in]fthe facet index.
[in]lvthe local index of the vertex in the facet.
[in]vthe global index of the vertex.

◆ set_vertex()

void OGF::MeshGrobEditor::set_vertex ( index_t  v,
double  x = 0.0,
double  y = 0.0,
double  z = 0.0 
)

Sets the coordinates of an existing vertex.

If this is a 2D mesh, z is ignored.

Parameters
[in]vthe index of the vertex, in 0..nb_vertices()-1
[in]x,y,zthe coordinates of the vertex.

Member Data Documentation

◆ quiet

bool OGF::MeshGrobEditor::quiet
Initial value:
=false
)

Definition at line 126 of file mesh_grob_editor_interface.h.


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