Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

C2DLine Class Reference

Class which represents a line segment i.e. a finite line. More...

#include <2DLine.h>

Inheritance diagram for C2DLine:

C2DLineBase C2DBase List of all members.

Public Member Functions

 C2DLine (void)
 Constructor.
 ~C2DLine (void)
 ~Destructor.
 C2DLine (const C2DPoint &PointFrom, const C2DVector &VectorTo)
 Constructor assigns from a point and vector.
 C2DLine (const C2DPoint &PointFrom, const C2DPoint &PointTo)
 Constructor assigns from 2 points.
 C2DLine (const C2DLine &Other)
 Constructor assigns from another line.
void Set (const C2DPoint &PointFrom, const C2DPoint &PointTo)
 Assigment from 2 points.
void Set (const C2DPoint &PointFrom, const C2DVector &VectorTo)
 Assignment using a point and a vector.
void SetPointTo (const C2DPoint &PointTo)
 Sets the point that this is going to.
void SetPointFrom (const C2DPoint &PointFrom)
 Sets the point that this is going from changing the vector as well.
void SetLength (double dLength)
 Set Length.
void ReverseDirection (void)
 Reverses the direction of the line.
bool IsOnRight (const C2DPoint &OtherPoint) const
 True if the point is to the right of the line.
C2DPoint GetPointTo (void) const
 Returns the second point.
C2DPoint GetPointFrom (void) const
 Returns the first point.
bool WouldCross (const C2DLine &Other) const
 True if this line would cross the other if it were infinite.
bool Crosses (const C2DLineBase &Other, C2DPointSet *IntersectionPts=0) const
 True if this line crosses the other line, returns the intersection pt.
bool Crosses (const C2DLine &Other, C2DPointSet *IntersectionPts=0, bool *pbOnThis=0, bool *pbOnOther=0, bool bAddPtIfFalse=false) const
 True if this line crosses the other. Returns the point is a collection is provided. Returns whether it would cross on this or on the other. Can opt to get the point where the cross would occur (if not parallel) even if they don't cross.
bool CrossesRay (const C2DLine &Ray, C2DPointSet *IntersectionPts=0) const
 True if the ray provided (infinite line starting from the first point) crosses this.
double Distance (const C2DPoint &TestPoint) const
 Returns the distance from this to the point.
double Distance (const C2DPoint &TestPoint, C2DPoint *ptOnThis) const
 Returns the distance from this to the point.
double Distance (const C2DLine &Other, C2DPoint *ptOnThis=0, C2DPoint *ptOnOther=0) const
 Returns the distance from this to the other line.
double Distance (const C2DLineBase &Other, C2DPoint *ptOnThis=0, C2DPoint *ptOnOther=0) const
 Distance to another line.
C2DPoint GetMidPoint (void) const
 Gets the mid point on the line.
C2DPoint GetPointOn (double dFactorFromStart) const
 Gets the point on the line given by the factor. e.g. 0.5 = mid point.
void GetBoundingRect (C2DRect &Rect) const
 Returns the bounding rectangle.
double GetLength (void) const
 Returns the length of the line.
void Move (const C2DVector &vector)
 Moves the line by the vector given.
void RotateToRight (double dAng, const C2DPoint &Origin)
 Rotation.
void Grow (double dFactor, const C2DPoint &Origin)
 Grows the line in size.
void Reflect (const C2DPoint &Point)
 Point reflection.
void Reflect (const C2DLine &Line)
 Reflects the in the line given.
void GrowFromCentre (double dFactor)
 Grows from the centre by the amount.
void Project (const C2DLine &Line, CInterval &Interval) const
 Projects this onto the line given.
void Project (const C2DVector &Vector, CInterval &Interval) const
 Projects this onto the vector given.
void GetSubLines (const C2DPointSet &PtsOnLine, C2DLineBaseSet &LineSet) const
 Splits the line up into sublines dependant upon the points provided which are points on this line. Adds the sub lines, in order, to the collection.
void SnapToGrid (void)
 Snaps this to the conceptual grid.

Public Attributes

C2DPoint point
 The first point.
C2DVector vector
 The vector to the second point.

Detailed Description

Class which represents a line segment i.e. a finite line.

Class which represents a line segment i.e. a finite line. Stores data as a point and a vector representing the movement to the new point.

---------------------------------------------------------------------------


Constructor & Destructor Documentation

C2DLine::C2DLine void   ) 
 

Constructor.

--------------------------------------------------------------------------
C2DLine::C2DLine

---------------------------------------------------------------------------

C2DLine::~C2DLine void   ) 
 

~Destructor.

--------------------------------------------------------------------------
C2DLine::~C2DLine

---------------------------------------------------------------------------

C2DLine::C2DLine const C2DPoint PointFrom,
const C2DVector VectorTo
 

Constructor assigns from a point and vector.

--------------------------------------------------------------------------
C2DLine::C2DLine

---------------------------------------------------------------------------

C2DLine::C2DLine const C2DPoint PointFrom,
const C2DPoint PointTo
 

Constructor assigns from 2 points.

--------------------------------------------------------------------------
C2DLine::C2DLine

---------------------------------------------------------------------------

C2DLine::C2DLine const C2DLine Other  ) 
 

Constructor assigns from another line.

--------------------------------------------------------------------------
C2DLine::C2DLine

---------------------------------------------------------------------------


Member Function Documentation

bool C2DLine::Crosses const C2DLine Other,
C2DPointSet IntersectionPts = 0,
bool *  pbOnThis = 0,
bool *  pbOnOther = 0,
bool  bAddPtIfFalse = false
const
 

True if this line crosses the other. Returns the point is a collection is provided. Returns whether it would cross on this or on the other. Can opt to get the point where the cross would occur (if not parallel) even if they don't cross.

True if this line crosses the other. Returns the point is a collection is provided. Returns whether it would cross on this or on the other. Can opt to get the point where the cross would occur (if not parallel) even if they don't cross.

bool C2DLine::Crosses const C2DLineBase Other,
C2DPointSet IntersectionPts = 0
const [virtual]
 

True if this line crosses the other line, returns the intersection pt.

--------------------------------------------------------------------------
C2DLine::Crosses

---------------------------------------------------------------------------

Implements C2DLineBase.

bool C2DLine::CrossesRay const C2DLine Ray,
C2DPointSet IntersectionPts = 0
const
 

True if the ray provided (infinite line starting from the first point) crosses this.

--------------------------------------------------------------------------
C2DLine::CrossesRay

---------------------------------------------------------------------------

double C2DLine::Distance const C2DLineBase Other,
C2DPoint ptOnThis = 0,
C2DPoint ptOnOther = 0
const [virtual]
 

Distance to another line.

--------------------------------------------------------------------------
C2DLine::Distance

---------------------------------------------------------------------------

Implements C2DLineBase.

double C2DLine::Distance const C2DLine Other,
C2DPoint ptOnThis = 0,
C2DPoint ptOnOther = 0
const
 

Returns the distance from this to the other line.

--------------------------------------------------------------------------
C2DLine::Distance

---------------------------------------------------------------------------

double C2DLine::Distance const C2DPoint TestPoint,
C2DPoint ptOnThis
const [virtual]
 

Returns the distance from this to the point.

--------------------------------------------------------------------------
C2DLine::Distance

---------------------------------------------------------------------------

Implements C2DLineBase.

double C2DLine::Distance const C2DPoint TestPoint  )  const [virtual]
 

Returns the distance from this to the point.

--------------------------------------------------------------------------
C2DLine::Distance

---------------------------------------------------------------------------

Implements C2DLineBase.

void C2DLine::GetBoundingRect C2DRect Rect  )  const [virtual]
 

Returns the bounding rectangle.

--------------------------------------------------------------------------
C2DLine::GetBoundingRect

---------------------------------------------------------------------------

Implements C2DBase.

C2DPoint C2DLine::GetMidPoint void   )  const
 

Gets the mid point on the line.

--------------------------------------------------------------------------
C2DLine::GetMidPoint

---------------------------------------------------------------------------

C2DPoint C2DLine::GetPointOn double  dFactorFromStart  )  const
 

Gets the point on the line given by the factor. e.g. 0.5 = mid point.

--------------------------------------------------------------------------
C2DLine::GetPointOn

---------------------------------------------------------------------------

C2DPoint C2DLine::GetPointTo void   )  const [virtual]
 

Returns the second point.

--------------------------------------------------------------------------
C2DLine::GetPointTo

---------------------------------------------------------------------------

Implements C2DLineBase.

void C2DLine::GetSubLines const C2DPointSet PtsOnLine,
C2DLineBaseSet LineSet
const [virtual]
 

Splits the line up into sublines dependant upon the points provided which are points on this line. Adds the sub lines, in order, to the collection.

Returns the lines that make up this defined by the points which are assumed to be on this line. i.e. splits the line up.

Implements C2DLineBase.

void C2DLine::Grow double  dFactor,
const C2DPoint Origin
[virtual]
 

Grows the line in size.

--------------------------------------------------------------------------
C2DLine::Grow

---------------------------------------------------------------------------

Implements C2DBase.

void C2DLine::GrowFromCentre double  dFactor  ) 
 

Grows from the centre by the amount.

--------------------------------------------------------------------------
C2DLine::GrowFromCentre

---------------------------------------------------------------------------

bool C2DLine::IsOnRight const C2DPoint OtherPoint  )  const
 

True if the point is to the right of the line.

--------------------------------------------------------------------------
C2DLine::IsOnRight

---------------------------------------------------------------------------

void C2DLine::Project const C2DVector Vector,
CInterval Interval
const [virtual]
 

Projects this onto the vector given.

--------------------------------------------------------------------------
C2DLine::Project

---------------------------------------------------------------------------

Implements C2DBase.

void C2DLine::Project const C2DLine Line,
CInterval Interval
const [virtual]
 

Projects this onto the line given.

--------------------------------------------------------------------------
C2DLine::Project

---------------------------------------------------------------------------

Implements C2DBase.

void C2DLine::Reflect const C2DLine Line  )  [virtual]
 

Reflects the in the line given.

--------------------------------------------------------------------------
C2DLine::Reflect

---------------------------------------------------------------------------

Implements C2DBase.

void C2DLine::Reflect const C2DPoint Point  )  [virtual]
 

Point reflection.

--------------------------------------------------------------------------
C2DLine::Reflect

---------------------------------------------------------------------------

Implements C2DBase.

void C2DLine::ReverseDirection void   )  [virtual]
 

Reverses the direction of the line.

--------------------------------------------------------------------------
C2DLine::ReverseDirection

---------------------------------------------------------------------------

Implements C2DLineBase.

void C2DLine::RotateToRight double  dAng,
const C2DPoint Origin
[virtual]
 

Rotation.

--------------------------------------------------------------------------
C2DLine::RotateToRight

---------------------------------------------------------------------------

Implements C2DBase.

void C2DLine::Set const C2DPoint PointFrom,
const C2DVector VectorTo
 

Assignment using a point and a vector.

--------------------------------------------------------------------------
C2DLine::Set

---------------------------------------------------------------------------

void C2DLine::Set const C2DPoint PointFrom,
const C2DPoint PointTo
 

Assigment from 2 points.

--------------------------------------------------------------------------
C2DLine::Set

---------------------------------------------------------------------------

void C2DLine::SetPointFrom const C2DPoint PointFrom  ) 
 

Sets the point that this is going from changing the vector as well.

--------------------------------------------------------------------------
C2DLine::SetPointFrom

---------------------------------------------------------------------------

void C2DLine::SetPointTo const C2DPoint PointTo  ) 
 

Sets the point that this is going to.

--------------------------------------------------------------------------
C2DLine::SetPointTo

---------------------------------------------------------------------------

void C2DLine::SnapToGrid void   )  [virtual]
 

Snaps this to the conceptual grid.

--------------------------------------------------------------------------
C2DLine::SnapToGrid

---------------------------------------------------------------------------

Implements C2DLineBase.

bool C2DLine::WouldCross const C2DLine Other  )  const
 

True if this line would cross the other if it were infinite.

--------------------------------------------------------------------------
C2DLine::WouldCross

---------------------------------------------------------------------------


The documentation for this class was generated from the following files:
Generated on Mon Apr 21 11:43:51 2008 for GeoLib by  doxygen 1.4.4