Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
G3D::LineSegment Class Reference


An finite segment of an infinite 3D line. More...

Public Member Functions

 LineSegment ()
 
 LineSegment (class BinaryInput &b)
 
virtual ~LineSegment ()
 
Point3 closestPoint (const Point3 &point) const
 Returns the closest point on the line segment to point. More...
 
void deserialize (class BinaryInput &b)
 
double distance (const Point3 &p) const
 
Returns the distance between point and the line More...
 
double distanceSquared (const Point3 &p) const
 
bool intersectsSolidSphere (const class Sphere &s) const
 Returns true if some part of this segment is inside the sphere. More...
 
float length () const
 
Point3 midpoint () const
 
Point3 point (int i) const
 Call with 0 or 1. More...
 
Point3 randomPoint () const
 
void serialize (class BinaryOutput &b) const
 

Static Public Member Functions

static LineSegment fromTwoPoints (const Point3 &point1, const Point3 &point2)
 Constructs a line from two (not equal) points. More...
 

Protected Member Functions

 LineSegment (const Point3 &__point, const Vector3 &_direction)
 

Protected Attributes

Point3 _point
 
Vector3 direction
 Not normalized. More...
 

Detailed Description


An finite segment of an infinite 3D line.

Constructor & Destructor Documentation

◆ LineSegment() [1/3]

G3D::LineSegment::LineSegment ( const Point3 __point,
const Vector3 _direction 
)
inlineprotected

◆ LineSegment() [2/3]

G3D::LineSegment::LineSegment ( )
inline

Referenced by fromTwoPoints().

◆ LineSegment() [3/3]

G3D::LineSegment::LineSegment ( class BinaryInput b)

◆ ~LineSegment()

virtual G3D::LineSegment::~LineSegment ( )
inlinevirtual

Member Function Documentation

◆ closestPoint()

Point3 G3D::LineSegment::closestPoint ( const Point3 point) const

Returns the closest point on the line segment to point.

Referenced by distance(), and distanceSquared().

◆ deserialize()

void G3D::LineSegment::deserialize ( class BinaryInput b)

◆ distance()

double G3D::LineSegment::distance ( const Point3 p) const
inline


Returns the distance between point and the line

◆ distanceSquared()

double G3D::LineSegment::distanceSquared ( const Point3 p) const
inline

◆ fromTwoPoints()

static LineSegment G3D::LineSegment::fromTwoPoints ( const Point3 point1,
const Point3 point2 
)
inlinestatic

Constructs a line from two (not equal) points.

◆ intersectsSolidSphere()

bool G3D::LineSegment::intersectsSolidSphere ( const class Sphere s) const

Returns true if some part of this segment is inside the sphere.

◆ length()

float G3D::LineSegment::length ( ) const
inline

◆ midpoint()

Point3 G3D::LineSegment::midpoint ( ) const
inline

◆ point()

Point3 G3D::LineSegment::point ( int  i) const

Call with 0 or 1.

◆ randomPoint()

Point3 G3D::LineSegment::randomPoint ( ) const

◆ serialize()

void G3D::LineSegment::serialize ( class BinaryOutput b) const

Member Data Documentation

◆ _point

Point3 G3D::LineSegment::_point
protected

Referenced by midpoint().

◆ direction

Vector3 G3D::LineSegment::direction
protected

Not normalized.

Referenced by length(), and midpoint().


documentation generated on Wed Nov 24 2021 08:01:57 using doxygen 1.8.15