#include <2DTriangle.h>
Inheritance diagram for C2DTriangle:
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 C2DPoint & | GetPoint1 (void) const |
Data access. | |
const C2DPoint & | GetPoint2 (void) const |
Data access. | |
const C2DPoint & | GetPoint3 (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. |
Class which represents a triangle with a variety of associated functions.
---------------------------------------------------------------------------
|
Constructor.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Constructor with assignment.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Destructor.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Static collinear.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
True if the 3 are collinear.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Returns true if the point is contained.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Distance to another.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Distance to a point.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Distance to a point.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Returns the area.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Static version of area signed function.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Returns the area signed (indicating weather clockwise or not).
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Returns the bounding rect.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Static version of circumcentre function.
-------------------------------------------------------------------------- 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. --------------------------------------------------------------------------- |
|
Returns the circumcentre.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Static version of Fermat point function.
-------------------------------------------------------------------------- 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. --------------------------------------------------------------------------- |
|
Returns the Fermat point (also known as the Torricelli point).
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Static version of InCentre function.
-------------------------------------------------------------------------- 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 |
|
InCentre function.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Returns the perimeter.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Grows the triangle.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Returns whether the triangle is clockwise.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Moves the triangle.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Projects this onto the vector given.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Projects this onto the line given.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Reflects the in the line given.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Reflects the triangle.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Rotates the triangle.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Assignement.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Snaps to the conceptual grid.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |