OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::anonymous_namespace{TextureDisplacement.cpp}::LscmLookup Struct Reference
Collaboration diagram for Slic3r::anonymous_namespace{TextureDisplacement.cpp}::LscmLookup:

Public Member Functions

bool uv_at (const Vec3f &pos, float tol, Vec2f &uv) const

Public Attributes

indexed_triangle_set patch
AABBTreeIndirect::Tree3f tree
std::vector< Vec2f > corner

Detailed Description

Member Function Documentation

◆ uv_at()

bool Slic3r::anonymous_namespace{TextureDisplacement.cpp}::LscmLookup::uv_at ( const Vec3f & pos,
float tol,
Vec2f & uv ) const
inline
3692 {
3693 size_t hit = 0;
3694 Vec3f foot;
3696 pos, hit, foot);
3697 if (d2 < 0.f || d2 > tol * tol || hit >= patch.indices.size())
3698 return false;
3699 const stl_triangle_vertex_indices &t = patch.indices[hit];
3700 float w1 = 0.f, w2 = 0.f; // a degenerate triangle takes its centroid's uv
3701 barycentric_weights(patch.vertices[size_t(t[0])], patch.vertices[size_t(t[1])], patch.vertices[size_t(t[2])],
3702 foot, w1, w2);
3703 const Vec2f *c3 = &corner[hit * 3];
3704 uv = (1.f - w1 - w2) * c3[0] + w1 * c3[1] + w2 * c3[2];
3705 return true;
3706 }
VectorType::Scalar squared_distance_to_indexed_triangle_set(const std::vector< VertexType > &vertices, const std::vector< IndexedFaceType > &faces, const TreeType &tree, const VectorType &point, size_t &hit_idx_out, Eigen::PlainObjectBase< VectorType > &hit_point_out)
Definition AABBTreeIndirect.hpp:801
Eigen::Matrix< float, 3, 1, Eigen::DontAlign > Vec3f
Definition Point.hpp:65
static void barycentric_weights(const Vec3f &a, const Vec3f &b, const Vec3f &c, const Vec3f &p, float &w1, float &w2)
Definition TextureDisplacement.cpp:2063
Eigen::Matrix< float, 2, 1, Eigen::DontAlign > Vec2f
Definition Point.hpp:64
indexed_triangle_set patch
Definition TextureDisplacement.cpp:3684
AABBTreeIndirect::Tree3f tree
Definition TextureDisplacement.cpp:3685
std::vector< Vec2f > corner
Definition TextureDisplacement.cpp:3687

References Slic3r::barycentric_weights(), corner, patch, Slic3r::AABBTreeIndirect::squared_distance_to_indexed_triangle_set(), and tree.

Here is the call graph for this function:

Member Data Documentation

◆ corner

std::vector<Vec2f> Slic3r::anonymous_namespace{TextureDisplacement.cpp}::LscmLookup::corner

Referenced by uv_at().

◆ patch

indexed_triangle_set Slic3r::anonymous_namespace{TextureDisplacement.cpp}::LscmLookup::patch

Referenced by uv_at().

◆ tree

AABBTreeIndirect::Tree3f Slic3r::anonymous_namespace{TextureDisplacement.cpp}::LscmLookup::tree

Referenced by uv_at().


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