Iray SDK API nvidia_logo_transpbg.gif Up
itriangle_connectivity.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2024 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_ITRIANGLE_CONNECTIVITY_H
8#define MI_NEURAYLIB_ITRIANGLE_CONNECTIVITY_H
9
12
13namespace mi {
14
15namespace neuraylib {
16
25{
26 Uint32 index[3];
27};
28
33{
34public:
36 Triangle_point_indices() { index[0] = 0; index[1] = 0; index[2] = 0; }
37
40 {
41 index[0] = e1;
42 index[1] = e2;
43 index[2] = e3;
44 }
45
48 {
49 index[0] = other.index[0];
50 index[1] = other.index[1];
51 index[2] = other.index[2];
52 }
53
55 Uint32& operator[]( Uint32 i) { return index[i]; }
56
58 const Uint32& operator[]( Uint32 i) const { return index[i]; }
59
64 int compare( const Triangle_point_indices& other) const
65 {
66 if ( index[0] < other.index[0]) return -1;
67 if ( index[0] > other.index[0]) return 1;
68 if ( index[1] < other.index[1]) return -1;
69 if ( index[1] > other.index[1]) return 1;
70 if ( index[2] < other.index[2]) return -1;
71 if ( index[2] > other.index[2]) return 1;
72 return 0;
73 }
74
76 bool operator==( const Triangle_point_indices& other) const { return compare(other) == 0; }
77
79 bool operator!=( const Triangle_point_indices& other) const { return compare(other) != 0; }
80
82 bool operator<( const Triangle_point_indices& other) const { return compare(other) < 0; }
83
85 bool operator<=( const Triangle_point_indices& other) const { return compare(other) <= 0; }
86
88 bool operator>( const Triangle_point_indices& other) const { return compare(other) > 0; }
89
91 bool operator>=( const Triangle_point_indices& other) const { return compare(other) >= 0; }
92};
93
134 public base::Interface_declare<0x47cf1faa,0x609d,0x44ee,0xa3,0x6a,0xca,0x02,0x92,0xf7,0x6a,0x40>
135{
136public:
138
139
141 virtual Uint32 triangles_size() const = 0;
142
159 Triangle_handle_struct t, const Uint32* indices, Size n = 1) = 0;
160
176 Triangle_handle_struct t, Uint32 v0, Uint32 v1, Uint32 v2) = 0;
177
192
198
204 Triangle_handle_struct t) const = 0;
205
210 virtual bool is_valid_connectivity() const = 0;
211
213
215
220 virtual bool has_attribute( Mesh_attribute_name name) const = 0;
221
241 Mesh_attribute_name name, Uint32 dim = 1) const = 0;
242
249
261
277
287
289
291
296
298};
299 // end group mi_neuray_leaf_nodes
301
302} // namespace neuraylib
303
304} // namespace mi
305
306#endif // MI_NEURAYLIB_ITRIANGLE_CONNECTIVITY_H
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
Interface representing an attribute vector for triangle meshes, polygon meshes, and subdivision surfa...
Definition: iattribute_vector.h:184
A connectivity class for triangle mesh geometry and their attributes.
Definition: itriangle_connectivity.h:135
virtual Sint32 attach_attribute_vector(IAttribute_vector *attr)=0
Attaches a given non-per-primitive mesh attribute to the mesh.
virtual Sint32 set_triangle_indices(Triangle_handle_struct t, Uint32 v0, Uint32 v1, Uint32 v2)=0
Sets the vertex indices of a triangle.
virtual Connectivity_map_type get_map_type() const =0
Returns the type of the connectivity.
virtual bool is_valid_connectivity() const =0
Indicates whether this connectivity is valid.
virtual IAttribute_vector * edit_attribute_vector(Mesh_attribute_name name)=0
Detaches and returns a non-per-primitive mesh attribute.
virtual Sint32 set_triangle_indices(Triangle_handle_struct t, const Triangle_point_indices_struct &triangle)=0
Sets the vertex indices of a triangle.
virtual Sint32 set_triangle_indices(Triangle_handle_struct t, const Uint32 *indices, Size n=1)=0
Sets the vertex indices of a triangle (or a range of triangles).
virtual Sint32 remove_attribute_vector(Mesh_attribute_name name)=0
Removes a non-per-primitive mesh attribute.
virtual Uint32 get_triangle_index(Triangle_handle_struct t, Uint32 vertex) const =0
Returns the index at the vertex vertex of triangle t.
virtual Uint32 triangles_size() const =0
Returns the number of triangles.
virtual const IAttribute_vector * access_attribute_vector(Mesh_attribute_name name) const =0
Returns a non-per-primitive mesh attribute.
virtual bool has_attribute(Mesh_attribute_name name) const =0
Indicates whether the connectivity has a particular mesh attribute.
virtual IAttribute_vector * create_attribute_vector(Mesh_attribute_name name, Uint32 dim=1) const =0
Creates a non-per-primitive mesh attribute.
virtual Triangle_point_indices_struct triangle_point_indices(Triangle_handle_struct t) const =0
Returns the indices for all three vertices of triangle t.
A triangle defined by three point indices, starting at index 0.
Definition: itriangle_connectivity.h:33
int compare(const Triangle_point_indices &other) const
Compares two triangles lexicographically.
Definition: itriangle_connectivity.h:64
bool operator<(const Triangle_point_indices &other) const
Returns true if *this is less than other.
Definition: itriangle_connectivity.h:82
bool operator<=(const Triangle_point_indices &other) const
Returns true if *this is less than or equal to other.
Definition: itriangle_connectivity.h:85
Triangle_point_indices(const Triangle_point_indices_struct &other)
Constructs triangle from underlying storage class.
Definition: itriangle_connectivity.h:47
const Uint32 & operator[](Uint32 i) const
Returns the i -th point index, where 0 <= i <= 2.
Definition: itriangle_connectivity.h:58
Uint32 & operator[](Uint32 i)
Returns the i -th point index, where 0 <= i <= 2.
Definition: itriangle_connectivity.h:55
bool operator==(const Triangle_point_indices &other) const
Equality comparison.
Definition: itriangle_connectivity.h:76
bool operator>(const Triangle_point_indices &other) const
Returns true if *this is greater than other.
Definition: itriangle_connectivity.h:88
Triangle_point_indices()
The default triangle has all three indices set to zero.
Definition: itriangle_connectivity.h:36
bool operator!=(const Triangle_point_indices &other) const
Inequality comparison.
Definition: itriangle_connectivity.h:79
Triangle_point_indices(Uint32 e1, Uint32 e2, Uint32 e3)
Constructs triangle from three point indices.
Definition: itriangle_connectivity.h:39
bool operator>=(const Triangle_point_indices &other) const
Returns true if *this is greater than or equal to other.
Definition: itriangle_connectivity.h:91
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
signed int Sint32
32-bit signed integer.
Definition: types.h:46
Mesh_attribute_name
Symbolic constants for mesh attributes.
Definition: iattribute_vector.h:60
Connectivity_map_type
Symbolic constants for different connectivity types.
Definition: iattribute_vector.h:131
Attribute vectors, used for triangle and polygon meshes.
Simple integer-based handles used by mesh interfaces.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: neuraylib.h:179
Handle class for type-safety.
Definition: identifier.h:56
A triangle defined by three point indices, starting at index 0.
Definition: itriangle_connectivity.h:25