MeshLib
 
Loading...
Searching...
No Matches
Math group

Topics

 2d <-> 3d conversion
 
 BestFit
 
 Box
 
 Constants
 
 Contour
 
 High Precision
 
 Intersection
 
 Matrix
 
 Aligning Transform
 
 Ray Box Intersection
 
 Triangle intersection
 
 Tuple Bindings
 
 Vector
 

Classes

struct  MR::AffineXf< V >
 
class  MR::QuadricApprox
 
struct  MR::DenseBox
 
class  MR::Histogram
 
struct  MR::Line< V >
 
struct  MR::Plane3< T >
 
struct  MR::QuadraticForm< V >
 
struct  MR::Quaternion< T >
 
struct  MR::SegmPoint< T >
 encodes a point inside a line segment using relative distance in [0,1] More...
 
struct  MR::Sphere< V >
 
struct  MR::TriPoint< T >
 encodes a point inside a triangle using barycentric coordinates More...
 

Functions

template<typename T >
AffineXf3< T > MR::lookAt (const Vector3< T > &center, const Vector3< T > &eye, const Vector3< T > &up)
 computes rigid transformation xf
 
template<typename V >
Box< V > MR::computeBoundingBox (const Vector< V, VertId > &points, const VertBitSet &region, const AffineXf< V > *toWorld=nullptr)
 
MRMESH_API AffineXf3d MR::makeRigidXf (const MeshPart &mp, const AffineXf3d &meshXf)
 
template<typename T >
MR::circumcircleDiameterSq (const Vector3< T > &a, const Vector3< T > &b, const Vector3< T > &c)
 
template<typename T >
MR::circumcircleDiameter (const Vector3< T > &a, const Vector3< T > &b, const Vector3< T > &c)
 
template<typename T >
MR::minTriangleAngleSin (const Vector3< T > &a, const Vector3< T > &b, const Vector3< T > &c)
 
template<typename T >
MR::triangleAspectRatio (const Vector3< T > &a, const Vector3< T > &b, const Vector3< T > &c)
 
template<typename T >
MR::dihedralAngleSin (const Vector3< T > &leftNorm, const Vector3< T > &rightNorm, const Vector3< T > &edgeVec)
 
template<typename T >
MR::dihedralAngleCos (const Vector3< T > &leftNorm, const Vector3< T > &rightNorm)
 
template<typename T >
MR::dihedralAngle (const Vector3< T > &leftNorm, const Vector3< T > &rightNorm, const Vector3< T > &edgeVec)
 
MRMESH_API bool MR::ccw (const Vector2i &a, const Vector2i &b)
 
MRMESH_API bool MR::orient3d (const Vector3i &a, const Vector3i &b, const Vector3i &c)
 
bool MR::orient3d (const Vector3i &a, const Vector3i &b, const Vector3i &c, const Vector3i &d)
 
MRMESH_API bool MR::orient3d (const std::array< PreciseVertCoords, 4 > &vs)
 first sorts the indices in ascending order, then calls the predicate for sorted points
 
MRMESH_API bool MR::orient3d (const PreciseVertCoords *vs)
 
MRMESH_API TriangleSegmentIntersectResult MR::doTriangleSegmentIntersect (const std::array< PreciseVertCoords, 5 > &vs)
 
MRMESH_API ConvertToIntVector MR::getToIntConverter (const Box3d &box)
 creates converter from Vector3f to Vector3i in Box range (int diapason is mapped to box range)
 
MRMESH_API ConvertToFloatVector MR::getToFloatConverter (const Box3d &box)
 creates converter from Vector3i to Vector3f in Box range (int diapason is mapped to box range)
 
MRMESH_API Vector3f MR::findTriangleSegmentIntersectionPrecise (const Vector3f &a, const Vector3f &b, const Vector3f &c, const Vector3f &d, const Vector3f &e, CoordinateConverters converters)
 
template<typename T >
Vector2< T > MR::fromEigen (const Eigen::Matrix< T, 2, 1 > &ev)
 
template<typename T >
Eigen::Matrix< T, 2, 1 > MR::toEigen (const Vector2< T > &v)
 
template<typename T >
Eigen::Matrix< T, 2, 2 > MR::toEigen (const SymMatrix2< T > &m)
 
template<typename T >
Eigen::Matrix< T, 2, 2 > MR::toEigen (const Matrix2< T > &m)
 
template<typename T >
Matrix2< T > MR::fromEigen (const Eigen::Matrix< T, 2, 2 > &m)
 
template<typename T >
Vector3< T > MR::fromEigen (const Eigen::Matrix< T, 3, 1 > &ev)
 
template<typename T >
Eigen::Matrix< T, 3, 1 > MR::toEigen (const Vector3< T > &v)
 
template<typename T >
Eigen::Matrix< T, 3, 3 > MR::toEigen (const SymMatrix3< T > &m)
 
template<typename T >
Eigen::Matrix< T, 3, 3 > MR::toEigen (const Matrix3< T > &m)
 
template<typename T >
Matrix3< T > MR::fromEigen (const Eigen::Matrix< T, 3, 3 > &m)
 
template<typename T >
Eigen::Matrix< T, 4, 4 > MR::toEigen (const SymMatrix4< T > &m)
 
template<typename T >
Eigen::Matrix< T, 4, 4 > MR::toEigen (const Matrix4< T > &m)
 
template<typename T >
Matrix4< T > MR::fromEigen (const Eigen::Matrix< T, 4, 4 > &m)
 
template<typename T >
Vector4< T > MR::fromEigen (const Eigen::Matrix< T, 4, 1 > &ev)
 
template<typename T >
Eigen::Matrix< T, 4, 1 > MR::toEigen (const Vector4< T > &v)
 
template<typename T >
Eigen::Matrix< T, 4, 1 > MR::toEigen (const Vector3< T > &v, T w)
 
template<typename T >
Quaternion< T > MR::fromEigen (const Eigen::Quaternion< T > &eq)
 
template<typename T >
Eigen::Quaternion< T > MR::toEigen (const Quaternion< T > &q)
 

Detailed Description

Function Documentation

◆ ccw()

MRMESH_API bool MR::ccw ( const Vector2i & a,
const Vector2i & b )

return true if the smallest rotation from vector (a) to vector (b) is in counter-clock-wise direction; uses simulation-of-simplicity to avoid "vectors are collinear"

◆ circumcircleDiameter()

template<typename T >
T MR::circumcircleDiameter ( const Vector3< T > & a,
const Vector3< T > & b,
const Vector3< T > & c )
inlinenodiscard

Computes the diameter of the triangle's ABC circumcircle

◆ circumcircleDiameterSq()

template<typename T >
T MR::circumcircleDiameterSq ( const Vector3< T > & a,
const Vector3< T > & b,
const Vector3< T > & c )
nodiscard

Computes the squared diameter of the triangle's ABC circumcircle;

◆ computeBoundingBox()

template<typename V >
Box< V > MR::computeBoundingBox ( const Vector< V, VertId > & points,
const VertBitSet & region,
const AffineXf< V > * toWorld = nullptr )

passes through all region points and finds the minimal bounding box containing all of them; if toWorld transformation is given then returns minimal bounding box in world space

◆ dihedralAngle()

template<typename T >
T MR::dihedralAngle ( const Vector3< T > & leftNorm,
const Vector3< T > & rightNorm,
const Vector3< T > & edgeVec )
nodiscard

given an edge direction between two faces with given normals (not necessary of unit length), computes the dihedral angle between the faces: 0 if both faces are in the same plane, positive if the faces form convex surface, negative if the faces form concave surface; please consider the usage of faster dihedralAngleSin(e) and dihedralAngleCos(e)

◆ dihedralAngleCos()

template<typename T >
T MR::dihedralAngleCos ( const Vector3< T > & leftNorm,
const Vector3< T > & rightNorm )
nodiscard

given two face normals, computes cosine of dihedral angle between the faces: 1 if both faces are in the same plane, 0 if the surface makes right angle turn at the edge, -1 if the faces overlap one another

◆ dihedralAngleSin()

template<typename T >
T MR::dihedralAngleSin ( const Vector3< T > & leftNorm,
const Vector3< T > & rightNorm,
const Vector3< T > & edgeVec )
nodiscard

given an edge direction between two faces with given normals, computes sine of dihedral angle between the faces: 0 if both faces are in the same plane, positive if the faces form convex surface, negative if the faces form concave surface

◆ doTriangleSegmentIntersect()

MRMESH_API TriangleSegmentIntersectResult MR::doTriangleSegmentIntersect ( const std::array< PreciseVertCoords, 5 > & vs)
nodiscard

checks whether triangle ABC (indices 012) and segment DE (indices 34) intersect uses simulation-of-simplicity to avoid edge-segment intersections and co-planarity

◆ findTriangleSegmentIntersectionPrecise()

MRMESH_API Vector3f MR::findTriangleSegmentIntersectionPrecise ( const Vector3f & a,
const Vector3f & b,
const Vector3f & c,
const Vector3f & d,
const Vector3f & e,
CoordinateConverters converters )
nodiscard

finds intersection precise, using high precision int inside this function input should have intersection

◆ fromEigen() [1/7]

template<typename T >
Vector2< T > MR::fromEigen ( const Eigen::Matrix< T, 2, 1 > & ev)
inlinenodiscard

◆ fromEigen() [2/7]

template<typename T >
Matrix2< T > MR::fromEigen ( const Eigen::Matrix< T, 2, 2 > & m)
inlinenodiscard

◆ fromEigen() [3/7]

template<typename T >
Vector3< T > MR::fromEigen ( const Eigen::Matrix< T, 3, 1 > & ev)
inlinenodiscard

◆ fromEigen() [4/7]

template<typename T >
Matrix3< T > MR::fromEigen ( const Eigen::Matrix< T, 3, 3 > & m)
inlinenodiscard

◆ fromEigen() [5/7]

template<typename T >
Vector4< T > MR::fromEigen ( const Eigen::Matrix< T, 4, 1 > & ev)
inlinenodiscard

◆ fromEigen() [6/7]

template<typename T >
Matrix4< T > MR::fromEigen ( const Eigen::Matrix< T, 4, 4 > & m)
inlinenodiscard

◆ fromEigen() [7/7]

template<typename T >
Quaternion< T > MR::fromEigen ( const Eigen::Quaternion< T > & eq)
inlinenodiscard

◆ getToFloatConverter()

MRMESH_API ConvertToFloatVector MR::getToFloatConverter ( const Box3d & box)

creates converter from Vector3i to Vector3f in Box range (int diapason is mapped to box range)

◆ getToIntConverter()

MRMESH_API ConvertToIntVector MR::getToIntConverter ( const Box3d & box)

creates converter from Vector3f to Vector3i in Box range (int diapason is mapped to box range)

◆ lookAt()

template<typename T >
AffineXf3< T > MR::lookAt ( const Vector3< T > & center,
const Vector3< T > & eye,
const Vector3< T > & up )

computes rigid transformation xf

xf.z - directed from center to eye
xf.x - directed orthogonal to up and xf.z
xf.y - directed orthogonal to xf.z and xf.x
xf(eye) = 0

◆ makeRigidXf()

MRMESH_API AffineXf3d MR::makeRigidXf ( const MeshPart & mp,
const AffineXf3d & meshXf )
nodiscard

given a mesh part and its arbitrary transformation, computes and returns the rigid transformation that best approximates meshXf

◆ minTriangleAngleSin()

template<typename T >
T MR::minTriangleAngleSin ( const Vector3< T > & a,
const Vector3< T > & b,
const Vector3< T > & c )
nodiscard

Computes sine of minimal angle in ABC triangle, which is equal to ratio of minimal edge length to circumcircle diameter

◆ orient3d() [1/4]

MRMESH_API bool MR::orient3d ( const PreciseVertCoords * vs)

◆ orient3d() [2/4]

MRMESH_API bool MR::orient3d ( const std::array< PreciseVertCoords, 4 > & vs)

first sorts the indices in ascending order, then calls the predicate for sorted points

◆ orient3d() [3/4]

MRMESH_API bool MR::orient3d ( const Vector3i & a,
const Vector3i & b,
const Vector3i & c )

returns true if the plane with orientated triangle ABC has 0 point at the left; uses simulation-of-simplicity to avoid "0 is exactly on plane"

◆ orient3d() [4/4]

bool MR::orient3d ( const Vector3i & a,
const Vector3i & b,
const Vector3i & c,
const Vector3i & d )
inline

returns true if the plane with orientated triangle ABC has D point at the left; uses simulation-of-simplicity to avoid "D is exactly on plane"

◆ toEigen() [1/11]

template<typename T >
Eigen::Matrix< T, 2, 2 > MR::toEigen ( const Matrix2< T > & m)
inlinenodiscard

◆ toEigen() [2/11]

template<typename T >
Eigen::Matrix< T, 3, 3 > MR::toEigen ( const Matrix3< T > & m)
inlinenodiscard

◆ toEigen() [3/11]

template<typename T >
Eigen::Matrix< T, 4, 4 > MR::toEigen ( const Matrix4< T > & m)
inlinenodiscard

◆ toEigen() [4/11]

template<typename T >
Eigen::Quaternion< T > MR::toEigen ( const Quaternion< T > & q)
inlinenodiscard

◆ toEigen() [5/11]

template<typename T >
Eigen::Matrix< T, 2, 2 > MR::toEigen ( const SymMatrix2< T > & m)
inlinenodiscard

◆ toEigen() [6/11]

template<typename T >
Eigen::Matrix< T, 3, 3 > MR::toEigen ( const SymMatrix3< T > & m)
inlinenodiscard

◆ toEigen() [7/11]

template<typename T >
Eigen::Matrix< T, 4, 4 > MR::toEigen ( const SymMatrix4< T > & m)
inlinenodiscard

◆ toEigen() [8/11]

template<typename T >
Eigen::Matrix< T, 2, 1 > MR::toEigen ( const Vector2< T > & v)
inlinenodiscard

◆ toEigen() [9/11]

template<typename T >
Eigen::Matrix< T, 3, 1 > MR::toEigen ( const Vector3< T > & v)
inlinenodiscard

◆ toEigen() [10/11]

template<typename T >
Eigen::Matrix< T, 4, 1 > MR::toEigen ( const Vector3< T > & v,
T w )
inlinenodiscard

◆ toEigen() [11/11]

template<typename T >
Eigen::Matrix< T, 4, 1 > MR::toEigen ( const Vector4< T > & v)
inlinenodiscard

◆ triangleAspectRatio()

template<typename T >
T MR::triangleAspectRatio ( const Vector3< T > & a,
const Vector3< T > & b,
const Vector3< T > & c )
nodiscard

Aspect ratio of a triangle is the ratio of the circum-radius to twice its in-radius