Skip to content

Commit

Permalink
Mesh::leftTangent
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedr committed Jan 5, 2025
1 parent c5a84c9 commit b88eb0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions source/MRMesh/MRMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,14 @@ Vector3d Mesh::holeDirArea( EdgeId e0 ) const
return 0.5 * sum;
}

Vector3f Mesh::leftTangent( EdgeId e ) const
{
assert( topology.left( e ) );
const auto lNorm = leftNormal( e );
const auto eDir = edgeVector( e ).normalized();
return cross( lNorm, eDir );
}

Vector3f Mesh::dirDblArea( VertId v ) const
{
Vector3f sum;
Expand Down
3 changes: 3 additions & 0 deletions source/MRMesh/MRMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ struct [[nodiscard]] Mesh
/// if the hole is planar then returned vector is orthogonal to the plane pointing outside and its magnitude is equal to hole area
[[nodiscard]] MRMESH_API Vector3d holeDirArea( EdgeId e ) const;

/// computes unit vector that is both orthogonal to given edge and to the normal of its left triangle, the vector is directed inside left triangle
[[nodiscard]] MRMESH_API Vector3f leftTangent( EdgeId e ) const;

/// computes triangular face normal from its vertices
[[nodiscard]] Vector3f leftNormal( EdgeId e ) const { return leftDirDblArea( e ).normalized(); }

Expand Down

0 comments on commit b88eb0a

Please sign in to comment.