MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Plane. More...
#include <MsqGeomPrim.hpp>
Public Member Functions | |
MsqPlane (const Vector3D &p_normal, double coeff) | |
MsqPlane (const Vector3D &p_normal, const Vector3D &p_point) | |
MsqPlane (double a, double b, double c, double d) | |
ax+by+cz+d=0 | |
const Vector3D & | normal () const |
get unit normal vector for plane | |
double | coefficient () const |
get coefficient term for plane | |
Vector3D | point () const |
Get point on plane closest to origin. | |
double | distance (const Vector3D &p_point) const |
Get distance from point to plane. | |
Vector3D | closest (const Vector3D &p_point) const |
Get closest location on plane to input position. | |
bool | intersect (const MsqPlane &plane, MsqLine &result) const |
bool | intersect (const MsqLine &line, double &line_param) const |
Private Attributes | |
Vector3D | mNormal |
unit normal | |
double | mCoeff |
Plane.
Definition at line 145 of file MsqGeomPrim.hpp.
MBMesquite::MsqPlane::MsqPlane | ( | const Vector3D & | p_normal, |
double | coeff | ||
) |
Definition at line 117 of file MsqGeomPrim.cpp.
References MBMesquite::Vector3D::length(), mCoeff, and mNormal.
MBMesquite::MsqPlane::MsqPlane | ( | const Vector3D & | p_normal, |
const Vector3D & | p_point | ||
) |
Definition at line 124 of file MsqGeomPrim.cpp.
MBMesquite::MsqPlane::MsqPlane | ( | double | a, |
double | b, | ||
double | c, | ||
double | d | ||
) |
Vector3D MBMesquite::MsqPlane::closest | ( | const Vector3D & | p_point | ) | const [inline] |
Get closest location on plane to input position.
Definition at line 182 of file MsqGeomPrim.hpp.
Referenced by MBMesquite::MsqSphere::intersect(), and GeomPrimTest::test_plane_closest_to_point().
{ return p_point - normal() * ( normal() % p_point + coefficient() ); }
double MBMesquite::MsqPlane::coefficient | ( | ) | const [inline] |
get coefficient term for plane
Definition at line 164 of file MsqGeomPrim.hpp.
Referenced by intersect(), and GeomPrimTest::test_plane_basic().
{ return mCoeff; }
double MBMesquite::MsqPlane::distance | ( | const Vector3D & | p_point | ) | const [inline] |
Get distance from point to plane.
Definition at line 176 of file MsqGeomPrim.hpp.
Referenced by GeomPrimTest::test_plane_distance(), and GeomPrimTest::test_plane_intersect_plane().
{ return fabs( normal() % p_point + coefficient() ); }
bool MBMesquite::MsqPlane::intersect | ( | const MsqPlane & | plane, |
MsqLine & | result | ||
) | const |
Find intersection of this plane with another.
Definition at line 136 of file MsqGeomPrim.cpp.
References coefficient(), MBMesquite::det(), moab::dot(), and normal().
Referenced by GeomPrimTest::test_plane_intersect_line(), and GeomPrimTest::test_plane_intersect_plane().
{ const double dot = normal() % plane.normal(); const double det = dot * dot - 1.0; if( fabs( det ) < DBL_EPSILON ) // parallel return false; const double s1 = ( coefficient() - dot * plane.coefficient() ) / det; const double s2 = ( plane.coefficient() - dot * coefficient() ) / det; result = MsqLine( s1 * normal() + s2 * plane.normal(), normal() * plane.normal() ); return true; }
bool MBMesquite::MsqPlane::intersect | ( | const MsqLine & | line, |
double & | line_param | ||
) | const |
Find point of itersection with a line
Definition at line 149 of file MsqGeomPrim.cpp.
References coefficient(), MBMesquite::MsqLine::direction(), moab::dot(), normal(), and MBMesquite::MsqLine::point().
{ const double dot = line.direction() % normal(); if( fabs( dot ) < DBL_EPSILON ) return false; result = -( normal() % line.point() + coefficient() ) / dot; return true; }
const Vector3D& MBMesquite::MsqPlane::normal | ( | ) | const [inline] |
get unit normal vector for plane
Definition at line 158 of file MsqGeomPrim.hpp.
Referenced by intersect(), MBMesquite::MsqSphere::intersect(), GeomPrimTest::test_plane_basic(), and GeomPrimTest::test_plane_intersect_plane().
{ return mNormal; }
Vector3D MBMesquite::MsqPlane::point | ( | ) | const [inline] |
Get point on plane closest to origin.
Definition at line 170 of file MsqGeomPrim.hpp.
Referenced by GeomPrimTest::test_plane_basic().
double MBMesquite::MsqPlane::mCoeff [private] |
Definition at line 149 of file MsqGeomPrim.hpp.
Referenced by MsqPlane().
Vector3D MBMesquite::MsqPlane::mNormal [private] |