找回密码
 注册
查看: 10466|回复: 39

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

[复制链接]
发表于 2003-6-23 23:54:12 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
GEOMETRY - Geometric Calculations
GEOMETRY is a collection of FORTRAN routines for geometric calculations in 2, 3 and N space. These calculations include angles, areas, containment, distances, 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.
A C version of some of these routines is available in GEOMETRYC.

Reference 1:
Adrian Bowyer and John Woodwark,
A Programmer's Geometry,
Butterworths, 1983.
Reference 2:
Joseph O'Rourke,
Computational Geometry,
Cambridge University Press,
Second Edition, 1998.
Files you may copy include:
geometry.f90, the source code;
geometry_prb.f90, the calling program;
geometry_prb.out, the sample output.
The list of routines includes:
ANGLE_CONTAINS_RAY_2D determines if an angle contains a ray, in 2D.
ANGLE_DEG_2D returns the angle swept out between two rays in 2D.
ANGLE_RAD_2D returns the angle 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.
ANGLEI_DEG_2D returns the interior angle in degrees between two rays in 2D.
ANGLEI_RAD_2D returns the interior angle in radians between two rays in 2D.
ARC_COSINE computes the arc cosine 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.
BIN_SEARCH_ONE_2D searches one cell in a 2D array of bins.
BIN_TO_R_EVEN2 returns the limits for a given "bin" in [A,B].
BIN_TO_R2_EVEN2 returns the limits for a given R2 "bin" in [A,B].
BIN_TO_R2_EVEN3 returns the limits for a given R2 "bin" in [A,B].
BIN_TO_R3_EVEN2 returns the limits for a given R3 "bin" in [A,B].
BIN_TO_R3_EVEN3 returns the limits for a given R3 "bin" in [A,B].
BOX_CLIP_LINE_2D uses a box to clip a line segment in 2D.
BOX_CONTAINS_LINE_SEG_2D reports if a box contains a line segment in 2D.
BOX_CONTAINS_POINT_2D reports if a box contains a point in 2D.
BOX_RAY_INT_2D: intersection ( box, ray ) in 2D.
CH_CAP capitalizes a single character.
CH_EQI is a case insensitive comparison of two characters for equality.
CIRCLE_AREA_2D computes the area of a circle in 2D.
CIRCLE_DIA2IMP_2D converts a diameter to an implicit circle in 2D.
CIRCLE_EXP2IMP_2D converts a circle from explicit to implicit form in 2D.
CIRCLE_EXP_CONTAINS_POINT_2D determines if an explicit circle contains a point in 2D.
CIRCLE_IMP_CONTAINS_POINT_2D determines if an implicit circle contains a point 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 ( implicit circle, point ) in 2D.
CIRCLE_IMP_POINTS_2D returns N equally spaced points on an implicit circle in 2D.
CIRCLE_IMP_POINTS_ARC_2D returns N points on an arc of an implicit circle 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_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_TRIANGLE_AREA_2D returns the area of a circle triangle in 2D.
CIRCLES_IMP_INT_2D: finds the intersection of two implicit circles in 2D.
CONE_AREA_3D computes the surface area of a right circular cone in 3D.
CONE_CENTROID_2D 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.
CORPL_2D "boxes" an angle defined by three points in 2D.
COT returns the cotangent of an angle.
COT_DEGREES returns the cotangent of an angle given in degrees.
CROSS0_2D finds the cross product of (P1-P0) and (P2-P0) in 2D.
CROSS0_3D computes the cross product of (P1-P0) and (P2-P0) in 3D.
CROSS_2D finds the cross product of a pair of vectors in 2D.
CROSS_3D computes the cross product of two vectors in 3D.
CUBE_SHAPE_3D describes a cube in 3D.
DEGREES_TO_RADIANS converts an angle from degrees to radians.
DIAEDG chooses a diagonal edge.
DIRECTION_PERT_3D randomly perturbs a direction vector in 3D.
DIRECTION_RANDOM_2D picks a random direction vector in 2D.
DIRECTION_RANDOM_3D picks a random direction vector in 3D.
DIRECTION_RANDOM_ND generates a random direction vector in ND.
DMS_TO_RADIANS converts an angle from degrees/minutes/seconds to radians.
DODEC_SHAPE_3D describes an dodecahedron in 3D.
DOT0_2D computes the dot product of (P1-P0) and (P2-P0) in 2D.
DOT0_3D computes the dot product of (P1-P0) and (P2-P0) in 3D.
DOT_2D computes the dot product of a pair of vectors in 2D.
DOT_3D computes the dot product of a pair of vectors in 3D.
DOT_ND computes the dot product of a pair of vectors in ND.
DUAL_SHAPE_3D constructs the dual of a shape in 3D.
ELLIPSE_AREA_2D returns the area of 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.
ENORM0_2D computes the Euclidean norm of (P1-P0) in 2D.
ENORM0_3D computes the Euclidean norm of (P1-P0) in 3D.
ENORM0_ND computes the Euclidean norm of (P1-P0) in ND.
ENORM_2D computes the Euclidean norm of a vector in 2D.
ENORM_3D computes the Euclidean norm of a vector in 3D.
ENORM_ND computes the Euclidean norm of a vector in ND.
ENORMSQ0_2D computes the square of the Euclidean norm of (P1-P0) in 2D.
ENORMSQ0_3D computes the square of the Euclidean norm of (P1-P0) in 3D.
ENORMSQ0_ND computes the squared Euclidean norm of (P1-P0) in ND.
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 ( implicit halfspace, triangle ) in 3D.
HALFSPACE_NORM_TRIANGLE_INT_3D: intersection ( normal halfspace, triangle ) in 3D.
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_SHAPE_2D returns points on the unit hexagon in 2D.
HEXAGON_UNIT_AREA_2D returns the area of a unit regular hexagon in 2D.
HEXAGON_VERTICES_2D returns the vertices of the unit hexagon in 2D.
I_MODP returns the nonnegative remainder of integer division.
I_RANDOM returns a random integer in a given range.
I_SWAP switches two integer values.
I_WRAP forces an integer to lie between given limits by wrapping.
ICOL_FIND_ITEM searches a table by columns for a given value.
ICOL_FIND_ITEM wrap searches a table by columns for a pair of items.
ICOS_SHAPE_3D describes an icosahedron in 3D.
IMAT_PRINT prints an integer matrix.
INDEX_BOX2_NEXT_2D produces indices on the surface of a box in 2D.
INDEX_BOX2_NEXT_3D produces indices on the surface of a box in 3D.
IROW_COMPARE compares two rows of a integer array.
IROW_SORT_A ascending sorts the rows of an integer array.
IROW_SWAP swaps two rows of an integer array.
IVEC_HEAP_D reorders an array of integers into an descending heap.
IVEC_PRINT prints an integer vector.
IVEC_RANDOM returns a random integer vector in a given range.
IVEC_SORT_HEAP_A ascending sorts an integer array using heap sort.
IVEC_UNIQUE finds the number of unique elements in a sorted integer array.
IVEC2_COMPARE compares pairs of integers stored in two vectors.
IVEC2_SORT_A ascending sorts a vector of pairs of integers.
IVEC2_UNIQUE keeps the unique elements in a array of pairs of integers.
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_EXP_NORMAL_2D computes the 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 ( explicit line, point ) in 2D.
LINE_EXP_POINT_NEAR_2D computes the 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_IMP2PAR_2D converts an implicit line to parametric form in 2D.
LINE_IMP_POINT_DIST_2D: distance ( implicit line, point ) in 2D.
LINE_IMP_POINT_DIST_3D: distance ( implicit line, point ) in 3D.
LINE_IMP_POINT_DIST_SIGNED_2D: signed distance ( implicit line, point ) in 2D.
LINE_PAR2IMP_2D converts a parametric line to implicit 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_SEG_CONTAINS_POINT_1D reports if a line segment contains a point in 1D.
LINE_SEG_CONTAINS_POINT_2D reports if a line segment contains a point in 2D.
LINE_SEG_POINT_DIST_2D: distance ( line segment, point ) in 2D.
LINE_SEG_POINT_DIST_3D: distance ( line segment, point ) in 3D.
LINE_SEG_POINT_NEAR_2D finds the point on a line segment nearest a point in 2D.
LINE_SEG_POINT_NEAR_3D finds the point on a line segment nearest a point in 3D.
LINES_EXP_ANGLE_3D finds the angle between two explicit lines in 3D.
LINES_EXP_ANGLE_ND returns the angle between two explicit lines in ND.
LINES_EXP_DIST_3D computes the distance between two explicit lines in 3D.
LINES_EXP_INT_2D determines where two explicit lines intersect in 2D.
LINES_EXP_PARALLEL_2D determines if two lines are parallel in 2D.
LINES_IMP_ANGLE_2D finds the angle between two implicit lines in 2D.
LINES_IMP_DIST_2D determines the distance between two implicit lines in 2D.
LINES_IMP_INT_2D determines where two implicit lines intersect in 2D.
LINES_PAR_ANGLE_2D finds the angle between two parametric lines in 2D.
LINES_PAR_ANGLE_3D finds the angle between two parametric lines in 3D.
LINES_PAR_DIST_3D finds the distance between two parametric lines in 3D.
LINES_PAR_INT_2D determines where two parametric lines intersect in 2D.
LINES_SEG_DIST_2D computes the distance between two line segments in 2D.
LINES_SEG_DIST_3D computes the distance between two line segments in 3D.
LINES_SEG_INT_1D computes the intersection of two line segments in 1D.
LINES_SEG_INT_2D computes the intersection of two line segments in 2D.
LOC2GLOB_3D converts from a local to global coordinate system in 3D.
LRLINE determines where a point lies in relation to a directed line.
MINABS finds a local minimum of F(X) = A * abs ( X ) + B.
MINQUAD finds a local minimum of F(X) = A * X * X + B * X + C.
NORMAL_01_SAMPLE samples the standard Normal PDF.
NORMAL_01_VECTOR samples the standard normal probability distribution.
OCTAHEDRON_SHAPE_3D describes an octahedron in 3D.
PARA_CONTAINS_POINT_2D determines if a point is inside a parallelogram in 2D.
PARA_CONTAINS_POINT_3D determines if a point is inside a parallelogram in 3D.
PARA_POINT_DIST_3D: distance ( parallelogram, point ) in 3D.
PARABOLA_EX finds the extremal point of a parabola determined by three points.
PARABOLA_EX2 finds the extremal point of a parabola determined by three points.
PARAPP_POINT_DIST_3D: distance ( parallelepiped, point ) in 3D.
PLANE_EXP2IMP_3D converts an explicit plane to implicit form in 3D.
PLANE_EXP2NORM_3D converts an explicit plane to normal form in 3D.
PLANE_EXP_NORMAL_3D finds the normal to an explicit plane in 3D.
PLANE_EXP_POINT_DIST_3D: distance ( explicit plane, point ) in 3D.
PLANE_EXP_PROJECT_3D projects points through a point onto a plane in 3D.
PLANE_GRID_3D computes points and lines making up a planar grid in 3D.
PLANE_IMP2EXP_3D converts an implicit plane to explicit form in 3D.
PLANE_IMP2NORM_3D converts an implicit plane to normal form in 3D.
PLANE_IMP_IS_DEGENERATE_3D is TRUE if an implicit plane is degenerate.
PLANE_IMP_LINE_PAR_INT_3D: intersection ( implicit plane, parametric line ) in 3D.
PLANE_IMP_LINE_SEG_NEAR_3D: nearest ( implicit plane, line segment ) in 3D.
PLANE_IMP_POINT_DIST_3D: distance ( implicit plane, point ) in 3D.
PLANE_IMP_POINT_DIST_SIGNED_3D: signed distance ( implicit plane, point) in 3D.
PLANE_IMP_POINT_NEAR_3D: nearest point on a implicit plane to a point in 3D.
PLANE_IMP_TRIANGLE_INT_3D: intersection ( implicit plane, triangle ) in 3D.
PLANE_IMP_TRIANGLE_NEAR_3D: nearest ( implicit plane, triangle ) in 3D.
PLANE_NORM2EXP_3D converts a normal plane to explicit form in 3D.
PLANE_NORM2IMP_3D converts a normal form plane to implicit form in 3D.
PLANE_NORM_BASIS_3D finds two perpendicular vectors in a plane in 3D.
PLANE_NORM_TRIANGLE_INT_3D: intersection ( normal plane, triangle ) in 3D.
PLANE_TRIANGLE_INT_ADD_3D is a utility for plane/triangle intersections.
PLANES_IMP_ANGLE_3D: dihedral angle between implicit planes in 3D.
POINT_INSIDE_BOX_2D determines if a point is inside a box in 2D.
POINT_INSIDE_BOX_3D determines if a point is inside a box in 3D.
POINT_INSIDE_PARALLELIPIPED_3D determines if a point is inside a parallelepiped in 3D.
POINTS_AVOID_POINT_NAIVE_2D determines if a point is "far enough" from a set of points in 2D.
POINTS_BISECT_LINE_IMP_2D finds the implicit line bisecting the line between two points in 2D.
POINTS_BISECT_LINE_PAR_2D finds the parametric line bisecting the line between two points in 2D.
POINTS_CENTROID_2D computes the discrete centroid of a point set in 2D.
POINTS_COLIN_2D estimates the colinearity of 3 points in 2D.
POINTS_COLIN_3D estimates the colinearity of 3 points in 3D.
POINTS_DELAUNAY_NAIVE_2D is a naive Delaunay triangulation scheme.
POINTS_DIST_2D finds the distance between two points in 2D.
POINTS_DIST_3D finds the distance between two points in 3D.
POINTS_DIST_ND finds the distance between two points in ND.
POINTS_DIST_SPHERE finds the distance between two points on a sphere.
POINTS_HULL_2D computes the convex hull of a set of points in 2D.
POINTS_NEAREST_POINT_BINS2_2D finds the nearest point to a given point in 2D.
POINTS_NEAREST_POINT_BINS3_2D finds the nearest point to a given point in 2D.
POINTS_NEAREST_POINT_BINS_2D finds the nearest point to a given point in 2D.
POINTS_NEAREST_POINT_DEL_2D searches a Delaunay triangulation for the nearest neighbor.
POINTS_NEAREST_POINT_NAIVE_2D finds the nearest point to a given point in 2D.
POINTS_NEAREST_POINT_NAIVE_3D finds the nearest point to a given point in 3D.
POINTS_NEAREST_POINT_NAIVE_ND finds the nearest point to a given point in ND.
POINTS_NEAREST_POINTS_BINS2_2D finds the nearest point to given points in 2D.
POINTS_NEAREST_POINTS_BINS2_3D finds the nearest point to given points in 3D.
POINTS_NEAREST_POINTS_BINS3_2D finds the nearest point to given points in 2D.
POINTS_NEAREST_POINTS_BINS3_3D finds the nearest point to given points in 3D.
POINTS_NEAREST_POINTS_BINS4_2D finds the nearest point to given points in 2D.
POINTS_NEAREST_POINTS_BINS_2D finds the nearest point to given points in 2D.
POINTS_NEAREST_POINTS_NAIVE_2D finds the nearest point to given points in 2D.
POINTS_NEAREST_POINTS_NAIVE_3D finds the nearest point to given points in 3D.
POLYGON_AREA_2_2D computes the area of a polygon in 2D.
POLYGON_AREA_2_3D computes the area of a polygon in 3D.
POLYGON_AREA_2D computes the area of a polygon in 2D.
POLYGON_AREA_3D computes the area of a polygon in 3D.
POLYGON_CENTROID_2_2D computes the centroid of a polygon in 2D.
POLYGON_CENTROID_2D computes the centroid of a polygon in 2D.
POLYGON_CENTROID_3D computes the centroid of a polygon in 3D.
POLYGON_CONTAINS_POINT_2_2D finds if a point is inside a convex polygon in 2D.
POLYGON_CONTAINS_POINT_2D finds if a point is inside a simple polygon in 2D.
POLYGON_CONVEX determines whether a polygon is convex in 2D.
POLYGON_INRAD_DATA_2D determines polygonal data from its inner radius in 2D.
POLYGON_LATTICE_AREA_2D computes the area of a lattice polygon in 2D.
POLYGON_OUTRAD_DATA_2D determines polygonal data from its outer radius in 2D.
POLYGON_SIDE_DATA_2D determines polygonal data from its side length in 2D.
POLYHEDRON_SURFACE_3D computes the surface area of a polyhedron in 3D.
POLYHEDRON_VOLUME_3D computes the volume of a polyhedron in 3D.
POLYLINE_INDEX_POINT_ND evaluates a polyline at a given arclength in ND.
POLYLINE_LENGTH_ND computes the length of a polyline in ND.
PROPLANE2 produces 2D coordinates of points that lie in a plane, in 3D.
PROPLANE3 projects points orthographically onto a plane, in 3D.
PROVEC projects a vector from M space into N space.
PYRAMID_VOLUME_3D computes the volume of a pyramid with square base in 3D.
QUAD_AREA_2D computes the area of a quadrilateral in 2D.
QUAD_CONTAINS_POINT_2D finds if a point is inside a convex quadrilateral in 2D.
QUAD_POINT_DIST_2D finds the distance from a point to a quadrilateral in 2D.
QUAD_POINT_DIST_SIGNED_2D: signed distanct ( quadrilateral, point ) 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.
R_MODP returns the nonnegative remainder of real division.
R_PI returns the value of pi.
R_RANDOM returns a random real in a given range.
R_SWAP switches two real values.
R_TO_BIN_EVEN2 determines the appropriate "bin" for C in [A,B].
R2_RANDOM returns a random R2 value in a given range.
R2_TO_BIN_EVEN2 determines the appropriate "bin" for an R2 value.
R2_TO_BIN_EVEN3 determines the appropriate "bin" for an R2 value.
R2VEC_BIN_EVEN2 bins an R2 array into evenly spaced bins.
R2VEC_BIN_EVEN3 bins an R2 array into evenly spaced bins.
R2VEC_BINNED_REORDER reorders a binned R2 data vector.
R2VEC_BINNED_REORDER2 reorders a binned R2 data vector.
R2VEC_BINNED_SORT_A sorts each bin of an R2 binned data vector.
R2VEC_BINNED_SORT_A2 sorts each bin of an R2 binned data vector.
R2VEC_PART_QUICK_A reorders an R2 vector as part of a quick sort.
R2VEC_RANDOM returns a random R2 vector in a given range.
R2VEC_SORT_QUICK_A ascending sorts an R2 vector using quick sort.
R3_TO_BIN_EVEN2 determines the appropriate "bin" for an R3 value.
R3_TO_BIN_EVEN3 determines the appropriate "bin" for an R3 value.
R3VEC_BIN_EVEN2 bins an R3 array into evenly spaced bins.
R3VEC_BINNED_REORDER reorders a binned R3 data vector.
R3VEC_BINNED_REORDER2 reorders a binned R3 data vector.
R3VEC_BINNED_SORT_A sorts each bin of an R3 binned data vector.
R3VEC_PART_QUICK_A reorders an R3 vector as part of a quick sort.
R3VEC_RANDOM returns a random R3 vector in a given range.
R3VEC_SORT_QUICK_A ascending sorts an R3 vector using quick sort.
RADEC_DISTANCE_3D - angular distance, astronomical units, sphere in 3D.
RADEC_TO_XYZ converts right ascension/declination to (X,Y,Z) coordinates.
RADIANS_TO_DEGREES converts an angle from radians to degrees.
RADIANS_TO_DMS converts an angle from radians to degrees/minutes/seconds.
RANDOM_INITIALIZE initializes the FORTRAN 90 random number seed.
RMAT2_DET computes the determinant of a 2 by 2 matrix.
RMAT2_INVERSE inverts a 2 by 2 real matrix using Cramer's rule.
RMAT3_DET computes the determinant of a 3 by 3 matrix.
RMAT3_INVERSE inverts a 3 by 3 real matrix using Cramer's rule.
RMAT4_DET computes the determinant of a 4 by 4 matrix.
RMAT5_DET computes the determinant of a 5 by 5 matrix.
RMAT_PRINT prints a real matrix.
RMAT_SOLVE uses Gauss-Jordan elimination to solve an N by N linear system.
ROTATION_AXIS2MAT_3D converts a rotation from axis to matrix format in 3D.
ROTATION_AXIS2QUAT_3D converts a rotation from axis to quaternion format in 3D.
ROTATION_AXIS_VECTOR_3D rotates a vector around an axis vector in 3D.
ROTATION_MAT2AXIS_3D converts a rotation from matrix to axis format in 3D.
ROTATION_MAT2QUAT_3D converts a rotation from matrix to quaternion format in 3D.
ROTATION_MAT_VECTOR applies a marix rotation to a vector in 3d.
ROTATION_QUAT2AXIS_3D converts a rotation from quaternion to axis format in 3D.
ROTATION_QUAT2MAT_3D converts a rotation from quaternion to matrix format in 3D.
ROTATION_QUAT_VECTOR applies a quaternion rotation to a vector in 3d.
RTRIS2 constructs a Delaunay triangulation of 2D vertices.
RVEC_BRACKET searches a sorted array for successive brackets of a value.
RVEC2_PRINT prints a pair of real vectors.
RVEC3_PRINT prints a trio of real vectors.
RVEC_EQ is true if every pair of entries in two vectors is equal.
RVEC_GT == ( A1 > A2 ) for real vectors.
RVEC_LT == ( A1 < A2 ) for real vectors.
RVEC_PRINT_2D prints a 2D vector.
RVEC_PRINT_3D prints a 3D vector.
RVEC_SWAP swaps the entries of two real vectors.
SHAPE_POINT_DIST_2D: distance ( regular shape, point ) in 2D.
SHAPE_POINT_NEAR_2D: nearest point ( regular shape, point ) in 2D.
SHAPE_PRINT_3D prints information about a polyhedron in 3D.
SHAPE_RAY_INT_2D: intersection ( regular shape, ray ) in 2D.
SOCCER_SHAPE_3D describes a truncated icosahedron in 3D.
SORT_HEAP_EXTERNAL externally sorts a list of items into linear order.
SPHERE_DIA2IMP_3D converts a diameter to an implicit sphere in 3D.
SPHERE_EXP2IMP_3D converts a sphere from explicit to implicit form in 3D.
SPHERE_EXP_CONTAINS_POINT_3D determines if an explicit sphere contains a point in 3D.
SPHERE_EXP_NEAR_POINT_3D finds the nearest point on an explicit sphere to a point in 3D.
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_CAP_AREA_3D computes the surface area of a spherical cap in 3D.
SPHERE_IMP_CAP_VOLUME_3D computes the volume of a spherical cap in 3D.
SPHERE_IMP_CONTAINS_POINT_3D determines if an implicit sphere contains a point in 3D.
SPHERE_IMP_GRIDFACES_3D produces a grid of triangles on an implicit sphere in 3D.
SPHERE_IMP_GRIDLINES_3D produces "grid lines" on an implicit sphere in 3D.
SPHERE_IMP_GRIDPOINTS_3D produces "grid points" on an implicit sphere in 3D.
SPHERE_IMP_LINE_PROJECT_3D projects a line onto an implicit sphere in 3D.
SPHERE_IMP_LOCAL2XYZ_3D converts local to XYZ coordinates on an implicit sphere in 3D.
SPHERE_IMP_NEAR_POINT_3D finds the nearest point on an implicit sphere to a point in 3D.
SPHERE_IMP_POINT_PROJECT_3D projects a point onto an implicit sphere, in 3D.
SPHERE_IMP_SPIRALPOINTS_3D produces spiral points on 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_UNIT_AREA_ND computes the surface area of a 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_SAMPLE2_3D is a BAD method for sampling the unit sphere in 3D.
SPHERE_UNIT_SAMPLE_ND picks a random point on the unit sphere in ND.
SPHERE_UNIT_SAMPLE2_ND picks a random point on the unit sphere in ND.
SPHERE_UNIT_SAMPLE3_ND picks a random point on the unit sphere in ND.
SPHERE_UNIT_VOLUME_ND computes the volume of a unit sphere in ND.
STRI_ANGLES_TO_AREA_3D computes the area of a spherical triangle.
STRI_SIDES_TO_ANGLES_3D computes spherical triangle angles in 3D.
STRI_VERTICES_TO_AREA_3D computes the area of a spherical triangle in 3D.
STRI_VERTICES_TO_CENTROID_3D gets a spherical triangle centroid in 3D.
STRI_VERTICES_TO_SIDES_3D computes spherical triangle sides in 3D.
STRING_2D groups line segments into connected lines in 2D.
SUPER_ELLIPSE_POINTS_2D returns N points on a tilted superellipse in 2D.
SWAPEC swaps diagonal edges until all triangles are Delaunay.
TAN_DEGREES returns the tangent of an angle given in degrees.
TETRA_BARYCENTRIC_3D returns the barycentric coordinates of a point in 3D.
TETRA_CENTROID_3D computes the centroid of a tetrahedron in 3D.
TETRA_CIRCUMSPHERE_3D computes the circumscribed sphere of a tetrahedron in 3D.
TETRA_CONTAINS_POINT_3D finds if a point is inside a tetrahedron in 3D.
TETRA_SHAPE_3D describes a tetrahedron in 3D.
TETRA_VOLUME_3D computes the volume of a tetrahedron in 3D.
TIMESTAMP prints the current YMDHMS date as a time stamp.
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 applies a coordinate axis rotation to the geometric transformation matrix.
TMAT_ROT_VECTOR applies an arbitrary axis rotation to the 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.
TRIANGLE_ANGLES_2D computes the angles of a triangle in 2D.
TRIANGLE_ANGLES_3D computes the angles of a triangle in 3D.
TRIANGLE_AREA_2_3D computes the area 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_HERON computes the area of a triangle using Heron's formula.
TRIANGLE_AREA_SIGNED_2D computes the signed area of a triangle in 2D.
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_CIRCUMCIRCLE_2D computes the circumcircle of a triangle in 2D.
TRIANGLE_CONTAINS_POINT_1_2D finds if a point is inside a triangle in 2D.
TRIANGLE_CONTAINS_POINT_2_2D finds if a point is inside a triangle in 2D.
TRIANGLE_DIAMETER_2D computes the diameter 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_LINE_IMP_INT_2D finds where an 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 triangle point to a point in 2D.
TRIANGLE_SAMPLE_2D returns a random point in a triangle.
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.
TRIANGULATION_BOUNDARY_COUNT returns the number of boundary edges.
TRIANGULATION_CHECK makes some simple checks on a triangulation.
TRIANGULATION_EDGE_CHECK checks the edges of a triangulation.
TRIANGULATION_EXAMPLE_DEL_2D sets up a sample Delaunay triangulation.
TRIANGULATION_NABE_NODES determines the neighbors of triangulation nodes.
TRIANGULATION_NABE_NODES_PRINT prints a triangulation node neighbor array.
TRIANGULATION_NABE_TRIANGLES determines triangle neighbors.
TRIANGULATION_NEIGHBOR determines a neighbor of a given triangle.
TRIANGULATION_PRINT prints out information defining a Delaunay triangulation.
TRIANGULATION_SAMPLE_2D returns random points in a triangulation.
TRIANGULATION_SEARCH_2D searches a triangulation for a point.
TUBE_2D constructs a "tube" of given width around a path in 2D.
TUPLE_NEXT2 computes the next element of an integer tuple space.
VBEDG determines which boundary edges are visible to a point.
VECTOR_DIRECTIONS_2D returns the direction angles of a vector in 2D.
VECTOR_DIRECTIONS_3D returns the direction angles of a vector in 3D.
VECTOR_ROTATE_2D rotates a vector around the origin in 2D.
VECTOR_ROTATE_BASE_2D rotates a vector around a base point in 2D.
VECTOR_SEPARATION_3D finds the angular separation between vectors in 3D.
VECTOR_SEPARATION_ND finds the angular separation between vectors in ND.
VECTOR_UNIT_2D normalizes a vector in 2D.
VECTOR_UNIT_3D normalizes a vector in 3D.
VECTOR_UNIT_ND normalizes a vector in ND.
VOXEL_LINE_3D computes the voxels that line on a line in 3D.
VOXEL_REGION_3D arranges a set of voxels into contiguous regions in 3D.
VOXEL_STEP_3D computes voxels along a line from a given point in 3D.
XYZ_TO_RADEC converts (X,Y,Z) to right ascension/declination coordinates.
 楼主| 发表于 2003-6-23 23:55:16 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

喜欢的学友支持一下。
发表于 2003-6-24 09:02:01 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

支持一下。
发表于 2003-6-24 11:12:05 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

顶一下!
发表于 2003-6-24 14:31:20 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

很有用处的东西,谢谢。
发表于 2003-6-24 14:38:33 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

支持,谢谢。
发表于 2003-6-24 20:33:50 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

支持!顶以下!
 楼主| 发表于 2003-6-30 04:05:23 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

C语言的上述程序。
GEOMETRYC - Geometric Calculations
GEOMETRYC is a collection of routines for geometric calculations in 2, 3 and N space. These calculations include angles, areas, containment, distances, intersection, nearest point, and volumes. The objects considered include points, lines, line segments, polygons, planes, polyhedra and vectors.
GEOMETRYC is a C version of a subset of the FORTRAN GEOMETRY collection.

Reference 1:
Adrian Bowyer and John Woodwark,
A Programmer's Geometry,
Butterworths, 1983.
Reference 2:
Joseph O'Rourke,
Computational Geometry,
Cambridge University Press,
Second Edition, 1998.
Files you may copy include:
geometryc.c, the source code;
geometryc.h, the include file;
geometryc_prb.c, the calling program;
geometryc_prb.out, the sample output.
The list of routines includes:
ANGLE_CONTAINS_RAY_2D determines if an angle contains a ray, in 2D.
ANGLE_DEG_2D returns the angle in degrees between two rays in 2D.
ANGLE_RAD_2D returns the angle in radians between two rays in 2D.
ANGLE_RAD_3D returns the angle in radians between two vectors in 3D.
ANGLE_RAD_ND returns the angle in radians between two vectors in ND.
ANGLEI_DEG_2D returns the interior angle in degrees between two rays in 2D.
ANGLEI_RAD_2D returns the interior angle in radians between two rays in 2D.
ARC_COSINE computes the arc cosine function, with argument truncation.
ATAN4 computes the inverse tangent of the ratio Y / X.
BOX_CONTAINS_POINT_3D determines if a point is inside a parallelepiped in 3D.
BOX_POINT_DIST_3D distance ( parallelepiped, point ) in 3D.
CIRCLE_DIA2IMP_2D converts a diameter to an implicit circle in 2D.
CIRCLE_EXP_CONTAINS_POINT_2D determines if an explicit circle contains a point in 2D.
CIRCLE_IMP_CONTAINS_POINT_2D determines if an implicit circle contains a poin
CIRCLE_IMP_LINE_PAR_INT_2D: ( implicit circle, parametric line ) intersection
CIRCLE_POINTS_2D returns N equally spaced points on the circle in 2D.
CONE_AREA_3D computes the surface area of a right circular cone in 3D.
CONE_VOLUME_3D computes the volume of a right circular cone in 3D.
COT returns the cotangent of an angle.
COTD returns the cotangent of an angle given in degrees.
CROSS_2D computes the cross product of two vectors in 2D.
CROSS_3D computes the cross product of two vectors in 3D.
CROSS0_2D computes the cross product of (P1-P0) and (P2-P0) in 2D.
CROSS0_3D computes the cross product of (P1-P0) and (P2-P0) in 3D.
DIRECTION_PERT_3D randomly perturbs a direction vector in 3D.
DIRECTION_RANDOM_3D computes a random direction vector in 3D.
DIRECTION_RANDOM_ND computes a random direction vector in ND.
DOT_2D computes the dot product of a pair of vectors in 2D.
DOT_3D computes the dot product of a pair of vectors in 3D.
DOT_ND computes the dot product of a pair of vectors in ND.
DOT0_2D computes the dot product of (P1-P0) and (P2-P0) in 2D.
DOT0_3D computes the dot product of (P1-P0) and (P2-P0) in 3D.
ENORM_2D computes the Euclidean norm of a vector in 2D.
ENORM_3D computes the Euclidean norm of a vector in 3D.
ENORM_ND computes the Euclidean norm of a vector in ND.
ENORM0_2D computes the Euclidean norm of (P1-P0) in 2D.
ENORM0_3D computes the Euclidean norm of (P1-P0) in 3D.
ENORM0_ND computes the Euclidean norm of (P1-P0) in ND.
ENORMSQ0_2D computes the squared Euclidean norm of (P1-P0) in 2D.
ENORMSQ0_3D computes the squared Euclidean norm of (P1-P0) in 3D.
ENORMSQ0_ND computes the squared Euclidean norm of (P1-P0) in ND.
GET_SEED returns a random seed for the random number generator.
HALFSPACE_IMP_TRIANGLE_INT_3D: intersection ( implicit halfspace, triangle ) in 3D.
HALFSPACE_NORM_TRIANGLE_INT_3D: intersection ( normal halfspace, triangle ) in 3D.
HALFSPACE_TRIANGLE_INT_3D: intersection ( halfspace, triangle ) in 3D.
I_RANDOM returns a random integer in a given range.
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 ( explicit line, point ) in 2D.
LINE_EXP2IMP_2D converts an explicit line to implicit form in 2D.
LINE_EXP2PAR_3D converts a line from explicit to parametric form in 3D.
LINE_SEG_POINT_DIST_3D computes the distance from a point to a line segment in 3D.
LINE_SEG_POINT_NEAR_3D finds the point on a line segment nearest a point in 3D.
LINES_IMP_ANGLE_2D finds the angle between two implicit lines in 2D.
LINES_IMP_INT_2D finds where two implicit lines intersect in 2D.
LINES_SEG_DIST_3D computes the distance between two line segments in 3D.
MINQUAD finds a local minimum of F(X) = A * X**2 + B * X + C.
NORMAL_01_SAMPLE returns random values from the standard 0,1 normal distribution.
PARA_CONTAINS_POINT_3D determines if a point is inside a parallelogram in 3D.
PARA_POINT_DIST_3D: distance ( parallelogram, point ) in 3D.
PARABOLA_EX finds the extremal point of a parabola from 3 data points.
PARABOLA_EX2 finds the extremal point of a parabola from 3 data points.
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_EXP2NORM_3D converts an explicit plane to normal form in 3D.
PLANE_IMP_LINE_SEG_NEAR_3D: distance ( implicit plane, line segment );
PLANE_IMP_POINT_DIST_3D: distance ( point, implicit plane ) in 3D.
PLANE_IMP_POINT_DIST_SIGNED_3D: signed distance ( implicit plane, point) in 3D.
PLANE_IMP_TRIANGLE_INT_3D intersection ( implicit plane, triangle ) in 3D.
PLANE_IMP_TRIANGLE_INT_ADD_3D is a utility for PLANE_IMP_TRIANGLE_INT_3D.
PLANE_IMP2NORM_3D converts an implicit plane to normal form in 3D.
PLANE_NORM_BASIS_3D finds two perpendicular vectors in a plane in 3D.
PLANE_NORM2IMP_3D converts a normal form plane to implicit form in 3D.
POINTS_COLIN_2D estimates the colinearity of 3 points in 2D.
POINTS_COLIN_3D estimates the colinearity of 3 points in 3D.
POLYGON_1_2D integrates the function 1 over a polygon in 2D.
POLYGON_AREA_2D computes the area of a polygon in 2D.
POLYGON_AREA_2_2D computes the area of a polygon in 2D.
POLYGON_AREA_2_3D computes the area of a polygon in 3D.
POLYGON_AREA_3D computes the area of a polygon in 3D.
POLYGON_CENTROID_2D computes the centroid of a polygon in 2D.
POLYGON_CENTROID_2_2D computes the centroid of a polygon in 2D.
POLYGON_CENTROID_3D computes the centroid of a polygon in 3D.
POLYGON_X_2D integrates the function X over a polygon in 2D.
POLYGON_Y_2D integrates the function Y 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_YY_2D integrates the function Y*Y over a polygon in 2D.
RMAT2_DET computes the determinant of a 2 by 2 matrix.
RMAT2_INVERSE computes the inverse of a 2 by 2 matrix.
RMAT3_DET computes the determinant of a 3 by 3 matrix.
RMAT3_INVERSE computes the inverse of a 3 by 3 matrix.
RMAT4_DET computes the determinant of a 4 by 4 matrix.
RMAT5_DET computes the determinant of a 5 by 5 matrix.
SPHERE_IMP_VOLUME_3D computes the volume of an implicit sphere in 3D.
TAND returns the tangent of an angle given in degrees.
TETRA_CENTROID_3D computes the centroid of a tetrahedron in 3D.
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 applies an axis rotation to the geometric transformation matrix.
TMAT_ROT_VECTOR applies a rotation about a vector to the 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_VOLUME_3D computes the volume of a torus in 3D.
TRIANGLE_AREA_2D computes the area of a triangle in 2D.
TRIANGLE_AREA_SIGNED_2D computes the signed area of a triangle in 2D.
TRIANGLE_AREA_3D computes the area of a triangle in 3D.
TRIANGLE_CENTROID_2D computes the centroid of a triangle in 2D.
TRIANGLE_CENTROID_3D computes the centroid of a triangle in 3D.
TRIANGLE_INCIRCLE_2D computes the inscribed circle of a triangle in 2D.
UNIFORM_01_SAMPLE computes a random value between 0 and 1.
VECTOR_ROTATE_2D rotates a vector around the origin in 2D.
VECTOR_ROTATE_3D rotates a vector around an axis vector in 3D.
VECTOR_UNIT_2D normalizes a vector in 3D.
VECTOR_UNIT_3D normalizes a vector in 3D.
VECTOR_UNIT_ND normalizes a vector in 3D.
 楼主| 发表于 2003-6-30 04:06:25 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

geometryc.c, the source code;
geometryc.h, the include file;
geometryc_prb.c, the calling program;
geometryc_prb.out, the sample output
发表于 2003-8-13 00:25:45 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

支持
发表于 2003-8-13 19:01:19 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

顶。
发表于 2003-8-21 02:56:49 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

ding !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
发表于 2003-9-22 08:11:15 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

顶!
发表于 2003-12-29 21:44:57 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

顶, 顶, 顶...顶!
发表于 2004-3-12 23:06:04 | 显示全部楼层

1D,2D,3D的几何计算,包括角度,面积,平移,旋转...的程序

严重支持
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表