14#include <lagrange/SurfaceMesh.h>
15#include <lagrange/utils/Error.h>
16#include <lagrange/utils/fmt/format.h>
17#include <lagrange/uv_mesh.h>
18#include <lagrange/views.h>
48template <
typename Scalar,
typename Index,
typename UVScalar = Scalar>
51 std::string_view uv_attribute_name =
"",
68template <
typename Scalar,
typename Index,
typename UVScalar = Scalar>
71 std::string_view uv_attribute_name =
"");
86template <
typename Scalar,
typename Index,
typename UVScalar = Scalar>
89 std::string_view uv_attribute_name =
"");
119template <
typename Scalar,
typename Index,
typename F>
123 std::string_view caller,
126 using OtherScalar = std::conditional_t<std::is_same_v<Scalar, float>, double,
float>;
133 throw Error(format(
"{}: no suitable UV attribute found.", caller));
A general purpose polygonal mesh class.
Definition SurfaceMesh.h:73
uint32_t AttributeId
Identified to be used to access an attribute.
Definition AttributeFwd.h:73
std::optional< AttributeId > uv_attribute_id(const SurfaceMesh< Scalar, Index > &mesh, const UVMeshOptions &options={})
Check whether a UV attribute of a given scalar type exists on a mesh.
Definition uv_mesh.cpp:132
Eigen::Map< Vector< Scalar >, Eigen::Unaligned > VectorView
Type alias for row-major vector view.
Definition views.h:83
const Eigen::Map< const Vector< Scalar >, Eigen::Unaligned > ConstVectorView
Type alias for row-major const vector view.
Definition views.h:87
nullptr_t, size_t, ptrdiff_t basic_ostream bad_weak_ptr extent, remove_extent, is_array,...
Definition attribute_string_utils.h:21
AttributeId get_uv_id(const SurfaceMesh< Scalar, Index > &mesh, std::string_view uv_attribute_name="", UVMeshOptions::ElementTypes element_types=UVMeshOptions::ElementTypes::IndexedOrVertex, TypeMismatchPolicy type_mismatch=TypeMismatchPolicy::Assert)
Get the ID of the UV attribute of a mesh.
Definition get_uv_attribute.cpp:26
auto dispatch_uv_scalar_type(SurfaceMesh< Scalar, Index > &mesh, const UVMeshOptions &options, std::string_view caller, F &&visitor)
Dispatch on the scalar type of a UV attribute.
Definition get_uv_attribute.h:120
std::tuple< RowMatrixView< UVScalar >, VectorView< Index > > ref_uv_attribute(SurfaceMesh< Scalar, Index > &mesh, std::string_view uv_attribute_name="")
Get the modifiable UV attribute buffers of a mesh.
Definition get_uv_attribute.cpp:127
std::tuple< ConstRowMatrixView< UVScalar >, ConstVectorView< Index > > get_uv_attribute(const SurfaceMesh< Scalar, Index > &mesh, std::string_view uv_attribute_name="")
Get the constant UV attribute buffers of a mesh.
Definition get_uv_attribute.cpp:103
TypeMismatchPolicy
Behavior when a named UV attribute has a mismatched scalar type.
Definition get_uv_attribute.h:27
@ Graceful
Return invalid_attribute_id() on type mismatch (for dual-dispatch probing).
Definition get_uv_attribute.h:29
@ Assert
Assert on type mismatch (default, for strict callers).
Definition get_uv_attribute.h:28
@ Error
Throw an error if collision is detected.
Definition MappingPolicy.h:24
ElementTypes
Supported element types for UV mesh extraction.
Definition uv_mesh.h:29
@ IndexedOrVertex
Only indexed/vertex attributes (zero-copy, no allocation).
Definition uv_mesh.h:30
Tag carrying a UV scalar type, used to disambiguate the type passed back to dispatch_uv_scalar_type c...
Definition get_uv_attribute.h:95