Triangle. More...
#include <rtriangle.h>
Public Member Functions | |
RTriangle (void) | |
RTriangle (const RTriangle &triangle) | |
RTriangle (tCoord x1, tCoord y1, tCoord x2, tCoord y2, tCoord x3, tCoord y3, bool reorder=true) | |
RTriangle (const RPoint &pt1, const RPoint &pt2, const RPoint &pt3, bool reorder=true) | |
int | Compare (const RTriangle &triangle) const |
tCoord | GetArea (void) const |
void | SetPoints (tCoord x1, tCoord y1, tCoord x2, tCoord y2, tCoord x3, tCoord y3, bool reorder=true) |
void | SetPoints (const RPoint &pt1, const RPoint &pt2, const RPoint &pt3, bool reorder=true) |
tCoord | GetX1 (void) const |
tCoord | GetY1 (void) const |
tCoord | GetX2 (void) const |
tCoord | GetY2 (void) const |
tCoord | GetX3 (void) const |
tCoord | GetY3 (void) const |
RPoint | GetPt1 (void) const |
RPoint | GetPt2 (void) const |
RPoint | GetPt3 (void) const |
Private Member Functions | |
void | ReOrder (void) |
Private Attributes | |
RPoint | Pt1 |
RPoint | Pt2 |
RPoint | Pt3 |
Detailed Description
Triangle.
This class represent a triangle. Be default, Pt1 is always the most bottom/left edge.
Constructor & Destructor Documentation
RTriangle | ( | void | ) |
Construct a triangle limited to the point (0,0).
Copy constructor.
- Parameters
-
triangle Triangle used for the initialisation.
Construct a line. The points are eventually exchanged to ensure that the first one is the most left-upper point.
- Parameters
-
x1 X-coordinate of the first edge. y1 Y-coordinate of the first edge. x2 X-coordinate of the second edge. y2 Y-coordinate of the second edge. x3 X-coordinate of the third edge. y3 Y-coordinate of the third edge. reorder Define if the line must be reorder.
Construct a line. The points are eventually exchanged to ensure that the first one is the most left-upper point.
- Parameters
-
pt1 The first edge. pt2 The second edge. pt2 The third edge. reorder Define if the line must be reorder.
Member Function Documentation
|
private |
ReOrder de points if necessary to follow the convention.
int Compare | ( | const RTriangle & | triangle | ) | const |
Compare two triangles. This function is used with the class RContainer.
- Parameters
-
triangle Triangle used for the comparison.
- Returns
- -1 The first edge of the current triangle is more at the left (at the bottom) of the other one. If identical, the same comparison is done for the second and third edges.
- +1 The left-bottom edge of the current triangle is more at the right ( upper) of the other one. If identical, the same comparison is done for the second and third edges.
tCoord GetArea | ( | void | ) | const |
Compute the area of the triangle.
- Returns
- the area.
void SetPoints | ( | tCoord | x1, |
tCoord | y1, | ||
tCoord | x2, | ||
tCoord | y2, | ||
tCoord | x3, | ||
tCoord | y3, | ||
bool | reorder = true |
||
) |
Set new points to the triangle.
- Parameters
-
x1 X-coordinate of the first edge. y1 Y-coordinate of the first edge. x2 X-coordinate of the second edge. y2 Y-coordinate of the second edge. x3 X-coordinate of the third edge. y3 Y-coordinate of the third edge. reorder Define if the line must be reorder.
Set new points to the triangle.
- Parameters
-
pt1 The first edge. pt2 The second edge. pt2 The third edge. reorder Define if the line must be reorder.
tCoord GetX1 | ( | void | ) | const |
Get the X position of the first edge.
- Returns
- a coordinate.
tCoord GetY1 | ( | void | ) | const |
Get the Y position of the first edge.
- Returns
- a coordinate.
tCoord GetX2 | ( | void | ) | const |
Get the X position of the second edge.
- Returns
- a coordinate.
tCoord GetY2 | ( | void | ) | const |
Get the Y position of the second edge.
- Returns
- a coordinate.
tCoord GetX3 | ( | void | ) | const |
Get the X position of the third edge.
- Returns
- a coordinate.
tCoord GetY3 | ( | void | ) | const |
Get the Y position of the third edge.
- Returns
- a coordinate.
RPoint GetPt1 | ( | void | ) | const |
Get the first edge.
- Returns
- a point.
RPoint GetPt2 | ( | void | ) | const |
Get the second edge.
- Returns
- a point.
RPoint GetPt3 | ( | void | ) | const |
Get the third edge.
- Returns
- a point.
Field Documentation
|
private |
The First edge of a triangle.
|
private |
The second edge of the triangle.
|
private |
The third edge of the triangle.