triangle (original) (raw)
triangle, a MATLAB code which computes properties of a triangle, including angles, area, centroid, circumcircle, edge lengths, incircle, orientation, orthocenter, quality, Cartesian to barycentric coordinates, barycentric coordinates to Cartesian. A point is treated as a (1,2) array, a list of points as an (n,2) array, and a triangle as a (3,2) array.
Licensing:
The information on this web page is distributed under the MIT license.
Languages:
triangle is available ina C version anda C++ version anda Fortran90 version anda MATLAB version andan Octave version anda Python version.
Related Data and Programs:
ellipse, a MATLAB code which carries out geometric calculations for ellipses and ellipsoids, including area, distance to a point, eccentricity, perimeter, points along the perimeter, random sampling, conversion between standard and quadratic forms.
geometry, a MATLAB code which performs geometric calculations in 2, 3 and n dimensional space.
hypersphere, a MATLAB code 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, a MATLAB code 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.
quadrilateral, a MATLAB code which carries out geometric calculations on quadrilaterals, including angles, area, distances, nearest point, point containment, perimeter, and random generation.
tetrahedron, a MATLAB code which computes properties of a given tetrahedron.
triangle_analyze, a MATLAB code which reads a triangle from a file, and then reports various properties.
triangle_interpolate, a MATLAB code 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;
Source Code:
- 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;
- r8mat_solve.m, solves an N by N linear system with multiple right hand sides.
- 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;
- 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_sample_reflect.m, randomly samples a point from a triangle in 2D, using reflection;
- 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;
Last revised on 11 January 2025.