Skip to content
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9d36d1a
Improved CurveCurveIntersectXY
saeeedtorabi Nov 14, 2025
7f0db82
Added support for extend
saeeedtorabi Nov 17, 2025
308385b
Merge branch 'master' into saeed-torabi/spiral-intersection-modify
saeeedtorabi Nov 17, 2025
dfd4385
- make geomA/B arg order consistent
dassaf4 Nov 21, 2025
ea35661
use `Checker.testExactNumber` for 0-tolerance comparisons (e.g., for …
dassaf4 Nov 21, 2025
a05819c
helper methods
dassaf4 Nov 21, 2025
7d88e0c
use linestring fraction as spiral fraction seed; it evaluates to a cl…
dassaf4 Nov 21, 2025
acce963
ClosestPointStrokeHandler ctor bug when result detail is provided
dassaf4 Nov 21, 2025
33485b9
remove unused methods and interval logic
dassaf4 Nov 25, 2025
6c4e6dc
doc
dassaf4 Nov 25, 2025
23e964a
doc
dassaf4 Nov 26, 2025
24ffc64
finally added a tol arg for comparing points
dassaf4 Nov 26, 2025
4d02a6c
fix anomalous testPoint3d call
dassaf4 Nov 26, 2025
adbd02c
spiral intersectXY:
dassaf4 Nov 26, 2025
67f0732
Merge branch 'master' into saeed-torabi/spiral-intersection-modify
dassaf4 Nov 26, 2025
05de9d5
extract-api
dassaf4 Nov 26, 2025
046dd22
Broke long lines to shorter lines to increase readability
saeeedtorabi Nov 27, 2025
4d40b5c
Merge branch 'master' into saeed-torabi/spiral-intersection-modify
saeeedtorabi Nov 27, 2025
62bc8e0
Implemented spirals close approach
saeeedtorabi Nov 26, 2025
81222ed
Major code refactor
saeeedtorabi Nov 28, 2025
98d4722
minor change
saeeedtorabi Dec 1, 2025
15f98f7
Merge branch 'master' into saeed-torabi/spiral-close-approach
saeeedtorabi Dec 3, 2025
380b5b5
Merge branch 'master' into saeed-torabi/spiral-close-approach
saeeedtorabi Dec 9, 2025
3a53765
minor doc change
saeeedtorabi Dec 18, 2025
4d66bb4
Merge branch 'master' into saeed-torabi/spiral-close-approach
saeeedtorabi Dec 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion common/api/core-geometry.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ export class CurveLocationDetail {
isSameCurveAndFraction(other: CurveLocationDetail | {
curve: CurvePrimitive;
fraction: number;
}): boolean;
}, fractionTol?: number): boolean;
point: Point3d;
point1?: Point3d;
pointQ: Point3d;
Expand Down Expand Up @@ -2224,6 +2224,7 @@ export class Geometry {
static isSameCoordinateSquared(x: number, y: number, tolerance?: number): boolean;
static isSameCoordinateWithToleranceFactor(x: number, y: number, toleranceFactor: number): boolean;
static isSameCoordinateXY(x0: number, y0: number, x1: number, y1: number, tolerance?: number): boolean;
static isSameFraction(x: number, y: number, tolerance?: number): boolean;
static isSamePoint2d(dataA: Point2d, dataB: Point2d, tolerance?: number): boolean;
static isSamePoint3d(dataA: Point3d, dataB: Point3d, tolerance?: number): boolean;
static isSamePoint3dXY(dataA: Point3d, dataB: Point3d, tolerance?: number): boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-geometry",
"comment": "",
"type": "none"
}
],
"packageName": "@itwin/core-geometry"
}
9 changes: 9 additions & 0 deletions core/geometry/src/Geometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,15 @@ export class Geometry {
d = -d;
return d <= tolerance;
}
/**
* Toleranced test for equivalent fractions.
* @param x first fraction to compare
* @param y second fraction to compare
* @param tolerance maximum difference between fractions considered equivalent, defaulting to [[smallFraction]].
*/
public static isSameFraction(x: number, y: number, tolerance: number = Geometry.smallFraction): boolean {
return this.isSameCoordinate(x, y, tolerance);
}
/**
* Boolean test for metric coordinate near-equality (i.e., if `x` and `y` are almost equal) using
* `tolerance = toleranceFactor * smallMetricDistance`
Expand Down
2 changes: 1 addition & 1 deletion core/geometry/src/curve/CurveCurve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class CurveCurve {
for (let i = 0; i < primitives.length; i++) {
const curveA = primitives[i];
for (let j = i + 1; j < primitives.length; j++) {
handler.resetGeometry(primitives[j]);
handler.resetGeometryB(primitives[j]);
curveA.dispatchToGeometryHandler(handler);
}
}
Expand Down
9 changes: 6 additions & 3 deletions core/geometry/src/curve/CurveLocationDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,12 @@ export class CurveLocationDetail {
}
return detailB;
}
/** Compare only the curve and fraction of this detail with `other`. */
public isSameCurveAndFraction(other: CurveLocationDetail | { curve: CurvePrimitive, fraction: number }): boolean {
return this.curve === other.curve && Geometry.isAlmostEqualNumber(this.fraction, other.fraction);
/**
* Compare only the curve and fraction of this detail with `other`.
* @param fractionTol optional relative tolerance for comparing fractions with [[Geometry.isAlmostEqualNumber]].
*/
public isSameCurveAndFraction(other: CurveLocationDetail | { curve: CurvePrimitive, fraction: number }, fractionTol?: number): boolean {
return this.curve === other.curve && Geometry.isAlmostEqualNumber(this.fraction, other.fraction, fractionTol);
}
/**
* Transform the detail in place.
Expand Down
3 changes: 2 additions & 1 deletion core/geometry/src/curve/CurvePrimitive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,9 @@ export abstract class CurvePrimitive extends GeometryQuery {
public abstract fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d;
/**
* Returns a ray whose origin is the curve point and direction is the unit tangent.
* @param fraction fractional position on the curve
* @param fraction fractional position on the curve.
* @param result optional preallocated ray.
* @returns tangent ray with normalized direction or zero vector if the derivative vanishes.
*/
public fractionToPointAndUnitTangent(fraction: number, result?: Ray3d): Ray3d {
const ray = this.fractionToPointAndDerivative(fraction, result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implement
this._workPoint = Point3d.create();
this._workRay = Ray3d.createZero();
this._closestPoint = result;
if (this._closestPoint)
this._closestPoint.a = Geometry.largeCoordinateResult
this._extend = extend ?? false;
this.startCurvePrimitive(undefined);
this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);
Expand Down
Loading