Iray SDK API nvidia_logo_transpbg.gif Up
mi::neuraylib::ITriangle_mesh Class Referenceabstract

Interface representing a triangle mesh. More...

#include <itriangle_mesh.h>

Inheritance diagram for mi::neuraylib::ITriangle_mesh:

Public Member Functions

Methods related to points
virtual Uint32 points_size () const =0
 Returns the number of points in the mesh. More...
 
virtual Uint32 points_capacity () const =0
 Returns the number of points for which space is allocated in the mesh. More...
 
virtual void reserve_points (Uint32 n)=0
 Reserves space for at least n points. More...
 
virtual Sint32 point (Uint32 index, Float32_3_struct &p) const =0
 Returns the coordinates of the point of index index in the output parameter p. More...
 
virtual Sint32 point (Uint32 index, Float64_3_struct &p) const =0
 Returns the coordinates of the point of index index in the output parameter p. More...
 
virtual Uint32 append_point (const Float32_3_struct &p)=0
 Adds a point p to the end of all points and returns the index of the new point. More...
 
virtual Uint32 append_point (const Float64_3_struct &p)=0
 Adds a point p to the end of all points and returns the index of the new point. More...
 
virtual Uint32 append_points (const Float32_3_struct *p, Size n)=0
 Adds an array of points to the end of all points and returns the index of the first new point. More...
 
virtual Uint32 append_points (const Float64_3_struct *p, Size n)=0
 Adds an array of points to the end of all points and returns the index of the first new point. More...
 
virtual Sint32 set_point (Uint32 index, const Float32_3_struct &p)=0
 Sets the point of index index to the new point p. More...
 
virtual Sint32 set_point (Uint32 index, const Float64_3_struct &p)=0
 Sets the point of index index to the new point p. More...
 
virtual Sint32 set_points (Uint32 index, const Float32_3_struct *p, Size n)=0
 Sets an array of points starting at index index. More...
 
virtual Sint32 set_points (Uint32 index, const Float64_3_struct *p, Size n)=0
 Sets an array of points starting at index index. More...
 
Methods related to triangles
virtual Uint32 triangles_size () const =0
 Returns the number of triangles. More...
 
virtual Uint32 triangles_capacity () const =0
 Returns the number of triangles for which space is allocated in the mesh. More...
 
virtual void reserve_triangles (Uint32 n)=0
 Reserves space for at least n triangles. More...
 
virtual Triangle_point_indices_struct triangle_point_indices (Triangle_handle_struct hnd) const =0
 Returns the triple of indices describing the vertices of the triangle of index i. More...
 
virtual Triangle_handle_struct append_triangle (const Triangle_point_indices_struct &triangle)=0
 Adds a triangle to the mesh. More...
 
virtual Triangle_handle_struct append_triangles (const Triangle_point_indices_struct *triangles, Size n)=0
 Adds an array of triangles to the mesh. More...
 
virtual Triangle_handle_struct append_triangles (const Uint32 *indices, Size n)=0
 Adds an array of triangles to the mesh. More...
 
virtual Sint32 set_triangle (Triangle_handle_struct hnd, const Triangle_point_indices_struct &triangle)=0
 Modifies a triangle of the mesh. More...
 
virtual Sint32 set_triangles (Triangle_handle_struct hnd, const Triangle_point_indices_struct *triangle, Size n)=0
 Modifies an array of triangles of the mesh. More...
 
Methods related to the mesh connectivity
virtual const ITriangle_connectivityaccess_mesh_connectivity () const =0
 Returns the mesh connectivity. More...
 
virtual ITriangle_connectivityedit_mesh_connectivity ()=0
 Detaches and returns the mesh connectivity. More...
 
virtual Sint32 attach_mesh_connectivity (ITriangle_connectivity *connectivity)=0
 Attaches the mesh connectivity to the mesh. More...
 
Methods related to custom connectivities
virtual ITriangle_connectivitycreate_connectivity (Connectivity_map_type map_type=CONNECTIVITY_MAP_GENERIC)=0
 Creates a new connectivity for non-per-primitive attributes. More...
 
virtual const ITriangle_connectivityaccess_connectivity (Mesh_attribute_name name) const =0
 Returns the connectivity for a given mesh attribute. More...
 
virtual ITriangle_connectivityedit_connectivity (Mesh_attribute_name name)=0
 Detaches and returns the connectivity for a given mesh attribute. More...
 
virtual Sint32 attach_connectivity (ITriangle_connectivity *connectivity)=0
 Attaches a given connectivity to the mesh. More...
 
virtual Sint32 remove_connectivity (Mesh_attribute_name name)=0
 Removes the connectivity for a non-per-primitive mesh attribute. More...
 
Methods related to per-primitive attributes
virtual bool has_attribute (Mesh_attribute_name name) const =0
 Indicates whether the mesh has a particular mesh attribute (per-primitive or other types). More...
 
virtual IAttribute_vectorcreate_attribute_vector (Mesh_attribute_name name, Uint32 dim=1)=0
 Creates a per-primitive mesh attribute. More...
 
virtual const IAttribute_vectoraccess_attribute_vector (Mesh_attribute_name name) const =0
 Returns a per-primitive mesh attribute. More...
 
virtual IAttribute_vectoredit_attribute_vector (Mesh_attribute_name name)=0
 Detaches and returns a per-primitive mesh attribute. More...
 
virtual Sint32 attach_attribute_vector (IAttribute_vector *attribute_vector)=0
 Attaches a given per-primitive mesh attribute to the mesh. More...
 
virtual Sint32 remove_attribute_vector (Mesh_attribute_name name)=0
 Removes a per-primitive mesh attribute. More...
 
Methods related to the bounding box
virtual Bbox3_struct get_bbox () const =0
 Returns the bounding box of the triangle mesh. More...
 
virtual Bbox3_struct get_tight_bbox (const Float64_4_4_struct &transformation_matrix) const =0
 Returns the bounding box of the triangle mesh after transformation. More...
 
Methods related to displacement
virtual void set_maximum_displacement (Float32 displacement)=0
 Sets the maximum displacement of the triangle mesh. More...
 
virtual Float32 get_maximum_displacement () const =0
 Returns the maximum displacement of the triangle mesh. More...
 
- Public Member Functions inherited from mi::neuraylib::IScene_element
virtual Element_type get_element_type () const =0
 Indicates the actual scene element represented by interfaces derived from this interface. More...
 
- Public Member Functions inherited from mi::neuraylib::IAttribute_set
virtual IDatacreate_attribute (const char *name, const char *type)=0
 Creates a new attribute name of the type type. More...
 
template<class T>
T * create_attribute (const char *name, const char *type)
 Creates a new attribute name of the type type. More...
 
template<class T>
T * create_attribute (const char *name)
 Creates a new attribute name of the type T. More...
 
virtual bool destroy_attribute (const char *name)=0
 Destroys the attribute name. More...
 
virtual const IDataaccess_attribute (const char *name) const =0
 Returns a const pointer to the attribute name. More...
 
template<class T>
const T * access_attribute (const char *name) const
 Returns a const pointer to the attribute name. More...
 
virtual IDataedit_attribute (const char *name)=0
 Returns a mutable pointer to the attribute name. More...
 
template<class T>
T * edit_attribute (const char *name)
 Returns a mutable pointer to the attribute name. More...
 
virtual bool is_attribute (const char *name) const =0
 Indicates existence of an attribute. More...
 
virtual const char * get_attribute_type_name (const char *name) const =0
 Returns the type of an attribute. More...
 
virtual Sint32 set_attribute_propagation (const char *name, Propagation_type value)=0
 Sets the propagation type of the attribute name. More...
 
virtual Propagation_type get_attribute_propagation (const char *name) const =0
 Returns the propagation type of the attribute name. More...
 
virtual const char * enumerate_attributes (Sint32 index) const =0
 Returns the name of the attribute indicated by index. More...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x71006633, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::Interface_declare< 0x8a2a4da9, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::Interface_declare< 0x1bcb8d48, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x71006633, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x8a2a4da9, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x1bcb8d48, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed Description

Interface representing a triangle mesh.

Triangle meshes are represented in an indexed format where triangles are triples of indices pointing into an array of points. Points and triangles are stored with consecutive indices, starting with the index 0 each. Both, points and triangles, can then be referred to by their index numbers. For type safety, triangle indices are represented using mi::neuraylib::Triangle_handle instead of plain integers.

In addition to regular attributes (see mi::neuraylib::IAttribute_set), meshes can also have mesh attributes. In contrast to regular attributes which exist only once per object, mesh attributes are always a vector of values with one vector element per primitive, per point, or per vertex (see mi::neuraylib::Mesh_attribute_name and mi::neuraylib::IAttribute_vector for details).

Per-primitive attributes can be directly used with the methods of this interface, namely create_attribute_vector(), access_attribute_vector(), edit_attribute_vector(), and attach_attribute_vector().

Per-point and per-vertex attributes require the use of a connectivity instead. Per-point attributes use the mesh connectivity (see edit_mesh_connectivity() and related methods), whereas per-vertex attributes use custom connectivities (see create_connectivity() and related methods).

This mesh interface supports the incremental construction of a mesh. Points and triangles can be added one at a time and in alternating order, if so desired. The only constraint is that triangles shall only refer to point indices of points that have been added already. Triangles can only be added or modified while the mesh connectivity is attached. This implies that per-point attributes (using the mesh connectivity) can only be created or modified before or after the triangles are added, not during that process.

The deletion of once added elements is not supported.

See also the "approx" attribute on mi::neuraylib::IAttribute_set for information how to control the tessellation of the triangle mesh.

See also
mi::neuraylib::ITriangle_connectivity
mi::neuraylib::IAttribute_vector

Example: Create a mesh with a single triangle with one normal and three texture coordinates

// The points of the triangle
point[0] = mi::Float32_3( 0.0f, 0.0f, 0.0f);
point[1] = mi::Float32_3( 1.0f, 0.0f, 0.0f);
point[2] = mi::Float32_3( 1.0f, 1.0f, 0.0f);
// The normal of the triangle
mi::Float32_3 normal( 0.0f, 0.0f, 1.0f);
// The texture coordinates for the triangle
mi::Float32_2 tex_coord[3];
tex_coord[0] = mi::Float32_2( 0.0f, 0.0f);
tex_coord[1] = mi::Float32_2( 1.0f, 0.0f);
tex_coord[2] = mi::Float32_2( 1.0f, 1.0f);
transaction->create<mi::neuraylib::ITriangle_mesh>( "Triangle_mesh"));
// Create the points of the mesh
for( mi::Uint32 i = 0; i < 3; ++i)
mesh->append_point( point[i]);
// Create the triangle and specify the mapping of its vertices to points
mesh->append_triangle( mi::neuraylib::Triangle_point_indices( 0, 1, 2)));
// Access the mesh connectivity
mesh->edit_mesh_connectivity());
// Create an attribute vector for 2-dimensional texture coordinates
mesh_connectivity->create_attribute_vector( mi::neuraylib::ATTR_TEXTURE, 2));
for( mi::Uint32 i = 0; i < 3; ++i)
texture_coordinates->append_float32( &tex_coord[i].x, 2);
mesh_connectivity->attach_attribute_vector( texture_coordinates.get());
// Attach the mesh connectivity back to mesh
mesh->attach_mesh_connectivity( mesh_connectivity.get());
// Create a custom connectivity for normals to share the same normal for all vertices
mesh->create_connectivity( mi::neuraylib::CONNECTIVITY_MAP_GENERIC));
normal_connectivity->set_triangle_indices( triangle_handle, 0, 0, 0);
// Create an attribute vector for normals
normal_connectivity->create_attribute_vector( mi::neuraylib::ATTR_NORMAL, 1));
normals->append_vector3( normal);
normal_connectivity->attach_attribute_vector( normals.get());
// Attach the custom connectivity to the mesh
mesh->attach_connectivity( normal_connectivity.get());
Handle class template for interfaces, automatizing the lifetime control via reference counting.
Definition: handle.h:113
Fixed-size math vector class template with generic operations.
Definition: vector.h:286
Interface representing a triangle mesh.
Definition: itriangle_mesh.h:122
virtual Sint32 point(Uint32 index, Float32_3_struct &p) const =0
Returns the coordinates of the point of index index in the output parameter p.
Handle class for type-safety.
Definition: identifier.h:66
A triangle defined by three point indices, starting at index 0.
Definition: itriangle_connectivity.h:33
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
math::Vector<Float32, 2> Float32_2
Vector of two Float32.
Definition: vector_typedefs.h:83
math::Vector<Float32, 3> Float32_3
Vector of three Float32.
Definition: vector_typedefs.h:90
@ ATTR_TEXTURE
Texture coordinates of type mi::Float32[] per point or per vertex (also called texture space).
Definition: iattribute_vector.h:101
@ ATTR_NORMAL
Surface normals of type mi::Float32_3 per point or per vertex.
Definition: iattribute_vector.h:65
@ CONNECTIVITY_MAP_GENERIC
A generic connectivity allows to map the vertices of every polygon to arbitrary indices.
Definition: iattribute_vector.h:136

Member Function Documentation

 access_attribute_vector()

virtual const IAttribute_vector * mi::neuraylib::ITriangle_mesh::access_attribute_vector ( Mesh_attribute_name  name) const
pure virtual

Returns a per-primitive mesh attribute.

Parameters
nameThe name of the attribute, see Mesh_attribute_name. The attribute must be a per-primitive attribute.
Returns
The requested attribute vector, or NULL in case of failure.

 access_connectivity()

virtual const ITriangle_connectivity * mi::neuraylib::ITriangle_mesh::access_connectivity ( Mesh_attribute_name  name) const
pure virtual

Returns the connectivity for a given mesh attribute.

Parameters
nameThe name of the attribute to return the connectivity for, see Mesh_attribute_name.
Returns
The connectivity for name, or NULL if there is no such attribute, or the attribute is a per-primitive attribute.

 access_mesh_connectivity()

virtual const ITriangle_connectivity * mi::neuraylib::ITriangle_mesh::access_mesh_connectivity ( ) const
pure virtual

Returns the mesh connectivity.

Returns
The mesh connectivity, or NULL if it currently not attached.

 append_point() [1/2]

virtual Uint32 mi::neuraylib::ITriangle_mesh::append_point ( const Float32_3_struct p)
pure virtual

Adds a point p to the end of all points and returns the index of the new point.

The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.

 append_point() [2/2]

virtual Uint32 mi::neuraylib::ITriangle_mesh::append_point ( const Float64_3_struct p)
pure virtual

Adds a point p to the end of all points and returns the index of the new point.

The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.

 append_points() [1/2]

virtual Uint32 mi::neuraylib::ITriangle_mesh::append_points ( const Float32_3_struct p,
Size  n 
)
pure virtual

Adds an array of points to the end of all points and returns the index of the first new point.

The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.

 append_points() [2/2]

virtual Uint32 mi::neuraylib::ITriangle_mesh::append_points ( const Float64_3_struct p,
Size  n 
)
pure virtual

Adds an array of points to the end of all points and returns the index of the first new point.

The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.

 append_triangle()

virtual Triangle_handle_struct mi::neuraylib::ITriangle_mesh::append_triangle ( const Triangle_point_indices_struct triangle)
pure virtual

Adds a triangle to the mesh.

This method requires that the mesh connectivity is attached. Afterwards all other connectivities and attributes must be updated accordingly.

Note
For best performance it is recommended to sort the triangles by their material index such that when looping over all triangles the material index changes as infrequently as possible.
Parameters
triangleThe vertex indices of the new triangle.
Returns
A handle for the new triangle, or a default-constructed handle in case of failure, i.e., the mesh connectivity has been detached, or at least one triangle point index is too large.

 append_triangles() [1/2]

virtual Triangle_handle_struct mi::neuraylib::ITriangle_mesh::append_triangles ( const Triangle_point_indices_struct triangles,
Size  n 
)
pure virtual

Adds an array of triangles to the mesh.

This method requires that the mesh connectivity is attached. Afterwards all other connectivities and attributes must be updated accordingly. The method stops processing array elements as soon as one triangle with invalid indices is found.

Note
For best performance it is recommended to sort the triangles by their material index such that when looping over all triangles the material index changes as infrequently as possible.
Parameters
trianglesThe array of vertex indices of all new triangle.
nThe number of triangles, i.e., array elements, to be added.
Returns
A handle for the first new triangle, or a default-constructed handle if no triangle at all was added, i.e., the mesh connectivity has been detached. Whether all triangles have been added successfully can be verified by comparing the sum of the return value and n to triangles_size().

 append_triangles() [2/2]

virtual Triangle_handle_struct mi::neuraylib::ITriangle_mesh::append_triangles ( const Uint32 indices,
Size  n 
)
pure virtual

Adds an array of triangles to the mesh.

This method requires that the mesh connectivity is attached. Afterwards all other connectivities and attributes must be updated accordingly. The method stops processing array elements as soon as one triangle with invalid indices is found.

Note
For best performance it is recommended to sort the triangles by their material index such that when looping over all triangles the material index changes as infrequently as possible.
Parameters
indicesThe array of vertex indices of all new triangle.
nThe number of triangles to be added. The array triangles contains $3*n$ elements.
Returns
A handle for the first new triangle, or a default-constructed handle if no triangle at all was added, i.e., the mesh connectivity has been detached. Whether all triangles have been added successfully can be verified by comparing the sum of the return value and n to triangles_size().

 attach_attribute_vector()

virtual Sint32 mi::neuraylib::ITriangle_mesh::attach_attribute_vector ( IAttribute_vector attribute_vector)
pure virtual

Attaches a given per-primitive mesh attribute to the mesh.

The attribute vector must not be used any longer after it has been attached.

See also
create_attribute_vector(), edit_attribute_vector()
Returns
  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: The attribute vector has not been acquired from this mesh.
  • -3: The attribute vector is not a per-primitive attribute vector.
  • -4: The attribute vector is a per-primitive attribute vector and the number of elements does not match the number of triangles of the mesh.
  • -5: An attribute of the same name is already attached to the mesh (or to one of its connectivities).

 attach_connectivity()

virtual Sint32 mi::neuraylib::ITriangle_mesh::attach_connectivity ( ITriangle_connectivity connectivity)
pure virtual

Attaches a given connectivity to the mesh.

This implicitly binds all attributes of the connectivity to the mesh. The connectivity must not be used any longer after it has been attached.

See also
create_connectivity(), edit_connectivity()
Returns
  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: The connectivity has not been created by or acquired from this mesh.
  • -3: The connectivity is already attached to the mesh.
  • -4: The connectivity is inconsistent (at least one index is too large for one of the attached attribute vectors).

 attach_mesh_connectivity()

virtual Sint32 mi::neuraylib::ITriangle_mesh::attach_mesh_connectivity ( ITriangle_connectivity connectivity)
pure virtual

Attaches the mesh connectivity to the mesh.

This implicitly binds all attributes of the connectivity to the mesh. The connectivity must not be used any longer after it has been attached.

See also
edit_mesh_connectivity()
Returns
  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: The mesh connectivity has not been acquired from this mesh.
  • -3: The mesh connectivity of this mesh has already been attached.
  • -4: The mesh connectivity is inconsistent (at least one index is too large for the number of points or one of the attached attribute vectors).
  • -5: The connectivity is not a mesh connectivity.

 create_attribute_vector()

virtual IAttribute_vector * mi::neuraylib::ITriangle_mesh::create_attribute_vector ( Mesh_attribute_name  name,
Uint32  dim = 1 
)
pure virtual

Creates a per-primitive mesh attribute.

The attribute is not yet attached to the mesh. It needs to be attached before it is released.

See also
attach_attribute_vector()
Parameters
nameThe name of the attribute, see Mesh_attribute_name. The attribute must be a per-primitive attribute.
dimDimension of an attribute value. Only used for those attributes that have user specifiable dimensions.
Returns
The requested attribute vector, or NULL in case of failure.

 create_connectivity()

virtual ITriangle_connectivity * mi::neuraylib::ITriangle_mesh::create_connectivity ( Connectivity_map_type  map_type = CONNECTIVITY_MAP_GENERIC)
pure virtual

Creates a new connectivity for non-per-primitive attributes.

The attribute is not yet attached to the mesh. It needs to be attached before it is released.

See also
attach_connectivity()

 edit_attribute_vector()

virtual IAttribute_vector * mi::neuraylib::ITriangle_mesh::edit_attribute_vector ( Mesh_attribute_name  name)
pure virtual

Detaches and returns a per-primitive mesh attribute.

The attribute needs to be reattached before it is released. Otherwise, the attribute is effectively removed from the mesh.

See also
attach_attribute_vector()
Parameters
nameThe name of the attribute, see Mesh_attribute_name. The attribute must be a per-primitive attribute.
Returns
The requested attribute vector, or NULL in case of failure.

 edit_connectivity()

virtual ITriangle_connectivity * mi::neuraylib::ITriangle_mesh::edit_connectivity ( Mesh_attribute_name  name)
pure virtual

Detaches and returns the connectivity for a given mesh attribute.

The connectivity needs to be reattached before it is released.

See also
attach_connectivity()
Parameters
nameThe name of the attribute to return the connectivity for, see Mesh_attribute_name.
Returns
The connectivity for name, or NULL if there is no such attribute, or the attribute is a per-primitive attribute.

 edit_mesh_connectivity()

virtual ITriangle_connectivity * mi::neuraylib::ITriangle_mesh::edit_mesh_connectivity ( )
pure virtual

Detaches and returns the mesh connectivity.

The connectivity needs to be reattached before it is released.

See also
attach_mesh_connectivity()
Returns
The mesh connectivity, or NULL if it currently not attached.

 get_bbox()

virtual Bbox3_struct mi::neuraylib::ITriangle_mesh::get_bbox ( ) const
pure virtual

Returns the bounding box of the triangle mesh.

 get_maximum_displacement()

virtual Float32 mi::neuraylib::ITriangle_mesh::get_maximum_displacement ( ) const
pure virtual

Returns the maximum displacement of the triangle mesh.

See also
set_maximum_displacement()

 get_tight_bbox()

virtual Bbox3_struct mi::neuraylib::ITriangle_mesh::get_tight_bbox ( const Float64_4_4_struct transformation_matrix) const
pure virtual

Returns the bounding box of the triangle mesh after transformation.

Parameters
transformation_matrixThe world-to-object space transformation matrix that is applied to the object before the bounding box is computed.

 has_attribute()

virtual bool mi::neuraylib::ITriangle_mesh::has_attribute ( Mesh_attribute_name  name) const
pure virtual

Indicates whether the mesh has a particular mesh attribute (per-primitive or other types).

Parameters
nameThe name of the attribute to query, see Mesh_attribute_name.
Returns
true if the mesh has this attribute, false otherwise.

 point() [1/2]

virtual Sint32 mi::neuraylib::ITriangle_mesh::point ( Uint32  index,
Float32_3_struct p 
) const
pure virtual

Returns the coordinates of the point of index index in the output parameter p.

The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.

Returns
  • 0: Success.
  • -1: index is out of bounds.

 point() [2/2]

virtual Sint32 mi::neuraylib::ITriangle_mesh::point ( Uint32  index,
Float64_3_struct p 
) const
pure virtual

Returns the coordinates of the point of index index in the output parameter p.

The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.

Returns
  • 0: Success.
  • -1: index is out of bounds.

 points_capacity()

virtual Uint32 mi::neuraylib::ITriangle_mesh::points_capacity ( ) const
pure virtual

Returns the number of points for which space is allocated in the mesh.

One can add points_capacity() - points_size() many points to the mesh before internal reallocation may become necessary.

See also
reserve_points().

 points_size()

virtual Uint32 mi::neuraylib::ITriangle_mesh::points_size ( ) const
pure virtual

Returns the number of points in the mesh.

 remove_attribute_vector()

virtual Sint32 mi::neuraylib::ITriangle_mesh::remove_attribute_vector ( Mesh_attribute_name  name)
pure virtual

Removes a per-primitive mesh attribute.

Parameters
nameThe name of the attribute, see Mesh_attribute_name. The attribute must be a per-primitive attribute.
Returns
  • 0: Success.
  • -1: There is no per-primitive attribute of the given name.

 remove_connectivity()

virtual Sint32 mi::neuraylib::ITriangle_mesh::remove_connectivity ( Mesh_attribute_name  name)
pure virtual

Removes the connectivity for a non-per-primitive mesh attribute.

If there are several mesh attributes attached to the same connectivity, only the given mesh attribute will be removed and the connectivity itself remains. Otherwise, removal of the connectivity implies removal of the corresponding mesh attribute.

Parameters
nameThe name of the attribute to remove the connectivity for, see Mesh_attribute_name.
Returns
  • 0: Success.
  • -1: There is no connectivity for the given mesh attribute.

 reserve_points()

virtual void mi::neuraylib::ITriangle_mesh::reserve_points ( Uint32  n)
pure virtual

Reserves space for at least n points.

Sets the internal capacity to at least n points before reallocation may become necessary. The number of points currently stored is not changed by this method.

See also
points_capacity().

 reserve_triangles()

virtual void mi::neuraylib::ITriangle_mesh::reserve_triangles ( Uint32  n)
pure virtual

Reserves space for at least n triangles.

Sets the internal capacity to at least n triangles before reallocation may become necessary. The number of triangles currently stored is not changed by this method.

See also
triangles_capacity().

 set_maximum_displacement()

virtual void mi::neuraylib::ITriangle_mesh::set_maximum_displacement ( Float32  displacement)
pure virtual

Sets the maximum displacement of the triangle mesh.

This value is the maximum absolute value of any displacement applied to the object (defaults to 0.0). The bounding box of the object will be expanded all around by this value.

 set_point() [1/2]

virtual Sint32 mi::neuraylib::ITriangle_mesh::set_point ( Uint32  index,
const Float32_3_struct p 
)
pure virtual

Sets the point of index index to the new point p.

The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.

Returns
  • 0: Success.
  • -1: index is out of bounds.

 set_point() [2/2]

virtual Sint32 mi::neuraylib::ITriangle_mesh::set_point ( Uint32  index,
const Float64_3_struct p 
)
pure virtual

Sets the point of index index to the new point p.

The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.

Returns
  • 0: Success.
  • -1: index is out of bounds.

 set_points() [1/2]

virtual Sint32 mi::neuraylib::ITriangle_mesh::set_points ( Uint32  index,
const Float32_3_struct p,
Size  n 
)
pure virtual

Sets an array of points starting at index index.

The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.

Returns
  • 0: Success.
  • -1: index is out of bounds.
  • -2: n is too large, i.e., index+n is out of bounds.

 set_points() [2/2]

virtual Sint32 mi::neuraylib::ITriangle_mesh::set_points ( Uint32  index,
const Float64_3_struct p,
Size  n 
)
pure virtual

Sets an array of points starting at index index.

The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.

Returns
  • 0: Success.
  • -1: index is out of bounds.
  • -2: n is too large, i.e., index+n is out of bounds.

 set_triangle()

virtual Sint32 mi::neuraylib::ITriangle_mesh::set_triangle ( Triangle_handle_struct  hnd,
const Triangle_point_indices_struct triangle 
)
pure virtual

Modifies a triangle of the mesh.

Note
For best performance it is recommended to sort the triangles by their material index such that when looping over all triangles the material index changes as infrequently as possible.
Parameters
hndThe triangle to modify.
triangleThe new vertex indices of the triangle.
Returns
  • 0: Success:
  • -1: hnd is out of bounds.
  • -2: The mesh connectivity has been detached.
  • -3: At least one triangle point index is too large.
Note
The append_point() function call returns the index of a newly added point.

 set_triangles()

virtual Sint32 mi::neuraylib::ITriangle_mesh::set_triangles ( Triangle_handle_struct  hnd,
const Triangle_point_indices_struct triangle,
Size  n 
)
pure virtual

Modifies an array of triangles of the mesh.

Note
For best performance it is recommended to sort the triangles by their material index such that when looping over all triangles the material index changes as infrequently as possible.
Parameters
hndThe first triangle to modify.
triangleThe new vertex indices of the triangle hnd up to hnd+n-1.
nThe number of triangles to modify.
Returns
  • 0: Success:
  • -1: hnd is out of bounds.
  • -2: The mesh connectivity has been detached.
  • -3: At least one triangle point index is too large.
  • -4: n is too large, i.e., hnd+n-1 is out of bounds.
Note
The append_point() function call returns the index of a newly added point.

 triangle_point_indices()

virtual Triangle_point_indices_struct mi::neuraylib::ITriangle_mesh::triangle_point_indices ( Triangle_handle_struct  hnd) const
pure virtual

Returns the triple of indices describing the vertices of the triangle of index i.

If the mesh connectivity is not attached, the triple (0,0,0) is returned.

 triangles_capacity()

virtual Uint32 mi::neuraylib::ITriangle_mesh::triangles_capacity ( ) const
pure virtual

Returns the number of triangles for which space is allocated in the mesh.

One can add triangles_capacity() - triangles_size() many triangles to the mesh before internal reallocation may become necessary.

See also
reserve_triangles().

 triangles_size()

virtual Uint32 mi::neuraylib::ITriangle_mesh::triangles_size ( ) const
pure virtual

Returns the number of triangles.