ACF $AcfVersion:0$
Functions
i3d::Geometry Namespace Reference

Geometric utility functions for 3D space. More...

Functions

double GetAngleBetweenVectors (const CVector3d &v1, const CVector3d &v2)
 Calculate angle between two vectors in radians.
 
double GetSignedAngleBetweenVectors (const CVector3d &v1, const CVector3d &v2, const CVector3d &axis)
 Calculate signed angle between two vectors around an axis.
 
double GetDistance (const CVector3d &p1, const CVector3d &p2)
 Calculate distance between two points.
 
double GetDistanceSq (const CVector3d &p1, const CVector3d &p2)
 Calculate squared distance between two points (faster).
 
double GetDistance (const CVector3d &point, const CPlane3d &plane)
 Calculate distance from point to plane.
 
double GetDistance (const CVector3d &point, const CLine3d &line)
 Calculate distance from point to line.
 
bool AreIntersecting (const CLine3d &line1, const CLine3d &line2, double tolerance=I_BIG_EPSILON)
 Check if two lines intersect in 3D.
 
bool GetIntersection (const CLine3d &line, const CPlane3d &plane, CVector3d &result, double tolerance=I_BIG_EPSILON)
 Find intersection point between line and plane.
 
double GetClosestPoints (const CLine3d &line1, const CLine3d &line2, CVector3d &point1, CVector3d &point2)
 Find closest points between two lines.
 
bool IsOnPositiveSide (const CVector3d &point, const CPlane3d &plane)
 Check if point is on the same side of plane as the plane's normal.
 
CVector3d ProjectVectorOntoVector (const CVector3d &vector, const CVector3d &onto)
 Project vector onto another vector.
 
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 IsPointInTriangle (const CVector3d &point, const CVector3d &p1, const CVector3d &p2, const CVector3d &p3)
 Check if point is inside triangle.
 
CVector3d GetTriangleNormal (const CVector3d &p1, const CVector3d &p2, const CVector3d &p3)
 Calculate normal vector of triangle.
 
double GetTriangleArea (const CVector3d &p1, const CVector3d &p2, const CVector3d &p3)
 Calculate area of triangle.
 

Detailed Description

Geometric utility functions for 3D space.

Function Documentation

◆ AreIntersecting()

bool i3d::Geometry::AreIntersecting ( const CLine3d line1,
const CLine3d line2,
double  tolerance = I_BIG_EPSILON 
)

Check if two lines intersect in 3D.

Parameters
line1First line.
line2Second line.
toleranceTolerance for intersection test.
Returns
True if lines intersect (or nearly intersect).

◆ GetAngleBetweenVectors()

double i3d::Geometry::GetAngleBetweenVectors ( const CVector3d v1,
const CVector3d v2 
)
inline

Calculate angle between two vectors in radians.

Parameters
v1First vector.
v2Second vector.
Returns
Angle in radians [0, PI].

Definition at line 28 of file Geometry.h.

References imath::TVector< Size, Element >::GetDotProduct(), and i3d::CVector3d::GetNormalized().

Referenced by GetSignedAngleBetweenVectors().

◆ GetBarycentricCoordinates()

bool i3d::Geometry::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.

Parameters
pointPoint to calculate barycentric coordinates for.
p1First triangle vertex.
p2Second triangle vertex.
p3Third triangle vertex.
uOutput barycentric coordinate u.
vOutput barycentric coordinate v.
wOutput barycentric coordinate w (w = 1 - u - v).
Returns
True if calculation successful.

◆ GetClosestPoints()

double i3d::Geometry::GetClosestPoints ( const CLine3d line1,
const CLine3d line2,
CVector3d point1,
CVector3d point2 
)

Find closest points between two lines.

Parameters
line1First line.
line2Second line.
point1Output closest point on line1.
point2Output closest point on line2.
Returns
Distance between closest points.

◆ GetDistance() [1/3]

double i3d::Geometry::GetDistance ( const CVector3d p1,
const CVector3d p2 
)
inline

Calculate distance between two points.

Definition at line 64 of file Geometry.h.

References imath::TVector< Size, Element >::GetLength().

◆ GetDistance() [2/3]

double i3d::Geometry::GetDistance ( const CVector3d point,
const CLine3d line 
)
inline

Calculate distance from point to line.

Definition at line 91 of file Geometry.h.

References i3d::CLine3d::GetDistance().

◆ GetDistance() [3/3]

double i3d::Geometry::GetDistance ( const CVector3d point,
const CPlane3d plane 
)
inline

Calculate distance from point to plane.

Definition at line 82 of file Geometry.h.

References i3d::CPlane3d::GetDistance().

◆ GetDistanceSq()

double i3d::Geometry::GetDistanceSq ( const CVector3d p1,
const CVector3d p2 
)
inline

Calculate squared distance between two points (faster).

Definition at line 73 of file Geometry.h.

◆ GetIntersection()

bool i3d::Geometry::GetIntersection ( const CLine3d line,
const CPlane3d plane,
CVector3d result,
double  tolerance = I_BIG_EPSILON 
)

Find intersection point between line and plane.

Parameters
lineLine to intersect.
planePlane to intersect.
resultOutput intersection point.
toleranceTolerance for parallel check.
Returns
True if intersection exists, false if line is parallel to plane.

◆ GetSignedAngleBetweenVectors()

double i3d::Geometry::GetSignedAngleBetweenVectors ( const CVector3d v1,
const CVector3d v2,
const CVector3d axis 
)
inline

Calculate signed angle between two vectors around an axis.

Parameters
v1First vector.
v2Second vector.
axisAxis to measure rotation around.
Returns
Signed angle in radians [-PI, PI].

Definition at line 44 of file Geometry.h.

References GetAngleBetweenVectors(), i3d::CVector3d::GetCrossProduct(), imath::TVector< Size, Element >::GetDotProduct(), and i3d::CVector3d::GetNormalized().

◆ GetTriangleArea()

double i3d::Geometry::GetTriangleArea ( const CVector3d p1,
const CVector3d p2,
const CVector3d p3 
)
inline

Calculate area of triangle.

Definition at line 206 of file Geometry.h.

References i3d::CVector3d::GetCrossProduct(), and imath::TVector< Size, Element >::GetLength().

◆ GetTriangleNormal()

CVector3d i3d::Geometry::GetTriangleNormal ( const CVector3d p1,
const CVector3d p2,
const CVector3d p3 
)
inline

Calculate normal vector of triangle.

Definition at line 195 of file Geometry.h.

References i3d::CVector3d::GetCrossProduct(), and i3d::CVector3d::GetNormalized().

◆ IsOnPositiveSide()

bool i3d::Geometry::IsOnPositiveSide ( const CVector3d point,
const CPlane3d plane 
)
inline

Check if point is on the same side of plane as the plane's normal.

Definition at line 132 of file Geometry.h.

References i3d::CPlane3d::GetSignedDistance().

◆ IsPointInTriangle()

bool i3d::Geometry::IsPointInTriangle ( const CVector3d point,
const CVector3d p1,
const CVector3d p2,
const CVector3d p3 
)

Check if point is inside triangle.

Parameters
pointPoint to test.
p1First triangle vertex.
p2Second triangle vertex.
p3Third triangle vertex.
Returns
True if point is inside or on triangle boundary.

◆ ProjectVectorOntoVector()

CVector3d i3d::Geometry::ProjectVectorOntoVector ( const CVector3d vector,
const CVector3d onto 
)
inline

Project vector onto another vector.

Parameters
vectorVector to project.
ontoVector to project onto.
Returns
Projection of vector onto 'onto'.

Definition at line 144 of file Geometry.h.

References imath::TVector< Size, Element >::GetDotProduct(), imath::TVector< Size, Element >::GetLength2(), and I_BIG_EPSILON.