MOAB: Mesh Oriented datABase  (version 5.2.1)
MBMesquite::MsqLine Class Reference

Line in R^3. More...

#include <MsqGeomPrim.hpp>

+ Collaboration diagram for MBMesquite::MsqLine:

Public Member Functions

 MsqLine (const Vector3D &p_point, const Vector3D &p_dir)
 MsqLine ()
const Vector3Dpoint () const
const Vector3Ddirection () const
Vector3D point (double param) const
 Get point given parameter (mPoint + param * mDirection)
double closest (const Vector3D &from_point) const
 Get parameter value for location on line closest to input point.
double distance (const Vector3D &from_point) const
bool intersect (const MsqLine &other, double &param, double epsilon) const
bool closest (const MsqLine &other, double &param) const
 Find parameter of closest position on this line to another line.

Static Public Member Functions

static MsqLine two_point (const Vector3D &p1, const Vector3D &p2)

Private Attributes

Vector3D mPoint
Vector3D mDirection

Detailed Description

Line in R^3.

Definition at line 42 of file MsqGeomPrim.hpp.

Constructor & Destructor Documentation

MBMesquite::MsqLine::MsqLine ( const Vector3D p_point,
const Vector3D p_dir 
) [inline]

Definition at line 49 of file MsqGeomPrim.hpp.

                                                              : mPoint( p_point ), mDirection( p_dir / p_dir.length() )

Definition at line 53 of file MsqGeomPrim.hpp.

: mPoint( 0, 0, 0 ), mDirection( 0, 0, 0 ) {}

Member Function Documentation

double MBMesquite::MsqLine::closest ( const Vector3D from_point) const [inline]
bool MBMesquite::MsqLine::closest ( const MsqLine other,
double &  param 
) const

Find parameter of closest position on this line to another line.

Definition at line 46 of file MsqGeomPrim.cpp.

References direction(), moab::dot(), N, and point().

    const Vector3D N = other.direction() * ( direction() * other.direction() );
    const double D   = -( N % other.point() );
    const double dot = N % direction();
    if( dot < DBL_EPSILON ) return false;  // parallel
    param = -( N % point() + D ) / dot;
    return true;
double MBMesquite::MsqLine::distance ( const Vector3D from_point) const [inline]

Definition at line 81 of file MsqGeomPrim.hpp.

        return ( point( closest( from_point ) ) - from_point ).length();
bool MBMesquite::MsqLine::intersect ( const MsqLine other,
double &  param,
double  epsilon 
) const

Find intersection between two lines

false if no point intersection (skew, parallel, coincident, etc.)

Definition at line 38 of file MsqGeomPrim.cpp.

References closest(), epsilon, MBMesquite::Vector3D::length_squared(), and point().

Referenced by GeomPrimTest::test_line_intersect().

    if( !closest( other, param ) ) return false;
    Vector3D p1 = point( param );
    Vector3D p2 = other.point( other.closest( p1 ) );
    return ( p1 - p2 ).length_squared() < epsilon * epsilon;
Vector3D MBMesquite::MsqLine::point ( double  param) const [inline]

Get point given parameter (mPoint + param * mDirection)

Definition at line 70 of file MsqGeomPrim.hpp.

        return point() + param * direction();
static MsqLine MBMesquite::MsqLine::two_point ( const Vector3D p1,
const Vector3D p2 
) [inline, static]

Definition at line 55 of file MsqGeomPrim.hpp.

Referenced by GeomPrimTest::test_line_basic().

        return MsqLine( p1, p2 - p1 );

Member Data Documentation

Definition at line 46 of file MsqGeomPrim.hpp.

Definition at line 45 of file MsqGeomPrim.hpp.

List of all members.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines