MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Circle in R^3. More...
#include <MsqGeomPrim.hpp>
Public Member Functions | |
MsqCircle () | |
MsqCircle (const Vector3D &p_center, const Vector3D &p_normal, double p_radius) | |
const Vector3D & | center () const |
const Vector3D & | normal () const |
double | radius () const |
Vector3D | radial_vector () const |
Get arbitrary radial vector (vector in plane with length equal to radius) | |
Vector3D | closest (const Vector3D &point) const |
bool | closest (const Vector3D &point, Vector3D &point_on_circle, Vector3D &tangent_at_point) const |
Static Public Member Functions | |
static bool | three_point (const Vector3D &p1, const Vector3D &p2, const Vector3D &p3, MsqCircle &result) |
static bool | two_point (const Vector3D ¢er, const Vector3D &p1, const Vector3D &p2, MsqCircle &result) |
Private Attributes | |
Vector3D | mCenter |
Vector3D | mNormal |
unit normal | |
double | mRadius |
Circle in R^3.
Definition at line 95 of file MsqGeomPrim.hpp.
MBMesquite::MsqCircle::MsqCircle | ( | ) | [inline] |
Definition at line 103 of file MsqGeomPrim.hpp.
Referenced by three_point(), and two_point().
MBMesquite::MsqCircle::MsqCircle | ( | const Vector3D & | p_center, |
const Vector3D & | p_normal, | ||
double | p_radius | ||
) | [inline] |
Definition at line 105 of file MsqGeomPrim.hpp.
const Vector3D& MBMesquite::MsqCircle::center | ( | ) | const [inline] |
Definition at line 118 of file MsqGeomPrim.hpp.
Referenced by MBMesquite::CircleDomain::arc_length(), closest(), MBMesquite::CircleDomain::closest_point(), MBMesquite::CircleDomain::position_from_length(), GeomPrimTest::test_circle_basic(), GeomPrimTest::test_circle_closest_to_point(), GeomPrimTest::test_circle_from_three_points(), GeomPrimTest::test_circle_from_two_points(), GeomPrimTest::test_sphere_intersect_plane(), GeomPrimTest::test_sphere_intersect_sphere(), three_point(), and two_point().
{ return mCenter; }
Vector3D MBMesquite::MsqCircle::closest | ( | const Vector3D & | point | ) | const |
Find closest point on circle to input position. Returns arbitrary location on circle if point is at center.
Definition at line 94 of file MsqGeomPrim.cpp.
References center(), MBMesquite::Vector3D::length(), MBMesquite::length(), normal(), radial_vector(), and radius().
Referenced by MBMesquite::CircleDomain::snap_to(), GeomPrimTest::test_circle_closest_to_point(), and GeomPrimTest::test_circle_closest_with_tangent().
{ const Vector3D from_center = point - center(); const Vector3D norm_proj = normal() * ( normal() % from_center ); // unit normal! const Vector3D in_plane = from_center - norm_proj; const double length = in_plane.length(); if( length < DBL_EPSILON ) return center() + radial_vector(); else return center() + in_plane * radius() / length; }
bool MBMesquite::MsqCircle::closest | ( | const Vector3D & | point, |
Vector3D & | point_on_circle, | ||
Vector3D & | tangent_at_point | ||
) | const |
Find closest point on circle to input position, and tangent at that point. Fails and returns false if point is at center of circle.
Definition at line 106 of file MsqGeomPrim.cpp.
References center(), MBMesquite::Vector3D::length(), MBMesquite::Vector3D::length_squared(), normal(), and radius().
const Vector3D& MBMesquite::MsqCircle::normal | ( | ) | const [inline] |
Definition at line 122 of file MsqGeomPrim.hpp.
Referenced by MBMesquite::CircleDomain::arc_length(), closest(), MBMesquite::CircleDomain::position_from_length(), radial_vector(), GeomPrimTest::test_circle_basic(), GeomPrimTest::test_circle_closest_to_point(), GeomPrimTest::test_circle_from_three_points(), GeomPrimTest::test_circle_from_two_points(), GeomPrimTest::test_sphere_intersect_plane(), and GeomPrimTest::test_sphere_intersect_sphere().
{ return mNormal; }
Vector3D MBMesquite::MsqCircle::radial_vector | ( | ) | const |
Get arbitrary radial vector (vector in plane with length equal to radius)
Definition at line 82 of file MsqGeomPrim.cpp.
References MBMesquite::Vector3D::length(), normal(), and radius().
Referenced by closest(), MBMesquite::CircleDomain::closest_point(), GeomPrimTest::test_circle_closest_to_point(), GeomPrimTest::test_sphere_intersect_sphere(), and MBMesquite::CircleDomain::vertex_normal_at().
double MBMesquite::MsqCircle::radius | ( | ) | const [inline] |
Definition at line 126 of file MsqGeomPrim.hpp.
Referenced by MBMesquite::CircleDomain::arc_length(), closest(), MBMesquite::CircleDomain::position_from_length(), radial_vector(), GeomPrimTest::test_circle_basic(), GeomPrimTest::test_circle_closest_to_point(), GeomPrimTest::test_circle_from_three_points(), GeomPrimTest::test_circle_from_two_points(), GeomPrimTest::test_sphere_intersect_plane(), three_point(), and two_point().
{ return mRadius; }
bool MBMesquite::MsqCircle::three_point | ( | const Vector3D & | p1, |
const Vector3D & | p2, | ||
const Vector3D & | p3, | ||
MsqCircle & | result | ||
) | [static] |
Find circle passing through three points
Definition at line 56 of file MsqGeomPrim.cpp.
References center(), MBMesquite::MsqLine::closest(), MBMesquite::length(), MBMesquite::Vector3D::length_squared(), MsqCircle(), MBMesquite::MsqLine::point(), and radius().
Referenced by GeomPrimTest::test_circle_from_three_points().
{ Vector3D norm = ( p1 - p2 ) * ( p3 - p2 ); if( norm.length_squared() < DBL_EPSILON ) return false; MsqLine line1( 0.5 * ( p1 + p2 ), norm * ( p1 - p2 ) ); MsqLine line2( 0.5 * ( p2 + p3 ), norm * ( p3 - p2 ) ); double t_xsect; if( !line1.closest( line2, t_xsect ) ) return false; Vector3D center = line1.point( t_xsect ); double radius = ( ( center - p1 ).length() + ( center - p2 ).length() + ( center - p3 ).length() ) / 3.0; result = MsqCircle( center, norm, radius ); return true; }
bool MBMesquite::MsqCircle::two_point | ( | const Vector3D & | center, |
const Vector3D & | p1, | ||
const Vector3D & | p2, | ||
MsqCircle & | result | ||
) | [static] |
Find circle with center and two points
Definition at line 72 of file MsqGeomPrim.cpp.
References center(), MBMesquite::length(), MBMesquite::Vector3D::length_squared(), MsqCircle(), and radius().
Referenced by GeomPrimTest::test_circle_from_two_points().
Vector3D MBMesquite::MsqCircle::mCenter [private] |
Definition at line 98 of file MsqGeomPrim.hpp.
Vector3D MBMesquite::MsqCircle::mNormal [private] |
unit normal
Definition at line 99 of file MsqGeomPrim.hpp.
double MBMesquite::MsqCircle::mRadius [private] |
Definition at line 100 of file MsqGeomPrim.hpp.