Properties of a Triangle

**TRIANGLE_PROPERTIES**
is a Python program which
can compute properties, including angles, area, centroid, circumcircle,
edge lengths, incircle, orientation, orthocenter, and quality,
of a triangle in 2D.

These properties include:

- Angles;
- Area;
- Centroid;
- Circumcircle (center and radius);
- Edge lengths;
- Incircle (center and radius);
- Orientation;
- Orthocenter;
- Quality: ratio of incircle radius / circumcircle radius;

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

**TRIANGLE_PROPERTIES** is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version and
a Python version.

POLYGON_PROPERTIES, a Python library which computes properties of an arbitrary polygon in the plane, defined by a sequence of vertices, including interior angles, area, centroid, containment of a point, convexity, diameter, distance to a point, inradius, lattice area, nearest point in set, outradius, uniform sampling.

TRIANGLE_INTERPOLATE, a Python library which shows how vertex data can be interpolated at any point in the interior of a triangle.

TRIANGLES, a dataset directory which contains examples of triangles;

- i4_modp.py, returns the nonnegative remainder of integer division;
- i4_wrap.py, forces an integer to lie in a given range;
- line_exp_perp_2d.py, returns a line perpendicular to an explicit line in 2D;
- line_exp2imp_2d.py, converts an explicit line to an implicit line in 2D;
- lines_exp_int_2d.py, finds the intersection of two explicit lines in 2D;
- lines_imp_int_2d.py, finds the intersection of two implicit lines in 2D;
- r8_acos.py, computes the inverse cosine of C;
- r8mat_print.py, prints an R8MAT;
- r8mat_print_some.py, prints some of an R8MAT;
- r8mat_solve.py, solves an N by N linear system with multiple right hand sides.
- r8mat_transpose_print.py, prints the transpose of an R8MAT;
- r8mat_transpose_print_some.py, prints some of the transpose of an R8MAT;
- r8vec_print.py, prints an R8VEC;
- r8vec_uniform_01.py, returns a unit pseudorandom R8VEC.
- segment_point_dist_2d.py, computes the distance between a point and a line segment in 2D;
- segment_point_near_2d.py, returns the nearest line segment point to a point in 2D;
- timestamp.py, prints the current YMDHMS date as a timestamp;
- triangle_angles.py, returns the angles of a triangle in 2D;
- triangle_area.py, returns the area of a triangle in 2D;
- triangle_centroid.py, returns the centroid of a triangle in 2D;
- triangle_circumcircle.py, returns the circumcenter of a triangle in 2D;
- triangle_contains_point.py, determines if a point is in a triangle in 2D;
- triangle_edge_length.py, returns the edge lengths of a triangle in 2D;
- triangle_incircle.py, returns the incircle of a triangle in 2D;
- triangle_orientation.py, returns the orientation of a triangle in 2D;
- triangle_orthocenter.py, returns the orthocenter of a triangle in 2D;
- triangle_point_dist.py, returns the distance of point to a triangle in 2D;
- triangle_point_near.py, returns the nearest point on a triangle in 2D;
- triangle_quality.py, returns the shape quality of a triangle in 2D;
- triangle_reference_sample.py, randomly samples a point from the reference triangle in 2D;
- triangle_sample.py, randomly samples a point from a triangle in 2D;
- triangle_xsi_to_xy.py, converts barycentric to cartesian coordinates in a triangle in 2D;
- triangle_xy_to_xsi.py, converts cartesian to barycentric coordinates in a triangle in 2D;

- triangle_properties_test.py, calls all the tests;
- triangle_properties_test.sh, runs all the tests;
- triangle_properties_test_output.txt, the output file;

You can go up one level to the Python source codes.