Properties of a Triangle

**TRIANGLE_PROPERTIES**,
a MATLAB 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.

GEOMETRY, a MATLAB library which performs geometric calculations in 2, 3 and N dimensional space.

HYPERSPHERE_PROPERTIES, a MATLAB library which carries out various operations for an M-dimensional hypersphere, including converting between Cartesian and spherical coordinates, stereographic projection, sampling the surface of the sphere, and computing the surface area and volume.

POLYGON_PROPERTIES, a MATLAB 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.

TETRAHEDRON_PROPERTIES, a MATLAB program which computes properties of a given tetrahedron.

TRIANGLE_ANALYZE, a MATLAB program which reads a triangle from a file, and then reports various properties.

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