36 auto preCollapse = [&] ( EdgeId edgeToCollapse,
const Vector3f& newEdgeOrgPos )
38 const auto org = mesh.
topology.
org( edgeToCollapse );
40 const auto orgPos = mesh.
orgPnt( edgeToCollapse );
41 const auto destPos = mesh.
destPnt( edgeToCollapse );
43 const auto ab = destPos - orgPos;
44 const auto dt = dot( newEdgeOrgPos - orgPos, ab );
45 const auto abLengthSq = ab.lengthSq();
51 if ( dt >= abLengthSq )
53 data[org] = data[dest];
57 const auto ratio = dt / abLengthSq;
58 data[org] = ( 1 - ratio ) * data[org] + ratio * data[dest];
std::vector<T>-like container that requires specific indexing type,
Definition MRVector.h:23
VertId dest(EdgeId he) const
returns destination vertex of half-edge
Definition MRMeshTopology.h:96
MRMESH_API PreCollapseCallback meshPreCollapseVertAttribute(const Mesh &mesh, const MeshAttributesToUpdate ¶ms)
VertId org(EdgeId he) const
returns origin vertex of half-edge
Definition MRMeshTopology.h:93
auto preCollapseVertAttribute(const Mesh &mesh, Vector< T, VertId > &data)
Definition MRMeshDecimateCallbacks.h:34
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
the attribute data of the mesh that needs to be updated
Definition MRMeshAttributesToUpdate.h:13
Vector3f orgPnt(EdgeId e) const
returns coordinates of the edge origin
Definition MRMesh.h:62
Vector3f destPnt(EdgeId e) const
returns coordinates of the edge destination
Definition MRMesh.h:65
MeshTopology topology
Definition MRMesh.h:24