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

C2DTriangle Class Reference

Class which represents a triangle. More...

#include <2DTriangle.h>

Inheritance diagram for C2DTriangle:

C2DBase List of all members.

Public Member Functions

 C2DTriangle (void)
 Constructor.
 C2DTriangle (const C2DPoint &pt1, const C2DPoint &pt2, const C2DPoint &pt3)
 Constructor with assignment.
 ~C2DTriangle (void)
 Destructor.
void Set (const C2DPoint &pt1, const C2DPoint &pt2, const C2DPoint &pt3)
 Assignement.
bool Collinear (void) const
 True if the 3 are collinear.
double GetArea (void) const
 Returns the area.
double GetAreaSigned (void) const
 Returns the area signed (indicating weather clockwise or not).
bool IsClockwise (void) const
 True if clockwise.
C2DPoint GetCircumCentre (void) const
 Returns the circumcentre.
C2DPoint GetFermatPoint (void) const
 Returns the Fermat point (also known as the Torricelli point).
C2DPoint GetInCentre (void) const
 InCentre function.
double GetPerimeter (void) const
 Returns the perimeter.
bool Contains (const C2DPoint &ptTest)
 Returns true if the point is contained.
void Move (const C2DVector &Vector)
 Moves the triangle.
void RotateToRight (double dAng, const C2DPoint &Origin)
 Rotates the triangle.
void Grow (double dFactor, const C2DPoint &Origin)
 Grows the triangle.
void Reflect (const C2DPoint &Point)
 Reflects the triangle.
void Reflect (const C2DLine &Line)
 Reflects the in the line given.
double Distance (const C2DPoint &ptTest) const
 Distance to a point.
double Distance (const C2DPoint &ptTest, C2DPoint *ptOnThis) const
 Distance to a point.
double Distance (const C2DTriangle &Other, C2DPoint *ptOnThis=0, C2DPoint *ptOnOther=0) const
 Distance to another.
void GetBoundingRect (C2DRect &Rect) const
 Returns the bounding rect.
const C2DPointGetPoint1 (void) const
 Data access.
const C2DPointGetPoint2 (void) const
 Data access.
const C2DPointGetPoint3 (void) const
 Data access.
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 SnapToGrid (void)
 Snaps to the conceptual grid.

Static Public Member Functions

static double GetAreaSigned (const C2DPoint &pt1, const C2DPoint &pt2, const C2DPoint &pt3)
 Static version of area signed function.
static double IsClockwise (const C2DPoint &pt1, const C2DPoint &pt2, const C2DPoint &pt3)
 Returns whether the triangle is clockwise.
static C2DPoint GetCircumCentre (const C2DPoint &pt1, const C2DPoint &pt2, const C2DPoint &pt3)
 Static version of circumcentre function.
static C2DPoint GetFermatPoint (const C2DPoint &pt1, const C2DPoint &pt2, const C2DPoint &pt3)
 Static version of Fermat point function.
static C2DPoint GetInCentre (const C2DPoint &pt1, const C2DPoint &pt2, const C2DPoint &pt3)
 Static version of InCentre function.
static bool Collinear (const C2DPoint &pt1, const C2DPoint &pt2, const C2DPoint &pt3)
 Static collinear.

Detailed Description

Class which represents a triangle.

Class which represents a triangle with a variety of associated functions.

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


Constructor & Destructor Documentation

C2DTriangle::C2DTriangle void   ) 
 

Constructor.

--------------------------------------------------------------------------
C2DTriangle::C2DTriangle

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

C2DTriangle::C2DTriangle const C2DPoint pt1,
const C2DPoint pt2,
const C2DPoint pt3
 

Constructor with assignment.

--------------------------------------------------------------------------
C2DTriangle::C2DTriangle

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

C2DTriangle::~C2DTriangle void   ) 
 

Destructor.

--------------------------------------------------------------------------
C2DTriangle::~C2DTriangle

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


Member Function Documentation

bool C2DTriangle::Collinear const C2DPoint pt1,
const C2DPoint pt2,
const C2DPoint pt3
[static]
 

Static collinear.

--------------------------------------------------------------------------
C2DTriangle::Collinear

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

bool C2DTriangle::Collinear void   )  const
 

True if the 3 are collinear.

--------------------------------------------------------------------------
C2DTriangle::Collinear

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

bool C2DTriangle::Contains const C2DPoint ptTest  ) 
 

Returns true if the point is contained.

--------------------------------------------------------------------------
C2DTriangle::Contains

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

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

Distance to another.

--------------------------------------------------------------------------
C2DTriangle::Distance

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

double C2DTriangle::Distance const C2DPoint ptTest,
C2DPoint ptOnThis
const
 

Distance to a point.

--------------------------------------------------------------------------
C2DTriangle::Distance

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

double C2DTriangle::Distance const C2DPoint ptTest  )  const [virtual]
 

Distance to a point.

--------------------------------------------------------------------------
C2DTriangle::Distance

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

Implements C2DBase.

double C2DTriangle::GetArea void   )  const
 

Returns the area.

--------------------------------------------------------------------------
C2DTriangle::GetArea

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

double C2DTriangle::GetAreaSigned const C2DPoint pt1,
const C2DPoint pt2,
const C2DPoint pt3
[static]
 

Static version of area signed function.

--------------------------------------------------------------------------
C2DTriangle::GetAreaSigned

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

double C2DTriangle::GetAreaSigned void   )  const
 

Returns the area signed (indicating weather clockwise or not).

--------------------------------------------------------------------------
C2DTriangle::GetAreaSigned

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

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

Returns the bounding rect.

--------------------------------------------------------------------------
C2DTriangle::GetBoundingRect

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

Implements C2DBase.

C2DPoint C2DTriangle::GetCircumCentre const C2DPoint pt1,
const C2DPoint pt2,
const C2DPoint pt3
[static]
 

Static version of circumcentre function.

--------------------------------------------------------------------------
C2DTriangle::GetCircumCentre

The circumcenter of a triangle can be found as the intersection of the three perpendicular bisectors. (A perpendicular bisector is a line that forms a right angle with one of the triangle's sides and intersects that side at its midpoint.) This is because the circumcenter is equidistant from any pair of the triangle's points, and all points on the perpendicular bisectors are equidistant from those points of the triangle.

The circumcentre's position depends on the type of triangle:

If and only if a triangle is acute (all angles smaller than a right angle), the circumcenter lies inside the triangle. If and only if it is obtuse (has one angle bigger than a right angle), the circumcenter lies outside. If and only if it is a right triangle, the circumcenter lies on one of its sides (namely, the hypotenuse). This is one form of Thales' theorem.

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

C2DPoint C2DTriangle::GetCircumCentre void   )  const
 

Returns the circumcentre.

--------------------------------------------------------------------------
C2DTriangle::GetCircumCentre

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

C2DPoint C2DTriangle::GetFermatPoint const C2DPoint pt1,
const C2DPoint pt2,
const C2DPoint pt3
[static]
 

Static version of Fermat point function.

--------------------------------------------------------------------------
C2DTriangle::GetFermatPoint

To locate the Fermat point:

1. Construct three regular triangles out of the three sides of the given triangle. 2. For each new vertex of the regular triangle, draw a line from it to the opposite triangle's vertex. These three lines intersect at the Fermat point. 3. For the case that the largest angle of the triangle exceeds 120, the solution is a point on the vertex of that angle.

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

C2DPoint C2DTriangle::GetFermatPoint void   )  const
 

Returns the Fermat point (also known as the Torricelli point).

--------------------------------------------------------------------------
C2DTriangle::GetFermatPoint

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

C2DPoint C2DTriangle::GetInCentre const C2DPoint pt1,
const C2DPoint pt2,
const C2DPoint pt3
[static]
 

Static version of InCentre function.

--------------------------------------------------------------------------
C2DTriangle::GetCircumCentre

The center of the incircle can be found as the intersection of the three internal angle bisectors. The center of an excircle is the intersection of the internal bisector of one angle and the external bisectors of the other two.

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

Set up a line to bisect the lines from 1 to 2 and 1 to 3

Set up a line to bisect the lines from 2 to 1 and 2 to 3

C2DPoint C2DTriangle::GetInCentre void   )  const
 

InCentre function.

--------------------------------------------------------------------------
C2DTriangle::InCentre.

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

double C2DTriangle::GetPerimeter void   )  const
 

Returns the perimeter.

--------------------------------------------------------------------------
C2DTriangle::GetPerimeter

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

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

Grows the triangle.

--------------------------------------------------------------------------
C2DTriangle::Grow

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

Implements C2DBase.

double C2DTriangle::IsClockwise const C2DPoint pt1,
const C2DPoint pt2,
const C2DPoint pt3
[static]
 

Returns whether the triangle is clockwise.

--------------------------------------------------------------------------
C2DTriangle::IsClockwise

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

void C2DTriangle::Move const C2DVector Vector  )  [virtual]
 

Moves the triangle.

--------------------------------------------------------------------------
C2DTriangle::Move

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

Implements C2DBase.

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

Projects this onto the vector given.

--------------------------------------------------------------------------
C2DTriangle::Project

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

Implements C2DBase.

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

Projects this onto the line given.

--------------------------------------------------------------------------
C2DTriangle::Project

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

Implements C2DBase.

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

Reflects the in the line given.

--------------------------------------------------------------------------
C2DTriangle::Reflect

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

Implements C2DBase.

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

Reflects the triangle.

--------------------------------------------------------------------------
C2DTriangle::Reflect

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

Implements C2DBase.

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

Rotates the triangle.

--------------------------------------------------------------------------
C2DTriangle::RotateToRight

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

Implements C2DBase.

void C2DTriangle::Set const C2DPoint pt1,
const C2DPoint pt2,
const C2DPoint pt3
 

Assignement.

--------------------------------------------------------------------------
C2DTriangle::Set

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

void C2DTriangle::SnapToGrid void   )  [virtual]
 

Snaps to the conceptual grid.

--------------------------------------------------------------------------
C2DTriangle::SnapToGrid

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

Implements C2DBase.


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