Triangle computations.
More...
|
function | triangle_lll2vp (s1, s2, s3) |
| Compute the vertices of a plane triangle given its side lengths. More...
|
|
function | triangle_vl2vp (v) |
| Compute the vertices of a plane triangle given its side lengths. More...
|
|
function | triangle_ppp2vl (v1, v2, v3) |
| Compute the side lengths of a triangle given its vertices. More...
|
|
function | triangle_vp2vl (v) |
| Compute the side lengths of a triangle given its vertices. More...
|
|
function | triangle_centroid_ppp (v1, v2, v3) |
| Compute the centroid (geometric center) of a triangle. More...
|
|
function | triangle_centroid_vp (v) |
| Compute the centroid (geometric center) of a triangle. More...
|
|
function | triangle_incenter_ppp (v1, v2, v3) |
| Compute the coordinate for the triangle's incircle. More...
|
|
function | triangle_incenter_vp (v) |
| Compute the coordinate for the triangle's incircle. More...
|
|
function | triangle_inradius_ppp (v1, v2, v3) |
| Compute the inradius of a triangle's incircle. More...
|
|
function | triangle_inradius_vp (v) |
| Compute the inradius of a triangle's incircle. More...
|
|
Triangle computations.
See Wikipedia for more information.
function triangle_centroid_ppp |
( |
v1 |
, |
|
|
v2 |
, |
|
|
v3 |
|
|
) |
| |
Compute the centroid (geometric center) of a triangle.
- Parameters
-
v1 | <vector> A vector [x, y] for vertex 1 coordinates. |
v2 | <vector> A vector [x, y] for vertex 2 coordinates. |
v3 | <vector> A vector [x, y] for vertex 3 coordinates. |
- Returns
- <vector> A vector [x, y] of coordinates.
function triangle_centroid_vp |
( |
v |
| ) |
|
Compute the centroid (geometric center) of a triangle.
- Parameters
-
v | <vector> A vector [v1, v2, v3] of vectors [x, y] coordinates. |
- Returns
- <vector> A vector [x, y] of coordinates.
function triangle_incenter_ppp |
( |
v1 |
, |
|
|
v2 |
, |
|
|
v3 |
|
|
) |
| |
Compute the coordinate for the triangle's incircle.
- Parameters
-
v1 | <vector> A vector [x, y] for vertex 1 coordinates. |
v2 | <vector> A vector [x, y] for vertex 2 coordinates. |
v3 | <vector> A vector [x, y] for vertex 3 coordinates. |
- Returns
- <vector> A vector [x, y] of coordinates.
The interior point for which distances to the sides of the triangle are equal.
function triangle_incenter_vp |
( |
v |
| ) |
|
Compute the coordinate for the triangle's incircle.
- Parameters
-
v | <vector> A vector [v1, v2, v3] of vectors [x, y] coordinates. |
- Returns
- <vector> A vector [x, y] of coordinates.
The interior point for which distances to the sides of the triangle are equal.
function triangle_inradius_ppp |
( |
v1 |
, |
|
|
v2 |
, |
|
|
v3 |
|
|
) |
| |
Compute the inradius of a triangle's incircle.
- Parameters
-
v1 | <vector> A vector [x, y] for vertex 1 coordinates. |
v2 | <vector> A vector [x, y] for vertex 2 coordinates. |
v3 | <vector> A vector [x, y] for vertex 3 coordinates. |
- Returns
- <decimal> The incircle radius.
function triangle_inradius_vp |
( |
v |
| ) |
|
Compute the inradius of a triangle's incircle.
- Parameters
-
v | <vector> A vector [v1, v2, v3] of vectors [x, y] coordinates. |
- Returns
- <decimal> The incircle radius.
function triangle_lll2vp |
( |
s1 |
, |
|
|
s2 |
, |
|
|
s3 |
|
|
) |
| |
Compute the vertices of a plane triangle given its side lengths.
- Parameters
-
s1 | <decimal> The length of the side 1. |
s2 | <decimal> The length of the side 2. |
s3 | <decimal> The length of the side 3. |
- Returns
- <vector> A vector [v1, v2, v3] of vectors [x, y] of coordinates.
Vertex v1
at the origin. Geometry required that s1
+ s2
is greater then s3
. Coordinates v3:
[x, y] will be 'nan' when specified triangle does not exists.
- Note
- Side length
s1
is measured along the positive x-axis.
-
Sides are numbered counterclockwise.
function triangle_ppp2vl |
( |
v1 |
, |
|
|
v2 |
, |
|
|
v3 |
|
|
) |
| |
Compute the side lengths of a triangle given its vertices.
- Parameters
-
v1 | <vector> A vector [x, y] for vertex 1 coordinates. |
v2 | <vector> A vector [x, y] for vertex 2 coordinates. |
v3 | <vector> A vector [x, y] for vertex 3 coordinates. |
- Returns
- <vector> A vector [s1, s2, s3] of lengths.
- Note
- Vertices are numbered counterclockwise.
function triangle_vl2vp |
( |
v |
| ) |
|
Compute the vertices of a plane triangle given its side lengths.
- Parameters
-
v | <vector> of decimal side lengths. |
- Returns
- <vector> A vector [v1, v2, v3] of vectors [x, y] of coordinates.
Vertex vs
[0] at the origin. Geometry required that vs
[0] + vs
[1] is greater then vs
[2]. Coordinates v3:
[x, y] will be 'nan' when specified triangle does not exists.
- Note
- Side length
vs
[0] is measured along the positive x-axis.
-
Sides are numbered counterclockwise.
function triangle_vp2vl |
( |
v |
| ) |
|
Compute the side lengths of a triangle given its vertices.
- Parameters
-
v | <vector> A vector [v1, v2, v3] of vectors [x, y] coordinates. |
- Returns
- <vector> A vector [s1, s2, s3] of lengths.
- Note
- Vertices are numbered counterclockwise.