# GEOMETRY Geometric Calculations

GEOMETRY is a FORTRAN77 library which carries out geometric calculations in 2, 3 and N dimensional space.

These calculations include angles, areas, containment, distances, intersections, lengths, and volumes.

Some geometric objects can be described in a variety of ways. For instance, a line has implicit, explicit and parametric representations. The names of routines often will specify the representation used, and there are routines to convert from one representation to another.

Another useful task is the delineation of a standard geometric object. For instance, there is a routine that will return the location of the vertices of an octahedron, and others to produce a series of "equally spaced" points on a circle, ellipse, sphere, or within the interior of a triangle.

### Languages:

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

### Related Data and Programs:

GEOMPACK, a FORTRAN77 library which computes the Delaunay triangulation and Voronoi diagram of 2D data.

POLYGON_MOMENTS, a FORTRAN77 library which computes arbitrary moments of a polygon.

SIMPLEX_COORDINATES, a FORTRAN77 library which computes the Cartesian coordinates of the vertices of a regular simplex in M dimensions.

SPHERE_GRID, a FORTRAN77 library which provides a number of ways of generating grids of points, or of points and lines, or of points and lines and faces, over the unit sphere.

TETRAHEDRONS, a dataset directory which contains examplesof tetrahedrons;

TRIANGULATION_DISPLAY_OPENGL, a C++ program which reads files defining a triangulation and displays an image using Open GL.

TRIANGULATION_TRIANGLE_NEIGHBORS, a FORTRAN90 program which reads data defining a triangulation, determines the neighboring triangles of each triangle, and writes that information to a file.

### Reference:

1. Gerard Bashein, Paul Detmer,
Centroid of a Polygon,
in Graphics Gems IV,
edited by Paul Heckbert,
AP Professional, 1994,
ISBN: 0123361559,
LC: T385.G6974.
2. SF Bockman,
Generalizing the Formula for Areas of Polygons to Moments,
American Mathematical Society Monthly,
Volume 96, Number 2, February 1989, pages 131-132.
A Programmer's Geometry,
Butterworths, 1983,
ISBN: 0408012420.
4. Paulo Cezar Pinto Carvalho, Paulo Roma Cavalcanti,
Point in Polyhedron Testing Using Spherical Polygons,
in Graphics Gems V,
edited by Alan Paeth,
ISBN: 0125434553,
LC: T385.G6975.
5. Daniel Cohen,
Voxel Traversal along a 3D Line,
in Graphics Gems IV,
edited by Paul Heckbert,
AP Professional, 1994,
ISBN: 0123361559,
LC: T385.G6974.
6. Thomas Cormen, Charles Leiserson, Ronald Rivest,
Introduction to Algorithms,
MIT Press, 2001,
ISBN: 0262032937.
7. Marc deBerg, Marc Krevald, Mark Overmars, Otfried Schwarzkopf,
Computational Geometry,
Springer, 2000,
ISBN: 3-540-65620-0.
8. Jack Dongarra, Jim Bunch, Cleve Moler, Pete Stewart,
LINPACK User's Guide,
SIAM, 1979,
ISBN13: 978-0-898711-72-1.
9. James Foley, Andries vanDam, Steven Feiner, John Hughes,
Computer Graphics, Principles and Practice,
Second Edition,
ISBN: 0201848406,
LC: T385.C5735.
10. Martin Gardner,
The Mathematical Carnival,
Knopf, 1975,
ISBN: 0394494067
Signed Distance From Point To Plane,
in Graphics Gems III,
edited by David Kirk,
ISBN: 0124096735,
LC: T385.G6973.
12. Branko Gruenbaum, Geoffrey Shephard,
Pick's Theorem,
The American Mathematical Monthly,
Volume 100, Number 2, February 1993, pages 150-161.
13. John Harris, Horst Stocker,
Handbook of Mathematics and Computational Science,
Springer, 1998,
ISBN: 0-387-94746-9,
LC: QA40.S76.
14. Barry Joe,
GEOMPACK - a software package for the generation of meshes using geometric algorithms,
Volume 13, 1991, pages 325-331.
15. Jack Kuipers,
Quaternions and Rotation Sequences,
Princeton, 1998,
ISBN: 0691102988.
16. Robert Miller,
Computing the Area of a Spherical Polygon,
in Graphics Gems IV,
edited by Paul Heckbert,
ISBN: 0123361559,
LC: T385.G6974.
17. Albert Nijenhuis, Herbert Wilf,
Combinatorial Algorithms for Computers and Calculators,
Second Edition,
ISBN: 0-12-519260-6,
LC: QA164.N54.
18. Atsuyuki Okabe, Barry Boots, Kokichi Sugihara, Sung Nok Chiu,
Spatial Tesselations: Concepts and Applications of Voronoi Diagrams,
Second Edition,
Wiley, 2000,
, LC: QA278.2.O36,
ISBN: 0-471-98635-6.
19. Joseph ORourke,
Computational Geometry,
Second Edition,
Cambridge, 1998,
ISBN: 0521649765,
LC: QA448.D38.
20. Edward Saff, Arno Kuijlaars,
Distributing Many Points on a Sphere,
The Mathematical Intelligencer,
Volume 19, Number 1, 1997, pages 5-11.
21. Peter Schorn, Frederick Fisher,
Testing the Convexity of a Polygon,
in Graphics Gems IV,
edited by Paul Heckbert,
AP Professional, 1994,
ISBN: 0123361559,
LC: T385.G6974.
22. M Shimrat,
Position of Point Relative to Polygon,
ACM Algorithm 112,
Communications of the ACM,
Volume 5, Number 8, page 434, August 1962.
23. Kenneth Stephenson,
Introduction to Circle Packing, The Theory of Discrete Analytic Functions,
Cambridge, 2005,
ISBN: 0521823560,
LC: QA640.7S74.
24. Allen VanGelder,
Efficient Computation of Polygon Area and Polyhedron Volume,
in Graphics Gems V,
edited by Alan Paeth,
AP Professional, 1995,
ISBN: 0125434553,
LC: T385.G6975.
25. Daniel Zwillinger, Steven Kokoska,
Standard Probability and Statistical Tables,
CRC Press, 2000,
ISBN 1-58488-059-7.

### List of Routines:

• ANGLE_BOX_2D "boxes" an angle defined by three points in 2D.
• ANGLE_CONTAINS_POINT_2D determines if an angle contains a point, in 2D.
• ANGLE_DEG_2D returns the angle swept out between two rays in 2D.
• ANGLE_HALF_2D finds half an angle in 2D.
• ANGLE_RAD_2D returns the angle in radians swept out between two rays in 2D.
• ANGLE_RAD_3D returns the angle in radians between two rays in 3D.
• ANGLE_RAD_ND returns the angle in radians between two rays in ND.
• ANGLE_TURN_2D computes a turning angle in 2D.
• ANNULUS_AREA_2D computes the area of a circular annulus in 2D.
• ANNULUS_SECTOR_AREA_2D computes the area of an annular sector in 2D.
• ANNULUS_SECTOR_CENTROID_2D computes the centroid of an annular sector in 2D.
• ARC_COSINE computes the arc cosine function, with argument truncation.
• ARC_SINE computes the arc sine function, with argument truncation.
• ATAN4 computes the inverse tangent of the ratio Y / X.
• BALL_UNIT_SAMPLE_2D picks a random point in the unit ball in 2D.
• BALL_UNIT_SAMPLE_3D picks a random point in the unit ball in 3D.
• BALL_UNIT_SAMPLE_ND picks a random point in the unit ball in ND.
• BASIS_MAP_3D computes the matrix which maps one basis to another in 3D.
• BOX_01_CONTAINS_POINT_2D determines if a point is inside the unit box in 2D.
• BOX_01_CONTAINS_POINT_ND determines if a point is inside the unit box in ND.
• BOX_CONTAINS_POINT_2D determines if a point is inside a box in 2D.
• BOX_CONTAINS_POINT_ND determines if a point is inside a box in ND.
• BOX_CONTAINS_SEGMENT_ND reports if a box contains a line segment in ND.
• BOX_RAY_INT_2D: intersection ( box, ray ) in 2D.
• BOX_SEGMENT_CLIP_2D uses a box to clip a line segment in 2D.
• CIRCLE_ARC_POINT_NEAR_2D : nearest point on a circular arc.
• CIRCLE_AREA_2D computes the area of a circle in 2D.
• CIRCLE_DIA2IMP_2D converts a diameter to an implicit circle in 2D.
• CIRCLE_EXP_CONTAINS_POINT_2D: explicit circle contains a point in 2D.
• CIRCLE_EXP2IMP_2D converts a circle from explicit to implicit form in 2D.
• CIRCLE_IMP_CONTAINS_POINT_2D: implicit circle contains a point in 2D?
• CIRCLE_IMP_LINE_EXP_DIST_2D: distance ( implicit circle, explicit line ) in 2D.
• CIRCLE_IMP_LINE_PAR_INT_2D: ( implicit circle, parametric line ) intersection in 2D.
• CIRCLE_IMP_POINT_DIST_2D: distance ( implicit circle, point ) in 2D.
• CIRCLE_IMP_POINT_DIST_SIGNED_2D: signed distance ( imp circle, point ) in 2D.
• CIRCLE_IMP_POINT_NEAR_2D: nearest ( implicit circle, point ) in 2D.
• CIRCLE_IMP_POINTS_2D returns points on an implicit circle in 2D.
• CIRCLE_IMP_POINTS_3D returns points on an implicit circle in 3D.
• CIRCLE_IMP_POINTS_ARC_2D: N points on an arc of an implicit circle in 2D.
• CIRCLE_IMP_PRINT_2D prints an implicit circle in 2D.
• CIRCLE_IMP_PRINT_3D prints an implicit circle in 3D.
• CIRCLE_IMP2EXP_2D converts a circle from implicit to explicit form in 2D.
• CIRCLE_LLR2IMP_2D converts a circle from LLR to implicit form in 2D.
• CIRCLE_LUNE_AREA_2D returns the area of a circular lune in 2D.
• CIRCLE_LUNE_CENTROID_2D returns the centroid of a circular lune in 2D.
• CIRCLE_PPPR2IMP_3D converts a circle from PPPR to implicit form in 3D.
• CIRCLE_PPR2IMP_2D converts a circle from PPR to implicit form in 2D.
• CIRCLE_SECTOR_AREA_2D computes the area of a circular sector in 2D.
• CIRCLE_SECTOR_CENTROID_2D returns the centroid of a circular sector in 2D.
• CIRCLE_SECTOR_CONTAINS_POINT_2D : is a point inside a circular sector?
• CIRCLE_SECTOR_PRINT_2D prints a circular sector in 2D.
• CIRCLE_TRIANGLE_AREA_2D returns the area of a circle triangle in 2D.
• CIRCLE_TRIPLE_ANGLE_2D returns an angle formed by three circles in 2D.
• CIRCLES_IMP_INT_2D: finds the intersection of two implicit circles in 2D.
• COMBIN2 computes the binomial coefficient C(N,K).
• CONE_AREA_3D computes the surface area of a right circular cone in 3D.
• CONE_CENTROID_3D returns the centroid of a cone in 3D.
• CONE_VOLUME_3D computes the volume of a right circular cone in 3D.
• CONV3D converts 3D data to a 2D projection.
• COS_DEG returns the cosine of an angle given in degrees.
• COT_DEG returns the cotangent of an angle given in degrees.
• COT_RAD returns the cotangent of an angle.
• CSC_DEG returns the cosecant of an angle given in degrees.
• CUBE_SHAPE_3D describes a cube in 3D.
• CUBE_SIZE_3D gives "sizes" for a cube in 3D.
• CYLINDER_POINT_DIST_3D: distance from a cylinder to a point in 3D.
• CYLINDER_POINT_INSIDE_3D determines if a cylinder contains a point in 3D.
• CYLINDER_POINT_NEAR_3D: nearest point on a cylinder to a point in 3D.
• CYLINDER_SAMPLE_3D samples a cylinder in 3D.
• CYLINDER_VOLUME_3D determines the volume of a cylinder in 3D.
• DIRECTION_PERT_3D randomly perturbs a direction vector in 3D.
• DIRECTION_UNIFORM_2D picks a random direction vector in 2D.
• DIRECTION_UNIFORM_3D picks a random direction vector in 3D.
• DIRECTION_UNIFORM_ND generates a random direction vector in ND.
• DISK_POINT_DIST_3D determines the distance from a disk to a point in 3D.
• DODEC_SHAPE_3D describes a dodecahedron in 3D.
• DODEC_SIZE_3D gives "sizes" for a dodecahedron in 3D.
• DUAL_SHAPE_3D constructs the dual of a shape in 3D.
• DUAL_SIZE_3D determines sizes for a dual of a shape in 3D.
• ELLIPSE_AREA_2D returns the area of an ellipse in 2D.
• ELLIPSE_POINT_DIST_2D finds the distance from a point to an ellipse in 2D.
• ELLIPSE_POINT_NEAR_2D finds the nearest point on an ellipse in 2D.
• ELLIPSE_POINTS_2D returns N points on an tilted ellipse in 2D.
• ELLIPSE_POINTS_ARC_2D returns N points on a tilted elliptical arc in 2D.
• GET_SEED returns a seed for the random number generator.
• GET_UNIT returns a free FORTRAN unit number.
• GLOB2LOC_3D converts from a global to a local coordinate system in 3D.
• HALFPLANE_CONTAINS_POINT_2D reports if a half-plane contains a point in 2d.
• HALFSPACE_IMP_TRIANGLE_INT_3D: intersection ( imp halfspace, triangle ).
• HALFSPACE_NORMAL_TRIANGLE_INT_3D: intersection ( norm halfspace, triangle ).
• HALFSPACE_TRIANGLE_INT_3D: intersection ( halfspace, triangle ) in 3D.
• HAVERSINE computes the haversine of an angle.
• HELIX_SHAPE_3D computes points on a helix in 3D.
• HEXAGON_AREA_2D returns the area of a regular hexagon in 2D.
• HEXAGON_UNIT_AREA_2D returns the area of a unit regular hexagon in 2D.
• I4_DEDEKIND_FACTOR computes a function needed for a Dedekind sum.
• I4_GCD finds the greatest common divisor of I and J.
• I4_HUGE returns a "huge" I4.
• I4_LCM computes the least common multiple of two I4's.
• I4_MODP returns the nonnegative remainder of integer division.
• I4_SWAP switches two I4's.
• I4_UNIFORM returns a scaled pseudorandom I4.
• I4_WRAP forces an I4 to lie between given limits by wrapping.
• I4COL_COMPARE compares columns I and J of an I4COL.
• I4COL_FIND_ITEM searches an I4COL for a given scalar value.
• I4COL_FIND_PAIR_WRAP searches an I4COL for a pair of items.
• I4COL_SORT_A ascending sorts an I4COL.
• I4COL_SORTED_UNIQUE_COUNT counts unique elements in an I4COL.
• I4COL_SWAP swaps columns J1 and J2 of an I4COL.
• I4MAT_PRINT prints an I4MAT.
• I4MAT_PRINT_SOME prints some of an I4MAT.
• I4MAT_TRANSPOSE_PRINT prints an I4MAT, transposed.
• I4MAT_TRANSPOSE_PRINT_SOME prints some of the transpose of an I4MAT.
• I4ROW_COMPARE compares two rows of an I4ROW.
• I4ROW_SORT_A ascending sorts the rows of an I4ROW.
• I4ROW_SORTED_UNIQUE_COUNT counts unique elements in an I4ROW.
• I4ROW_SWAP swaps two rows of an I4ROW.
• I4VEC_HEAP_D reorders an I4VEC into an descending heap.
• I4VEC_INDICATOR sets an I4VEC to the indicator vector.
• I4VEC_LCM returns the least common multiple of an I4VEC.
• I4VEC_PRINT prints an I4VEC.
• I4VEC_PRODUCT returns the product of the entries of an I4VEC.
• I4VEC_REVERSE reverses the elements of an I4VEC.
• I4VEC_SORT_HEAP_A ascending sorts an I4VEC using heap sort.
• I4VEC_SORTED_UNIQUE finds the unique elements in a sorted I4VEC.
• I4VEC_UNIFORM returns a scaled pseudorandom I4VEC.
• I4VEC_ZERO sets the entries of an I4VEC to 0.
• I4VEC2_COMPARE compares pairs of integers stored in two vectors.
• I4VEC2_SORT_A ascending sorts a vector of pairs of integers.
• I4VEC2_SORTED_UNIQUE gets the unique elements in a sorted I4VEC2.
• ICOS_SHAPE describes an icosahedron.
• ICOS_SIZE gives "sizes" for an icosahedron in 3D.
• LINE_EXP_IS_DEGENERATE_ND finds if an explicit line is degenerate in ND.
• LINE_EXP_NORMAL_2D computes a unit normal vector to a line in 2D.
• LINE_EXP_PERP_2D computes a line perpendicular to a line and through a point.
• LINE_EXP_POINT_DIST_2D: distance ( explicit line, point ) in 2D.
• LINE_EXP_POINT_DIST_3D: distance ( explicit line, point ) in 3D.
• LINE_EXP_POINT_DIST_SIGNED_2D: signed distance ( exp line, point ) in 2D.
• LINE_EXP_POINT_NEAR_2D: point on an explicit line nearest a point in 2D.
• LINE_EXP_POINT_NEAR_3D: nearest point on explicit line to point in 3D.
• LINE_EXP2IMP_2D converts an explicit line to implicit form in 2D.
• LINE_EXP2PAR_2D converts a line from explicit to parametric form in 2D.
• LINE_EXP2PAR_3D converts a line from explicit to parametric form in 3D.
• LINE_IMP_IS_DEGENERATE_2D finds if an implicit point is degenerate in 2D.
• LINE_IMP_POINT_DIST_2D: distance ( implicit line, point ) in 2D.
• LINE_IMP_POINT_DIST_SIGNED_2D: signed distance ( imp line, point ) in 2D.
• LINE_IMP2EXP_2D converts an implicit line to explicit form in 2D.
• LINE_IMP2PAR_2D converts an implicit line to parametric form in 2D.
• LINE_PAR_POINT_DIST_2D: distance ( parametric line, point ) in 2D.
• LINE_PAR_POINT_DIST_3D: distance ( parametric line, point ) in 3D.
• LINE_PAR2EXP_2D converts a parametric line to explicit form in 2D.
• LINE_PAR2IMP_2D converts a parametric line to implicit form in 2D.
• LINES_EXP_ANGLE_3D finds the angle between two explicit lines in 3D.
• LINES_EXP_PARALLEL_2D determines if two lines are parallel in 2D.
• LINES_EXP_PARALLEL_3D determines if two lines are parallel in 3D.
• OCTAHEDRON_SIZE_3D returns size information for an octahedron in 3D.
• PARALLELOGRAM_AREA_2D computes the area of a parallelogram in 2D.
• PARALLELOGRAM_AREA_3D computes the area of a parallelogram in 3D.
• PERM_INVERSE inverts a permutation "in place".
• PLANE_EXP_NORMAL_3D finds the normal to an explicit plane in 3D.
• PLANE_EXP2IMP_3D converts an explicit plane to implicit form in 3D.
• PLANE_EXP2NORMAL_3D converts an explicit plane to normal form in 3D.
• PLANE_IMP_IS_DEGENERATE_3D is TRUE if an implicit plane is degenerate.
• PLANE_IMP2EXP_3D converts an implicit plane to explicit form in 3D.
• PLANE_IMP2NORMAL_3D converts an implicit plane to normal form in 3D.
• PLANE_NORMAL_BASIS_3D finds two perpendicular vectors in a plane in 3D.
• PLANE_NORMAL_QR_TO_XYZ: QR_TO_XYZ coordinates for a normal form plane.
• PLANE_NORMAL_TETRAHEDRON_INTERSECT intersects a plane and a tetrahedron.
• PLANE_NORMAL_UNIFORM_3D generates a random normal plane in 3D.
• PLANE_NORMAL_UNIFORM_ND generates a random normal plane in ND.
• PLANE_NORMAL_XYZ_TO_QR: XYZ to QR coordinates for a normal form plane.
• PLANE_NORMAL2EXP_3D converts a normal plane to explicit form in 3D.
• PLANE_NORMAL2IMP_3D converts a normal form plane to implicit form in 3D.
• POINTS_DIST_ND finds the distance between two points in ND.
• POINTS_HULL_2D computes the convex hull of 2D points.
• POINTS_POINT_NEAR_NAIVE_ND finds the nearest point to a given point in ND.
• POLAR_TO_XY converts polar coordinates to XY coordinates.
• POLYGON_1_2D integrates the function 1 over a polygon in 2D.
• POLYGON_ANGLES_2D computes the interior angles of a polygon in 2D.
• POLYGON_AREA_2D computes the area of a polygon in 2D.
• POLYGON_AREA_2D_2 computes the area of a polygon in 2D.
• POLYGON_AREA_3D computes the area of a polygon in 3D.
• POLYGON_AREA_3D_2 computes the area of a polygon in 3D.
• POLYGON_LATTICE_AREA_2D computes the area of a lattice polygon in 2D.
• POLYGON_X_2D integrates the function X over a polygon in 2D.
• POLYGON_XX_2D integrates the function X*X over a polygon in 2D.
• POLYGON_XY_2D integrates the function X*Y over a polygon in 2D.
• POLYGON_Y_2D integrates the function Y over a polygon in 2D.
• POLYGON_YY_2D integrates the function Y*Y over a polygon in 2D.
• POLYHEDRON_AREA_3D computes the surface area of a polyhedron in 3D.
• POLYHEDRON_VOLUME_3D computes the volume of a polyhedron in 3D.
• PYRAMID_VOLUME_3D computes the volume of a pyramid with square base in 3D.
• QUAD_CONTAINS_POINT_2D finds if a point is inside a convex quadrilateral in 2D.
• QUAT_CONJ conjugates a quaternion.
• QUAT_INV inverts a quaternion.
• QUAT_MUL multiplies two quaternions.
• QUAT_NORM computes the norm of a quaternion.
• R4_UNIFORM_01 returns a unit pseudorandom R4.
• R8_HUGE returns a "huge" R8.
• R8_IS_INT determines if an R8 represents an integer value.
• R8_MODP returns the nonnegative remainder of R8 division.
• R8_NORMAL_01 returns a unit pseudonormal R8.
• R8_PI returns the value of pi as an R8.
• R8_SIGN_OPPOSITE_STRICT is TRUE if two R8's are strictly of opposite sign.
• R8_SWAP switches two R8's.
• R8_UNIFORM returns a scaled pseudorandom R8.
• R8_UNIFORM_01 returns a unit pseudorandom R8.
• R82VEC_PERMUTE permutes an R82VEC in place.
• R82VEC_SORT_HEAP_INDEX_A ascending index heaps an R82VEC.
• R8GE_DET computes the determinant of a matrix factored by R8GE_FA or R8GE_TRF.
• R8GE_FA performs a LINPACK style PLU factorization of an R8GE matrix.
• R8GE_SL solves a system factored by R8GE_FA.
• R8MAT_COPY copies an R8MAT.
• R8MAT_DET_2D computes the determinant of a 2 by 2 matrix.
• R8MAT_DET_3D computes the determinant of a 3 by 3 matrix.
• R8MAT_DET_4D computes the determinant of a 4 by 4 R8MAT.
• R8MAT_DET_5D computes the determinant of a 5 by 5 R8MAT.
• R8MAT_INVERSE_2D inverts a 2 by 2 R8MAT using Cramer's rule.
• R8MAT_INVERSE_3D inverts a 3 by 3 R8MAT using Cramer's rule.
• R8MAT_MM multiplies two R8MAT's.
• R8MAT_MV multiplies a matrix times a vector.
• R8MAT_PRINT prints an R8MAT.
• R8MAT_PRINT_SOME prints some of an R8MAT.
• R8MAT_SOLVE uses Gauss-Jordan elimination to solve an N by N linear system.
• R8MAT_SOLVE_2D solves a 2 by 2 linear system using Cramer's rule.
• R8MAT_TRANSPOSE_PRINT prints an R8MAT, transposed.
• R8MAT_TRANSPOSE_PRINT_SOME prints some of an R8MAT transposed.
• R8MAT_UNIFORM returns a scaled pseudorandom R8MAT.
• R8MAT_UNIFORM_01 returns a unit pseudorandom R8MAT.
• R8VEC_ANGLE_3D computes the angle between two vectors in 3D.
• R8VEC_BRACKET searches a sorted array for successive brackets of a value.
• R8VEC_CROSS_PRODUCT_2D finds the cross product of a pair of vectors in 2D.
• R8VEC_CROSS_PRODUCT_AFFINE_2D finds the affine cross product in 2D.
• R8VEC_CROSS_PRODUCT_3D computes the cross product of two R8VEC's in 3D.
• R8VEC_CROSS_PRODUCT_AFFINE_3D computes the affine cross product in 3D.
• R8VEC_DIFF_DOT_PRODUCT: dot product of a pair of R8VEC differences.
• R8VEC_DIFF_NORM returns the L2 norm of the difference of R8VEC's.
• R8VEC_DIFF_NORM_SQUARED: square of the L2 norm of the difference of R8VEC's.
• R8VEC_DOT_PRODUCT finds the dot product of a pair of R8VEC's.
• R8VEC_DOT_PRODUCT_AFFINE computes the affine dot product V1-V0 * V2-V0.
• R8VEC_EQ is true if every pair of entries in two vectors is equal.
• R8VEC_GT: ( A1 > A2 ) for double precision vectors.
• R8VEC_LT: ( A1 < A2 ) for double precision vectors.
• R8VEC_NEGATIVE_STRICT: every element of an R8VEC is strictly negative.
• R8VEC_NORM returns the L2 norm of an R8VEC.
• R8VEC_NORM_AFFINE returns the affine norm of an R8VEC.
• R8VEC_NORM_SQUARED returns the square of the L2 norm of an R8VEC.
• R8VEC_NORMAL_01 returns a unit pseudonormal R8VEC.
• R8VEC_NORMSQ returns the square of the L2 norm of an R8VEC.
• R8VEC_NORMSQ_AFFINE returns the affine squared norm of an R8VEC.
• R8VEC_POLARIZE decomposes an R8VEC into normal and parallel components.
• R8VEC_POSITIVE_STRICT: every element of an R8VEC is strictly positive.
• R8VEC_PRINT prints an R8VEC.
• R8VEC_SCALAR_TRIPLE_PRODUCT finds the scalar triple product in 3D.
• R8VEC_SWAP swaps the entries of two R8VEC's.
• R8VEC_UNIFORM returns a scaled pseudorandom R8VEC.
• R8VEC_UNIFORM_01 returns a unit pseudorandom R8VEC.
• RADEC_DISTANCE_3D - angular distance, astronomical units, sphere in 3D.
• RADEC_TO_XYZ converts right ascension/declination to (X,Y,Z) coordinates.
• ROTATION_AXIS_VECTOR_3D rotates a vector around an axis vector in 3D.
• ROTATION_AXIS2MAT_3D converts a rotation from axis to matrix format in 3D.
• ROTATION_AXIS2QUAT_3D converts rotation from axis to quaternion form in 3D.
• ROTATION_MAT_VECTOR_3D applies a marix rotation to a vector in 3d.
• RTP_TO_XYZ converts (R,Theta,Phi) to (X,Y,Z) coordinates.
• SEC_DEG returns the secant of an angle given in degrees.
• SEGMENT_CONTAINS_POINT_1D reports if a line segment contains a point in 1D.
• SIMPLEX_LATTICE_LAYER_POINT_NEXT: next simplex lattice layer point.
• SIMPLEX_LATTICE_POINT_NEXT returns the next simplex lattice point.
• SIMPLEX_UNIT_LATTICE_POINT_NUM_ND: count lattice points.
• SIMPLEX_UNIT_VOLUME_ND computes the volume of the unit simplex in ND.
• SIMPLEX_VOLUME_ND computes the volume of a simplex in ND.
• SIN_DEG returns the sine of an angle given in degrees.
• SIN_POWER_INT evaluates the sine power integral.
• SOCCER_SIZE_3D gives "sizes" for a truncated icosahedron in 3D.
• SORT_HEAP_EXTERNAL externally sorts a list of items into ascending order.
• SPHERE_CAP_AREA_2D computes the surface area of a spherical cap in 2D.
• SPHERE_CAP_AREA_3D computes the surface area of a spherical cap in 3D.
• SPHERE_CAP_AREA_ND computes the area of a spherical cap in ND.
• SPHERE_CAP_VOLUME_2D computes the volume of a spherical cap in 2D.
• SPHERE_CAP_VOLUME_3D computes the volume of a spherical cap in 3D.
• SPHERE_CAP_VOLUME_ND computes the volume of a spherical cap in ND.
• SPHERE_DIA2IMP_3D converts a diameter to an implicit sphere in 3D.
• SPHERE_DISTANCE_XYZ computes great circle distances on a sphere.
• SPHERE_DISTANCE1 computes great circle distances on a sphere.
• SPHERE_DISTANCE2 computes great circle distances on a sphere.
• SPHERE_DISTANCE3 computes great circle distances on a sphere.
• SPHERE_EXP_CONTAINS_POINT_3D: does an explicit sphere contain a point in 3D.
• SPHERE_EXP_POINT_NEAR_3D: nearest point on explicit sphere to a point in 3D.
• SPHERE_EXP2IMP_3D converts a sphere from explicit to implicit form in 3D.
• SPHERE_EXP2IMP_ND finds an N-dimensional sphere through N+1 points.
• SPHERE_IMP_AREA_3D computes the surface area of an implicit sphere in 3D.
• SPHERE_IMP_AREA_ND computes the surface area of an implicit sphere in ND.
• SPHERE_IMP_CONTAINS_POINT_3D: point in implicit sphere in 3D?
• SPHERE_IMP_LINE_PROJECT_3D projects a line onto an implicit sphere in 3D.
• SPHERE_IMP_LOCAL2XYZ_3D: local to XYZ coordinates on implicit sphere in 3D.
• SPHERE_IMP_POINT_NEAR_3D: nearest point on implicit sphere to a point in 3D.
• SPHERE_IMP_POINT_PROJECT_3D projects a point onto an implicit sphere in 3D.
• SPHERE_IMP_VOLUME_3D computes the volume of an implicit sphere in 3D.
• SPHERE_IMP_VOLUME_ND computes the volume of an implicit sphere in ND.
• SPHERE_IMP_ZONE_AREA_3D computes the surface area of a spherical zone in 3D.
• SPHERE_IMP_ZONE_VOLUME_3D computes the volume of a spherical zone in 3D.
• SPHERE_IMP2EXP_3D converts a sphere from implicit to explicit form in 3D.
• SPHERE_K computes a factor useful for spherical computations.
• SPHERE_TRIANGLE_ANGLES_TO_AREA computes the area of a spherical triangle.
• SPHERE_TRIANGLE_CONTAINS_POINT determines if a spherical triangle contains a point.
• SPHERE_TRIANGLE_SIDES_TO_ANGLES computes spherical triangle angles in 3D.
• SPHERE_TRIANGLE_VERTICES_TO_ANGLES: spherical triangle angles from vertices.
• SPHERE_TRIANGLE_VERTICES_TO_AREA computes the area of a spherical triangle in 3D.
• SPHERE_TRIANGLE_VERTICES_TO_CENTROID gets a spherical triangle centroid in 3D.
• SPHERE_TRIANGLE_VERTICES_TO_ORIENTATION seeks the orientation of a spherical triangle.
• SPHERE_TRIANGLE_VERTICES_TO_SIDES computes spherical triangle sides.
• SPHERE_UNIT_AREA_ND computes the surface area of a unit sphere in ND.
• SPHERE_UNIT_AREA_VALUES returns some areas of the unit sphere in ND.
• SPHERE_UNIT_SAMPLE_2D picks a random point on the unit sphere (circle) in 2D.
• SPHERE_UNIT_SAMPLE_3D picks a random point on the unit sphere in 3D.
• SPHERE_UNIT_VOLUME_ND computes the volume of a unit sphere in ND.
• SPHERE_UNIT_VOLUME_VALUES returns some volumes of the unit sphere in ND.
• SPHERE01_DISTANCE_XYZ computes great circle distances on a unit sphere.
• SPHERE01_POLYGON_AREA returns the area of a spherical polygon.
• SPHERE01_TRIANGLE_ANGLES_TO_AREA: area of a spherical triangle on unit sphere.
• SPHERE01_TRIANGLE_SIDES_TO_ANGLES; spherical triangle angles on the unit sphere.
• SPHERE01_TRIANGLE_VERTICES_TO_ANGLES: spherical triangle angles from vertices.
• SPHERE01_TRIANGLE_VERTICES_TO_AREA: area of a spherical triangle on the unit sphere.
• SPHERE01_TRIANGLE_VERTICES_TO_CENTROID: spherical triangle centroid on unit sphere.
• SPHERE01_TRIANGLE_VERTICES_TO_MIDPOINTS gets the midsides of a spherical triangle.
• SPHERE01_TRIANGLE_VERTICES_TO_SIDES: spherical triangle sides on unit sphere.
• SUPER_ELLIPSE_POINTS_2D returns N points on a tilted superellipse in 2D.
• TAN_DEG returns the tangent of an angle given in degrees.
• TETRAHEDRON_BARYCENTRIC_3D: barycentric coordinates of a point in 3D.
• TETRAHEDRON_CENTROID_3D computes the centroid of a tetrahedron in 3D.
• TETRAHEDRON_CIRCUMSPHERE_3D computes the circumsphere of a tetrahedron in 3D.
• TETRAHEDRON_CONTAINS_POINT_3D finds if a point is inside a tetrahedron in 3D.
• TETRAHEDRON_DIHEDRAL_ANGLES_3D computes dihedral angles of a tetrahedron.
• TETRAHEDRON_EDGE_LENGTH_3D returns edge lengths of a tetrahedron in 3D.
• TETRAHEDRON_FACE_ANGLES_3D returns the 12 face angles of a tetrahedron 3D.
• TETRAHEDRON_FACE_AREAS_3D returns the 4 face areas of a tetrahedron 3D.
• TETRAHEDRON_LATTICE_LAYER_POINT_NEXT: next tetrahedron lattice layer point.
• TETRAHEDRON_LATTICE_POINT_NEXT returns the next tetrahedron lattice point.
• TETRAHEDRON_QUALITY1_3D: "quality" of a tetrahedron in 3D.
• TETRAHEDRON_RHOMBIC_SIZE_3D gives "sizes" for a rhombic tetrahedron in 3D.
• TETRAHEDRON_SIZE_3D gives "sizes" for a tetrahedron in 3D.
• TETRAHEDRON_SOLID_ANGLES_3D computes solid angles of a tetrahedron.
• TETRAHEDRON_UNIT_LATTICE_POINT_NUM_3D: count lattice points.
• TETRAHEDRON_VOLUME_3D computes the volume of a tetrahedron in 3D.
• TIMESTAMP prints out the current YMDHMS date as a timestamp.
• TMAT_INIT initializes the geometric transformation matrix.
• TMAT_MXM multiplies two geometric transformation matrices.
• TMAT_MXP multiplies a geometric transformation matrix times a point.
• TMAT_MXP2 multiplies a geometric transformation matrix times N points.
• TMAT_MXV multiplies a geometric transformation matrix times a vector.
• TMAT_ROT_AXIS: coordinate axis rotation to geometric transformation matrix.
• TMAT_ROT_VECTOR: arbitrary axis rotation to geometric transformation matrix.
• TMAT_SCALE applies a scaling to the geometric transformation matrix.
• TMAT_SHEAR applies a shear to the geometric transformation matrix.
• TMAT_TRANS applies a translation to the geometric transformation matrix.
• TORUS_AREA_3D returns the area of a torus in 3D.
• TORUS_VOLUME_3D computes the volume of a torus in 3D.
• TP_TO_XYZ converts unit spherical TP coordinates to XYZ coordinates.
• TRIANGLE_ANGLES_2D computes the angles of a triangle in 2D.
• TRIANGLE_ANGLES_3D computes the angles of a triangle in 3D.
• TRIANGLE_AREA_2D computes the area of a triangle in 2D.
• TRIANGLE_AREA_3D computes the area of a triangle in 3D.
• TRIANGLE_AREA_3D_2 computes the area of a triangle in 3D.
• TRIANGLE_AREA_3D_3 computes the area of a triangle in 3D.
• TRIANGLE_AREA_HERON computes the area of a triangle using Heron's formula.
• TRIANGLE_AREA_VECTOR_3D computes the area vector of a triangle in 3D.
• TRIANGLE_BARYCENTRIC_2D finds the barycentric coordinates of a point in 2D.
• TRIANGLE_CENTROID_2D computes the centroid of a triangle in 2D.
• TRIANGLE_CENTROID_3D computes the centroid of a triangle in 3D.
• TRIANGLE_CIRCUMCENTER_2D computes the circumcenter of a triangle in 2D.
• TRIANGLE_CIRCUMCENTER_2D_2 computes the circumcenter of a triangle in 2D.
• TRIANGLE_CIRCUMCENTER computes the circumcenter of a triangle in ND.
• TRIANGLE_CIRCUMCIRCLE_2D computes the circumcircle of a triangle in 2D.
• TRIANGLE_CIRCUMCIRCLE_2D_2 computes the circumcircle of a triangle in 2D.
• TRIANGLE_DIAMETER_2D computes the diameter of a triangle in 2D.
• TRIANGLE_EDGE_LENGTH_2D returns edge lengths of a triangle in 2D.
• TRIANGLE_GRIDPOINTS_2D computes gridpoints within a triangle in 2D.
• TRIANGLE_INCENTER_2D computes the incenter of a triangle in 2D.
• TRIANGLE_INCIRCLE_2D computes the inscribed circle of a triangle in 2D.
• TRIANGLE_INRADIUS_2D: radius of the inscribed circle of a triangle in 2D.
• TRIANGLE_IS_DEGENERATE_ND finds if a triangle is degenerate in ND.
• TRIANGLE_LATTICE_LAYER_POINT_NEXT: next triangle lattice layer point.
• TRIANGLE_LATTICE_POINT_NEXT returns the next triangle lattice point.
• TRIANGLE_LINE_IMP_INT_2D: implicit line intersects a triangle in 2D.
• TRIANGLE_ORIENTATION_2D determines the orientation of a triangle in 2D.
• TRIANGLE_ORTHOCENTER_2D computes the orthocenter of a triangle in 2D.
• TRIANGLE_POINT_DIST_2D: distance ( triangle, point ) in 2D.
• TRIANGLE_POINT_DIST_3D: distance ( triangle, point ) in 3D.
• TRIANGLE_POINT_DIST_SIGNED_2D: signed distance ( triangle, point ) in 2D.
• TRIANGLE_POINT_NEAR_2D computes the nearest point on a triangle in 2D.
• TRIANGLE_QUALITY_2D: "quality" of a triangle in 2D.
• TRIANGLE_RIGHT_LATTICE_POINT_NUM_2D: count lattice points.
• TRIANGLE_SAMPLE returns random points in a triangle.
• TRIANGLE_UNIT_LATTICE_POINT_NUM_2D: count lattice points.
• TRIANGLE_XSI_TO_XY_2D converts from barycentric to XY coordinates in 2D.
• TRIANGLE_XY_TO_XSI_2D converts from XY to barycentric in 2D.
• TRUNCATED_OCTAHEDRON_SIZE_3D gives "sizes" for a truncated octahedron in 3D.
• VECTOR_DIRECTIONS_ND returns the direction angles of a vector in ND.
• VECTOR_ROTATE_2D rotates a vector around the origin in 2D.
• VECTOR_ROTATE_3D rotates a vector around an axis vector in 3D.
• VECTOR_ROTATE_BASE_2D rotates a vector around a base point in 2D.
• VECTOR_SEPARATION_ND finds the angular separation between vectors in ND.
• VECTOR_UNIT_ND normalizes a vector in ND.
• VOXELS_DIST_L1_ND computes the L1 distance between voxels in ND.
• VOXELS_LINE_3D computes voxels along a line in 3D.
• VOXELS_REGION_3D arranges contiguous voxels into regions in 3D.
• VOXELS_STEP_3D computes voxels along a line from a given point in 3D.
• XY_TO_POLAR converts XY coordinates to polar coordinates.
• XYZ_TO_RADEC converts (X,Y,Z) to right ascension/declination coordinates.
• XYZ_TO_RTP converts (X,Y,Z) to (R,Theta,Phi) coordinates.
• XYZ_TO_TP converts (X,Y,Z) to (Theta,Phi) coordinates.

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

Last revised on 25 July 2011.