xmsgrid  1.0
xms Namespace Reference

XMS Namespace. More...

Namespaces

Classes

struct  BarycentricVals
 Structure for Barycentric coordinate calculations. More...
 
class  DaStreamReader
 
class  DaStreamWriter
 
struct  edgerecord
 Defines an edge that intersects a breakline. More...
 
class  ETestMessagingState
 
class  fSatisfies
 a class used with the boost::geometry::index::satisfies function More...
 
class  GmExtents2d
 2D geometric extents (min/max). More...
 
class  GmExtents3d
 3D geometric extents (min/max). More...
 
class  GmMultiPolyIntersectionSorter
 Base class for sorting intersections from GmMultiPolyIntersector. More...
 
class  GmMultiPolyIntersectionSorterTerse
 Class for sorting intersections from GmMultiPolyIntersector in a terse way (with no duplicate info). More...
 
class  GmMultiPolyIntersector
 See GmMultiPolyIntersectorImpl comments. More...
 
struct  GmMultiPolyIntersectorData
 Struct used by GmMultiPolyIntersector. More...
 
class  GmMultiPolyIntersectorImpl
 Used to intersect a line segment with any number of polygons in 2D. Returns the intersected polygons in order along with t values. May be an alternative to SurfaceIter and feiTraverseLineSegment2. More...
 
class  GmPolygon
 Interface to a boost::geometry::polygon class. More...
 
class  GmPolygonImpl
 Wraps a boost polygon for point in poly, min distance from point to poly etc. More...
 
class  GmPolyLinePtRedistributer
 Redistributes the point locations on a polyline based on a size. More...
 
class  GmPolyLinePtRedistributerImpl
 Implementation of GmPolyLinePtRedistributer. More...
 
class  GmPtSearch
 Spatial index for searching points. More...
 
class  GmPtSearchImpl
 Implementation of GmPtSearch. Generic class for searching location data. Uses a boost R-tree to query a set of locations. Works for 2D and 3D. More...
 
class  GmTriSearch
 Spatial index for searching triangles. More...
 
class  GmTriSearchImpl
 Implementation of GmTriSearch. More...
 
class  idx_pt
 class for indexing the points More...
 
class  idx_tri
 provides indexing for the spatial index More...
 
class  ix
 An intersection point of a line with a polygon. More...
 
class  ltPt2
 
class  ltPt3
 
class  ltPt3_2D
 
class  Observer
 
class  Progress
 
class  ProgressListener
 
class  Pt2
 
class  Pt3
 
class  Pt4
 
class  SharedSingleton
 
class  Singleton
 
class  StCommaNumpunct
 
class  StTemp2DigitExponents
 
class  TrAutoFixFourTrianglePts
 
class  TrAutoFixFourTrianglePtsImpl
 Used to delete points that are connected to 4 triangles and then retriangulate the void. More...
 
class  TrBreaklineAdder
 Adds breaklines to a tin. More...
 
class  TrBreaklineAdderImpl
 Adds breaklines to a triangulation. More...
 
class  TrOuterTriangleDeleter
 
class  TrOuterTriangleDeleterImpl
 Used to delete tin triangles that are outside given polygons. The polygons may include holes - polygons inside polygons. More...
 
class  TrTin
 
class  TrTinImpl
 Class to encapsulate a tin made simply of arrays of points, triangles and adjacency information. Also methods to manipulate it. More...
 
class  TrTriangulator
 Base class used to derive a class to triangulate points. More...
 
class  TrTriangulatorPoints
 Class to triangulate simple points. More...
 
class  XmEdge
 Two integer values representing an edge of an XmUGrid. By default has a direction. Can be sorted to have minimum index first. More...
 
class  XmLog
 
class  XmUGrid
 Geometry for an unstructured grid. An XmUGrid is defined as a vector of 3d points and a stream of cells. Throughout this interface, we use these terms: More...
 

Typedefs

typedef boost::geometry::model::d2::point_xy< double > GmBstPt2d
 Boost geometry 2d point.
 
typedef boost::geometry::model::polygon< GmBstPt2dGmBstPoly2d
 Boost polygon 2d.
 
typedef boost::geometry::model::polygon< Pt3dGmBstPoly3d
 Boost polygon 3d.
 
typedef boost::geometry::model::box< Pt3dGmBstBox3d
 Boost box 3d.
 
typedef boost::geometry::model::linestring< Pt3dGmBstLine3d
 Boost line 3d.
 
typedef boost::geometry::ring_type< GmBstPoly3d >::type GmBstRing3d
 Boost ring 3d.
 
typedef std::pair< GmBstBox3d, int > ValueBox
 Pair used in rtree.
 
typedef bgi::rtree< ValueBox, bgi::quadratic< 8 > > RtreeBox
 Rtree typedef.
 
typedef bg::model::box< bPt > box
 box
 
typedef size_t value
 value
 
typedef bgi::quadratic< 8 > qRtree
 qRtree
 
typedef std::vector< edgerecordVecEdge
 Vector of edgerecord.
 

Enumerations

enum  Turn_enum { TURN_LEFT, TURN_RIGHT, TURN_COLINEAR_180, TURN_COLINEAR_0 }
 direction of turn between 3 points More...
 
enum  PtInOutOrOn_enum { PT_ERROR = -1, PT_IN, PT_OUT, PT_ON }
 point in, out, or on More...
 
enum  GmMultiPolyIntersectorQueryEnum { GMMPIQ_COVEREDBY, GMMPIQ_INTERSECTS }
 Type of query.
 
enum  XmUGridCellType {
  XMU_INVALID_CELL_TYPE = -1, XMU_EMPTY_CELL = 0, XMU_VERTEX = 1, XMU_POLY_VERTEX = 2,
  XMU_LINE = 3, XMU_POLY_LINE = 4, XMU_TRIANGLE = 5, XMU_TRIANGLE_STRIP = 6,
  XMU_POLYGON = 7, XMU_PIXEL = 8, XMU_QUAD = 9, XMU_TETRA = 10,
  XMU_VOXEL = 11, XMU_HEXAHEDRON = 12, XMU_WEDGE = 13, XMU_PYRAMID = 14,
  XMU_PENTAGONAL_PRISM = 15, XMU_HEXAGONAL_PRISM = 16, XMU_QUADRATIC_EDGE = 21, XMU_QUADRATIC_TRIANGLE = 22,
  XMU_QUADRATIC_QUAD = 23, XMU_QUADRATIC_POLYGON = 36, XMU_QUADRATIC_TETRA = 24, XMU_QUADRATIC_HEXAHEDRON = 25,
  XMU_QUADRATIC_WEDGE = 26, XMU_QUADRATIC_PYRAMID = 27, XMU_BIQUADRATIC_QUAD = 28, XMU_TRIQUADRATIC_HEXAHEDRON = 29,
  XMU_QUADRATIC_LINEAR_QUAD = 30, XMU_QUADRATIC_LINEAR_WEDGE = 31, XMU_BIQUADRATIC_QUADRATIC_WEDGE = 32, XMU_BIQUADRATIC_QUADRATIC_HEXAHEDRON = 33,
  XMU_BIQUADRATIC_TRIANGLE = 34, XMU_CUBIC_LINE = 35, XMU_CONVEX_POINT_SET = 41, XMU_POLYHEDRON = 42,
  XMU_PARAMETRIC_CURVE = 51, XMU_PARAMETRIC_SURFACE = 52, XMU_PARAMETRIC_TRI_SURFACE = 53, XMU_PARAMETRIC_QUAD_SURFACE = 54,
  XMU_PARAMETRIC_TETRA_REGION = 55, XMU_PARAMETRIC_HEX_REGION = 56, XMU_HIGHER_ORDER_EDGE = 60, XMU_HIGHER_ORDER_TRIANGLE = 61,
  XMU_HIGHER_ORDER_QUAD = 62, XMU_HIGHER_ORDER_POLYGON = 63, XMU_HIGHER_ORDER_TETRAHEDRON = 64, XMU_HIGHER_ORDER_WEDGE = 65,
  XMU_HIGHER_ORDER_PYRAMID = 66, XMU_HIGHER_ORDER_HEXAHEDRON = 67, XMU_NUMBER_OF_CELL_TYPES
}
 Matches cell types from VTK (see vtkCellType.h)
 
enum  XmUGridFaceOrientation {
  XMU_ORIENTATION_UNKNOWN = -1, XMU_ORIENTATION_SIDE = 0, XMU_ORIENTATION_TOP = 1, XMU_ORIENTATION_BOTTOM = 2,
  XMU_ORIENTATION_NUMBER
}
 The orientation of a 3D face must be one of these.
 

Functions

bool gmPointInOrOnBox2d (const Pt3d &a_bMin, const Pt3d &a_bMax, const Pt3d &a_pt)
 finds if a point is in or on a box in 2d More...
 
bool gmBoxesOverlap2d (const Pt3d &a_b1Min, const Pt3d &a_b1Max, const Pt3d &a_b2Min, const Pt3d &a_b2Max)
 finds if 2 boxes overlap in 2d More...
 
void gmCalculateNormalizedPlaneCoefficients (const Pt3d &p1, const Pt3d &p2, const Pt3d &p3, double *a, double *b, double *c, double *d)
 Calculates the plane coefficients for a triangle. Given point references calculate coefficents for plane (ax+by+cz+d=0). More...
 
void gmCalculateNormalizedPlaneCoefficients (const Pt3d *p1, const Pt3d *p2, const Pt3d *p3, double *a, double *b, double *c, double *d)
 Calculates the plane coefficients for a triangle. Given point pointers calculate coefficents for plane (ax+by+cz+d=0). More...
 
double gmMiddleZ (const VecPt3d &a_points)
 Returns the z value halfway between the max and min z. Different from the average z (where many points can skew the average). More...
 
PtInOutOrOn_enum gmPtInCircumcircle (const Pt3d &pt, Pt3d circumcirclePts[3])
 Is a given point inside a circumcircle defined by three points? More...
 
double gmXyDistanceSquared (const Pt3d &pt1, const Pt3d &pt2)
 Calculate XY distance between two 3D points. More...
 
bool gmCircumcircleWithTol (const Pt3d *pt1, const Pt3d *pt2, const Pt3d *pt3, double *xc, double *yc, double *r2, double tol)
 Computes center & radius squared for circumcircle of triangle made by the three points. More...
 
int gmCartToBary (const Pt3d *cart, const Pt3d *orig, double coef[6], int dir, Pt3d *bary)
 Compute Barycentric coords for point. Use gmBaryPrepare to get the coefficients and direction. More...
 
int gmBaryPrepare (const Pt3d *p1, const Pt3d *p2, const Pt3d *p3, const Pt3d *norm, Pt3d *orig, double coef[6], int *dir, bool flag)
 For a tri - compute dir & coefs to compute Barycentric coords. More...
 
bool gmColinearWithTol (const Pt3d &p1, const Pt3d &p2, const Pt3d &p3, const double tol)
 Returns true if (the three vertices are gmColinear. Result should be insensitive to the order of the vertices. More...
 
bool gmIntersectLineSegmentsWithTol (const Pt3d &one1, const Pt3d &one2, const Pt3d &two1, const Pt3d &two2, double *xi, double *yi, double *zi1, double *zi2, double tol)
 Intersects the plan projection of two line segments. More...
 
bool gmCounterClockwiseTri (const Pt3d &vtx0, const Pt3d &vtx1, const Pt3d &vtx2)
 Returns true if the triangle is wrapped counter clockwise. More...
 
double gmCross2D (const double &dx1, const double &dy1, const double &dx2, const double &dy2)
 Returns the cross product of two 2-d vectors. More...
 
double gmCross2D (const Pt3d &a_origin, const Pt3d &a_A, const Pt3d &a_B)
 2D cross product of two points More...
 
double gmAngleBetween2DVectors (double dxp, double dyp, double dxn, double dyn)
 Returns the angle (0-2PI) in radians between the edges p and n based on a ccw rotation from p to n. More...
 
double gmAngleBetween2DVectors (double dxp, double dyp, double dxn, double dyn, double a_magn, double a_magp)
 Returns the angle (0-2PI) in radians between the edges p and n based on a ccw rotation from p to n. More...
 
double gmAngleBetweenEdges (const Pt3d &p1, const Pt3d &p2, const Pt3d &p3)
 Returns the ccw angle (0-2pi) between p2-p1 and p2-p3. More...
 
double gmAngleBetweenEdges (const Pt2d &p1, const Pt2d &p2, const Pt2d &p3)
 Returns the ccw angle (0-2pi) between p2-p1 and p2-p3. More...
 
double gmComputeDeviationInDirection (const Pt3d &a_p0, const Pt3d &a_p1, const Pt3d &a_p2)
 Computes the deviation in direction from one seg to next seg 1 is from a_p0 to a_p1 seg 2 is from a_p1 to a_p2. More...
 
bool gmOnLineWithTol (const Pt3d &p1, const Pt3d &p2, const double x, const double y, const double tol)
 Determines if a point (x,y) is on the line defined by p1 and p2. Assumes p1 and p2 aren't the same. More...
 
bool gmOnLineAndBetweenEndpointsWithTol (const Pt3d &a_pt1, const Pt3d &a_pt2, const double a_x, const double a_y, double a_tol)
 determines if (x,y) is on the line passing through p1 & p2 and between p1 & p2. More...
 
void gmAddToExtents (const Pt3d &a_pt, Pt3d &a_min, Pt3d &a_max)
 Compares a_pt to a_min and a_max. If a_pt is less than a_min or greater than a_max, a_min and a_max are updated. More...
 
void gmAddToExtents (const Pt3d &a_pt, Pt2d &a_min, Pt2d &a_max)
 
void gmAddToExtents (const Pt2d &a_pt, Pt3d &a_min, Pt3d &a_max)
 
double gmXyDistance (double x1, double y1, double x2, double y2)
 Compute the 2d distance between 2 points. More...
 
double gmXyDistance (const Pt3d &pt1, const Pt3d &pt2)
 
Turn_enum gmTurn (const Pt3d &a_v1, const Pt3d &a_v2, const Pt3d &a_v3, double a_angtol)
 Determine if angle a_v1, a_v2, a_v3 is a left turn, a right turn, colinear 180 degrees, or colinear 0 degrees. More...
 
Pt3d gmComputeCentroid (const VecPt3d &a_points)
 Computes the centroid of points (but not of a polygon). Shouldn't pass an empty vector (no checks are performed). More...
 
Pt3d gmComputePolygonCentroid (const VecPt3d &pts)
 Computes the plan view centroid of a non-self-intersecting polygon. More...
 
bool gmLinesIntersect (const Pt3d &one1, const Pt3d &one2, const Pt3d &two1, const Pt3d &two2)
 intersects the plan projection of two line segments (bad func name) segment 1 = one1,one2 = one1 + lambda(one2 - one1) segment 2 = two1,two2 = two1 + mu (two2 - two1) More...
 
bool gmLinesCross (const Pt3d &a_segment1Point1, const Pt3d &a_segment1Point2, const Pt3d &a_segment2Point1, const Pt3d &a_segment2Point2)
 Determine whether 2 line segments cross. The segments may touch at the end points. More...
 
template<typename T >
int gmPointInPolygon2D (const T *a_verts, const size_t a_num, const double a_x, const double a_y, const double a_tol)
 Determines whether (a_x, a_y) is inside=1, on=0, or outside=-1 the polygon defined by the given vertices. More...
 
int gmPointInPolygon2D (const Pt3d *a_verts, size_t a_num, double a_x, double a_y)
 
int gmPointInPolygon2D (const Pt3d *a_verts, size_t a_num, Pt3d a_pt)
 
int gmPointInPolygon2D (const Pt2i *a_verts, size_t a_num, Pt2d a_pt)
 
int gmPointInPolygon2D (const Pt2i *a_verts, size_t a_num, Pt3d a_pt)
 
int gmPointInPolygon2D (const Pt2i *a_verts, size_t a_num, Pt2i a_pt)
 
int gmPointInPolygon2D (const VecPt3d &a_verts, const Pt3d &a_pt)
 
template int gmPointInPolygon2D< Pt3d > (const Pt3d *a_verts, const size_t a_num, const double a_x, const double a_y, const double a_tol)
 
template int gmPointInPolygon2D< Pt2d > (const Pt2d *a_verts, const size_t a_num, const double a_x, const double a_y, const double a_tol)
 
template int gmPointInPolygon2D< Pt2i > (const Pt2i *a_verts, const size_t a_num, const double a_x, const double a_y, const double a_tol)
 
double gmComputeXyTol (const Pt3d &a_mn, const Pt3d &a_mx)
 Given extents (min, max), compute a tolerance for the xy plane to be used with geometric functions. More...
 
double gmXyTol (bool a_set, double a_value)
 Get or set (set first time) global xy tolerance for float operations. More...
 
double gmZTol (bool a_set, double a_value)
 Get or set (set first time) global z tolerance for float operations. More...
 
bool gmEqualPointsXY (double x1, double y1, double x2, double y2, double tolerance)
 Returns true if the points are equal to within gmXyTol(). More...
 
bool gmEqualPointsXY (double x1, double y1, double x2, double y2)
 
bool gmEqualPointsXY (const Pt2d &a_pt1, const Pt2d &a_pt2, double tol)
 
bool gmEqualPointsXY (const Pt3d &a_pt1, const Pt3d &a_pt2, double tol)
 
bool gmEqualPointsXY (const Pt2i &point1, const Pt2i &point2)
 
bool gmEqualPointsXYZ (double x1, double y1, double z1, double x2, double y2, double z2, double tolerance)
 Returns true if the points are equal to within tolerance. More...
 
bool gmEqualPointsXYZ (double x1, double y1, double z1, double x2, double y2, double z2)
 
bool gmEqualPointsXYZ (const Pt3d &pt1, const Pt3d &pt2, double tol)
 
bool gmPointInTriangleWithTol (const Pt3d *p1, const Pt3d *p2, const Pt3d *p3, double x, double y, double tol)
 Returns true if (x,y) is in the tri formed by p1, p2, p3. More...
 
bool gmInsideOrOnLineWithTol (const Pt3d *p1, const Pt3d *p2, const Pt3d *inpoint, const double x, const double y, const double tol, double *dist)
 Returns true if the (x,y) is on the line segment (p1,p2) or on the same side of the line as "inpoint". ASSERTs in debug if "inpoint" is on the line (within tol). More...
 
double gmPolygonArea (const Pt3d *pts, size_t npoints)
 Compute 2d planview projection of area of polygon. More...
 
VecPt3d gmArrayToVecPt3d (double *a_array, int a_size)
 Useful in testing to create a VecPt3d from a C array of xy pairs. More...
 
void gmEnvelopeOfPts (const VecPt3d &a_pts, Pt3d &a_min, Pt3d &a_max)
 Calculates the envelope of a vector of points. More...
 
void gmOrderPointsCounterclockwise (const VecPt3d &a_pts, VecInt &a_ccwOrder, int a_startindex)
 Orders array of points counter clockwise. Given non-empty array of points. array of point indices ordered counter clockwise based on the angle from the centroid where angle starts at point at startindex. More...
 
void gmOrderPointsCounterclockwise (VecPt3d &a_pts)
 Overload to gmOrderPointsCounterclockwise. More...
 
double gmFindClosestPtOnSegment (const Pt3d &a_pt1, const Pt3d &a_pt2, const Pt3d &a_pt, Pt3d &a_newpt, const double a_tol)
 Finds the closest point to another point on a segment. More...
 
double gmPtDistanceAlongSegment (const Pt3d &a_pt1, const Pt3d &a_pt2, const Pt3d &a_pt, const double a_tol)
 Finds the distance along a segment for the location closest to a_pt. More...
 
bool gmInsideOfLineWithTol (const Pt3d &a_vertex1, const Pt3d &a_vertex2, const Pt3d &a_oppositevertex, const double a_x, const double a_y, const double a_tol)
 Returns TRUE if the Point on the same side of the line (defined by vertex1 and vertex2) as oppositevertex. More...
 
void gmExtents2D (const VecPt3d &a_points, Pt2d &a_min, Pt2d &a_max)
 Get the 2D extents of a vector of points. More...
 
void gmExtents2D (const VecPt3d &a_points, Pt3d &a_min, Pt3d &a_max)
 
void gmExtents3D (const VecPt3d &a_points, Pt3d &a_min, Pt3d &a_max)
 Get the 3D extents of a vector of points. More...
 
double gmPerpendicularAngle (const Pt3d &a_pt1, const Pt3d &a_pt2)
 Returns the angle in radians perpendicular to the two points. More...
 
double gmBisectingAngle (const Pt3d &a_p1, const Pt3d &a_p2, const Pt3d &a_p3)
 Returns the angle (0-2pi) which bisects the edges p2-p1 and p2-p3 based on a ccw rotation from edge 1 to edge 2. More...
 
void gmComponentMagnitudes (double *a_x, double *a_y, double *a_mag, double *a_dir, bool a_tomagdir)
 converts the magnitude and angle to xy components or vice versa More...
 
Pt3d gmCreateVector (const Pt3d &a_p1, const Pt3d &a_p2)
 creates a vector from a_p1 to a_p2 More...
 
double gmConvertAngleToBetween0And360 (double a_angle, bool a_InDegrees)
 given an angle, this function will return the corresponding angle that matches it in the range of 0 deg to 360 deg More...
 
void gmCross3D (const Pt3d &a_vec1, const Pt3d &a_vec2, Pt3d *a_vec3)
 Perform a cross product of Pt3d's. More...
 
double gmDot3D (const Pt3d &a_vec1, const Pt3d &a_vec2)
 Perform a dot product of Pt3d's. More...
 
int gmIntersectTriangleAndLineSegment (const Pt3d &a_pt1, const Pt3d &a_pt2, const Pt3d &a_t0, const Pt3d &a_t1, const Pt3d &a_t2, Pt3d &a_IntersectPt)
 Determine if the line (described by a_pt1 and a_pt2) intersects the triangle (a_t0, a_t1, a_t2). More...
 
double gm2DDistanceToLineWithTol (const Pt3d *a_pt1, const Pt3d *a_pt2, double a_x, double a_y, double a_tol)
 return the xy distance from (a_x,a_y) to line through (a_pt1, a_pt2) More...
 
void gmGetConvexHull (const VecPt3d &a_pts, VecPt3d &a_hull, bool a_includeOn)
 Calculate convex hull using Monotone chain aka Andrew's algorithm. More...
 
static double iDistanceToRing (const GmBstRing3d &a_ring, const Pt3d &a_pt)
 Return the minimum distance from the point to a line on the ring. More...
 
void iCartToBary (const Pt3d &a_pt1, const Pt3d &a_pt2, const Pt3d &a_pt3, BarycentricVals &a_b)
 Converts from Cartesian coordinates to Barycentric coordinates (local triangle coords). More...
 
void iGetBarycentricCoords (const Pt3d &a_p, BarycentricVals &a_b, Pt3d &weights)
 Calculates weights at the 3 points of a triangle given the location "a_p" and the Barycentric coords of the triangle. More...
 
int mxLUDecomp (double **mat, int n, int *indx, double *d)
 Decompose an n x n matrix into Upper & Lower trianglar (in place), from "Numerical Recipes in C" p 43. More...
 
int mxLUBcksub (double **mat, int n, const int *indx, double *b)
 solve [mat]{x} = {b} by back substitution (mat = LU of mat), from "Numerical Recipes in C" p 44. More...
 
bool mxiLudcmp3 (double mat[3][3], int indx[3], double *d)
 Decomposes a 3 x 3 matrix into Upper & Lower trianglar(in place) More...
 
void mxiLubksb3 (const double mat[3][3], const int indx[3], double b[3])
 solve [mat]{x} = {b} by back substitution (mat = LU of mat) More...
 
bool mxSolveNxN (double **A, double *x, double *b, int n)
 Solves the matrix equation [A]*{x}={b} for {x} where [A] is NxN and {x} and {b} are Nx1 vectors. The matrix A is replaced with the LU decomposition of A. More...
 
bool mxSolveBandedEquations (double **a, double *x, double *b, int numeqs, int halfbandwidth)
 Solves the matrix equation [a][x]=[b] using gauss elimination. More...
 
bool mxSolve3x3 (double A[3][3], double x[3], double b[3])
 Solves the matrix equation [A]*{x}={b} for {x} where [A] is 3x3 and {x} and {b} are 3x1 vectors. More...
 
int mxInvert4x4 (const double matrix[4][4], double inv[4][4])
 Compute the inverse of a transformation matrix. Checks for special case of Orthogonal 4x4 and does easy inverse otherwise uses Gauss-Jordan Elimination with full pivoting and scaling with partial unraveling of loops for speed. See Numerical Recipes in C pages 36-37. More...
 
void mxPointMult (Pt3d *pt, const double ctm[4][4])
 Multiplies a point by a transformation matrix. More...
 
void mxCopy4x4 (double copy[4][4], const double matrix[4][4])
 Copy a transformation matrix. Simply uses memcpy. More...
 
void mxIdent4x4 (double matrix[4][4])
 Sets a transformation matrix to identity. More...
 
void mxMult4x4 (double product[4][4], const double matrix1[4][4], const double matrix2[4][4])
 Multiplies two transformation matrices. More...
 
void mxRotate4x4 (double xrot, double yrot, double zrot, double rMatt[4][4])
 return a rotation matrix with specified x, y, z rotations z - y - x order More...
 
void mxTranslate4x4 (const Pt3d &a_translation, double a_mx[4][4])
 return a translation matrix with specified translation z - y - x order More...
 
bool trTriangulateIt (TrTriangulator &a_Client)
 Do delaunay divide-and-conquer triangulation. More...
 
double trArea (const Pt3d &a_pt1, const Pt3d &a_pt2, const Pt3d &a_pt3)
 Return the signed planar area of the triangle (CCW Positive). More...
 
void trBuildGridTrianglePolys (int rows, int cols, VecPt3d &a_points, VecInt2d &a_polys)
 Create something like this: More...
 
void trBuildGridPolys (int rows, int cols, VecPt3d &pts, VecInt2d &polys)
 Build something like this: More...
 
int trIncrementIndex (int i)
 Faster than a % operation and we do this a lot. More...
 
int trDecrementIndex (int i)
 Faster than a % operation and we do this a lot. More...
 
void trRenumberOnDelete (const SetInt &a_deleting, VecInt &a_vec)
 Boost serialize function. More...
 
VecPt3d ConvexHull (const std::vector< Pt3< double >> &a_points)
 Returns the convex hull of a set of points (Deprecated). More...
 
VecInt ConvexHullWithIndices (const std::vector< int > &a_points, std::shared_ptr< XmUGrid > a_ugrid)
 Returns the convex hull of a set of points (Deprecated). More...
 
bool DoLineSegmentsCross (const std::pair< Pt3< double >, Pt3< double >> &a_segment1, const std::pair< Pt3< double >, Pt3< double >> &a_segment2)
 Determine whether 2 line segments intersect (Deprecated). More...
 
bool DoLineSegmentsCross (const Pt3< double > &a_segment1Point1, const Pt3< double > &a_segment1Point2, const Pt3< double > &a_segment2Point1, const Pt3< double > &a_segment2Point2)
 Determine whether 2 line segments cross (Deprecated). More...
 
bool XmEdgesEquivalent (const XmEdge &a_edge1, const XmEdge &a_edge2)
 Test if two edges are the same ignoring direction. More...
 
std::shared_ptr< XmUGridTEST_XmUGrid1Left90Tri ()
 Builds a 1 cell (left 90 degree triangle) 2D XmUGrid for testing. More...
 
std::shared_ptr< XmUGridTEST_XmUGridSimpleQuad ()
 Builds a 2 cell (Quad) 2D XmUGrid for testing. More...
 
std::shared_ptr< XmUGridTEST_XmUGrid2dLinear ()
 Builds an XmUGrid with supported 1D and 2D linear cells for testing. More...
 
std::shared_ptr< XmUGridTEST_XmUGrid3dLinear ()
 Builds an XmUGrid with supported 3D linear cells for testing. More...
 
std::shared_ptr< XmUGridTEST_XmUGridHexagonalPolyhedron ()
 Builds a 1 cell hexagon with cell type polyhedron. More...
 
std::shared_ptr< xms::XmUGridTEST_XmUBuildQuadUGrid (int a_rows, int a_cols)
 Builds a UGrid of Quads at 1 spacing for rows & cols specified. More...
 
std::shared_ptr< xms::XmUGridTEST_XmUBuildQuadUGrid (int a_rows, int a_cols, const xms::Pt3d &a_origin)
 Builds a UGrid of Quads at 1 spacing for rows & cols specified. More...
 
std::shared_ptr< xms::XmUGridTEST_XmUBuildHexahedronUgrid (int a_rows, int a_cols, int a_lays)
 Builds a UGrid of Quads at 1 spacing for rows & cols specified. More...
 
std::shared_ptr< xms::XmUGridTEST_XmUBuildHexahedronUgrid (int a_rows, int a_cols, int a_lays, const xms::Pt3d &a_origin)
 Builds a UGrid of Quads at 1 spacing for rows & cols specified. More...
 
std::shared_ptr< xms::XmUGridTEST_XmUBuildPolyhedronUgrid (int a_rows, int a_cols, int a_lays)
 Builds a UGrid of Quads at 1 spacing for rows & cols specified. More...
 
std::shared_ptr< xms::XmUGridTEST_XmUBuildPolyhedronUgrid (int a_rows, int a_cols, int a_lays, const xms::Pt3d &a_origin)
 Builds a UGrid of Quads at 1 spacing for rows & cols specified. More...
 
std::shared_ptr< xms::XmUGridTEST_XmUBuild3DChevronUgrid ()
 Builds a UGrid with one 3D Chevron polyhedron. More...
 
std::shared_ptr< XmUGridXmReadUGridFromAsciiFile (const std::string &a_filePath)
 Read XmUGrid from an ASCII file. More...
 
std::shared_ptr< XmUGridXmReadUGridFromStream (std::istream &a_inStream)
 Read an XmUGrid from ASCII text from an input stream. More...
 
void XmWriteUGridToAsciiFile (std::shared_ptr< XmUGrid > a_ugrid, const std::string &a_filePath)
 Write an XmUGrid to an ASCII file. More...
 
void XmWriteUGridToStream (std::shared_ptr< XmUGrid > a_ugrid, std::ostream &a_outStream)
 Save an XmUGrid ASCII text to output stream. More...
 
void XmWriteUGridToStream (const XmUGrid &a_ugrid, std::ostream &a_outStream, bool a_binary)
 Save an XmUGrid ASCII text to output stream. More...
 

Detailed Description

XMS Namespace.

Enumeration Type Documentation

◆ PtInOutOrOn_enum

point in, out, or on

Enumerator
PT_ERROR 

error

PT_IN 

in

PT_OUT 

out

PT_ON 

on

Definition at line 36 of file geoms.h.

◆ Turn_enum

direction of turn between 3 points

Enumerator
TURN_LEFT 

turn left

TURN_RIGHT 

turn right

TURN_COLINEAR_180 

continue onward

TURN_COLINEAR_0 

turns back on same segment

Definition at line 28 of file geoms.h.

Function Documentation

◆ ConvexHull()

std::vector< Pt3d > xms::ConvexHull ( const std::vector< Pt3< double >> &  a_points)

Returns the convex hull of a set of points (Deprecated).

Parameters
[in]a_pointsThe list of points
Returns
the list of points in the convex hull
Note
a convex hull is the minimum set of points which contains (not connects) all of the points in a set and is convex.

Definition at line 55 of file XmGeometry.cpp.

References gmGetConvexHull().

Referenced by ConvexHullWithIndices().

◆ ConvexHullWithIndices()

VecInt xms::ConvexHullWithIndices ( const std::vector< int > &  a_points,
std::shared_ptr< XmUGrid a_ugrid 
)

Returns the convex hull of a set of points (Deprecated).

Parameters
[in]a_pointsThe list of indices to points
[in]a_ugridThe ugrid that contains the points.
Returns
the list of indices to points in the convex hull
Note
a convex hull is the minimum set of points which contains (not connects) all of the points in a set and is convex.

Definition at line 70 of file XmGeometry.cpp.

References ConvexHull().

◆ DoLineSegmentsCross() [1/2]

bool xms::DoLineSegmentsCross ( const std::pair< Pt3< double >, Pt3< double >> &  a_segment1,
const std::pair< Pt3< double >, Pt3< double >> &  a_segment2 
)

Determine whether 2 line segments intersect (Deprecated).

Parameters
[in]a_segment1The first line segment
[in]a_segment2The second line segment
Returns
true if the line segments intersect

Definition at line 99 of file XmGeometry.cpp.

References gmLinesCross().

◆ DoLineSegmentsCross() [2/2]

bool xms::DoLineSegmentsCross ( const Pt3< double > &  a_segment1Point1,
const Pt3< double > &  a_segment1Point2,
const Pt3< double > &  a_segment2Point1,
const Pt3< double > &  a_segment2Point2 
)

Determine whether 2 line segments cross (Deprecated).

Parameters
[in]a_segment1Point1First point 3d of line segment 1
[in]a_segment1Point2Second point 3d of line segment 1
[in]a_segment2Point1First point 3d of line segment 2
[in]a_segment2Point2Second point 3d of line segment 2
Returns
true if the line segments cross

Definition at line 115 of file XmGeometry.cpp.

References gmLinesCross().

◆ gm2DDistanceToLineWithTol()

double xms::gm2DDistanceToLineWithTol ( const Pt3d a_pt1,
const Pt3d a_pt2,
double  a_x,
double  a_y,
double  a_tol 
)

return the xy distance from (a_x,a_y) to line through (a_pt1, a_pt2)

Parameters
[in]a_pt1first point of line segment
[in]a_pt2second point of line segment
[in]a_xx location of point used to compute distance to line
[in]a_yy location of point used to compute distance to line
[in]a_toltolerance used in geometric computations
Returns
distance from a_x,a_y to the line (a_pt1, a_pt2)

Definition at line 2177 of file geoms.cpp.

References sqr().

◆ gmAddToExtents() [1/3]

void xms::gmAddToExtents ( const Pt3d a_pt,
Pt3d a_min,
Pt3d a_max 
)

Compares a_pt to a_min and a_max. If a_pt is less than a_min or greater than a_max, a_min and a_max are updated.

Parameters
[in]a_ptA point.
[in,out]a_minMinimum.
[in,out]a_maxMaximum.

Definition at line 787 of file geoms.cpp.

Referenced by xms::GmMultiPolyIntersectorImpl::BuildRTree(), xms::GmMultiPolyIntersectorImpl::CalculateBuffer(), xms::TrTinImpl::GetExtents(), xms::XmUGrid::Impl::GetExtentsFromPoints(), gmExtents2D(), gmExtents3D(), and xms::TrTriangulatorPoints::UpdateAreaTolerance().

◆ gmAddToExtents() [2/3]

void xms::gmAddToExtents ( const Pt3d a_pt,
Pt2d a_min,
Pt2d a_max 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]a_ptA point.
[in,out]a_minMinimum.
[in,out]a_maxMaximum.

Definition at line 802 of file geoms.cpp.

◆ gmAddToExtents() [3/3]

void xms::gmAddToExtents ( const Pt2d a_pt,
Pt3d a_min,
Pt3d a_max 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]a_ptA point.
[in,out]a_minMinimum.
[in,out]a_maxMaximum.

Definition at line 815 of file geoms.cpp.

◆ gmAngleBetween2DVectors() [1/2]

double xms::gmAngleBetween2DVectors ( double  dxp,
double  dyp,
double  dxn,
double  dyn 
)

Returns the angle (0-2PI) in radians between the edges p and n based on a ccw rotation from p to n.

Parameters
[in]dxpx of vector p.
[in]dypy of vector p.
[in]dxnx of vector n.
[in]dyny of vector n.
Returns
The angle.

Definition at line 603 of file geoms.cpp.

References sqr().

Referenced by gmAngleBetweenEdges().

◆ gmAngleBetween2DVectors() [2/2]

double xms::gmAngleBetween2DVectors ( double  dxp,
double  dyp,
double  dxn,
double  dyn,
double  a_magn,
double  a_magp 
)

Returns the angle (0-2PI) in radians between the edges p and n based on a ccw rotation from p to n.

Parameters
[in]dxpx of vector p.
[in]dypy of vector p.
[in]dxnx of vector n.
[in]dyny of vector n.
[in]a_magnMagnitude of n.
[in]a_magpMagnitude of p.
Returns
The angle.

Definition at line 622 of file geoms.cpp.

References gmCross2D(), and XM_PI.

◆ gmAngleBetweenEdges() [1/2]

double xms::gmAngleBetweenEdges ( const Pt3d p1,
const Pt3d p2,
const Pt3d p3 
)

Returns the ccw angle (0-2pi) between p2-p1 and p2-p3.

Parameters
[in]p1Point 1.
[in]p2Point 2.
[in]p3Point 3.
Returns
The angle.

Definition at line 655 of file geoms.cpp.

References gmAngleBetween2DVectors().

Referenced by xms::TrTinImpl::SwapEdge().

◆ gmAngleBetweenEdges() [2/2]

double xms::gmAngleBetweenEdges ( const Pt2d p1,
const Pt2d p2,
const Pt2d p3 
)

Returns the ccw angle (0-2pi) between p2-p1 and p2-p3.

Parameters
[in]p1Point 1.
[in]p2Point 2.
[in]p3Point 3.
Returns
The angle.

Definition at line 672 of file geoms.cpp.

References gmAngleBetween2DVectors().

◆ gmArrayToVecPt3d()

VecPt3d xms::gmArrayToVecPt3d ( double *  a_array,
int  a_size 
)

Useful in testing to create a VecPt3d from a C array of xy pairs.

Parameters
[in]a_arrayArray of xy pairs ([x][y][x][y]...).
[in]a_sizeArray size.
Returns
Vector of Pt3d.

Definition at line 1590 of file geoms.cpp.

Referenced by GmPolygonUnitTests::SetUpPolyWithHole().

◆ gmBaryPrepare()

int xms::gmBaryPrepare ( const Pt3d p1,
const Pt3d p2,
const Pt3d p3,
const Pt3d norm,
Pt3d orig,
double  coef[6],
int *  dir,
bool  flag 
)

For a tri - compute dir & coefs to compute Barycentric coords.

Parameters
p1= 1st point of triangle.
p2= 2nd point of triangle.
p3= 3rd point of triangle.
norm= triangle normal.
orig= triangle origin (min xyz of p1, p2 and p3).
coef= ?
dir= 0 if norm points to x, 1 if to y, 2 if to z.
flag= if true, origin will be computed from the triangle. If false, just calculate the coefficients and the origin is zero.
Returns
XM_SUCCESS or XM_FAILURE.

Definition at line 315 of file geoms.cpp.

References Mmin(), and XM_SUCCESS.

Referenced by iCartToBary().

◆ gmBisectingAngle()

double xms::gmBisectingAngle ( const Pt3d a_p1,
const Pt3d a_p2,
const Pt3d a_p3 
)

Returns the angle (0-2pi) which bisects the edges p2-p1 and p2-p3 based on a ccw rotation from edge 1 to edge 2.

Parameters
[in]a_p1The first point defining the edge (a_p1:a_p2)
[in]a_p2The second point defining two edges (a_p1:a_p2, a_p2:a_p3)
[in]a_p3The third point defining the edge (a_p2:a_p3)
Returns
angle that bisects the edges

Definition at line 1901 of file geoms.cpp.

References gmCross2D(), sqr(), and XM_PI.

◆ gmBoxesOverlap2d()

bool xms::gmBoxesOverlap2d ( const Pt3d a_b1Min,
const Pt3d a_b1Max,
const Pt3d a_b2Min,
const Pt3d a_b2Max 
)

finds if 2 boxes overlap in 2d

Parameters
[in]a_b1MinMin x,y of first box
[in]a_b1MaxMax x,y of first box
[in]a_b2MinMin x,y of second box
[in]a_b2MaxMax x,y of second box
Returns
true if the boxes overlap

Definition at line 79 of file geoms.cpp.

◆ gmCalculateNormalizedPlaneCoefficients() [1/2]

void xms::gmCalculateNormalizedPlaneCoefficients ( const Pt3d p1,
const Pt3d p2,
const Pt3d p3,
double *  a,
double *  b,
double *  c,
double *  d 
)

Calculates the plane coefficients for a triangle. Given point references calculate coefficents for plane (ax+by+cz+d=0).

Parameters
[in]p1First point.
[in]p2Second point.
[in]p3Third point.
[out]aCoefficient a.
[out]bCoefficient b.
[out]cCoefficient c.
[out]dCoefficient d.

Definition at line 105 of file geoms.cpp.

◆ gmCalculateNormalizedPlaneCoefficients() [2/2]

void xms::gmCalculateNormalizedPlaneCoefficients ( const Pt3d p1,
const Pt3d p2,
const Pt3d p3,
double *  a,
double *  b,
double *  c,
double *  d 
)

Calculates the plane coefficients for a triangle. Given point pointers calculate coefficents for plane (ax+by+cz+d=0).

Parameters
[in]p1First point.
[in]p2Second point.
[in]p3Third point.
[out]aCoefficient a.
[out]bCoefficient b.
[out]cCoefficient c.
[out]dCoefficient d.

Definition at line 127 of file geoms.cpp.

◆ gmCartToBary()

int xms::gmCartToBary ( const Pt3d cart,
const Pt3d orig,
double  coef[6],
int  dir,
Pt3d bary 
)

Compute Barycentric coords for point. Use gmBaryPrepare to get the coefficients and direction.

Parameters
[in]cartcart?
[in]origorig?
[in]coef6 coefficients.
[in]dirDirection.
[out]barypoint?
Returns
XM_SUCCESS (always it seems)

Definition at line 275 of file geoms.cpp.

References XM_SUCCESS.

Referenced by iGetBarycentricCoords().

◆ gmCircumcircleWithTol()

bool xms::gmCircumcircleWithTol ( const Pt3d pt1,
const Pt3d pt2,
const Pt3d pt3,
double *  xc,
double *  yc,
double *  r2,
double  tol 
)

Computes center & radius squared for circumcircle of triangle made by the three points.

Parameters
pt1first of 3 locations defining a triangle
pt2second of 3 locations defining a triangle
pt3third of 3 locations defining a triangle
xccircumcenter x coord
yccircumcenter y coord
r2radius squared of circumcircle
toltolerance for geometric comparison
Returns
false on error (triangle has zero area), otherwise true

Definition at line 218 of file geoms.cpp.

References sqr().

Referenced by gmPtInCircumcircle().

◆ gmColinearWithTol()

bool xms::gmColinearWithTol ( const Pt3d p1,
const Pt3d p2,
const Pt3d p3,
const double  tol 
)

Returns true if (the three vertices are gmColinear. Result should be insensitive to the order of the vertices.

Parameters
[in]p1Point 1.
[in]p2Point 2.
[in]p3Point 3.
[in]tolTolerance
Returns
true if colinear.

Definition at line 393 of file geoms.cpp.

References gmOnLineWithTol().

Referenced by gmIntersectLineSegmentsWithTol(), and xms::TrTriangulatorPoints::ReceiveTriangle().

◆ gmComponentMagnitudes()

void xms::gmComponentMagnitudes ( double *  a_x,
double *  a_y,
double *  a_mag,
double *  a_dir,
bool  a_tomagdir 
)

converts the magnitude and angle to xy components or vice versa

Parameters
[in,out]a_xvector x component either specified or calculated from a_mag, a_dir
[in,out]a_yvector y component either specified or calculated from a_mag, a_dir
[in,out]a_magvector magnitude either specified or calculated from a_x, a_y
[in,out]a_dirvector direction (degrees) either specified or calculated from a_x, a_y
[in]a_tomagdirflag, when true a_x, a_y are used to calculate a_mag, a_dir; when false a_mag, a_dir are used to calculate a_x, a_y

Definition at line 1941 of file geoms.cpp.

References sqr(), XM_PI, and XM_ZERO_TOL.

◆ gmComputeCentroid()

Pt3d xms::gmComputeCentroid ( const VecPt3d a_points)

Computes the centroid of points (but not of a polygon). Shouldn't pass an empty vector (no checks are performed).

Parameters
[in]a_pointsPoints.
Returns
Centroid.

Definition at line 895 of file geoms.cpp.

Referenced by xms::GmMultiPolyIntersectionSorterTerse::RemoveDuplicateEdges(), GeomsXmsngUnitTests::test_gmComputeCentroid(), and trBuildGridTrianglePolys().

◆ gmComputeDeviationInDirection()

double xms::gmComputeDeviationInDirection ( const Pt3d a_p0,
const Pt3d a_p1,
const Pt3d a_p2 
)

Computes the deviation in direction from one seg to next seg 1 is from a_p0 to a_p1 seg 2 is from a_p1 to a_p2.

Parameters
[in]a_p01st point on 1st segment.
[in]a_p12nd point on 1st segment and 1st point on second segment.
[in]a_p22nd point on 2nd segment.
Returns
Returns value between 0 and PI. note: magnitude zero would cause problem - return PI in this case returning PI would indicate that there could be discontinuity this is a streamlined version of gmAngleBetweenEdges that function
  • computes a directed internal difference
  • requires an extra cross product, several compares & multiplies this function still has the sqrt and acos, so maybe not a big deal

Definition at line 697 of file geoms.cpp.

References Mmax(), Mmin(), and XM_PI.

◆ gmComputePolygonCentroid()

Pt3d xms::gmComputePolygonCentroid ( const VecPt3d pts)

Computes the plan view centroid of a non-self-intersecting polygon.

Parameters
[in]ptsPoints.
Returns
Centroid.

Definition at line 908 of file geoms.cpp.

Referenced by xms::XmUGrid::Impl::GetCellCentroid(), and GeomsXmsngUnitTests::test_gmComputePolygonCentroid().

◆ gmComputeXyTol()

double xms::gmComputeXyTol ( const Pt3d a_mn,
const Pt3d a_mx 
)

Given extents (min, max), compute a tolerance for the xy plane to be used with geometric functions.

Parameters
a_mnMinimum.
a_mxMaximum.
Returns
Tolerance.

Definition at line 1262 of file geoms.cpp.

References gmXyDistance().

Referenced by xms::GmMultiPolyIntersectorImpl::CalculateBuffer(), xms::TrBreaklineAdderImpl::ComputeTolerance(), and xms::TrTriangulatorPoints::UpdateAreaTolerance().

◆ gmConvertAngleToBetween0And360()

double xms::gmConvertAngleToBetween0And360 ( double  a_angle,
bool  a_InDegrees 
)

given an angle, this function will return the corresponding angle that matches it in the range of 0 deg to 360 deg

Parameters
[in]a_angleThe angle to convert to 0 to 360
[in]a_InDegreesFlag to tell if the angle is in degrees vs radians
Returns
an angle between 0 and 360

Definition at line 1997 of file geoms.cpp.

References GTEQ_TOL(), LT_TOL(), and XM_PI.

◆ gmCounterClockwiseTri()

bool xms::gmCounterClockwiseTri ( const Pt3d vtx0,
const Pt3d vtx1,
const Pt3d vtx2 
)

Returns true if the triangle is wrapped counter clockwise.

Parameters
[in]vtx0Vertex 0.
[in]vtx1Vertex 1.
[in]vtx2Vertex 2.
Returns
true if vertex order is counter clockwise.

Definition at line 564 of file geoms.cpp.

References trArea().

Referenced by xms::TrTinImpl::SwapEdge().

◆ gmCreateVector()

Pt3d xms::gmCreateVector ( const Pt3d a_p1,
const Pt3d a_p2 
)

creates a vector from a_p1 to a_p2

Parameters
[in]a_p1The first point
[in]a_p2The second point
Returns
a vector with x,y,z components representing the direction from a_p1 to a_p2

Definition at line 1982 of file geoms.cpp.

◆ gmCross2D() [1/2]

double xms::gmCross2D ( const double &  dx1,
const double &  dy1,
const double &  dx2,
const double &  dy2 
)

Returns the cross product of two 2-d vectors.

Parameters
dx1x component of vector 1
dy1y component of vector 1
dx2x component of vector 2
dy2y component of vector 2
Returns
cross product of 2 vectors vector 1 = dx1i + dy1j vector 2 = dx2i + dy2j

Definition at line 579 of file geoms.cpp.

Referenced by gmAngleBetween2DVectors(), gmBisectingAngle(), and gmLinesCross().

◆ gmCross2D() [2/2]

double xms::gmCross2D ( const Pt3d a_origin,
const Pt3d a_A,
const Pt3d a_B 
)

2D cross product of two points

Parameters
[in]a_originorigin point for the "vectors"
[in]a_Afirst vector
[in]a_Bsecond vector
Returns
the cross product

Definition at line 590 of file geoms.cpp.

◆ gmCross3D()

void xms::gmCross3D ( const Pt3d a_vec1,
const Pt3d a_vec2,
Pt3d a_vec3 
)

Perform a cross product of Pt3d's.

Parameters
[in]a_vec1First vector to cross
[in]a_vec2Second vector to cross
[out]a_vec3Resulting cross product

Definition at line 2034 of file geoms.cpp.

Referenced by gmIntersectTriangleAndLineSegment().

◆ gmDot3D()

double xms::gmDot3D ( const Pt3d a_vec1,
const Pt3d a_vec2 
)
inline

Perform a dot product of Pt3d's.

Parameters
[in]a_vec1First vector to dot
[in]a_vec2Second vector to dot
Returns
The dot product has the geometric interpretation as the length of the projection of a_vec1 onto the unit vector a_vec2 when the two vectors are placed so that their tails coincide.

Definition at line 2048 of file geoms.cpp.

Referenced by gmIntersectTriangleAndLineSegment().

◆ gmEnvelopeOfPts()

void xms::gmEnvelopeOfPts ( const VecPt3d a_pts,
Pt3d a_min,
Pt3d a_max 
)

Calculates the envelope of a vector of points.

Parameters
[in]a_ptsArray of points
[out]a_minMin x,y,z of the points
[out]a_maxMax x,y,z of the points

Definition at line 1606 of file geoms.cpp.

References XM_ENSURE_TRUE.

◆ gmEqualPointsXY() [1/5]

bool xms::gmEqualPointsXY ( double  x1,
double  y1,
double  x2,
double  y2,
double  tolerance 
)

Returns true if the points are equal to within gmXyTol().

Parameters
x1x of point 1.
y1y of point 1.
x2x of point 2.
y2y of point 2.
tolerancetolerance.
Returns
true if equal.

Definition at line 1308 of file geoms.cpp.

Referenced by xms::GmMultiPolyIntersectionSorterTerse::FixTValueAtDuplicateXy(), gmEqualPointsXY(), gmInsideOfLineWithTol(), gmInsideOrOnLineWithTol(), gmIntersectLineSegmentsWithTol(), gmOnLineWithTol(), and xms::GmMultiPolyIntersectorImpl::PointsOnSegment().

◆ gmEqualPointsXY() [2/5]

bool xms::gmEqualPointsXY ( double  x1,
double  y1,
double  x2,
double  y2 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
x1x of point 1.
y1y of point 1.
x2x of point 2.
y2y of point 2.
Returns
true if equal.

Definition at line 1327 of file geoms.cpp.

References gmEqualPointsXY(), and gmXyTol().

◆ gmEqualPointsXY() [3/5]

bool xms::gmEqualPointsXY ( const Pt2d a_pt1,
const Pt2d a_pt2,
double  tol 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
a_pt1Point 1.
a_pt2Point 2.
toltolerance.
Returns
true if equal within tolerance.

Definition at line 1338 of file geoms.cpp.

References gmEqualPointsXY().

◆ gmEqualPointsXY() [4/5]

bool xms::gmEqualPointsXY ( const Pt3d a_pt1,
const Pt3d a_pt2,
double  tol 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
a_pt1Point 1.
a_pt2Point 2.
toltolerance.
Returns
true if equal within tolerance.

Definition at line 1349 of file geoms.cpp.

References gmEqualPointsXY().

◆ gmEqualPointsXY() [5/5]

bool xms::gmEqualPointsXY ( const Pt2i point1,
const Pt2i point2 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
point1Point 1.
point2Point 2.
Returns
true if equal within tolerance.

Definition at line 1359 of file geoms.cpp.

◆ gmEqualPointsXYZ() [1/3]

bool xms::gmEqualPointsXYZ ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
double  tolerance 
)

Returns true if the points are equal to within tolerance.

Parameters
x1x of point 1.
y1y of point 1.
z1z of point 1.
x2x of point 2.
y2y of point 2.
z2z of point 2.
tolerancetolerance.
Returns
true if equal.

Definition at line 1376 of file geoms.cpp.

Referenced by gmEqualPointsXYZ().

◆ gmEqualPointsXYZ() [2/3]

bool xms::gmEqualPointsXYZ ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
x1x of point 1.
y1y of point 1.
z1z of point 1.
x2x of point 2.
y2y of point 2.
z2z of point 2.
Returns
true if equal within tolerance.

Definition at line 1398 of file geoms.cpp.

References gmEqualPointsXYZ(), and gmXyTol().

◆ gmEqualPointsXYZ() [3/3]

bool xms::gmEqualPointsXYZ ( const Pt3d pt1,
const Pt3d pt2,
double  tol 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
pt1Point 1.
pt2Point 2.
toltolerance.
Returns
true if equal within tolerance.

Definition at line 1409 of file geoms.cpp.

References gmEqualPointsXYZ().

◆ gmExtents2D() [1/2]

void xms::gmExtents2D ( const VecPt3d a_points,
Pt2d a_min,
Pt2d a_max 
)

Get the 2D extents of a vector of points.

Parameters
[in]a_pointsThe points.
[out]a_minMinimum point (xy) of bounding rectangle.
[out]a_maxMaximum point (xy) of bounding rectangle.

Definition at line 1821 of file geoms.cpp.

References gmAddToExtents(), and XM_ENSURE_TRUE_VOID_NO_ASSERT.

◆ gmExtents2D() [2/2]

void xms::gmExtents2D ( const VecPt3d a_points,
Pt3d a_min,
Pt3d a_max 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]a_pointsVector of points.
[in,out]a_minMinimum value.
[in,out]a_maxMaximum value.

Definition at line 1838 of file geoms.cpp.

References gmAddToExtents(), and XM_ENSURE_TRUE_VOID_NO_ASSERT.

◆ gmExtents3D()

void xms::gmExtents3D ( const VecPt3d a_points,
Pt3d a_min,
Pt3d a_max 
)

Get the 3D extents of a vector of points.

Parameters
[in]a_pointsThe points.
[out]a_minMinimum point (xyz) of bounding box.
[out]a_maxMaximum point (xyz) of bounding box.

Definition at line 1856 of file geoms.cpp.

References gmAddToExtents(), and XM_ENSURE_TRUE_VOID_NO_ASSERT.

◆ gmFindClosestPtOnSegment()

double xms::gmFindClosestPtOnSegment ( const Pt3d a_pt1,
const Pt3d a_pt2,
const Pt3d a_pt,
Pt3d a_newpt,
const double  a_tol 
)

Finds the closest point to another point on a segment.

Parameters
[in]a_pt1First point of segment
[in]a_pt2Second point of segment
[in]a_ptPoint used to find closest point on the segment
[out]a_newptThe point on the segment (a_pt1, a_pt2) that is closest to a_pt.
[in]a_tolTolerance
Returns
parametric value along the line a_pt1, a_pt2 that is the location of a_newpt.

Definition at line 1714 of file geoms.cpp.

References gmPtDistanceAlongSegment().

◆ gmGetConvexHull()

void xms::gmGetConvexHull ( const VecPt3d a_pts,
VecPt3d a_hull,
bool  a_includeOn 
)

Calculate convex hull using Monotone chain aka Andrew's algorithm.

Parameters
[in]a_ptsThe input points.
[out]a_hullThe convex hull polygon. First point is NOT repeated.
[in]a_includeOnShould points on the hull's line segments be included?

Definition at line 2211 of file geoms.cpp.

References gmTurn().

Referenced by ConvexHull(), xms::XmUGrid::Impl::GetPlanViewPolygon3d(), and GeomsXmsngUnitTests::testConvexHull().

◆ gmInsideOfLineWithTol()

bool xms::gmInsideOfLineWithTol ( const Pt3d a_vertex1,
const Pt3d a_vertex2,
const Pt3d a_oppositevertex,
const double  a_x,
const double  a_y,
const double  a_tol 
)

Returns TRUE if the Point on the same side of the line (defined by vertex1 and vertex2) as oppositevertex.

Parameters
[in]a_vertex1: First point on the line segment
[in]a_vertex2: Second point on the line segment
[in]a_oppositevertex: Point on one side of the line
[in]a_x: X location of the point being tested
[in]a_y: Y location of the point being tested
[in]a_tol: Tolerance for degenerate cases
Returns
true if the a_x, a_y are inside the line defined by a_vertex1 and a_vertex2. Inside is defined as the opposite side of a_oppositevertex

Definition at line 1782 of file geoms.cpp.

References gmEqualPointsXY(), and sqr().

◆ gmInsideOrOnLineWithTol()

bool xms::gmInsideOrOnLineWithTol ( const Pt3d p1,
const Pt3d p2,
const Pt3d inpoint,
const double  x,
const double  y,
const double  tol,
double *  dist 
)

Returns true if the (x,y) is on the line segment (p1,p2) or on the same side of the line as "inpoint". ASSERTs in debug if "inpoint" is on the line (within tol).

Parameters
[in]p1Point 1.
[in]p2Point 2.
[in]inpointPoint on same side of line as xy if true is returned.
[in]xx of point.
[in]yy of point.
[in]tolTolerance.
[out]distHow far "outside" the point is. A negative distance indicates point is in by that distance.
Returns
true if in.

Definition at line 1450 of file geoms.cpp.

References gmEqualPointsXY(), Mfabs(), and sqr().

Referenced by gmPointInTriangleWithTol().

◆ gmIntersectLineSegmentsWithTol()

bool xms::gmIntersectLineSegmentsWithTol ( const Pt3d one1,
const Pt3d one2,
const Pt3d two1,
const Pt3d two2,
double *  xi,
double *  yi,
double *  zi1,
double *  zi2,
double  tol 
)

Intersects the plan projection of two line segments.

Parameters
one1first point on segment 1
one2second point on segment 1
two1first point on segment 2
two2second point on segment 2
xix coord of intersection
yiy coord of intersection
zi1z coord of intersection on segment 1
zi2z coord of intersection on segemnt 2
toltolerance for geometric comparison

segment 1 = one1,one2 = one1 + lambda(one2 - one1) segment 2 = two1,two2 = two1 + mu (two2 - two1)

Returns
true if lines intersect, else false

Definition at line 420 of file geoms.cpp.

References EQ_TOL(), gmColinearWithTol(), gmEqualPointsXY(), GT_TOL(), and LT_TOL().

Referenced by xms::TrBreaklineAdderImpl::FindIntersectingEdgeFromEdge(), xms::TrBreaklineAdderImpl::FindIntersectingEdgeFromPoint(), and xms::TrBreaklineAdderImpl::ProcessSegmentBySwapping().

◆ gmIntersectTriangleAndLineSegment()

int xms::gmIntersectTriangleAndLineSegment ( const Pt3d a_pt1,
const Pt3d a_pt2,
const Pt3d a_t0,
const Pt3d a_t1,
const Pt3d a_t2,
Pt3d a_IntersectPt 
)

Determine if the line (described by a_pt1 and a_pt2) intersects the triangle (a_t0, a_t1, a_t2).

Parameters
[in]a_pt1First point defining a segment
[in]a_pt2Second point defining a segment
[in]a_t0First point defining a triangle
[in]a_t1Second point defining a triangle
[in]a_t2Third point defining a triangle
[out]a_IntersectPtThe point of intersection if the segment and triangle intersect
Returns
-1 if triangle is degenerate (a point or a line) 0 if line does not intersect triangle 1 if line does intersect triangle 2 if line and triangle are in the same plane

Definition at line 2075 of file geoms.cpp.

References gmCross3D(), gmDot3D(), and XM_ZERO_TOL.

◆ gmLinesCross()

bool xms::gmLinesCross ( const Pt3d a_segment1Point1,
const Pt3d a_segment1Point2,
const Pt3d a_segment2Point1,
const Pt3d a_segment2Point2 
)

Determine whether 2 line segments cross. The segments may touch at the end points.

Parameters
[in]a_segment1Point1First point 3d of line segment 1
[in]a_segment1Point2Second point 3d of line segment 1
[in]a_segment2Point1First point 3d of line segment 2
[in]a_segment2Point2Second point 3d of line segment 2
Returns
true if the line segments cross

Definition at line 1013 of file geoms.cpp.

References gmCross2D().

Referenced by xms::XmUGrid::Impl::DoEdgesCrossWithPointChange(), DoLineSegmentsCross(), and GeomsXmsngUnitTests::testDoLineSegmentsCross().

◆ gmLinesIntersect()

bool xms::gmLinesIntersect ( const Pt3d one1,
const Pt3d one2,
const Pt3d two1,
const Pt3d two2 
)

intersects the plan projection of two line segments (bad func name) segment 1 = one1,one2 = one1 + lambda(one2 - one1) segment 2 = two1,two2 = two1 + mu (two2 - two1)

Parameters
one1first point on first segment
one2second point on first segment
two1first point on second segment
two2second point on second segment
Returns
true if segments intersect, else false

Definition at line 966 of file geoms.cpp.

References GT_TOL(), LT_TOL(), and XM_ZERO_TOL.

◆ gmMiddleZ()

double xms::gmMiddleZ ( const VecPt3d a_points)

Returns the z value halfway between the max and min z. Different from the average z (where many points can skew the average).

Parameters
a_pointsvector of locations
Returns
Middle z value.

Definition at line 153 of file geoms.cpp.

◆ gmOnLineAndBetweenEndpointsWithTol()

bool xms::gmOnLineAndBetweenEndpointsWithTol ( const Pt3d a_pt1,
const Pt3d a_pt2,
const double  a_x,
const double  a_y,
double  a_tol 
)

determines if (x,y) is on the line passing through p1 & p2 and between p1 & p2.

Parameters
a_pt1first location defining segment
a_pt2second location defining segment
a_xx coord
a_yy coord
a_toltolerance for comparison
Returns
true if on line segment
Note
For simple test of colinearity, call gmOnLineWithTol or gmColinear

Definition at line 767 of file geoms.cpp.

References gmOnLineWithTol(), Mmax(), and Mmin().

Referenced by xms::GmMultiPolyIntersectorImpl::PointsOnSegment().

◆ gmOnLineWithTol()

bool xms::gmOnLineWithTol ( const Pt3d p1,
const Pt3d p2,
const double  x,
const double  y,
const double  tol 
)

Determines if a point (x,y) is on the line defined by p1 and p2. Assumes p1 and p2 aren't the same.

Parameters
p1first location defining a line
p2second location defining a line
xx coord of point to test
yy coord of point to test
toltolerance for geometric comparison
Returns
Returns true if the Point is on the line passing through p1 and p2 within the tolerance passed. note: you should always be careful to consider the case when p1 and p2 are very close to each other but not to x,y. in that case this test will almost always fail because it will be more susceptible to roundoff error. if you need to know if three points are colinear you should use the gmColinear function.

Definition at line 732 of file geoms.cpp.

References gmEqualPointsXY(), and sqr().

Referenced by gmColinearWithTol(), and gmOnLineAndBetweenEndpointsWithTol().

◆ gmOrderPointsCounterclockwise() [1/2]

void xms::gmOrderPointsCounterclockwise ( const VecPt3d a_pts,
VecInt a_ccwOrder,
int  a_startindex 
)

Orders array of points counter clockwise. Given non-empty array of points. array of point indices ordered counter clockwise based on the angle from the centroid where angle starts at point at startindex.

Parameters
[in]a_ptsArray of points
[out]a_ccwOrderArray of indices to points
[in]a_startindexStarting position in arrays

Definition at line 1635 of file geoms.cpp.

Referenced by gmOrderPointsCounterclockwise().

◆ gmOrderPointsCounterclockwise() [2/2]

void xms::gmOrderPointsCounterclockwise ( VecPt3d a_pts)

Overload to gmOrderPointsCounterclockwise.

Parameters
[out]a_ptsArray of points

Definition at line 1690 of file geoms.cpp.

References gmOrderPointsCounterclockwise().

◆ gmPerpendicularAngle()

double xms::gmPerpendicularAngle ( const Pt3d a_pt1,
const Pt3d a_pt2 
)

Returns the angle in radians perpendicular to the two points.

Parameters
[in]a_pt1The first point defining an edge
[in]a_pt2The second point defining an edge
Returns
angle perpendicular to the edge

Definition at line 1874 of file geoms.cpp.

References sqr(), and XM_PI.

◆ gmPointInOrOnBox2d()

bool xms::gmPointInOrOnBox2d ( const Pt3d a_bMin,
const Pt3d a_bMax,
const Pt3d a_pt 
)

finds if a point is in or on a box in 2d

Parameters
[in]a_bMinMin x,y of first box
[in]a_bMaxMax x,y of first box
[in]a_ptpoint being tested
Returns
true if the point is in or on a box

Definition at line 65 of file geoms.cpp.

◆ gmPointInPolygon2D() [1/7]

template<typename T >
int xms::gmPointInPolygon2D ( const T *  a_verts,
const size_t  a_num,
const double  a_x,
const double  a_y,
const double  a_tol 
)

Determines whether (a_x, a_y) is inside=1, on=0, or outside=-1 the polygon defined by the given vertices.

DON'T repeat the first point at the end of the polygon array

See also
EFastPointInPoly
GmPolygon
Parameters
[in]a_vertsThe polygon in CW or CCW order (doesn't matter which).
[in]a_numNumber of verts in a_verts.
[in]a_xX coordinate of point to test.
[in]a_yY coordinate of point to test.
[in]a_tolTolerance.
Returns
1 (inside), 0 (on), or -1 (outside)

Definition at line 1057 of file geoms.cpp.

Referenced by GmPointInPolyTester_gmPointInPolygon2D::CheckPoint(), gmPointInPolygon2D(), and GeomsXmsngIntermediateTests::test_gmPointInPolygon2D().

◆ gmPointInPolygon2D() [2/7]

int xms::gmPointInPolygon2D ( const Pt3d a_verts,
size_t  a_num,
double  a_x,
double  a_y 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]a_vertsThe polygon in CW or CCW order (doesn't matter which).
[in]a_numNumber of verts in a_verts.
[in]a_xX coordinate of point to test.
[in]a_yY coordinate of point to test.
Returns
1 (inside), 0 (on), or -1 (outside)

Definition at line 1155 of file geoms.cpp.

References gmPointInPolygon2D(), and gmXyTol().

◆ gmPointInPolygon2D() [3/7]

int xms::gmPointInPolygon2D ( const Pt3d a_verts,
size_t  a_num,
Pt3d  a_pt 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]a_vertsThe polygon in CW or CCW order (doesn't matter which).
[in]a_numNumber of verts in a_verts.
[in]a_ptPoint to test.
Returns
1 (inside), 0 (on), or -1 (outside)

Definition at line 1166 of file geoms.cpp.

References gmPointInPolygon2D(), and gmXyTol().

◆ gmPointInPolygon2D() [4/7]

int xms::gmPointInPolygon2D ( const Pt2i a_verts,
size_t  a_num,
Pt2d  a_pt 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]a_vertsThe polygon in CW or CCW order (doesn't matter which).
[in]a_numNumber of verts in a_verts.
[in]a_ptPoint to test.
Returns
1 (inside), 0 (on), or -1 (outside)

Definition at line 1177 of file geoms.cpp.

References gmPointInPolygon2D(), and gmXyTol().

◆ gmPointInPolygon2D() [5/7]

int xms::gmPointInPolygon2D ( const Pt2i a_verts,
size_t  a_num,
Pt3d  a_pt 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]a_vertsThe polygon in CW or CCW order (doesn't matter which).
[in]a_numNumber of verts in a_verts.
[in]a_ptPoint to test.
Returns
1 (inside), 0 (on), or -1 (outside)

Definition at line 1188 of file geoms.cpp.

References gmPointInPolygon2D(), and gmXyTol().

◆ gmPointInPolygon2D() [6/7]

int xms::gmPointInPolygon2D ( const Pt2i a_verts,
size_t  a_num,
Pt2i  a_pt 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]a_vertsThe polygon in CW or CCW order (doesn't matter which).
[in]a_numNumber of verts in a_verts.
[in]a_ptPoint to test.
Returns
1 (inside), 0 (on), or -1 (outside)

Definition at line 1199 of file geoms.cpp.

References gmPointInPolygon2D(), and gmXyTol().

◆ gmPointInPolygon2D() [7/7]

int xms::gmPointInPolygon2D ( const VecPt3d a_verts,
const Pt3d a_pt 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]a_vertsThe polygon in CW or CCW order (doesn't matter which).
[in]a_ptPoint to test.
Returns
1 (inside), 0 (on), or -1 (outside)

Definition at line 1209 of file geoms.cpp.

References gmPointInPolygon2D(), and gmXyTol().

Referenced by GeomsXmsngIntermediateTests::test_gmPointInPolygon2D().

◆ gmPointInPolygon2D< Pt2d >()

template int xms::gmPointInPolygon2D< Pt2d > ( const Pt2d a_verts,
const size_t  a_num,
const double  a_x,
const double  a_y,
const double  a_tol 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]a_vertsThe polygon in CW or CCW order (doesn't matter which).
[in]a_numNumber of verts in a_verts.
[in]a_xX coordinate of point to test.
[in]a_yY coordinate of point to test.
[in]a_tolTolerance.
Returns
1 (inside), 0 (on), or -1 (outside)

◆ gmPointInPolygon2D< Pt2i >()

template int xms::gmPointInPolygon2D< Pt2i > ( const Pt2i a_verts,
const size_t  a_num,
const double  a_x,
const double  a_y,
const double  a_tol 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]a_vertsThe polygon in CW or CCW order (doesn't matter which).
[in]a_numNumber of verts in a_verts.
[in]a_xX coordinate of point to test.
[in]a_yY coordinate of point to test.
[in]a_tolTolerance.
Returns
1 (inside), 0 (on), or -1 (outside)

◆ gmPointInPolygon2D< Pt3d >()

template int xms::gmPointInPolygon2D< Pt3d > ( const Pt3d a_verts,
const size_t  a_num,
const double  a_x,
const double  a_y,
const double  a_tol 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]a_vertsThe polygon in CW or CCW order (doesn't matter which).
[in]a_numNumber of verts in a_verts.
[in]a_xX coordinate of point to test.
[in]a_yY coordinate of point to test.
[in]a_tolTolerance.
Returns
1 (inside), 0 (on), or -1 (outside)

◆ gmPointInTriangleWithTol()

bool xms::gmPointInTriangleWithTol ( const Pt3d p1,
const Pt3d p2,
const Pt3d p3,
double  x,
double  y,
double  tol 
)

Returns true if (x,y) is in the tri formed by p1, p2, p3.

Parameters
[in]p1Point 1.
[in]p2Point 2.
[in]p3Point 3.
[in]xx of point.
[in]yy of point.
[in]tolTolerance.
Returns
true if in.

Definition at line 1423 of file geoms.cpp.

References gmInsideOrOnLineWithTol().

◆ gmPolygonArea()

double xms::gmPolygonArea ( const Pt3d pts,
size_t  npoints 
)

Compute 2d planview projection of area of polygon.

Parameters
ptslocations defining the polygon
npointsnumber of pts
Returns
Area of the polygon.

CCW = positive area, CW = negative. Don't repeat the last point.

Definition at line 1537 of file geoms.cpp.

Referenced by xms::XmUGrid::Impl::GetOrientationFromArea().

◆ gmPtDistanceAlongSegment()

double xms::gmPtDistanceAlongSegment ( const Pt3d a_pt1,
const Pt3d a_pt2,
const Pt3d a_pt,
const double  a_tol 
)

Finds the distance along a segment for the location closest to a_pt.

Parameters
[in]a_pt1First point of segment
[in]a_pt2Second point of segment
[in]a_ptPoint used to find closest point on the segment
[in]a_tolTolerance
Returns
parametric value along the line a_pt1, a_pt2 that is the closest location to a_pt.

Definition at line 1749 of file geoms.cpp.

Referenced by xms::GmMultiPolyIntersectorImpl::ComputeTValues(), and gmFindClosestPtOnSegment().

◆ gmPtInCircumcircle()

PtInOutOrOn_enum xms::gmPtInCircumcircle ( const Pt3d pt,
Pt3d  circumcirclePts[3] 
)

Is a given point inside a circumcircle defined by three points?

Parameters
ptThe point.
circumcirclePts3 points on the circumcircle.
Returns
PtInOutOrOn_enum

Definition at line 172 of file geoms.cpp.

References gmCircumcircleWithTol(), gmXyTol(), PT_ERROR, PT_IN, PT_ON, PT_OUT, and sqr().

Referenced by xms::TrTinImpl::PointIsInCircumcircle().

◆ gmTurn()

Turn_enum xms::gmTurn ( const Pt3d a_v1,
const Pt3d a_v2,
const Pt3d a_v3,
double  a_angtol 
)

Determine if angle a_v1, a_v2, a_v3 is a left turn, a right turn, colinear 180 degrees, or colinear 0 degrees.

Parameters
a_v1first of 3 locations defining an angle
a_v2second of 3 locations defining an angle
a_v3third of 3 locations defining an angle
a_angtoltolerance for comparing angle see notes
Returns
the type of turn defined by the angle
Note
a_angtol was added in August 2014 by AKZ (with consultation by APC). This is the sine of the angle that is considered a turn at all. The default is 0.0017453 (sine 0.1 and sine 179.9). Therefore, this function will only classify two segments as colinear if the angle between edges is less than this tol of the angle between edges is greater than 180-tol. In that case it will determine if the angle is considered to be 180 TURN_COLINEAR_180 or 0 TURN_COLINEAR_0 based on the cosine.

Definition at line 863 of file geoms.cpp.

References TURN_COLINEAR_0, TURN_COLINEAR_180, TURN_LEFT, and TURN_RIGHT.

Referenced by gmGetConvexHull(), and xms::GmMultiPolyIntersectionSorterTerse::RemoveDuplicateEdges().

◆ gmXyDistance() [1/2]

double xms::gmXyDistance ( double  x1,
double  y1,
double  x2,
double  y2 
)

Compute the 2d distance between 2 points.

Parameters
x1x coord of location 1
y1y coord of location 1
x2x coord of location 2
y2y coord of location 2
Returns
Distance between location 1 and 2
Note
See gmActualDistance if you don't want the distance in model units.

Definition at line 832 of file geoms.cpp.

References sqr().

Referenced by xms::GmMultiPolyIntersectorImpl::CalculateBuffer(), xms::TrTinImpl::CheckTriangle(), and gmComputeXyTol().

◆ gmXyDistance() [2/2]

double xms::gmXyDistance ( const Pt3d pt1,
const Pt3d pt2 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]pt1Point 1.
[in]pt2Point 2.
Returns
Distance.

Definition at line 842 of file geoms.cpp.

References sqr().

◆ gmXyDistanceSquared()

double xms::gmXyDistanceSquared ( const Pt3d pt1,
const Pt3d pt2 
)

Calculate XY distance between two 3D points.

Parameters
[in]pt1First point.
[in]pt2Second point.
Returns
distance squared.

Definition at line 202 of file geoms.cpp.

References sqr().

◆ gmXyTol()

double xms::gmXyTol ( bool  a_set,
double  a_value 
)

Get or set (set first time) global xy tolerance for float operations.

Parameters
a_setTrue if setting.
a_valueThe value if setting.
Returns
XY tolerance.

Definition at line 1279 of file geoms.cpp.

Referenced by xms::GmMultiPolyIntersectorImpl::ComputeTValues(), xms::GmMultiPolyIntersectionSorterTerse::FixTValueAtDuplicateXy(), gmEqualPointsXY(), gmEqualPointsXYZ(), gmPointInPolygon2D(), gmPtInCircumcircle(), and xms::GmMultiPolyIntersectorImpl::TraverseLineSegment().

◆ gmZTol()

double xms::gmZTol ( bool  a_set,
double  a_value 
)

Get or set (set first time) global z tolerance for float operations.

Parameters
a_setTrue if setting.
a_valueThe value if setting.
Returns
Z tolerance.

Definition at line 1292 of file geoms.cpp.

◆ iCartToBary()

void xms::iCartToBary ( const Pt3d a_pt1,
const Pt3d a_pt2,
const Pt3d a_pt3,
BarycentricVals a_b 
)

Converts from Cartesian coordinates to Barycentric coordinates (local triangle coords).

Parameters
a_pt1Point 1.
a_pt2Point 2.
a_pt3Point 3.
a_bBarycentric values.

Definition at line 188 of file GmTriSearch.cpp.

References xms::BarycentricVals::coef, xms::BarycentricVals::dir, gmBaryPrepare(), xms::BarycentricVals::orig, xms::Pt3< T >::x, and xms::Pt3< T >::y.

Referenced by xms::GmTriSearchImpl::GetTriBarycentricVals().

◆ iDistanceToRing()

static double xms::iDistanceToRing ( const GmBstRing3d a_ring,
const Pt3d a_pt 
)
static

Return the minimum distance from the point to a line on the ring.

Parameters
[in]a_ringThe ring.
[in]a_ptA point.
Returns
The distance.

Definition at line 75 of file GmPolygon.cpp.

Referenced by xms::GmPolygonImpl::MinDistanceToBoundary().

◆ iGetBarycentricCoords()

void xms::iGetBarycentricCoords ( const Pt3d a_p,
BarycentricVals a_b,
Pt3d weights 
)

Calculates weights at the 3 points of a triangle given the location "a_p" and the Barycentric coords of the triangle.

Parameters
a_pA point
a_bBarycentric values.
weightsWeights.

Definition at line 203 of file GmTriSearch.cpp.

References xms::BarycentricVals::coef, xms::BarycentricVals::dir, gmCartToBary(), xms::BarycentricVals::orig, xms::Pt3< T >::x, and xms::Pt3< T >::y.

Referenced by xms::GmTriSearchImpl::FindTriangle().

◆ mxCopy4x4()

void xms::mxCopy4x4 ( double  copy[4][4],
const double  matrix[4][4] 
)

Copy a transformation matrix. Simply uses memcpy.

Parameters
copymatrix that will have result of copy
matrix4x4 matrix to copy

Definition at line 563 of file matrix.cpp.

Referenced by mxInvert4x4(), and mxMult4x4().

◆ mxIdent4x4()

void xms::mxIdent4x4 ( double  matrix[4][4])

Sets a transformation matrix to identity.

Parameters
matrixmatrix to change

Definition at line 571 of file matrix.cpp.

Referenced by mxRotate4x4(), and mxTranslate4x4().

◆ mxiLubksb3()

void xms::mxiLubksb3 ( const double  mat[3][3],
const int  indx[3],
double  b[3] 
)

solve [mat]{x} = {b} by back substitution (mat = LU of mat)

Parameters
matmatrix[3][3]
indx
bvector of solution [mat]{x} = {b}

Definition at line 231 of file matrix.cpp.

Referenced by mxSolve3x3().

◆ mxiLudcmp3()

bool xms::mxiLudcmp3 ( double  mat[3][3],
int  indx[3],
double *  d 
)

Decomposes a 3 x 3 matrix into Upper & Lower trianglar(in place)

Parameters
matmatrix[3][3]
indx
ddeterminant of matrix
Returns
false if errors are encountered else true

Definition at line 157 of file matrix.cpp.

References xmlog::debug, and XM_LOG.

Referenced by mxSolve3x3().

◆ mxInvert4x4()

int xms::mxInvert4x4 ( const double  matrix[4][4],
double  inv[4][4] 
)

Compute the inverse of a transformation matrix. Checks for special case of Orthogonal 4x4 and does easy inverse otherwise uses Gauss-Jordan Elimination with full pivoting and scaling with partial unraveling of loops for speed. See Numerical Recipes in C pages 36-37.

Parameters
matrixmatrix[4][4] to invert
invinverse of matrix
Returns
XM_FAILURE if errors are encountered else XM_SUCCESS

Definition at line 422 of file matrix.cpp.

References xmlog::error, mxCopy4x4(), XM_FAILURE, XM_LOG, and XM_SUCCESS.

◆ mxLUBcksub()

int xms::mxLUBcksub ( double **  mat,
int  n,
const int *  indx,
double *  b 
)

solve [mat]{x} = {b} by back substitution (mat = LU of mat), from "Numerical Recipes in C" p 44.

Parameters
matmatrix[n][n]
ndimension of matrix mat
indx
bvector of solution [mat]{x} = {b}
Returns
XM_SUCCESS

Definition at line 122 of file matrix.cpp.

References XM_SUCCESS.

Referenced by mxSolveNxN().

◆ mxLUDecomp()

int xms::mxLUDecomp ( double **  mat,
int  n,
int *  indx,
double *  d 
)

Decompose an n x n matrix into Upper & Lower trianglar (in place), from "Numerical Recipes in C" p 43.

Parameters
matmatrix[n][n]
ndimension of matrix mat
indx
dmatrix determinant
Returns
XM_FAILURE if errors encountered else XM_SUCCESS

Definition at line 47 of file matrix.cpp.

References XM_FAILURE, and XM_SUCCESS.

Referenced by mxSolveNxN().

◆ mxMult4x4()

void xms::mxMult4x4 ( double  product[4][4],
const double  matrix1[4][4],
const double  matrix2[4][4] 
)

Multiplies two transformation matrices.

Parameters
productresult of matrix1*matrix2
matrix1[4][4] matrix multiplied by matrix2
matrix2[4][4] matrix multiplied by matrix1

Definition at line 585 of file matrix.cpp.

References mxCopy4x4().

◆ mxPointMult()

void xms::mxPointMult ( Pt3d pt,
const double  ctm[4][4] 
)

Multiplies a point by a transformation matrix.

Parameters
ptpoint to multiply
ctmtransform matrix[4][4].

Definition at line 549 of file matrix.cpp.

◆ mxRotate4x4()

void xms::mxRotate4x4 ( double  xrot,
double  yrot,
double  zrot,
double  rMatt[4][4] 
)

return a rotation matrix with specified x, y, z rotations z - y - x order

Parameters
xrotx rotation amount
yroty rotation amount
zrotz rotation amount
rMattmatrix to be built

Definition at line 611 of file matrix.cpp.

References mxIdent4x4(), and XM_PI.

◆ mxSolve3x3()

bool xms::mxSolve3x3 ( double  A[3][3],
double  x[3],
double  b[3] 
)

Solves the matrix equation [A]*{x}={b} for {x} where [A] is 3x3 and {x} and {b} are 3x1 vectors.

Parameters
Amatrix[3][3]
xvector[3]
bvector[3] of solution [A]{x} = {b}
Returns
XM_FAILURE if errors are encountered else XM_SUCCESS

Definition at line 399 of file matrix.cpp.

References mxiLubksb3(), and mxiLudcmp3().

◆ mxSolveBandedEquations()

bool xms::mxSolveBandedEquations ( double **  a,
double *  x,
double *  b,
int  numeqs,
int  halfbandwidth 
)

Solves the matrix equation [a][x]=[b] using gauss elimination.

Parameters
amatrix[n][n]
xvector nx1
bvector of solution [A]{x} = {b}
numeqsnumber of equations
halfbandwidth
Note
Assumes that [a] is a banded symmetric matrix with only the upper half stored. If a matrix is banded and symmetric, only values at or above the main diagonal need to be stored. When setting up the matrix, the indices in the equivalent full matrix are mapped to the indices in the banded matrix with the following formula (i,j)=(i,j-i+1) where j is the row number and i is the column number.
Returns
false if errors encountered else true

Definition at line 325 of file matrix.cpp.

◆ mxSolveNxN()

bool xms::mxSolveNxN ( double **  A,
double *  x,
double *  b,
int  n 
)

Solves the matrix equation [A]*{x}={b} for {x} where [A] is NxN and {x} and {b} are Nx1 vectors. The matrix A is replaced with the LU decomposition of A.

Parameters
Amatrix[n][n]
xvector nx1
bvector of solution [A]{x} = {b}
nsize of matrix A
Returns
false if errors encountered else true

Definition at line 268 of file matrix.cpp.

References mxLUBcksub(), mxLUDecomp(), and XM_FAILURE.

◆ mxTranslate4x4()

void xms::mxTranslate4x4 ( const Pt3d a_translation,
double  a_mx[4][4] 
)

return a translation matrix with specified translation z - y - x order

Parameters
a_translationtranslation distances in x, y, and z.
a_mxmatrix to be built

Definition at line 638 of file matrix.cpp.

References mxIdent4x4().

◆ TEST_XmUBuild3DChevronUgrid()

std::shared_ptr< XmUGrid > xms::TEST_XmUBuild3DChevronUgrid ( )

Builds a UGrid with one 3D Chevron polyhedron.

Returns
Returns the UGrid.

Definition at line 3980 of file XmUGrid.cpp.

References xms::XmUGrid::New().

Referenced by XmUGridUnitTests::testGetCellPlanViewPolygon().

◆ TEST_XmUBuildHexahedronUgrid() [1/2]

std::shared_ptr< XmUGrid > xms::TEST_XmUBuildHexahedronUgrid ( int  a_rows,
int  a_cols,
int  a_lays 
)

Builds a UGrid of Quads at 1 spacing for rows & cols specified.

Parameters
[in]a_rowsnumber of rows in UGrid
[in]a_colsnumber of columns in UGrid
[in]a_laysnumber of layers in UGrid
Returns
Returns the UGrid.

Definition at line 3817 of file XmUGrid.cpp.

Referenced by XmUGridUnitTests::testCell3dFunctionCaching(), XmUGridUnitTests::testGetCell3dFaceAdjacentCell(), XmUGridUnitTests::testGetCell3dFaceOrientationHexahedrons(), XmUGridUnitTests::testGetCellEdgeAdjacentCells(), XmUGridUnitTests::testGetExtents(), and XmUGridUnitTests::testIsCellValidWithPointChange().

◆ TEST_XmUBuildHexahedronUgrid() [2/2]

std::shared_ptr< XmUGrid > xms::TEST_XmUBuildHexahedronUgrid ( int  a_rows,
int  a_cols,
int  a_lays,
const xms::Pt3d a_origin 
)

Builds a UGrid of Quads at 1 spacing for rows & cols specified.

Parameters
[in]a_rowsnumber of rows in UGrid
[in]a_colsnumber of columns in UGrid
[in]a_laysnumber of layers in UGrid
[in]a_originlocatGetPointLocation UGrid begins (min x, min y, min z)
Returns
Returns the UGrid.

Definition at line 3830 of file XmUGrid.cpp.

References xms::XmUGrid::New().

◆ TEST_XmUBuildPolyhedronUgrid() [1/2]

std::shared_ptr< XmUGrid > xms::TEST_XmUBuildPolyhedronUgrid ( int  a_rows,
int  a_cols,
int  a_lays 
)

Builds a UGrid of Quads at 1 spacing for rows & cols specified.

Parameters
[in]a_rowsnumber of rows in UGrid
[in]a_colsnumber of columns in UGrid
[in]a_laysnumber of layers in UGrid
Returns
Returns the UGrid.

Definition at line 3883 of file XmUGrid.cpp.

Referenced by XmUGridUnitTests::testGetCell3dFaceOrientationHexahedrons(), XmUGridUtilsTests::testLargeUGridBinarySpeed(), and XmUGridUnitTests::testLargeUGridLinkSpeed().

◆ TEST_XmUBuildPolyhedronUgrid() [2/2]

std::shared_ptr< XmUGrid > xms::TEST_XmUBuildPolyhedronUgrid ( int  a_rows,
int  a_cols,
int  a_lays,
const xms::Pt3d a_origin 
)

Builds a UGrid of Quads at 1 spacing for rows & cols specified.

Parameters
[in]a_rowsnumber of rows in UGrid
[in]a_colsnumber of columns in UGrid
[in]a_laysnumber of layers in UGrid
[in]a_originlocation wGetPointLocationd begins (min x, min y, min z)
Returns
Returns the UGrid.

Definition at line 3896 of file XmUGrid.cpp.

References xms::XmUGrid::New().

◆ TEST_XmUBuildQuadUGrid() [1/2]

std::shared_ptr< XmUGrid > xms::TEST_XmUBuildQuadUGrid ( int  a_rows,
int  a_cols 
)

Builds a UGrid of Quads at 1 spacing for rows & cols specified.

Parameters
[in]a_rowsnumber of rows in UGrid
[in]a_colsnumber of columns in UGrid
Returns
Returns the UGrid.

Definition at line 3769 of file XmUGrid.cpp.

◆ TEST_XmUBuildQuadUGrid() [2/2]

std::shared_ptr< XmUGrid > xms::TEST_XmUBuildQuadUGrid ( int  a_rows,
int  a_cols,
const xms::Pt3d a_origin 
)

Builds a UGrid of Quads at 1 spacing for rows & cols specified.

Parameters
[in]a_rowsnumber of rows in UGrid
[in]a_colsnumber of columns in UGrid
[in]a_originlocation where the UGrid begins (min x, min y, min z)
Returns
Returns the UGrid.

Definition at line 3781 of file XmUGrid.cpp.

References xms::XmUGrid::New().

◆ TEST_XmUGrid1Left90Tri()

std::shared_ptr< XmUGrid > xms::TEST_XmUGrid1Left90Tri ( )

Builds a 1 cell (left 90 degree triangle) 2D XmUGrid for testing.

2
| \
| \
| \
0----1
Returns
Returns a builder for the UGrid.

Definition at line 3639 of file XmUGrid.cpp.

References xms::XmUGrid::New().

Referenced by XmUGridUnitTests::testOperators(), XmUGridUtilsTests::testReadBasicUGrid(), XmUGridUtilsTests::testReadReadyAtNextLine(), and XmUGridUtilsTests::testWriteBasicUGrid().

◆ TEST_XmUGrid2dLinear()

◆ TEST_XmUGrid3dLinear()

◆ TEST_XmUGridHexagonalPolyhedron()

std::shared_ptr< XmUGrid > xms::TEST_XmUGridHexagonalPolyhedron ( )

Builds a 1 cell hexagon with cell type polyhedron.

Returns
Returns the UGrid.

Definition at line 3740 of file XmUGrid.cpp.

References xms::XmUGrid::New().

Referenced by XmUGridUtilsTests::testReadPolyhedronUGrid(), and XmUGridUtilsTests::testWritePolyhedronUGrid().

◆ TEST_XmUGridSimpleQuad()

◆ trArea()

double xms::trArea ( const Pt3d a_pt1,
const Pt3d a_pt2,
const Pt3d a_pt3 
)

Return the signed planar area of the triangle (CCW Positive).

This uses the formula: (-x2*y1 + x3*y1 + x1*y2 - x3*y2 - x1*y3 + x2*y3) / 2 reworked to ensure precision is not lost with large numbers by moving the triangle to the origin by subtracting the first vertex's location from all vertices.

Parameters
[in]a_pt1First point on triangle.
[in]a_pt2Second point on triangle.
[in]a_pt3Third point on triangle.
Returns
The area.

Definition at line 46 of file triangles.cpp.

Referenced by gmCounterClockwiseTri(), xms::TrTriangulatorPoints::ReceiveTriangle(), xms::TrTinImpl::SwapEdge(), and xms::TrTinImpl::TriangleArea().

◆ trBuildGridPolys()

void xms::trBuildGridPolys ( int  rows,
int  cols,
VecPt3d pts,
VecInt2d polys 
)

Build something like this:

///  (0, 0)
///    0-------------1-------------2
///    |             |             |
///    |             |             |
///    |      1      |      2      |
///    |             |             |
///    |             |             |
///    3-------------4-------------5
///                             (20,-10)
/// 
Parameters
[in]rowsNumber of rows
[in]colsNumber of columns
[out]ptsThe points.
[out]polysThe polygons.

Definition at line 132 of file triangles.cpp.

Referenced by trBuildGridTrianglePolys().

◆ trBuildGridTrianglePolys()

void xms::trBuildGridTrianglePolys ( int  rows,
int  cols,
VecPt3d a_points,
VecInt2d a_polys 
)

◆ trDecrementIndex()

int xms::trDecrementIndex ( int  i)
inline

Faster than a % operation and we do this a lot.

Parameters
iThe index.
Returns
The decremented index.

Definition at line 54 of file triangles.h.

Referenced by xms::TrTinImpl::CheckAndSwap(), xms::TrTinImpl::NextBoundaryPoint(), xms::TrTinImpl::SwapEdge(), and xms::TrTinImpl::TriangleAdjacentToEdge().

◆ trIncrementIndex()

◆ trRenumberOnDelete()

void xms::trRenumberOnDelete ( const SetInt a_deleting,
VecInt a_vec 
)

Boost serialize function.

Renumbers items in a_vec as if deleting items in a_deleting.

Used to renumber m_tris when deleting points. Subtracts 1 from each point index that is greater than or equal to the point index that was deleted. Goes from greatest number being deleted to least so greater numbers get reduced more with each pass.

Parameters
[in]a_deletingSet of numbered things in a_vec being deleted.
[in,out]a_vecVector of numbered things that gets renumbered.

Definition at line 1376 of file TrTin.cpp.

Referenced by xms::TrTinImpl::DeletePoints().

◆ trTriangulateIt()

bool xms::trTriangulateIt ( TrTriangulator a_Client)

Do delaunay divide-and-conquer triangulation.

This algorithm can leave triangles that are VERY long and thin. The default ratio should be sufficient to get rid of these (on the exterior only). If you want to supply a bigger ratio to get rid of more triangles, you can, or you can do it on your own after you call this function.

Parameters
[in,out]a_ClientClass used to help do the triangulation.
Returns
true if no errors.

Definition at line 2656 of file triangulate.cpp.

References xmlog::error, and XM_LOG.

Referenced by TrTriangulatorPointsUnitTests::test1(), TrTriangulatorPointsUnitTests::test_bug12336(), and xms::TrTriangulator::Triangulate().

◆ XmEdgesEquivalent()

bool xms::XmEdgesEquivalent ( const XmEdge a_edge1,
const XmEdge a_edge2 
)

Test if two edges are the same ignoring direction.

Parameters
a_edge1The first edge to compare against.
a_edge2The second edge to compare against.
Returns
True if two edges are same when indexes are in sorted order.

Definition at line 158 of file XmEdge.cpp.

References xms::XmEdge::IsEquivalent().

Referenced by XmEdgeUnitTests::testIsEquivalent().

◆ XmReadUGridFromAsciiFile()

std::shared_ptr< XmUGrid > xms::XmReadUGridFromAsciiFile ( const std::string &  a_filePath)

Read XmUGrid from an ASCII file.

Parameters
[in]a_filePathfilename to read including path, file name, and extension
Returns
the UGrid that was read from the file

Definition at line 563 of file XmUGridUtils.cpp.

References XmReadUGridFromStream().

Referenced by XmUGridUtilsTests::testWriteThenReadUGridFileToAscii().

◆ XmReadUGridFromStream()

◆ XmWriteUGridToAsciiFile()

void xms::XmWriteUGridToAsciiFile ( std::shared_ptr< XmUGrid a_ugrid,
const std::string &  a_filePath 
)

Write an XmUGrid to an ASCII file.

Parameters
[in]a_ugridThe UGrid to write to the file
[in]a_filePathfilename to write including path, file name, and extension

Definition at line 630 of file XmUGridUtils.cpp.

References XmWriteUGridToStream().

Referenced by XmUGridUtilsTests::testWriteThenReadUGridFileToAscii().

◆ XmWriteUGridToStream() [1/2]

◆ XmWriteUGridToStream() [2/2]

void xms::XmWriteUGridToStream ( const XmUGrid a_ugrid,
std::ostream &  a_outStream,
bool  a_binary 
)

Save an XmUGrid ASCII text to output stream.

Parameters
[in]a_ugridthe UGrid to save
[in]a_outStreamthe stream to write
[in]a_binaryshould arrays be written in binary

Definition at line 650 of file XmUGridUtils.cpp.