31 static GEOMDLLIMPEXP
size_t Append (
bvector<T> *dest, T
const *source,
size_t count);
50 static GEOMDLLIMPEXP
bool Set (
bvector<T> *dest, T
const &data,
size_t index);
53 static GEOMDLLIMPEXP
bool Get (
bvector<T> *dest, T &data,
size_t index);
103 public:
static double GEOMDLLIMPEXP
LargestCoordinate (T
const *data,
size_t count);
108 public:
static double GEOMDLLIMPEXP
Tolerance (
bvector<T> const &data,
double absTol,
double relTol);
113 public:
static double GEOMDLLIMPEXP
Tolerance (T
const *data,
size_t count,
double absTol,
double relTol);
119 public:
static bool GEOMDLLIMPEXP
Equal (T
const *dataA,
size_t countA, T
const *dataB,
size_t countB);
127 public:
static bool GEOMDLLIMPEXP
AlmostEqual (T
const &valueA, T
const &valueB);
135 public:
static bool GEOMDLLIMPEXP
AlmostEqual (T
const &valueA, T
const &valueB,
double tolerance);
155 public:
static size_t GEOMDLLIMPEXP
MostDistantIndex (T
const *data,
size_t n, T
const &baseValue);
182 static GEOMDLLIMPEXP
size_t Cluster
187 double absTol = -1.0,
232 static GEOMDLLIMPEXP
size_t Cluster
237 double absTol = -1.0,
243 double &minAngle,
size_t &minIndex,
244 double &maxAngle,
size_t &maxIndex
268 static GEOMDLLIMPEXP
double Min (
double a1,
double a2);
270 static GEOMDLLIMPEXP
double Min (
double a1,
double a2,
double a3);
272 static GEOMDLLIMPEXP
double Min (
double a1,
double a2,
double a3,
double a4);
275 static GEOMDLLIMPEXP
double MinAbs (
double a1,
double a2);
277 static GEOMDLLIMPEXP
double MinAbs (
double a1,
double a2,
double a3);
279 static GEOMDLLIMPEXP
double MinAbs (
double a1,
double a2,
double a3,
double a4);
283 static GEOMDLLIMPEXP
double Max (
double a1,
double a2);
285 static GEOMDLLIMPEXP
double Max (
double a1,
double a2,
double a3);
287 static GEOMDLLIMPEXP
double Max (
double a1,
double a2,
double a3,
double a4);
290 static GEOMDLLIMPEXP
double MaxAbs (
double a1,
double a2);
292 static GEOMDLLIMPEXP
double MaxAbs (
double a1,
double a2,
double a3);
294 static GEOMDLLIMPEXP
double MaxAbs (
double a1,
double a2,
double a3,
double a4);
297 static GEOMDLLIMPEXP
double MaxAbs (
double a1,
double a2,
double a3,
double a4,
double a5,
double a6);
300 static GEOMDLLIMPEXP
void UpdateMax (
double &evolvingMax,
double testValue);
303 static GEOMDLLIMPEXP
bool WithinTolerance (
double a1,
double a2,
double abstol);
306 static GEOMDLLIMPEXP
double SnapZero (
double a,
double abstol);
309 static GEOMDLLIMPEXP
int TolerancedSign (
double a,
double abstol);
312 static GEOMDLLIMPEXP
bool WithinTolerance (
double a1,
double a2,
double abstol,
double reltol);
317 static GEOMDLLIMPEXP
double ComputeTolerance (
double maxSize,
double abstol,
double reltol);
324 static GEOMDLLIMPEXP
double Max (
double const *values,
size_t n);
325 static GEOMDLLIMPEXP
double Min (
double const *values,
size_t n);
326 static GEOMDLLIMPEXP
double MaxAbs (
double const *values,
size_t n);
327 static GEOMDLLIMPEXP
double MinAbs (
double const *values,
size_t n);
329 static GEOMDLLIMPEXP
void ScaleArray (
double *values,
size_t n,
double a);
338 static GEOMDLLIMPEXP
double Clamp (
double x,
double a,
double b);
340 static GEOMDLLIMPEXP
bool IsExact01 (
double a0,
double a1);
343 static GEOMDLLIMPEXP
bool IsIn01 (
double x);
348 static GEOMDLLIMPEXP
bool IsIn01OrExtension (
double x,
bool extend0,
bool extend1);
351 static GEOMDLLIMPEXP
bool IsIn01 (
double x,
double y);
360 static GEOMDLLIMPEXP
double Hypotenuse (
double a,
double b);
362 static GEOMDLLIMPEXP
double Hypotenuse (
double a,
double b,
double c);
364 static GEOMDLLIMPEXP
double Hypotenuse (
double a,
double b,
double c,
double d);
367 static GEOMDLLIMPEXP
double DeterminantXYXY (
double x0,
double y0,
double x1,
double y1);
371 static GEOMDLLIMPEXP
bool SafeDivideParameter (
double &result,
double numerator,
double denominator,
double defaultResult = 0.0);
383 double defaultResult = 0.0
433 static GEOMDLLIMPEXP
bool SafeDivideDistanceSquared (
double &result,
double numerator,
double denominator,
double defaultResult = 0.0);
439 static GEOMDLLIMPEXP
bool SafeDivide (
double &result,
double numerator,
double denominator,
double defaultResult = 0.0,
double smallFraction = 1.0e-15);
443 static GEOMDLLIMPEXP
bool LinearTransform (
double a0,
double a1,
double b0,
double b1,
double &c,
double &d);
445 static GEOMDLLIMPEXP
bool UpperBound (
double const *pData,
size_t n,
double searchValue,
size_t &index);
447 static GEOMDLLIMPEXP
bool LowerBound (
double const *pData,
size_t n,
double searchValue,
size_t &index);
461 static GEOMDLLIMPEXP
bool BoundingValues (
double const *pData,
size_t n,
double searchValue,
size_t &lowerIndex,
double &lowerBound,
double &upperBound);
462 static GEOMDLLIMPEXP
bool BoundingValues (
bvector<double>const &data,
double searchValue,
size_t &lowerIndex,
double &lowerBound,
double &upperBound);
463 static GEOMDLLIMPEXP
bool BoundingValues (
size_t n,
double searchValue,
size_t &lowerIndex,
double &lowerBound,
double &upperBound);
465 static GEOMDLLIMPEXP
void Sort (
double *data,
size_t count,
bool ascending =
true);
471 static GEOMDLLIMPEXP
double Interpolate (
double dataA,
double fraction,
double dataB);
475 static GEOMDLLIMPEXP
void Swap (
double &dataA,
double &dataB);
478 static GEOMDLLIMPEXP
void UpdateMinMax (
double x,
double f,
double &xMin,
double &fMin,
double &xMax,
double &fMax);
481 static GEOMDLLIMPEXP
double Magnitude (
double a,
double b,
double c);
483 static GEOMDLLIMPEXP
double Magnitude (
double a,
double b);
496 static GEOMDLLIMPEXP
double Sum (
double *data,
int n);
498 static GEOMDLLIMPEXP
double SumAbs (
double *data,
int n);
503 static GEOMDLLIMPEXP
double PreciseSum (
double *data,
size_t n);
504 static GEOMDLLIMPEXP
double PreciseSum (
double a,
double b,
double c);
557 size_t numCopyLeft = 1,
558 size_t numCopyRight = 1
600 static GEOMDLLIMPEXP
size_t Cluster
605 double absTol = -1.0,
626 double &minDistance,
size_t &minIndex,
627 double &maxDistance,
size_t &maxIndex
797 size_t &segmentIndex,
799 double &segmentFraction,
822 public:
static GEOMDLLIMPEXP
double Length (
DPoint3dCP xyz,
double const *weight, ptrdiff_t step,
size_t n,
bool addClosure =
false);
833 public:
static GEOMDLLIMPEXP
double SumAbsoluteAngles (
DPoint3dCP xyz,
double const *weight, ptrdiff_t step,
size_t count,
bool addClosure,
double minEdgeLength = 0.0);
839 bool addClosurePoint,
849 bool addClosurePoint,
855 double &edgeFraction,
864 bool addClosurePoint,
867 double &globalFraction,
871 double &edgeFraction,
879 bool addClosurePoint,
882 double &globalFraction,
886 double &edgeFraction,
902 double maxDistance = DBL_MAX
959 public:
static GEOMDLLIMPEXP
bool IsSelfIntersectingXY (DPoint3d *points,
size_t n,
bool addClosure =
false);
964 bool requireClosurePoint =
true
974 bool requireClosurePoint =
true);
992 double startFraction,
993 double signedDistance,
995 size_t &endSegmentIndex,
996 double &segmentFraction,
997 double &actualDistance
1005 double startFraction,
1006 double signedDistance,
1007 double &endFraction,
1008 size_t &endSegmentIndex,
1009 double &segmentFraction,
1010 double &actualDistance
1068 double fraction0 = 0.0,
1069 double fraction1 = 1.0
1086 bool includeStartPoint =
true,
1087 double startFraction = 0.0,
1088 double endFraction = 1.0
1099 double startFraction = 0.0,
1100 double endFraction = 1.0,
1109 double startFraction = 0.0,
1110 double endFraction = 1.0
1128 double offsetDistance,
1129 bool periodic =
false,
1130 double maxMiterRadians = 1.58
1139 double offsetDistance,
1141 bool periodic =
false,
1142 double maxMiterRadians = 1.58
1237 bool signedOneBasedIndices,
1238 bool addVerticesAtCrossings
1266 bool bSignedOneBasedIndices
1293 bool bSignedOneBasedIndices
1365 bool bSignedOneBasedIndices
1375 public:
static GEOMDLLIMPEXP
double AreaXY (
DPoint3dCP pXYZ,
size_t numXYZ);
1384 public:
static GEOMDLLIMPEXP
double Area (
DPoint2dCP pXY,
size_t numXY);
1424 double &rayFraction,
1425 size_t &edgeBaseIndex
1441 size_t &edgeBaseIndex,
1471 double touchTolerance,
1553 template <
typename T>
1564 size_t CyclicPhysicalIndex (
size_t i)
const
1566 if (i < m_entries.size ())
1569 return i % m_entries.size ();
1580 m_defaultValue (defaultValue)
1591 size_t n0 = m_i1 - m_i0;
1592 size_t n1 = m_entries.size ();
1598 m_entries.reserve (2 * n0);
1599 for (
size_t i = 0; i < n0; i++)
1600 m_entries.push_back (m_entries[i]);
1606 size_t Size ()
const {
return m_i1 - m_i0;}
1611 m_entries[CyclicPhysicalIndex (m_i1)] = value;
1624 size_t n = m_entries.size ();
1629 m_entries[m_i0] = value;
1635 return m_defaultValue;
1636 return m_entries[CyclicPhysicalIndex(m_i1)];
1643 return m_defaultValue;
1644 return m_entries[m_i0];
1650 size_t n = m_i1 - m_i0;
1652 return m_defaultValue;
1655 if (k >= (ptrdiff_t)n)
1657 if ((ptrdiff_t)m_i0 + k >= (ptrdiff_t)m_i1)
1658 return m_defaultValue;
1659 size_t i = m_i0 + k;
1660 return m_entries[CyclicPhysicalIndex(i)];
1667 return m_defaultValue;
1668 if (m_i0 + k >= m_i1)
1669 return m_defaultValue;
1670 size_t i = m_i1 - 1 - k;
1671 return m_entries[CyclicPhysicalIndex(i)];
1678 return m_defaultValue;
1679 size_t i = m_i0 + k;
1681 return m_entries[CyclicPhysicalIndex(i)];
1682 return m_defaultValue;
1705 if (m_i0 >= m_entries.size ())
1708 m_i1 -= m_entries.size ();
1717 if (n != other.
Size ())
1719 for (
size_t i = 0; i < n; i++)
1739 template <
typename T>
1751 size_t Parent (
size_t i)
1757 size_t LeftChild (
size_t i) {
return 2 * i + 1; }
1758 size_t RightChild (
size_t i) {
return 2 * i + 2; }
1759 public:
size_t Size ()
const {
return m_heap.size ();}
1766 m_heap.push_back (
Entry (data, value));
1767 size_t child = m_heap.size () - 1;
1771 size_t parent = Parent (child);
1772 if (m_heap[parent].m_value < m_heap[child].m_value)
1774 std::swap (m_heap[parent], m_heap[child]);
1788 size_t n = m_heap.size ();
1791 data = m_heap.front ().m_data;
1792 value = m_heap.front ().m_value;
1794 m_heap.front () = m_heap.back ();
1801 size_t child = LeftChild (parent);
1804 size_t rightChild = child + 1;
1805 if (rightChild < n && m_heap[rightChild].m_value < m_heap[child].m_value)
1807 if (m_heap[child].m_value < m_heap[parent].m_value)
1809 std::swap (m_heap[child], m_heap[parent]);
1822 return removeMin (data, value);
1828 size_t n = m_heap.size ();
1829 for (
size_t i = 0; i < n; i++)
1831 size_t i1 = LeftChild (i);
1832 size_t i2 = RightChild (i);
1833 if (i1 < n && m_heap[i1].m_value < m_heap[i].m_value)
1835 if (i2 < n && m_heap[i2].m_value < m_heap[i].m_value)
1876 void ReverseXF (
bool reverseFAs01Fraction);
1896 void ReverseXFUV (
bool reverseFAs01Fraction,
bool negateVectorU,
bool negateVectorV);
1913 void ReverseXFUVC (
bool reverseFAs01Fraction,
bool negateVectorU,
bool negateVectorV);
1918 void ReverseXFUVC (
size_t index0,
size_t index1,
bool reverseFAs01Fraction,
bool negateVectorU,
bool negateVectorV);
struct RotMatrix const * RotMatrixCP
Definition: msgeomstructs_typedefs.h:135
static bool ClearlyIncreasingFraction(double a, double b)
test knowing range 0..1 for values...
static bool IsIn01OrExtension(double x, bool extend0, bool extend1)
Test if x is between 0 and 1 inclusive.
Operations on arrays of DVec3d (bvector and contiguous buffer).
Definition: DPoint3dOps.h:213
static bool IsRectangle(DPoint3dCP points, size_t n, TransformR localToWorld, TransformR worldToLocal, bool requireClosurePoint=true)
test if points are form a rectangle.
Entry(T data, double value)
Definition: DPoint3dOps.h:1746
static void AddContinuationStartPoint(bvector< DPoint3d > &points, DPoint3dCR xyz, bool forceIncludeThisPoint)
push_back xyz to the point array, but possibly ignore if it duplicates points.back () ...
static bool Are4EdgesPerpendicular(DPoint3dCP points)
return true if the 4 edges between points 01,12,23,30 are perpendicular.
struct RotMatrix & RotMatrixR
Definition: msgeomstructs_typedefs.h:135
static bool SafeDivideDistanceSquared(double &result, double numerator, double denominator, double defaultResult=0.0)
Attempt to divide {numerator/denominator} Return false if result is larger than 30 digits...
static void CopyBetweenFractions(bvector< DPoint3d > const &points, bvector< DPoint3d > &dest, double fractionA, double fractionB)
Search (forward or reverse, according to sign of requested distance).
static size_t FindClusterRoot(bvector< size_t > &clusterData, size_t start)
Walk from start to root. All entries along the way are fixed up to point directly to the root...
static double SumAbsoluteAngles(DPoint3dCP xyz, double const *weight, ptrdiff_t step, size_t count, bool addClosure, double minEdgeLength=0.0)
void Clear()
Definition: DPoint3dOps.h:1761
static void EnforceClosure(bvector< DPoint3d > &points)
If final point is "AlmostEqual" to first, make it exact. If not, push first point to close...
static size_t MostDistantIndex(bvector< T >const &data, T const &baseValue)
Find the index of the value most distance from baseValue. Return SIZE_MAX if empty array...
static void ApplyFunction(bvector< double > const &x, double(*f)(double), bvector< double > &fOfx)
static void SetZeros(bvector< double > &dest)
DPoint3dDoubleUVArrays with additional markup: ul> ul>m_curve – array of curve primitive pointer (no...
Definition: DPoint3dOps.h:1904
static bool CoordinateFrame(bvector< DPoint3d > *pXYZIn, TransformR localToWorld, TransformR worldToLocal)
Compute a local to world transformation for a polygon (disconnects allowed) Favor first polygon CCW f...
void push_back(const_reference)
static double Magnitude(double a, double b, double c)
return sqrt (a*a + b*b + c*c)
static bool ClosestApproach(bvector< DPoint3d > const &xyzA, bvector< DPoint3d > const &xyzB, CurveLocationDetailR locationA, CurveLocationDetailR locationB)
Find the closest approach between polylines.
T GetFromRight(size_t k) const
return the i'th entry counting from right to left.
Definition: DPoint3dOps.h:1664
struct DPoint3d const * DPoint3dCP
Definition: msgeomstructs_typedefs.h:79
static ValidatedDouble ValidatedDivideDistanceSquared(double a, double b, double defaultResult=0.0)
Attempt to divide {numerator/denominator}.
bool operator==(DoubleEndedQueue< T > const &other) const
Test if two queues have identical logical entries.
Definition: DPoint3dOps.h:1714
static void SortTail(bvector< double > &data, size_t i0, bool ascending=true)
Sort entries starting at i0.
void PopLeft()
remove the left-most entry.
Definition: DPoint3dOps.h:1698
struct IFacetOptions const & IFacetOptionsCR
Definition: msgeomstructs_typedefs.h:162
static void Swap(double &dataA, double &dataB)
static void Compress(bvector< T > &data, double tolerance)
Inplace removal of near-duplicate points.
static void MinusOnePlus1LinearMapInPlace(bvector< double > &data, double aMinus, double aPlus)
map (-1,1) to (aMinus,aPlus) in place
static double SmallCoordinateRelTol()
Relative tolerance for coordinate tests. This is 1e-10, and is coarser than Angle::SmallAngle.
static void AppendXY(bvector< DPoint2d > *dest, double x, double y)
append a point to the bvector
static double Min(double a1, double a2)
min of 2 candidates
static bool AddCloseApproaches(bvector< DPoint3d > const &xyzA, bvector< DPoint3d > const &xyzB, bvector< CurveLocationDetail > &locationA, bvector< CurveLocationDetail > &locationB, double maxDistance=DBL_MAX)
Find (pairs of) points of closest approach between two linestrings.
static bool IsValidClusterIndex(bvector< size_t > &clusterData, size_t index)
Simple bounds check in an index.
T GetFromLeft(size_t k) const
return the k'th entry counting from left to right
Definition: DPoint3dOps.h:1675
void MakeRoomForInsertion()
Ensure there is capacity for 1 additional insertion to the logical dequeue.
Definition: DPoint3dOps.h:1589
struct DVec3d & DVec3dR
Definition: msgeomstructs_typedefs.h:89
static bool IsAlmostIn01(double x)
Test if x is between 0 and 1 inclusive, with AlmostEqualFraction at each end.
static bool PrincipalExtents(bvector< DPoint3d > const &points, TransformR originWithExtentVectors)
T m_data
Definition: DPoint3dOps.h:1745
static bool FixupAndTriangulateProjectedLoops(bvector< int > *pIndices, bvector< int > *pExteriorLoopIndices, bvector< DPoint3d > *pXYZOut, TransformCR localToWorld, TransformCR worldToLocal, bvector< DPoint3d > *pXYZIn, double xyTolerance, bool bSignedOneBasedIndices)
Triangulate a single space polygon as projected in caller-supplied coordinate frame.
static bool ClosestPoint(bvector< DPoint3d > const &xyz, bool addClosurePoint, DPoint3dCR spacePoint, double &fraction, DPoint3dR curvePoint)
Search for closest point on edge. Optionally add closure edge.
static DRange1d ProjectedParameterRange(bvector< DPoint3d > const &points, DRay3dCR ray)
static bool IsExact01(double a0, double a1)
Bitwise equality test for exact 01 interval references...
static bool OffsetLineStringXY(bvector< DPoint3d > &out, bvector< DPoint3d > const &in, double offsetDistance, bool periodic=false, double maxMiterRadians=1.58)
Simple linestring offset – miter joints, no loop removal.
#define END_BENTLEY_GEOMETRY_NAMESPACE
Definition: Bentley.r.h:30
static bool WireCentroid(bvector< DPoint3d > const &points, double &length, DPoint3dR centroid, double fraction0=0.0, double fraction1=1.0)
return polyline length and centroid of the "wire".
static bool AlmostEqual(T const &valueA, T const &valueB)
Near equality test with default Angle::SmallAngle absolute and relative tolerances.
size_t Size() const
Definition: DPoint3dOps.h:1759
static double Hypotenuse(double a, double b)
return sqrt (a^2 + b^2)
static bool LinearTransform(double a0, double a1, double b0, double b1, double &c, double &d)
Compute a linear transformation f(x) = c + d * x so that a0 maps to b0 and a1 maps to b1...
T MinData()
Definition: DPoint3dOps.h:1781
static bool CentroidAndArea(bvector< DPoint2d > &points, DPoint2dR centroid, double &area)
Return the centroid and area of the polygon.
static bool WithinTolerance(double a1, double a2, double abstol)
Test if two doubles are equal within tolerance.
Embed a double ended queue in a bvector ul> li>The dequeue's logical start value a can appear a...
Definition: DPoint3dOps.h:1554
static bool Equal(bvector< T > const &dataA, bvector< T > const &dataB)
Test if all members are exactly equal.
static ValidatedDouble ValidatedDivideParameter(double a, double b, double defaultResult=0.0)
Attempt to divide {numerator/denominator}.
bool RemoveMin(T &data, double &value)
Remove the root (minimum sort value) entry.
Definition: DPoint3dOps.h:1786
static void InterpolateAll(bvector< T > &dest, bvector< T > const &dataA, double f, bvector< T > const &dataB)
Interpolate between T values in dataA and dataB.
bool SearchBracketPoints(double f, size_t &i0, double &f0, DPoint3dR xyz0, size_t &i1, double &f1, DPoint3dR xyz1) const
Search the fraction array for an interval containing f.
Coincident logical constraint.
static void Multiply(bvector< DPoint3d > *xyz, TransformCR transform)
Multiply each (non-disconnect) point in place by a transform.
static bool LexicalYExtrema(int &iMin, int &iMax, DPoint2dCP points, int nPoint)
Return indices where min and max y of lexical sort order occur.
static void CopyToIndex(bvector< double > const &source, bvector< size_t > const &index, bvector< double > &dest)
make dest[i] = source[index[i]];
PlanePolygonSSICode
Definition: DPoint3dOps.h:1174
static bool ClearlyIncreasing(double a, double b, double tol)
test with tolerance for equality
void Insert(T data, double value)
insert an entry
Definition: DPoint3dOps.h:1763
size_type count(const key_type &__x) const
Definition: stdcxx/bstdmap.h:277
void swap(basic_string< _CharT, _Traits, _Allocator > &__a, basic_string< _CharT, _Traits, _Allocator > &__b)
Definition: basic_string.h:1396
static double Length(bvector< DPoint3d > const &xyz, bool addClosure=false)
return the total length of the polyline. Optionally add closure edge. disconnects allowed...
static bool ClosestPointXY(bvector< DPoint3d > const &xyz, DMatrix4dCP worldToLocal, DPoint3dCR spacePoint, size_t &closestIndex, double &minDist)
search for closest point in array (NO implied curve or lines between points).
static bool FractionToFrenetFrame(bvector< DPoint3d > const &points, double f, TransformR frame)
static bool IsConvex(bvector< DPoint3d > const &xyz)
test if the polygon is convex.
static double SumAbs(double *data, int n)
static double MaxAbsDiff(bvector< double > const &x, bvector< double > const &y)
static void LinearMapFrontBackToInterval(bvector< double > &data, double a0, double a1)
map first point to a0, last to a1, others proportionally
struct Transform & TransformR
Definition: msgeomstructs_typedefs.h:134
bool IsEmpty() const
Definition: DPoint3dOps.h:1585
T GetCyclicFromLeft(ptrdiff_t k) const
return the i'th entry counting cyclically from the left
Definition: DPoint3dOps.h:1648
static void CollectZPairsForOrderedXPoints(bvector< DPoint3d >const &pointA, bvector< DPoint3d > const &pointB, bvector< CurveLocationDetailPair > &pairs)
Both inputs must have increasing X.
static bool FixupAndTriangulateSpaceLoops(bvector< int > *pIndices, bvector< int > *pExteriorLoopIndices, bvector< DPoint3d > *pXYZOut, TransformR localToWorld, TransformR worldToLocal, bvector< DPoint3d > *pXYZIn, double xyTolerance, bool bSignedOneBasedIndices)
Triangulate a single space polygon.
ValidatedValue< double > ValidatedDouble
Definition: GeomApi.h:353
bvector< ICurvePrimitive * > m_curve
ul> li>Invoke the base class ReverseXFYV with with passthrough args li>Reverse curves, optionally negating vectors /ul>
Definition: DPoint3dOps.h:1906
static ValidatedDouble ValidatedDivide(double a, double b, double defaultResult=0.0, double minRelativeDivisor=1.0e-15)
Attempt to divide {numerator/denominator}.
static ValidatedDRay3d PolylineFractionToRay(bvector< DPoint3d > const &points, double polylineFraction)
static bool BoundingValues(double const *pData, size_t n, double searchValue, size_t &lowerIndex, double &lowerBound, double &upperBound)
Search a sorted array for a bracketing interval, preferably lowerBound &le searchValue < upperBound...
double m_value
Definition: DPoint3dOps.h:1744
static void AddPointIfDistinctFromBack(bvector< DPoint3d > &points, DPoint3d xyz)
push a point on the back, but skip of "AlmostEqual"
static bool ClosestPointXY(bvector< DPoint3d > const &xyz, bool addClosurePoint, DPoint3dCR spacePoint, DMatrix4dCP worldToLocal, double &globalFraction, DPoint3dR curvePoint, size_t &edgeIndex, size_t &numEdge, double &edgeFraction, double &xyDistance)
Search for closest point on edge, using xy coordinates after optional projection. Optionally add clos...
static bool Get(bvector< T > *dest, T &data, size_t index)
Get with checked array pointer and index.
ValidatedValue< struct DVec2d > ValidatedDVec2d
Definition: GeomApi.h:345
Pair of arrays of corresponding xyz and double values.
Definition: DPoint3dOps.h:1848
Implement the classic "Union Find" algorithm in bvector Begin with n distinct sequential inte...
Definition: DPoint3dOps.h:1516
static T * MallocAndCopy(bvector< T > &source)
Copy data to the heap as allocated by BSIBaseGeom::Malloc.
static void AppendXY(bvector< DVec2d > *dest, double x, double y)
append a vector to the bvector
struct DPoint2d & DPoint2dR
Definition: msgeomstructs_typedefs.h:78
static double Interpolate(double dataA, double fraction, double dataB)
Interpolate between values.
static size_t Cluster(bvector< DVec3d > const &xyzIn, bvector< DVec3d > *xyzOut, bvector< size_t > &oldIndexToPackedIndex, double absTol=-1.0, double relTol=-1.0)
Find nearly-identical points.
bool RemoveMin()
Definition: DPoint3dOps.h:1818
static bool FixupAndTriangulateLoopsXY(bvector< int > *pIndices, bvector< int > *pExteriorLoopIndices, bvector< DPoint3d > *pXYZOut, bvector< DPoint3d > *pXYZIn, double xyTolerance, int maxPerFace, bool signedOneBasedIndices, bool addVerticesAtCrossings)
Triangulate a single xy polygon.
class wrapper for static utiliity functions on data structures built around DPoint2d.
Definition: DPoint3dOps.h:19
Operations on arrays of DVec2d (bvector and contiguous buffer).
Definition: DPoint3dOps.h:249
bvector< double > m_f
Definition: DPoint3dOps.h:1851
static UsageSums SumSegmentLengths(bvector< DPoint3d > const &xyz)
return statistical data (sum, min, max ..) for length of segments
static double Max(double a1, double a2)
min of 2 candidates
static bool FindNotAlmostEqualBefore(bvector< T >const &data, T const &baseValue, size_t i0, size_t &i1, T &value)
Search for [i0-1..(downward)] for index i1 at which the array value is not AlmostEqual to the given v...
LocalCoordinateSelect
Definition: msgeomstructs_typedefs.h:231
static bool SafeDivide(double &result, double numerator, double denominator, double defaultResult=0.0, double smallFraction=1.0e-15)
Attempt to divide {numerator/denominator} Return false if result is larger than than 1/safeDivideFrac...
static size_t GetStrokeCount(bvector< DPoint3d > const &points, IFacetOptionsCR options, double startFraction=0.0, double endFraction=1.0)
static double PreciseSum(double *data, size_t n)
Sum using Kanane's high precision correction sequence.
double MinValue()
Definition: DPoint3dOps.h:1780
Implementation of a priorityQueue (sometimes called a heap).
Definition: DPoint3dOps.h:1740
bvector< DPoint2d > m_uv
Definition: DPoint3dOps.h:1887
static void AppendXY0(bvector< DPoint3d > &dest, bvector< DPoint2d > const &source)
Append xy points with 0 z.
static double AreaXY(bvector< DPoint3d > const &xyz)
Return the of the polygon's projection to the xy plane.
Operations on arrays of DPoint2d (bvector and contiguous buffer).
Definition: DPoint3dOps.h:161
static bool PickTriangleFromStart(DPoint3dCP pXYZ, size_t numXYZ, DRay3dCR ray, DPoint3dR xyz, DPoint3dR triangleFractions, double &rayFraction, size_t &edgeBaseIndex)
Search for a triangle which has an interior point intersection with a ray.
static DRange1d ProjectedParameterRange(bvector< DPoint3d > const &points, DRay3dCR ray, double fraction0, double fraction1)
static void Sort(double *data, size_t count, bool ascending=true)
sort flat array of doubles, optionally descending.
static bool MinMaxDistance(bvector< DPoint3d > const &xyzA, bvector< DPoint3d > const &xyzB, double &minDistance, size_t &minIndex, double &maxDistance, size_t &maxIndex)
Find the min and max distances and their index positions.
static ValidatedDouble InverseInterpolate(double dataA, double value, double dataB)
Return the fraction such that Interplate (dataA, fraction, dataB) equals value.
static bool AddStrokes(bvector< DPoint3d > const &points, bvector< DPoint3d > &strokes, IFacetOptionsCR options, bool includeStartPoint=true, double startFraction=0.0, double endFraction=1.0)
static void UpdateMinMax(double x, double f, double &xMin, double &fMin, double &xMax, double &fMax)
update evolving minmax f values with associated x values.
static void SetPolylinePolylineHeapTrigger(size_t mn)
Set the transition from m*n search to range heap for PolylinePolyline searches.
static size_t NewClusterIndex(bvector< size_t > &clusterData)
Create a new cluster, i.e. new entry at end of array pointing to itself as parent.
void AppendXdeltaF(DPoint3dCR xyz, double deltaF)
Append xyz to its array, If there are prior fractions, add deltaF to the last.
static bool FractionAtSignedDistanceFromFraction(bvector< DPoint3d > const &xyz, double startFraction, double signedDistance, double &endFraction, size_t &endSegmentIndex, double &segmentFraction, double &actualDistance)
Search (forward or reverse, according to sign of requested distance).
Operations in which an array of points is understood to be connected as a polyline (but not closed as...
Definition: DPoint3dOps.h:772
static bool MaxDistanceFromUnboundedRay(bvector< DPoint3d > const &xyz, DRay3dCR ray, size_t &index, double &maxDistance)
search for farthest point from unbounded ray
Operations in which an array of points is understood to be connected as a closed polygon.
Definition: DPoint3dOps.h:1183
void ReverseXF(bool reverseFAs01Fraction)
Reverse the order of the xyz and F arrays.
static void GreedyTriangulationBetweenLinestrings(bvector< DPoint3d > const &linestringA, bvector< DPoint3d > const &linestringB, bvector< DTriangle3d > &triangles, bvector< int > *oneBasedABIndex=nullptr)
Build triangles that advance along two linestrings.
static bool FindNotAlmostEqualAtOrAfter(bvector< T >const &data, T const &baseValue, size_t i0, size_t &i1, T &value)
Search for [i0..] for index i1 at which the array value is not AlmostEqual to the given value...
static size_t AddClusters(bvector< size_t > &clusterData, size_t numAdd)
Create numAdd new clusters. Return the total number of clusters.
static ValidatedDouble ValidatedDivideDistance(double a, double b, double defaultResult=0.0)
Attempt to divide {numerator/denominator}.
static size_t MergeClusters(bvector< size_t > &clusterData, size_t index0, size_t index1)
Announce that the clusters that contains index0 are ultimately the same cluster.
static double LargestXYCoordinate(DPoint3dCP points, size_t n)
Find the largest coordinate in array, ignoreing z.
struct CurveLocationDetail & CurveLocationDetailR
Definition: msgeomstructs_typedefs.h:167
ValidatedValue< DRay3d > ValidatedDRay3d
Definition: GeomApi.h:360
struct DMatrix4d & DMatrix4dR
Definition: msgeomstructs_typedefs.h:97
static bool ClosestPoint(bvector< DPoint3d > const &xyz, DPoint3dCR spacePoint, size_t &closestIndex, double &minDist)
search for closest point in array (NO implied curve or lines between points).
static bool CollectIntersectionsAndCloseApproachesXY(bvector< DPoint3d > const &xyzA, bvector< double > const *paramA, bvector< DPoint3d > const &xyzB, bvector< double > const *paramB, bvector< CurveLocationDetail > &locationA, bvector< CurveLocationDetail > &locationB, double maxDist)
Compute intersections among linestrings.
static double ClampFraction(double s)
Clamp a single fraction.
struct DPoint2d const & DPoint2dCR
Definition: msgeomstructs_typedefs.h:78
static void AppendXYZ(bvector< DPoint3d > *dest, double x, double y, double z=0.0)
append a point to the bvector
static size_t Append(bvector< T > *dest, T const *source, size_t count)
append contiguous points to the bvector. return first index
A Bentley supplied implementation std::vector.
Definition: stdcxx/bvector.h:77
void ReverseXFUV(bool reverseFAs01Fraction, bool negateVectorU, bool negateVectorV)
DRange3d GetRange() const
Return the range of the points.
static bool PrincipalAxes(bvector< DPoint3d > const &points, DVec3dR centroid, RotMatrixR axes, DVec3dR moments)
struct DPlane3d const & DPlane3dCR
Definition: msgeomstructs_typedefs.h:113
static void CompressColinearPoints(bvector< DPoint3d > &points, double absTol, bool eliminateOverdraw, bool closed)
Inplace compression of points to eliminate colinear points.
static void CompressByChordError(bvector< DPoint3d > &result, bvector< DPoint3d > const &source, double chordTolerance)
Simplifies a sequence of segments up to tolerance.
static void CopyFromIndex(bvector< double > const &source, bvector< size_t > const &index, bvector< double > &dest)
make dest[index[i]] = source[i];
struct DPoint3d & DPoint3dR
Definition: msgeomstructs_typedefs.h:79
static double SegmentLength(bvector< DPoint3d > const &points, size_t index)
Return the length of the segment starting at given index.
static void ClampDirectedFractionInterval(double &t0, double &t1)
Clamp two fractions to 0..1 respecting directional relationship.
static size_t CountDisconnects(bvector< DPoint3d > &points)
Return the number of disconnect points in the array.
static double DeterminantXYXY(double x0, double y0, double x1, double y1)
return determinant
static double Clamp(double x, double a, double b)
Clamp x so it is between a and b. a is assumed less than or equal to b.
static bool LexicalXExtrema(int &iMin, int &iMax, DPoint2dCP points, int nPoint)
Return indices where min and max y of lexical sort order occur.
static DMatrix4d MomentSums(DPoint3dCR origin, bvector< DPoint3d > const &points)
Accumulate (points[i]-origin) into moments sums.
static void Copy(bvector< T > *dest, bvector< T > const *source)
Copy from source to destination.
struct DSegment3d const & DSegment3dCR
Definition: msgeomstructs_typedefs.h:115
A 1d interval with low and high values.
Definition: DRange1d.h:41
static void LinearMapInPlace(bvector< double > &data, double a, double b)
replace each data[i] by (a + b * data[i]);
static size_t Cluster(bvector< DPoint2d > const &xyzIn, bvector< DPoint2d > *xyzOut, bvector< size_t > &oldIndexToPackedIndex, double absTol=-1.0, double relTol=-1.0)
Find nearly-identical points.
struct DMatrix4d const * DMatrix4dCP
Definition: msgeomstructs_typedefs.h:97
static double Area(bvector< DPoint2d > const &xy)
Return the of the polygon's area.
static bool ReorientTriangulationIndices(bvector< int > &indices, bool *pbReversed, bool bSignedOneBasedIndices)
Adjust the triangulation indices returned by ~mvu_triangulateSpacePolygon to match the orientation of...
static double MaxAbs(double a1, double a2)
min absolute value of 2 candidates
struct Transform const & TransformCR
Definition: msgeomstructs_typedefs.h:134
static DRange3d Range(bvector< DPoint3d > const *pXYZIn)
static int TolerancedComparison(double a, double b)
Return -1,0,1 for less than, AlmostEqual, greater than.
static bool IsSelfIntersectingXY(bvector< DPoint3d > const &xyz, bool addClosure=false)
return true if there are any intersections within the linestring.
ICurvePrimitive is a (polymorphic) base class for parametric curves – line segemnt, circular/elliptic arc, bspline curve, spiral.
Definition: CurvePrimitive.h:49
static double Tolerance(bvector< T > const &data, double absTol, double relTol)
return a tolerance as an absolute tolerance plus relative tolerance times largest coordinate...
static void UpdateMax(double &evolvingMax, double testValue)
update an evolving max value.
static bool OffsetLineString(bvector< DPoint3d > &out, bvector< DPoint3d > const &in, double offsetDistance, DVec3dCR planeNormal, bool periodic=false, double maxMiterRadians=1.58)
Simple linestring offset – miter joints, no loop removal.
static void ChebyshevPoints(bvector< double > &dest, size_t numChebyshev, bool addLimitPoints, size_t numCopyLeft=1, size_t numCopyRight=1)
Constructs an array of Chebyshev points, optionally adding -1 and +1 end values.
struct ICurvePrimitive const * ICurvePrimitiveCP
Definition: msgeomstructs_typedefs.h:166
void PopRight()
remove the right-most entry
Definition: DPoint3dOps.h:1686
static void Reverse(bvector< T > &xyz)
Reverse all points in the vector.
bool Validate()
verify the heap structure .
Definition: DPoint3dOps.h:1825
void Add(DPoint3dCR xyz, double f, DVec3dCR vectorU, ICurvePrimitive *curve)
Add data to respective arrays.
Definition: DPoint3dOps.h:1922
static bool Set(bvector< T > *dest, T const &data, size_t index)
Set with checked array pointer and index.
static double SignedDistanceBetweenFractions(bvector< DPoint3d > const &points, double fraction0, double fraction1)
Return distance (along polyline) between fractional positions.
static PlanePolygonSSICode PlaneIntersectionPoints(bvector< DPoint3d > const &points, DPlane3dCR plane, double touchTolerance, bvector< CurveLocationDetail > &trueCrossings, bvector< CurveLocationDetail > *touchData, DRange1d &altitudeLimits)
Collect data for a polygon crossing a plane.
static bool UpperBound(double const *pData, size_t n, double searchValue, size_t &index)
Find the Index of value in pData(sorted!!!) which is greater than searchValue.
DoubleEndedQueue(T defaultValue)
Initialize with a specified default value to be returned for invalid accesses.
Definition: DPoint3dOps.h:1577
static void Multiply(bvector< DPoint2d > *xyz, TransformCR transform)
Multiply each (non-disconnect) point in place by a transform.
DPoint3dDoubleArrays with additional markup: ul> ul>m_uv – array of 2d (uv, xy) data ul>m_vectorU –...
Definition: DPoint3dOps.h:1885
static bool SecondAreaMomentProducts(bvector< DPoint3d > const &xyz, DPoint3dCR origin, DMatrix4dR products)
bvector< DVec3d > m_vectorV
ul> li>Invoke the base class ReverseXF with reverseFAs01Fraction.
Definition: DPoint3dOps.h:1889
static double SnapZero(double a, double abstol)
snap to zero if within tolerance.
void AppendXF(DPoint3dCR xyz, double f)
Append to each array.
static void AppendToChains(bvector< bvector< DPoint3d >> &chains, DSegment3dCR segment)
If segment chains to the final chain, add its endpoint to the chain. Otherwise start a new chain...
static bool IsIn01(double x)
Test if x is between 0 and 1 inclusive.
static void PackAlmostEqualAfter(bvector< DPoint3d > &points, size_t initialCount)
Starting at initialIndex, pack out points that are AlmostEqual. (if initialIndex is greater than 0...
#define BEGIN_BENTLEY_GEOMETRY_NAMESPACE
Definition: Bentley.r.h:29
struct DPoint3d const & DPoint3dCR
Definition: msgeomstructs_typedefs.h:79
T GetLeft() const
return the left entry in the dequeue
Definition: DPoint3dOps.h:1640
static double MinAbs(double a1, double a2)
min absolute value of 2 candidates
static bool ChooseSafeDivideParameter(double &result, double numerator0, double denominator0, double numerator1, double denominator1, double defaultResult=0.0)
Attempt to divide either of {numerator0/denominator0} or (numerator1/denominator1) Return false if re...
static double LargestCoordinate(bvector< T > const &data)
return the largest absolute coordinate in the array.
bvector< DVec3d > m_vectorU
Definition: DPoint3dOps.h:1888
static void AppendDisconnect(bvector< T > *dest)
append a disconnect.
static bool MinMaxAngle(bvector< DVec3d > const &dataA, bvector< DVec3d > const &dataB, double &minAngle, size_t &minIndex, double &maxAngle, size_t &maxIndex)
Find the min and max distances and their index positions.
struct DRay3d const & DRay3dCR
Definition: msgeomstructs_typedefs.h:120
struct DVec3d const & DVec3dCR
Definition: msgeomstructs_typedefs.h:89
static bool Normalize(bvector< double > &data, double a0, double a1)
replace each value by its fractional position between a0 and a1.
static void CompressCyclic(bvector< T > &data, double tolerance)
Inplace removal of near-duplicate points via Compress, followed by removal of trailing points that ma...
void AddRight(T value)
Add value to the dequeue at the right.
Definition: DPoint3dOps.h:1608
static bool LowerBound(double const *pData, size_t n, double searchValue, size_t &index)
Find the Index of value in pData(sorted!!!) which is greater or than equal to searchValue.
void Add(ValidatedDRay3d const &ray, double f, ICurvePrimitive *curve)
Definition: DPoint3dOps.h:1929
struct DPoint2d const * DPoint2dCP
Definition: msgeomstructs_typedefs.h:78
Operations on arrays of doubles (bvector and contiguous buffer).
Definition: DPoint3dOps.h:261
Definition: DPoint3dOps.h:1742
static void AppendXYZ(bvector< DVec3d > *dest, double x, double y, double z=0.0)
append a point to the bvector
bool IsEmpty()
Definition: DPoint3dOps.h:1782
static bool CentroidNormalAndArea(bvector< DPoint3d > const &xyz, DPoint3dR centroid, DVec3dR normal, double &area)
Return the 3D polygon centroid, normal and area.
static size_t Cluster(bvector< DPoint3d > const &xyzIn, bvector< DPoint3d > *xyzOut, bvector< size_t > &oldIndexToPackedIndex, double absTol=-1.0, double relTol=-1.0)
Find nearly-identical points.
static double ChebyshevPoint(size_t i, size_t n)
Return the ith of n chebyshev points, cos(PI * (2i+1)/(2n)), starting at i=0.
static void AppendInterpolated(bvector< T > &dest, T const &first, T const &last, size_t count, bool includeFirst=true)
Add uniformly spaced interpolated points between limits.
Operations on arrays of DPoint2d (bvector and contiguous buffer).
Definition: DPoint3dOps.h:578
static void ScaleArray(double *values, size_t n, double a)
static DVec3d AreaNormal(bvector< DPoint3d > const &xyz)
Sum 0.5 times the cross product vectors from first point to all edges.
static size_t Size(bvector< T > *dest)
size with pointer check
static double SegmentFractionToPolylineFraction(size_t segmentIndex, size_t numSegment, double segmentFraction)
convert segment index and fraction along segment to overall fraction of polyline. ...
size_t Size() const
Definition: DPoint3dOps.h:1606
static bool AlmostEqualFraction(double a, double b)
Near-equality test knowing range 0..1 for values...
void Clear()
Clear the dequeue.
Definition: DPoint3dOps.h:1575
T GetRight() const
return the right entry in the dequeue
Definition: DPoint3dOps.h:1632
static ValidatedDVec2d ValidatedDivideAndDifferentiate(double f, double df, double g, double dg)
Attempt to divide {f/g}.
static DPoint3d SegmentFractionToPoint(bvector< DPoint3d > const &points, size_t index, double segmentFraction)
Return the point at fractional position along a specified edge.
static void MovingAverages(bvector< double > &dest, bvector< double > const &source, size_t blockSize, size_t numSkip0=0, size_t numSkip1=0)
Compute moving averages of blockSize consecutive values, optionally skipping some leading and trailin...
A 3d low and high corner pair for range boxes.
Definition: drange3d.h:20
Accumulate given values.
Definition: counters.h:42
static int TolerancedSign(double a, double abstol)
Return -1,0,1 according to sign, with 0 case subject to tolerance.
static bool PolylineFractionsOnSameSegment(double f0, double f1, size_t numVertex)
Test if two global fractions map to the same segment within a polyline.
static void SetSequential(bvector< double > &dest, double a0=0.0, double delta=1.0)
static double Sum(double *data, int n)
4x4 matrix used for perspective (homogeneous coordinate) calculations.
Definition: dmatrix4d.h:18
static double ComputeTolerance(double maxSize, double abstol, double reltol)
Return a tolerance appropriate for coordinates up to maxSize.
static bool PolylineFractionToSegmentData(size_t numVertex, double fraction, size_t &segmentIndex, size_t &numSegment, double &segmentFraction, bool &isExtrapolated)
convert fraction along total polyline to segment and local fraction.
bvector< DPoint3d > m_xyz
Definition: DPoint3dOps.h:1850
void AddLeft(T value)
Add value to the dequeue at the left.
Definition: DPoint3dOps.h:1617
void ReverseXFUVC(bool reverseFAs01Fraction, bool negateVectorU, bool negateVectorV)
ul> li> Reverse in range index0<=index=""> Any array for which any part of the index range...
static bool SafeDivideParameter(double &result, double numerator, double denominator, double defaultResult=0.0)
Attempt to divide {numerator/denominator} Return false if result is larger than 10 digits...