Various attribute processing utilities.
More...
|
| template<typename ValueType, typename Index> |
| void | set_invalid_indexed_values (IndexedAttribute< ValueType, Index > &attr) |
| | For each element in the index buffer set to invalid<Index>(), appends a new value set to invalid<ValueType>() and updates the index to point to it.
|
| |
|
Mapping attributes between different element types.
- When mapping indexed to value attributes, values are duplicated for each corner, since otherwise the mapping corner -> value would be lost.
- When mapping value to indexed attributes, the size of the value buffer must be equal to the number of corners. The values are not deduplicated in the new indexed attribute.
|
| template<typename Scalar, typename Index> |
| AttributeId | map_attribute (SurfaceMesh< Scalar, Index > &mesh, AttributeId id, std::string_view new_name, AttributeElement new_element) |
| | Map attribute values to a new attribute with a different element type.
|
| |
| template<typename Scalar, typename Index> |
| AttributeId | map_attribute (SurfaceMesh< Scalar, Index > &mesh, std::string_view old_name, std::string_view new_name, AttributeElement new_element) |
| | Map attribute values to a new attribute with a different element type.
|
| |
| template<typename Scalar, typename Index> |
| AttributeId | map_attribute_in_place (SurfaceMesh< Scalar, Index > &mesh, AttributeId id, AttributeElement new_element) |
| | Map attribute values to a different element type.
|
| |
| template<typename Scalar, typename Index> |
| AttributeId | map_attribute_in_place (SurfaceMesh< Scalar, Index > &mesh, std::string_view name, AttributeElement new_element) |
| | Map attribute values to a different element type.
|
| |
Various attribute processing utilities.
◆ set_invalid_indexed_values()
template<typename ValueType, typename Index>
#include <lagrange/internal/set_invalid_indexed_values.h>
For each element in the index buffer set to invalid<Index>(), appends a new value set to invalid<ValueType>() and updates the index to point to it.
- Template Parameters
-
| ValueType | Attribute value type. |
| Index | Attribute index type. |
- Parameters
-
| [in,out] | attr | The indexed attribute to fix up. |
◆ map_attribute() [1/2]
template<typename
Scalar, typename Index>
#include <lagrange/map_attribute.h>
Map attribute values to a new attribute with a different element type.
If the input attribute is a value attribute, its number of rows must match the number of target mesh element (or number of corners if the target is an indexed attribute).
- Parameters
-
| [in,out] | mesh | Input mesh. Modified to add a new attribute. |
| [in] | id | Id of the input attribute to map. |
| [in] | new_name | Name of the new mesh attribute to create. |
| [in] | new_element | New attribute element type. |
- Template Parameters
-
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- Id of the newly created attribute.
◆ map_attribute() [2/2]
template<typename
Scalar, typename Index>
#include <lagrange/map_attribute.h>
Map attribute values to a new attribute with a different element type.
If the input attribute is a value attribute, its number of rows must match the number of target mesh element (or number of corners if the target is an indexed attribute).
- Parameters
-
| [in,out] | mesh | Input mesh. Modified to add a new attribute. |
| [in] | old_name | Name of the input attribute to map. |
| [in] | new_name | Name of the new mesh attribute to create. |
| [in] | new_element | New attribute element type. |
- Template Parameters
-
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- Id of the newly created attribute.
◆ map_attribute_in_place() [1/2]
template<typename
Scalar, typename Index>
#include <lagrange/map_attribute.h>
Map attribute values to a different element type.
A new attribute with the new element type is created with the same name as the old one, and the old one is removed. If the input attribute is a value attribute, its number of rows must match the number of target mesh element (or number of corners if the target is an indexed attribute).
- Todo
- To be truly in-place ideally the new AttributeId should be the same as the old one.
- Parameters
-
| [in,out] | mesh | Input mesh. Modified to add a new attribute. |
| [in] | id | Id of the input attribute to map. |
| [in] | new_element | New attribute element type. |
- Template Parameters
-
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- Id of the modified attribute.
◆ map_attribute_in_place() [2/2]
template<typename
Scalar, typename Index>
#include <lagrange/map_attribute.h>
Map attribute values to a different element type.
A new attribute with the new element type is created with the same name as the old one, and the old one is removed. If the input attribute is a value attribute, its number of rows must match the number of target mesh element (or number of corners if the target is an indexed attribute).
- Todo
- To be truly in-place ideally the new AttributeId should be the same as the old one.
- Parameters
-
| [in,out] | mesh | Input mesh. Modified to add a new attribute. |
| [in] | name | Name of the attribute to map. |
| [in] | new_element | New attribute element type. |
- Template Parameters
-
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- Id of the modified attribute.
◆ unify_index_buffer()
template<typename
Scalar, typename Index>
#include <lagrange/unify_index_buffer.h>
Unify index buffers of the input mesh for all attributes specified in attribute_ids.
- Postcondition
- The attributes specified by
attribute_id will become vertex attributes in the output mesh under the same names.
- Parameters
-
| [in] | mesh | The input polygonal mesh. |
| [in] | attribute_ids | The input indexed attribute ids to be unified. If empty, all indexed attributes are unified. |
- Returns
- A polygonal mesh with unified indices for position and attributes specified in
attribute_ids.
- See also
- unify_named_index_buffer
◆ unify_named_index_buffer()
template<typename
Scalar, typename Index>
#include <lagrange/unify_index_buffer.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- Parameters
-
| [in] | mesh | The input polygonal mesh. |
| [in] | attribute_names | The input indexed attribute names to be unified. If empty, all indexed attributes are unified. |
- Returns
- A polygonal mesh with unified indices for position and attributes specified in
attribute_names.
- See also
- unify_index_buffer