StraightLine2D Class Reference

A straight line in the 2D plane. More...

#include <MBARI/Geometry2D.H>

Collaboration diagram for StraightLine2D:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 StraightLine2D ()
 default constructo, constructs an invalid object
 StraightLine2D (const Vector2D &point, const Vector2D &direction)
 construct from two Vector2D
 StraightLine2D (std::istream &is)
 Construct from the data contained in the input stream is.
void reset (const Vector2D &point, const Vector2D &direction)
 reset the straight line
void writeToStream (std::ostream &os) const
 write the entire StraightLine2D to the output stream os
void readFromStream (std::istream &is)
 read the StraightLine2D from the input stream is
Vector2D point (float n=0.0F) const
 get a point on the line
Vector2D direction () const
 returns the direction vector for this straight line
Vector2D intersect (const StraightLine2D &other, float &n, float &m) const
 returns a vector to the intersection point of this and other
bool isParallel (const StraightLine2D &other) const
 whether this and other are parallel
bool isOrthogonal (const StraightLine2D &other) const
 whether this and other are orthogonal
bool isPointOnLine (const Vector2D &pt) const
 whether pt is on the straight line
bool isIdentical (const StraightLine2D &other) const
 whether this and other describe identical straight lines
bool isValid () const
 whether this object is valid

Detailed Description

A straight line in the 2D plane.

Definition at line 165 of file Geometry2D.H.


Constructor & Destructor Documentation

StraightLine2D::StraightLine2D (  ) 

default constructo, constructs an invalid object

Definition at line 319 of file Geometry2D.C.

StraightLine2D::StraightLine2D ( const Vector2D point,
const Vector2D direction 
)

construct from two Vector2D

Parameters:
point vector determining a point on the line
direction vector determing the direction if the line

Definition at line 324 of file Geometry2D.C.

StraightLine2D::StraightLine2D ( std::istream &  is  ) 

Construct from the data contained in the input stream is.

Definition at line 330 of file Geometry2D.C.

References readFromStream().


Member Function Documentation

Vector2D StraightLine2D::direction (  )  const

returns the direction vector for this straight line

Definition at line 369 of file Geometry2D.C.

References ASSERT, and isValid().

Referenced by intersect(), isOrthogonal(), and isParallel().

Vector2D StraightLine2D::intersect ( const StraightLine2D other,
float &  n,
float &  m 
) const

returns a vector to the intersection point of this and other

if the lines do not intersect (i.e. they are parallel), an invalid Vector2D is returned.

Parameters:
n in this variable, the scalar is returned, for which the intersection point is this->point(n);
m the scalar, for which the interesection point is other.point(m)

Definition at line 376 of file Geometry2D.C.

References ASSERT, direction(), isParallel(), isValid(), point(), Vector2D::x(), and Vector2D::y().

bool StraightLine2D::isIdentical ( const StraightLine2D other  )  const

whether this and other describe identical straight lines

Definition at line 421 of file Geometry2D.C.

References ASSERT, isParallel(), isPointOnLine(), isValid(), and point().

bool StraightLine2D::isOrthogonal ( const StraightLine2D other  )  const

whether this and other are orthogonal

Definition at line 401 of file Geometry2D.C.

References ASSERT, direction(), Vector2D::isOrthogonal(), and isValid().

bool StraightLine2D::isParallel ( const StraightLine2D other  )  const

whether this and other are parallel

Definition at line 393 of file Geometry2D.C.

References ASSERT, direction(), Vector2D::isCollinear(), and isValid().

Referenced by intersect(), and isIdentical().

bool StraightLine2D::isPointOnLine ( const Vector2D pt  )  const

whether pt is on the straight line

Definition at line 409 of file Geometry2D.C.

References ASSERT, isValid(), Vector2D::isValid(), Vector2D::x(), and Vector2D::y().

Referenced by isIdentical().

bool StraightLine2D::isValid (  )  const

whether this object is valid

Definition at line 430 of file Geometry2D.C.

Referenced by direction(), intersect(), isIdentical(), isOrthogonal(), isParallel(), isPointOnLine(), and point().

Vector2D StraightLine2D::point ( float  n = 0.0F  )  const

get a point on the line

Parameters:
n get point point + n * direction; for n = 0 (default), this is the point entered in the constructor or in reset

Definition at line 362 of file Geometry2D.C.

References ASSERT, and isValid().

Referenced by intersect(), and isIdentical().

void StraightLine2D::readFromStream ( std::istream &  is  ) 

read the StraightLine2D from the input stream is

Definition at line 353 of file Geometry2D.C.

References Vector2D::readFromStream().

Referenced by Token::readFromStream(), and StraightLine2D().

void StraightLine2D::reset ( const Vector2D point,
const Vector2D direction 
)

reset the straight line

Parameters:
point vector determining a point on the line
direction vector determing the direction if the line

Definition at line 336 of file Geometry2D.C.

void StraightLine2D::writeToStream ( std::ostream &  os  )  const

write the entire StraightLine2D to the output stream os

Definition at line 344 of file Geometry2D.C.

References Vector2D::writeToStream().

Referenced by Token::writeToStream().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:43:50 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3