2D triangle class
More...
#include <triangle_2d.h>
|
| | Triangle2D (const Vector2D &v1, const Vector2D &v2, const Vector2D &v3) |
| | constructor with variables
|
| | Triangle2D (const Segment2D &seg, const Vector2D &v) |
| | constructor with a segment and a point
|
| const Triangle2D & | assign (const Vector2D &v1, const Vector2D &v2, const Vector2D &v3) |
| | assign new vertex points
|
| bool | isValid () const |
| | check if this triangle is valid or not.
|
| const Triangle2D & | assign (const Segment2D &seg, const Vector2D &v) |
| | assign new segment and vertex point
|
| const Vector2D & | a () const |
| | get 1st point
|
| const Vector2D & | b () const |
| | get 2nd point
|
| const Vector2D & | c () const |
| | get 3rd point
|
| virtual double | area () const |
| | get the area of this region
|
| double | signedArea () const |
| | get a signed area. this method is equivalent to signed_area().
|
| double | doubleSignedArea () const |
| | get a double of signed area value. this method is equivalent to double_signed_area().
|
| bool | ccw () const |
| | check if this triangle's vertices are placed counterclockwise order.
|
| virtual bool | contains (const Vector2D &point) const |
| | check if this triangle contains 'point'.
|
| Vector2D | centroid () const |
| | get the center of gravity(centroid, JUU-SIN)
|
| Vector2D | incenter () const |
| | get the center of inscribed circle(NAI-SIN)
|
| Vector2D | circumcenter () const |
| | get the center of circumscribed circle(GAI-SIN)
|
| Vector2D | orthocenter () const |
| | get the orthocenter(SUI-SIN)
|
| int | intersection (const Line2D &line, Vector2D *sol1, Vector2D *sol2) const |
| | calculate intersection point with line.
|
| int | intersection (const Ray2D &ray, Vector2D *sol1, Vector2D *sol2) const |
| | calculate intersection point with ray.
|
| int | intersection (const Segment2D &segment, Vector2D *sol1, Vector2D *sol2) const |
| | calculate intersection point with line segment.
|
|
virtual | ~Region2D () |
| | virtual destructor.
|
|
| static double | double_signed_area (const Vector2D &a, const Vector2D &b, const Vector2D &c) |
| | get a double signed area value (== area of parallelogram)
|
| static double | signed_area (const Vector2D &a, const Vector2D &b, const Vector2D &c) |
| | get a signed area value
|
| static bool | ccw (const Vector2D &a, const Vector2D &b, const Vector2D &c) |
| | check if input vertices are placed counterclockwise order.
|
| static Vector2D | centroid (const Vector2D &a, const Vector2D &b, const Vector2D &c) |
| | get the center of gravity(JUU-SIN)
|
| static Vector2D | incenter (const Vector2D &a, const Vector2D &b, const Vector2D &c) |
| | get the incenter point(NAI-SIN)
|
| static Vector2D | circumcenter (const Vector2D &a, const Vector2D &b, const Vector2D &c) |
| | get the circumcenter point(GAI-SIN)
|
| static Vector2D | orthocenter (const Vector2D &a, const Vector2D &b, const Vector2D &c) |
| | get the orthomcenter point(SUI-SIN)
|
| static bool | contains (const Vector2D &a, const Vector2D &b, const Vector2D &c, const Vector2D &point) |
| | check if triangle(a,b,c) contains the point 'p'.
|
|
|
| Region2D () |
| | accessible only from derived classes
|
◆ Triangle2D() [1/2]
constructor with variables
- Parameters
-
| v1 | first vertex point |
| v2 | second vertex point |
| v3 | third vertex point |
◆ Triangle2D() [2/2]
constructor with a segment and a point
- Parameters
-
| seg | segment consist of triangle, first and second vertex points |
| v | third vertex point |
◆ a()
| const Vector2D & rcsc::Triangle2D::a |
( |
| ) |
const |
|
inline |
get 1st point
- Returns
- const reference to the member variable
◆ area()
| virtual double rcsc::Triangle2D::area |
( |
| ) |
const |
|
inlinevirtual |
get the area of this region
- Returns
- value of the area
Implements rcsc::Region2D.
◆ assign() [1/2]
assign new segment and vertex point
- Parameters
-
| seg | segment consist of triangle, first and second vertex points |
| v | third vertex point |
- Returns
- const reference to itself
◆ assign() [2/2]
assign new vertex points
- Parameters
-
| v1 | first vertex point |
| v2 | second vertex point |
| v3 | third vertex point |
- Returns
- const reference to itself
◆ b()
| const Vector2D & rcsc::Triangle2D::b |
( |
| ) |
const |
|
inline |
get 2nd point
- Returns
- const reference to the member variable
◆ c()
| const Vector2D & rcsc::Triangle2D::c |
( |
| ) |
const |
|
inline |
get 3rd point
- Returns
- const reference to the member variable
◆ ccw() [1/2]
| bool rcsc::Triangle2D::ccw |
( |
| ) |
const |
|
inline |
check if this triangle's vertices are placed counterclockwise order.
- Returns
- checked result
◆ ccw() [2/2]
check if input vertices are placed counterclockwise order.
- Parameters
-
| a | 1st input point |
| b | 2nd input point |
| c | 3rd input point |
- Returns
- checked result
◆ centroid() [1/2]
| Vector2D rcsc::Triangle2D::centroid |
( |
| ) |
const |
|
inline |
get the center of gravity(centroid, JUU-SIN)
- Returns
- coordinates of gravity center
◆ centroid() [2/2]
get the center of gravity(JUU-SIN)
- Parameters
-
| a | triangle's 1st vertex |
| b | triangle's 2nd vertex |
| c | triangle's 3rd vertex |
- Returns
- coordinates of gravity center
centroid = (a + b + c) / 3
◆ circumcenter() [1/2]
| Vector2D rcsc::Triangle2D::circumcenter |
( |
| ) |
const |
|
inline |
get the center of circumscribed circle(GAI-SIN)
- Returns
- coordinates of outer center
◆ circumcenter() [2/2]
get the circumcenter point(GAI-SIN)
- Parameters
-
| a | triangle's 1st vertex |
| b | triangle's 2nd vertex |
| c | triangle's 3rd vertex |
- Returns
- coordinates of circumcenter
◆ contains() [1/2]
check if triangle(a,b,c) contains the point 'p'.
- Parameters
-
| a | vertex1 |
| b | vertex2 |
| c | vertex3 |
| point | checked point |
- Returns
- checked result
◆ contains() [2/2]
| bool rcsc::Triangle2D::contains |
( |
const Vector2D & | point | ) |
const |
|
virtual |
check if this triangle contains 'point'.
- Parameters
-
- Returns
- true or false
Implements rcsc::Region2D.
◆ double_signed_area()
get a double signed area value (== area of parallelogram)
- Parameters
-
| a | 1st input point |
| b | 2nd input point |
| c | 3rd input point |
- Returns
- double sined area value. If points a, b, c are placed counterclockwise order, returns positive number. If points a, b, c are placed clockwise order, returns negative number. If points a, b, c are placed on a line, returns 0.
◆ doubleSignedArea()
| double rcsc::Triangle2D::doubleSignedArea |
( |
| ) |
const |
|
inline |
get a double of signed area value. this method is equivalent to double_signed_area().
- Returns
- double of signed area value If points a, b, c are placed counterclockwise order, returns positive number. If points a, b, c are placed clockwise order, returns negative number. If points a, b, c are placed on a line, returns 0.
◆ incenter() [1/2]
| Vector2D rcsc::Triangle2D::incenter |
( |
| ) |
const |
|
inline |
get the center of inscribed circle(NAI-SIN)
- Returns
- coordinates of inner center
◆ incenter() [2/2]
get the incenter point(NAI-SIN)
- Parameters
-
| a | triangle's 1st vertex |
| b | triangle's 2nd vertex |
| c | triangle's 3rd vertex |
- Returns
- coordinates of incenter
◆ intersection() [1/3]
calculate intersection point with line.
- Parameters
-
| line | considerd line. |
| sol1 | pointer to the 1st solution variable |
| sol2 | pointer to the 2nd solution variable |
- Returns
- number of intersection
◆ intersection() [2/3]
calculate intersection point with ray.
- Parameters
-
| ray | considerd ray line. |
| sol1 | pointer to the 1st solution variable |
| sol2 | pointer to the 2nd solution variable |
- Returns
- number of intersection
◆ intersection() [3/3]
calculate intersection point with line segment.
- Parameters
-
| segment | considerd line segment. |
| sol1 | pointer to the 1st solution variable |
| sol2 | pointer to the 2nd solution variable |
- Returns
- number of intersection
◆ isValid()
| bool rcsc::Triangle2D::isValid |
( |
| ) |
const |
|
inline |
check if this triangle is valid or not.
- Returns
- true if triangle is valid.
◆ orthocenter() [1/2]
| Vector2D rcsc::Triangle2D::orthocenter |
( |
| ) |
const |
|
inline |
get the orthocenter(SUI-SIN)
- Returns
- coordinates of ortho center
◆ orthocenter() [2/2]
get the orthomcenter point(SUI-SIN)
- Parameters
-
| a | triangle's 1st vertex |
| b | triangle's 2nd vertex |
| c | triangle's 3rd vertex |
- Returns
- coordinates of orthocenter
orthocenter = a + b + c - 2 * circumcenter
◆ signed_area()
get a signed area value
- Parameters
-
| a | 1st input point |
| b | 2nd input point |
| c | 3rd input point |
- Returns
- signed area value If points a, b, c are placed counterclockwise order, returns positive number. If points a, b, c are placed clockwise order, returns negative number. If points a, b, c are placed on a line, returns 0.
◆ signedArea()
| double rcsc::Triangle2D::signedArea |
( |
| ) |
const |
|
inline |
get a signed area. this method is equivalent to signed_area().
- Returns
- signed area value If points a, b, c are placed counterclockwise order, returns positive number. If points a, b, c are placed clockwise order, returns negative number. If points a, b, c are placed on a line, returns 0.
The documentation for this class was generated from the following files: