# TRIANGLE_PROPERTIES Properties of a Triangle

TRIANGLE_PROPERTIES is a C library which can compute properties of a triangle, including angles, area, centroid, circumcircle, edge lengths, incircle, orientation, orthocenter, and quality.

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;

### Licensing:

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

### Languages:

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

### Related Data and Programs:

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

HYPERSPHERE_PROPERTIES, a C 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 C 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 C program which computes properties of a given tetrahedron.

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

TRIANGLE_INTERPOLATE, a C 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;

### List of Routines:

• I4_MODP returns the nonnegative remainder of I4 division.
• I4_WRAP forces an I4 to lie between given limits by wrapping.
• LINE_EXP_IS_DEGENERATE_ND finds if an explicit line is degenerate in ND.
• LINE_EXP_PERP computes a line perpendicular to a line and through a point.
• LINE_EXP2IMP converts an explicit line to implicit form in 2D.
• LINE_IMP_IS_DEGENERATE finds if an implicit point is degenerate in 2D.
• LINES_EXP_INT determines where two explicit lines intersect in 2D.
• LINES_IMP_INT determines where two implicit lines intersect in 2D.
• R8_ACOS computes the arc cosine function, with argument truncation.
• R8_HUGE returns a "huge" R8.
• R8_MAX returns the maximum of two R8's.
• R8_MIN returns the minimum of two R8's.
• R8_UNIFORM_01 returns a pseudorandom R8 scaled to [0,1].
• R8MAT_INVERSE_2D inverts a 2 by 2 R8MAT using Cramer's rule.
• R8MAT_SOLVE uses Gauss-Jordan elimination to solve an N by N linear system.
• R8MAT_TRANSPOSE_PRINT prints an R8MAT, transposed.
• R8MAT_TRANSPOSE_PRINT_SOME prints some of an R8MAT, transposed.
• R8VEC_COPY copies an R8VEC.
• R8VEC_EQ is true if two R8VEC's are equal.
• R8VEC_NORM returns the L2 norm of an R8VEC.
• R8VEC_PRINT prints an R8VEC.
• SEGMENT_POINT_DIST: distance ( line segment, point ) in 2D.
• SEGMENT_POINT_NEAR finds the point on a line segment nearest a point in 2D.
• TIMESTAMP prints the current YMDHMS date as a time stamp.
• TRIANGLE_ANGLES computes the angles of a triangle in 2D.
• TRIANGLE_AREA computes the area of a triangle in 2D.
• TRIANGLE_CENTROID computes the centroid of a triangle in 2D.
• TRIANGLE_CIRCUMCIRCLE computes the circumcircle of a triangle in 2D.
• TRIANGLE_CONTAINS_POINT finds if a point is inside a triangle in 2D.
• TRIANGLE_DIAMETER computes the diameter of a triangle in 2D.
• TRIANGLE_EDGE_LENGTH returns edge lengths of a triangle in 2D.
• TRIANGLE_INCIRCLE computes the inscribed circle of a triangle in 2D.
• TRIANGLE_ORIENTATION determines the orientation of a triangle in 2D.
• TRIANGLE_ORTHOCENTER computes the orthocenter of a triangle in 2D.
• TRIANGLE_POINT_DIST: distance ( triangle, point ) in 2D.
• TRIANGLE_POINT_NEAR computes the nearest triangle point to a point in 2D.
• TRIANGLE_QUALITY: "quality" of a triangle in 2D.
• TRIANGLE_REFERENCE_SAMPLE returns random points in the reference triangle.
• TRIANGLE_SAMPLE returns random points in a triangle.
• TRIANGLE_XSI_TO_XY converts from barycentric to XY coordinates in 2D.
• TRIANGLE_XY_TO_XSI converts from XY to barycentric in 2D.

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

Last revised on 06 November 2015.