32 dot = qMax(-1.0, qMin(1.0, dot));
75 return (p2 - p1).GetLength2();
151 double projection = vector.
GetDotProduct(onto) / ontoLengthSq;
152 return onto * projection;
Definition of a line in 3D space.
double GetDistance(const CVector3d &point) const
Calculate distance from point to line segment.
Definition of a plane in 3D space.
double GetSignedDistance(const CVector3d &point) const
Calculate signed distance from point to plane.
double GetDistance(const CVector3d &point) const
Calculate absolute distance from point to plane.
Represents a position or mathematical vector in 3D space with double precision.
CVector3d GetNormalized(double length=1.0) const
Return normalized vector with the same direction and specified length.
CVector3d GetCrossProduct(const imath::TVector< 3 > &vector) const
Calculates the cross product of this vector with another vector.
Element GetLength() const
Calculates the Euclidean length (magnitude) of the vector.
Element GetDotProduct(const TVector< Size, Element > &vector) const
Calculates the dot product with another vector.
Element GetLength2() const
Calculates the squared Euclidean length of the vector.
static const double I_BIG_EPSILON
double GetSignedAngleBetweenVectors(const CVector3d &v1, const CVector3d &v2, const CVector3d &axis)
Calculate signed angle between two vectors around an axis.
double GetAngleBetweenVectors(const CVector3d &v1, const CVector3d &v2)
Calculate angle between two vectors in radians.
bool GetBarycentricCoordinates(const CVector3d &point, const CVector3d &p1, const CVector3d &p2, const CVector3d &p3, double &u, double &v, double &w)
Calculate barycentric coordinates of point relative to triangle.
bool GetIntersection(const CLine3d &line, const CPlane3d &plane, CVector3d &result, double tolerance=I_BIG_EPSILON)
Find intersection point between line and plane.
double GetDistanceSq(const CVector3d &p1, const CVector3d &p2)
Calculate squared distance between two points (faster).
bool IsOnPositiveSide(const CVector3d &point, const CPlane3d &plane)
Check if point is on the same side of plane as the plane's normal.
double GetTriangleArea(const CVector3d &p1, const CVector3d &p2, const CVector3d &p3)
Calculate area of triangle.
CVector3d GetTriangleNormal(const CVector3d &p1, const CVector3d &p2, const CVector3d &p3)
Calculate normal vector of triangle.
CVector3d ProjectVectorOntoVector(const CVector3d &vector, const CVector3d &onto)
Project vector onto another vector.
bool AreIntersecting(const CLine3d &line1, const CLine3d &line2, double tolerance=I_BIG_EPSILON)
Check if two lines intersect in 3D.
bool IsPointInTriangle(const CVector3d &point, const CVector3d &p1, const CVector3d &p2, const CVector3d &p3)
Check if point is inside triangle.
double GetClosestPoints(const CLine3d &line1, const CLine3d &line2, CVector3d &point1, CVector3d &point2)
Find closest points between two lines.
double GetDistance(const CVector3d &p1, const CVector3d &p2)
Calculate distance between two points.