@itwin/core-geometry 5.1.0-dev.55 → 5.1.0-dev.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Geometry.d.ts +5 -5
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +2 -2
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/solid/Box.d.ts.map +1 -1
- package/lib/cjs/solid/Box.js +7 -0
- package/lib/cjs/solid/Box.js.map +1 -1
- package/lib/cjs/solid/Cone.d.ts.map +1 -1
- package/lib/cjs/solid/Cone.js +6 -0
- package/lib/cjs/solid/Cone.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
- package/lib/cjs/solid/LinearSweep.js +9 -4
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RuledSweep.js +5 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts.map +1 -1
- package/lib/cjs/solid/Sphere.js +5 -2
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
- package/lib/cjs/solid/TorusPipe.js +4 -0
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/esm/Geometry.d.ts +5 -5
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +2 -2
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/solid/Box.d.ts.map +1 -1
- package/lib/esm/solid/Box.js +7 -0
- package/lib/esm/solid/Box.js.map +1 -1
- package/lib/esm/solid/Cone.d.ts.map +1 -1
- package/lib/esm/solid/Cone.js +6 -0
- package/lib/esm/solid/Cone.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
- package/lib/esm/solid/LinearSweep.js +9 -4
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +1 -1
- package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
- package/lib/esm/solid/RuledSweep.js +5 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts.map +1 -1
- package/lib/esm/solid/Sphere.js +5 -2
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
- package/lib/esm/solid/TorusPipe.js +4 -0
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cone.js","sourceRoot":"","sources":["../../../src/solid/Cone.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AAGvC,wDAAqD;AACrD,wCAAqC;AAErC,0CAAkD;AAElD,qDAAkD;AAClD,uFAAoF;AACpF,mEAAyD;AACzD,mEAAkE;AAElE,uDAAoD;AACpD,qDAAkD;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAa,IAAK,SAAQ,+BAAc;IACtC,wCAAwC;IACxB,kBAAkB,GAAG,MAAM,CAAC;IAE5C,+FAA+F;IACvF,aAAa,CAAY;IACjC,yEAAyE;IACjE,QAAQ,CAAS;IACzB,yEAAyE;IACjE,QAAQ,CAAS;IACzB,wCAAwC;IAChC,UAAU,CAAS;IAE3B,oCAAoC;IACpC,YAAsB,GAAc,EAAE,OAAe,EAAE,OAAe,EAAE,MAAe;QACrF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC;QACzB,IAAI,CAAC,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,MAAM,CAAC,OAAO,EAAE,CAAC;QACpD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAEpD,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAE,CAAC;QACpD,MAAM,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACrD,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;QAChD,OAAO,0BAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EACzE,mBAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;IACxF,CAAC;CACF;AArRD,oBAqRC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { GeometryHandler, UVSurface, UVSurfaceIsoParametricDistance } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\n\n/**\n * A cone with axis along the z-axis of a (possibly skewed) local coordinate system.\n * * The curved surface of the cone `C` with axis `vectorZ = centerB - centerA` is parameterized over (u,v) in [0,1]x[0,1] by\n * `C(u,v) = centerA + vFractionToRadius(v) * (cos(u * 2pi) * vectorX + sin(u * 2pi) * vectorY) + v * vectorZ`.\n * * Either radius may be zero, but they may not both be zero.\n * * Cross section size is determined by the lengths of `vectorX`, `vectorY`, and the radii.\n * * If `vectorX` and `vectorY` are orthonormal, the cross sections are circular, with sections at v = 0 and v = 1 having radius\n * `radiusA` and `radiusB`, respectively; otherwise, the cross sections are elliptical.\n * * The stored matrix encapsulates `vectorX`, `vectorY`, and `vectorZ` in the respective columns. Typically the first two columns\n * are orthogonal and unit length, and the last is full length.\n * * Creating a Cone without orthogonal xy-axes of equal length is possible, but not recommended, for the resulting geometry\n * lacks portability; for example, such a Cone cannot be represented as a DGN element (see [[createDgnCone]]).\n * @public\n */\nexport class Cone extends SolidPrimitive implements UVSurface, UVSurfaceIsoParametricDistance {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"cone\";\n\n /** Local to world transform. Axes may have any nonzero length and may be non-perpendicular. */\n private _localToWorld: Transform;\n /** Nominal cross sectional radius at z=0 (scales the cone's xy-axes). */\n private _radiusA: number;\n /** Nominal cross sectional radius at z=1 (scales the cone's xy-axes). */\n private _radiusB: number;\n /** Maximum of _radiusA and _radiusB. */\n private _maxRadius: number;\n\n /** Constructor, inputs CONSUMED. */\n protected constructor(map: Transform, radiusA: number, radiusB: number, capped: boolean) {\n super(capped);\n this._localToWorld = map;\n this._radiusA = radiusA;\n this._radiusB = radiusB;\n this._maxRadius = Math.max(this._radiusA, this._radiusB); // um... should resolve elliptical sections\n }\n /** Return a clone of this Cone. */\n public clone(): Cone {\n return new Cone(this._localToWorld.clone(), this._radiusA, this._radiusB, this.capped);\n }\n /** Return a coordinate frame (right handed unit vectors)\n * * origin at center of the base circle.\n * * base circle in the xy plane\n * * z axis by right hand rule.\n */\n public getConstructiveFrame(): Transform | undefined {\n return this._localToWorld.cloneRigid();\n }\n /** Apply the transform to this cone's local to world coordinates.\n * * Note that the radii are not changed. Scaling is absorbed into the frame.\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n transform.multiplyTransformTransform(this._localToWorld, this._localToWorld);\n return true;\n }\n /**\n * Create a clone and immediately transform the clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): Cone | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /**\n * Create a right circular cylinder or cone from the given base centers and radii.\n * * The circular cross sections are perpendicular to the axis line between the centers.\n * * Both radii must be of the same sign, and at least one radius must be nonzero.\n * * Negative radii are accepted to create an interior surface, however the downstream effects of this, combined with capping, may be problematic.\n */\n public static createAxisPoints(centerA: Point3d, centerB: Point3d, radiusA: number, radiusB: number, capped?: boolean): Cone | undefined {\n const zDirection = centerA.vectorTo(centerB);\n const a = zDirection.magnitude();\n if (Geometry.isSmallMetricDistance(a)) return undefined;\n // force near-zero radii to true zero\n radiusA = Geometry.correctSmallMetricDistance(radiusA);\n radiusB = Geometry.correctSmallMetricDistance(radiusB);\n // cone tip may not be \"within\" the z range.\n if (radiusA * radiusB < 0.0) return undefined;\n // at least one must be nonzero.\n if (radiusA + radiusB === 0.0) return undefined;\n const matrix = Matrix3d.createRigidHeadsUp(zDirection);\n matrix.scaleColumns(1.0, 1.0, a, matrix);\n const localToWorld = Transform.createOriginAndMatrix(centerA, matrix);\n return new Cone(localToWorld, radiusA, radiusB, capped ?? false);\n }\n /**\n * Create a general cone from cross sections parallel to the plane spanned by the given vectors.\n * * Circular cross sections are indicated by perpendicular vectors of the same length.\n * * Elliptical cross sections are indicated by non-perpendicular vectors, or vectors of different lengths.\n * * Cross sectional planes do not have to be perpendicular to the axis line between centers.\n * * Cross section size is affected both by the given vector lengths and radii. To avoid unexpected scaling,\n * pass orthonormal vectors for circular cross sections, or unit radii for elliptical cross sections.\n * * There is no validation of the input radii. For best results, they should be nonnegative, and at least one should be nonzero.\n */\n public static createBaseAndTarget(centerA: Point3d, centerB: Point3d, vectorX: Vector3d, vectorY: Vector3d, radiusA: number, radiusB: number, capped?: boolean): Cone {\n radiusA = Math.abs(Geometry.correctSmallMetricDistance(radiusA));\n radiusB = Math.abs(Geometry.correctSmallMetricDistance(radiusB));\n const vectorZ = centerA.vectorTo(centerB);\n const localToWorld = Transform.createOriginAndMatrixColumns(centerA, vectorX, vectorY, vectorZ);\n return new Cone(localToWorld, radiusA, radiusB, capped ?? false);\n }\n\n /**\n * Create a circular cone from the typical parameters of the DGN file.\n * * This method calls [[createBaseAndTarget]] with normalized vectors, `vectorY` squared against `vectorX`, and\n * `radiusA` and `radiusB` scaled by the original length of `vectorX`.\n * * These restrictions allow the cone to be represented by an element in the DGN file.\n */\n public static createDgnCone(centerA: Point3d, centerB: Point3d, vectorX: Vector3d, vectorY: Vector3d, radiusA: number, radiusB: number, capped?: boolean): Cone | undefined {\n const rigidMatrix = Matrix3d.createRigidFromColumns(vectorX, vectorY, AxisOrder.XYZ);\n if (rigidMatrix) {\n const vectorXMag = vectorX.magnitude();\n return this.createBaseAndTarget(centerA, centerB, rigidMatrix.columnX(), rigidMatrix.columnY(), radiusA * vectorXMag, radiusB * vectorXMag, capped);\n }\n return undefined;\n }\n\n /** (Property accessor) Return the center point at the base plane */\n public getCenterA(): Point3d { return this._localToWorld.multiplyXYZ(0, 0, 0); }\n /** (Property accessor) */\n public getCenterB(): Point3d { return this._localToWorld.multiplyXYZ(0, 0, 1); }\n /** (Property accessor) Return the x vector in the local frame */\n public getVectorX(): Vector3d { return this._localToWorld.matrix.columnX(); }\n /** (Property accessor) Return the y vector in the local frame */\n public getVectorY(): Vector3d { return this._localToWorld.matrix.columnY(); }\n /** (Property accessor) return the radius at the base plane */\n public getRadiusA(): number { return this._radiusA; }\n /** (Property accessor) return the radius at the top plane */\n public getRadiusB(): number { return this._radiusB; }\n /** (Property accessor) return the larger of radiusA and radiusB */\n public getMaxRadius(): number { return this._maxRadius; }\n /** (Property accessor) return the radius at fraction `v` along the axis */\n public vFractionToRadius(v: number): number { return Geometry.interpolate(this._radiusA, v, this._radiusB); }\n /** (Property accessor) test if `other` is an instance of `Cone` */\n public isSameGeometryClass(other: any): boolean { return other instanceof Cone; }\n /** (Property accessor) Test for nearly equal coordinate data. */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof Cone) {\n if (this.capped !== other.capped) return false;\n if (!this._localToWorld.isAlmostEqualAllowZRotation(other._localToWorld)) return false;\n return Geometry.isSameCoordinate(this._radiusA, other._radiusA)\n && Geometry.isSameCoordinate(this._radiusB, other._radiusB);\n }\n return false;\n }\n /** Second step of double dispatch: call `handler.handleCone(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleCone(this);\n }\n\n /**\n * return strokes for a cross-section (elliptic arc) at specified fraction v along the axis.\n * * fixedStrokeCount takes priority over stroke options.\n * * The linestring is created by LineString3d.createForStrokes (fixedStrokeCount, options), which sets up property according to the options:\n * * optional fractions member\n * * optional uvParams. uvParams are installed as full-scale distance parameters.\n * * optional derivatives.\n * @param v fractional position along the cone axis\n * @param fixedStrokeCount optional stroke count.\n * @param options optional stroke options.\n */\n public strokeConstantVSection(v: number, fixedStrokeCount?: number, options?: StrokeOptions): LineString3d {\n let strokeCount = 16;\n if (fixedStrokeCount !== undefined)\n strokeCount = fixedStrokeCount;\n else if (options !== undefined)\n strokeCount = options.defaultCircleStrokes; // NEEDS WORK -- get circle stroke count with this.maxRadius !!!\n else {\n // accept the local default\n }\n strokeCount = Geometry.clampToStartEnd(strokeCount, 4, 64);\n const r = this.vFractionToRadius(v);\n const result = LineString3d.createForStrokes(fixedStrokeCount, options);\n const twoPi = Math.PI * 2.0;\n const deltaRadians = twoPi / strokeCount;\n let radians = 0;\n const fractions = result.fractions; // possibly undefined !!!\n const derivatives = result.packedDerivatives; // possibly undefined !!!\n const uvParams = result.packedUVParams; // possibly undefined !!\n const surfaceNormals = result.packedSurfaceNormals;\n const xyz = Point3d.create();\n const dXdu = Vector3d.create();\n const dXdv = Vector3d.create();\n const normal = Vector3d.create();\n const transform = this._localToWorld;\n let rc, rs, cc, ss;\n for (let i = 0; i <= strokeCount; i++) {\n if (i * 2 <= strokeCount)\n radians = i * deltaRadians;\n else\n radians = (i - strokeCount) * deltaRadians;\n cc = Math.cos(radians);\n ss = Math.sin(radians);\n rc = r * cc;\n rs = r * ss;\n\n transform.multiplyXYZ(rc, rs, v, xyz);\n result.addPoint(xyz);\n if (fractions)\n fractions.push(i / strokeCount);\n if (derivatives) {\n transform.matrix.multiplyXYZ(-rs * twoPi, rc * twoPi, 0.0, dXdu);\n derivatives.push(dXdu);\n }\n if (surfaceNormals) {\n // the along-hoop vector does not need to be scaled by radius -- just need the direction for a cross product.\n transform.matrix.multiplyXYZ(-ss, cc, 0.0, dXdu);\n transform.matrix.multiplyXYZ(0, 0, 1, dXdv);\n dXdu.unitCrossProduct(dXdv, normal);\n surfaceNormals.push(normal);\n }\n if (uvParams) {\n uvParams.pushXY(i / strokeCount, v);\n }\n }\n return result;\n }\n /**\n * Return the Arc3d section at vFraction\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const r = this.vFractionToRadius(vFraction);\n const transform = this._localToWorld;\n const center = transform.multiplyXYZ(0, 0, vFraction);\n const vector0 = transform.matrix.multiplyXYZ(r, 0, 0);\n const vector90 = transform.matrix.multiplyXYZ(0, r, 0);\n return Loop.create(Arc3d.create(center, vector0, vector90));\n }\n /** Extend `rangeToExtend` so it includes this `Cone` instance. */\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\n const arc0 = this.constantVSection(0.0)!;\n const arc1 = this.constantVSection(1.0)!;\n arc0.extendRange(rangeToExtend, transform);\n arc1.extendRange(rangeToExtend, transform);\n }\n /** Evaluate a point on the Cone surfaces, with\n * * v = 0 is the base plane.\n * * v = 1 is the top plane\n * * u = 0 to u = 1 wraps the angular range.\n */\n public uvFractionToPoint(uFraction: number, vFraction: number, result?: Point3d): Point3d {\n const theta = uFraction * Math.PI * 2.0;\n const r = Geometry.interpolate(this._radiusA, vFraction, this._radiusB);\n const cosTheta = Math.cos(theta);\n const sinTheta = Math.sin(theta);\n return this._localToWorld.multiplyXYZ(r * cosTheta, r * sinTheta, vFraction, result);\n }\n /** Evaluate a point tangent plane on the Cone surfaces, with\n * * v = 0 is the base plane.\n * * v = 1 is the top plane\n * * u = 0 to u = 1 wraps the angular range.\n */\n public uvFractionToPointAndTangents(uFraction: number, vFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\n const theta = uFraction * Math.PI * 2.0;\n const r = Geometry.interpolate(this._radiusA, vFraction, this._radiusB);\n const drdv = this._radiusB - this._radiusA;\n const cosTheta = Math.cos(theta);\n const sinTheta = Math.sin(theta);\n const fTheta = 2.0 * Math.PI;\n return Plane3dByOriginAndVectors.createOriginAndVectors(\n this._localToWorld.multiplyXYZ(r * cosTheta, r * sinTheta, vFraction),\n this._localToWorld.multiplyVectorXYZ(-r * sinTheta * fTheta, r * cosTheta * fTheta, 0),\n this._localToWorld.multiplyVectorXYZ(drdv * cosTheta, drdv * sinTheta, 1.0),\n result);\n }\n /**\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n return this.capped;\n }\n /**\n * Directional distance query\n * * u direction is around longitude circle at maximum distance from axis.\n * * v direction is on a line of longitude between the latitude limits.\n */\n public maxIsoParametricDistance(): Vector2d {\n const vectorX = this._localToWorld.matrix.columnX();\n const vectorY = this._localToWorld.matrix.columnY();\n const columnZ = this._localToWorld.matrix.columnZ();\n\n const xyNormal = vectorX.unitCrossProduct(vectorY)!;\n const hZ = xyNormal.dotProduct(columnZ);\n const zSkewVector = columnZ.plusScaled(xyNormal, hZ);\n const zSkewDistance = zSkewVector.magnitudeXY();\n return Vector2d.create(Math.PI * 2 * Math.max(this._radiusA, this._radiusB),\n Geometry.hypotenuseXY(Math.abs(this._radiusB - this._radiusA) + zSkewDistance, hZ));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Cone.js","sourceRoot":"","sources":["../../../src/solid/Cone.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AAGvC,wDAAqD;AACrD,wCAAqC;AAErC,0CAAkD;AAElD,qDAAkD;AAClD,uFAAoF;AACpF,mEAAyD;AACzD,mEAAkE;AAElE,uDAAoD;AACpD,qDAAkD;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAa,IAAK,SAAQ,+BAAc;IACtC,wCAAwC;IACxB,kBAAkB,GAAG,MAAM,CAAC;IAE5C,+FAA+F;IACvF,aAAa,CAAY;IACjC,yEAAyE;IACjE,QAAQ,CAAS;IACzB,yEAAyE;IACjE,QAAQ,CAAS;IACzB,wCAAwC;IAChC,UAAU,CAAS;IAE3B,oCAAoC;IACpC,YAAsB,GAAc,EAAE,OAAe,EAAE,OAAe,EAAE,MAAe;QACrF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAE,2CAA2C;IACxG,CAAC;IACD,mCAAmC;IAC5B,KAA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AAG,QAAQ,EAAE,GAAG,CAAC,EAC3E,MAAM,CAAC,CAAC;IACZ,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IACD;;;;OAIG;IACI,wBAAwB;QAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAEpD,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAE,CAAC;QACpD,MAAM,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACrD,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;QAChD,OAAO,0BAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EACzE,mBAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;IACxF,CAAC;CACF;AA3RD,oBA2RC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { GeometryHandler, UVSurface, UVSurfaceIsoParametricDistance } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\n\n/**\n * A cone with axis along the z-axis of a (possibly skewed) local coordinate system.\n * * The curved surface of the cone `C` with axis `vectorZ = centerB - centerA` is parameterized over (u,v) in [0,1]x[0,1] by\n * `C(u,v) = centerA + vFractionToRadius(v) * (cos(u * 2pi) * vectorX + sin(u * 2pi) * vectorY) + v * vectorZ`.\n * * Either radius may be zero, but they may not both be zero.\n * * Cross section size is determined by the lengths of `vectorX`, `vectorY`, and the radii.\n * * If `vectorX` and `vectorY` are orthonormal, the cross sections are circular, with sections at v = 0 and v = 1 having radius\n * `radiusA` and `radiusB`, respectively; otherwise, the cross sections are elliptical.\n * * The stored matrix encapsulates `vectorX`, `vectorY`, and `vectorZ` in the respective columns. Typically the first two columns\n * are orthogonal and unit length, and the last is full length.\n * * Creating a Cone without orthogonal xy-axes of equal length is possible, but not recommended, for the resulting geometry\n * lacks portability; for example, such a Cone cannot be represented as a DGN element (see [[createDgnCone]]).\n * @public\n */\nexport class Cone extends SolidPrimitive implements UVSurface, UVSurfaceIsoParametricDistance {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"cone\";\n\n /** Local to world transform. Axes may have any nonzero length and may be non-perpendicular. */\n private _localToWorld: Transform;\n /** Nominal cross sectional radius at z=0 (scales the cone's xy-axes). */\n private _radiusA: number;\n /** Nominal cross sectional radius at z=1 (scales the cone's xy-axes). */\n private _radiusB: number;\n /** Maximum of _radiusA and _radiusB. */\n private _maxRadius: number;\n\n /** Constructor, inputs CONSUMED. */\n protected constructor(map: Transform, radiusA: number, radiusB: number, capped: boolean) {\n super(capped);\n this._localToWorld = map;\n this._radiusA = radiusA;\n this._radiusB = radiusB;\n this._maxRadius = Math.max(this._radiusA, this._radiusB); // um... should resolve elliptical sections\n }\n /** Return a clone of this Cone. */\n public clone(): Cone {\n return new Cone(this._localToWorld.clone(), this._radiusA, this._radiusB, this.capped);\n }\n /** Return a coordinate frame (right handed unit vectors)\n * * origin at center of the base circle.\n * * base circle in the xy plane\n * * z axis by right hand rule.\n */\n public getConstructiveFrame(): Transform | undefined {\n return this._localToWorld.cloneRigid();\n }\n /** Apply the transform to this cone's local to world coordinates.\n * * Note that the radii are not changed. Scaling is absorbed into the frame.\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n transform.multiplyTransformTransform(this._localToWorld, this._localToWorld);\n if (transform.matrix.determinant() < 0.0) {\n // if mirror, reverse z-axis (origin and direction) to preserve outward normals\n this._localToWorld.origin.addInPlace(this._localToWorld.matrix.columnZ());\n this._localToWorld.matrix.scaleColumnsInPlace(1, 1, -1);\n [this._radiusA, this._radiusB] = [this._radiusB, this._radiusA];\n }\n return true;\n }\n /**\n * Create a clone and immediately transform the clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): Cone | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /**\n * Create a right circular cylinder or cone from the given base centers and radii.\n * * The circular cross sections are perpendicular to the axis line between the centers.\n * * Both radii must be of the same sign, and at least one radius must be nonzero.\n * * Negative radii are accepted to create an interior surface, however the downstream effects of this, combined with capping, may be problematic.\n */\n public static createAxisPoints(centerA: Point3d, centerB: Point3d, radiusA: number, radiusB: number, capped?: boolean): Cone | undefined {\n const zDirection = centerA.vectorTo(centerB);\n const a = zDirection.magnitude();\n if (Geometry.isSmallMetricDistance(a)) return undefined;\n // force near-zero radii to true zero\n radiusA = Geometry.correctSmallMetricDistance(radiusA);\n radiusB = Geometry.correctSmallMetricDistance(radiusB);\n // cone tip may not be \"within\" the z range.\n if (radiusA * radiusB < 0.0) return undefined;\n // at least one must be nonzero.\n if (radiusA + radiusB === 0.0) return undefined;\n const matrix = Matrix3d.createRigidHeadsUp(zDirection);\n matrix.scaleColumns(1.0, 1.0, a, matrix);\n const localToWorld = Transform.createOriginAndMatrix(centerA, matrix);\n return new Cone(localToWorld, radiusA, radiusB, capped ?? false);\n }\n /**\n * Create a general cone from cross sections parallel to the plane spanned by the given vectors.\n * * Circular cross sections are indicated by perpendicular vectors of the same length.\n * * Elliptical cross sections are indicated by non-perpendicular vectors, or vectors of different lengths.\n * * Cross sectional planes do not have to be perpendicular to the axis line between centers.\n * * Cross section size is affected both by the given vector lengths and radii. To avoid unexpected scaling,\n * pass orthonormal vectors for circular cross sections, or unit radii for elliptical cross sections.\n * * There is no validation of the input radii. For best results, they should be nonnegative, and at least one should be nonzero.\n */\n public static createBaseAndTarget(centerA: Point3d, centerB: Point3d, vectorX: Vector3d, vectorY: Vector3d, radiusA: number, radiusB: number, capped?: boolean): Cone {\n radiusA = Math.abs(Geometry.correctSmallMetricDistance(radiusA));\n radiusB = Math.abs(Geometry.correctSmallMetricDistance(radiusB));\n const vectorZ = centerA.vectorTo(centerB);\n const localToWorld = Transform.createOriginAndMatrixColumns(centerA, vectorX, vectorY, vectorZ);\n return new Cone(localToWorld, radiusA, radiusB, capped ?? false);\n }\n\n /**\n * Create a circular cone from the typical parameters of the DGN file.\n * * This method calls [[createBaseAndTarget]] with normalized vectors, `vectorY` squared against `vectorX`, and\n * `radiusA` and `radiusB` scaled by the original length of `vectorX`.\n * * These restrictions allow the cone to be represented by an element in the DGN file.\n */\n public static createDgnCone(centerA: Point3d, centerB: Point3d, vectorX: Vector3d, vectorY: Vector3d, radiusA: number, radiusB: number, capped?: boolean): Cone | undefined {\n const rigidMatrix = Matrix3d.createRigidFromColumns(vectorX, vectorY, AxisOrder.XYZ);\n if (rigidMatrix) {\n const vectorXMag = vectorX.magnitude();\n return this.createBaseAndTarget(centerA, centerB, rigidMatrix.columnX(), rigidMatrix.columnY(), radiusA * vectorXMag, radiusB * vectorXMag, capped);\n }\n return undefined;\n }\n\n /** (Property accessor) Return the center point at the base plane */\n public getCenterA(): Point3d { return this._localToWorld.multiplyXYZ(0, 0, 0); }\n /** (Property accessor) */\n public getCenterB(): Point3d { return this._localToWorld.multiplyXYZ(0, 0, 1); }\n /** (Property accessor) Return the x vector in the local frame */\n public getVectorX(): Vector3d { return this._localToWorld.matrix.columnX(); }\n /** (Property accessor) Return the y vector in the local frame */\n public getVectorY(): Vector3d { return this._localToWorld.matrix.columnY(); }\n /** (Property accessor) return the radius at the base plane */\n public getRadiusA(): number { return this._radiusA; }\n /** (Property accessor) return the radius at the top plane */\n public getRadiusB(): number { return this._radiusB; }\n /** (Property accessor) return the larger of radiusA and radiusB */\n public getMaxRadius(): number { return this._maxRadius; }\n /** (Property accessor) return the radius at fraction `v` along the axis */\n public vFractionToRadius(v: number): number { return Geometry.interpolate(this._radiusA, v, this._radiusB); }\n /** (Property accessor) test if `other` is an instance of `Cone` */\n public isSameGeometryClass(other: any): boolean { return other instanceof Cone; }\n /** (Property accessor) Test for nearly equal coordinate data. */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof Cone) {\n if (this.capped !== other.capped) return false;\n if (!this._localToWorld.isAlmostEqualAllowZRotation(other._localToWorld)) return false;\n return Geometry.isSameCoordinate(this._radiusA, other._radiusA)\n && Geometry.isSameCoordinate(this._radiusB, other._radiusB);\n }\n return false;\n }\n /** Second step of double dispatch: call `handler.handleCone(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleCone(this);\n }\n\n /**\n * return strokes for a cross-section (elliptic arc) at specified fraction v along the axis.\n * * fixedStrokeCount takes priority over stroke options.\n * * The linestring is created by LineString3d.createForStrokes (fixedStrokeCount, options), which sets up property according to the options:\n * * optional fractions member\n * * optional uvParams. uvParams are installed as full-scale distance parameters.\n * * optional derivatives.\n * @param v fractional position along the cone axis\n * @param fixedStrokeCount optional stroke count.\n * @param options optional stroke options.\n */\n public strokeConstantVSection(v: number, fixedStrokeCount?: number, options?: StrokeOptions): LineString3d {\n let strokeCount = 16;\n if (fixedStrokeCount !== undefined)\n strokeCount = fixedStrokeCount;\n else if (options !== undefined)\n strokeCount = options.defaultCircleStrokes; // NEEDS WORK -- get circle stroke count with this.maxRadius !!!\n else {\n // accept the local default\n }\n strokeCount = Geometry.clampToStartEnd(strokeCount, 4, 64);\n const r = this.vFractionToRadius(v);\n const result = LineString3d.createForStrokes(fixedStrokeCount, options);\n const twoPi = Math.PI * 2.0;\n const deltaRadians = twoPi / strokeCount;\n let radians = 0;\n const fractions = result.fractions; // possibly undefined !!!\n const derivatives = result.packedDerivatives; // possibly undefined !!!\n const uvParams = result.packedUVParams; // possibly undefined !!\n const surfaceNormals = result.packedSurfaceNormals;\n const xyz = Point3d.create();\n const dXdu = Vector3d.create();\n const dXdv = Vector3d.create();\n const normal = Vector3d.create();\n const transform = this._localToWorld;\n let rc, rs, cc, ss;\n for (let i = 0; i <= strokeCount; i++) {\n if (i * 2 <= strokeCount)\n radians = i * deltaRadians;\n else\n radians = (i - strokeCount) * deltaRadians;\n cc = Math.cos(radians);\n ss = Math.sin(radians);\n rc = r * cc;\n rs = r * ss;\n\n transform.multiplyXYZ(rc, rs, v, xyz);\n result.addPoint(xyz);\n if (fractions)\n fractions.push(i / strokeCount);\n if (derivatives) {\n transform.matrix.multiplyXYZ(-rs * twoPi, rc * twoPi, 0.0, dXdu);\n derivatives.push(dXdu);\n }\n if (surfaceNormals) {\n // the along-hoop vector does not need to be scaled by radius -- just need the direction for a cross product.\n transform.matrix.multiplyXYZ(-ss, cc, 0.0, dXdu);\n transform.matrix.multiplyXYZ(0, 0, 1, dXdv);\n dXdu.unitCrossProduct(dXdv, normal);\n surfaceNormals.push(normal);\n }\n if (uvParams) {\n uvParams.pushXY(i / strokeCount, v);\n }\n }\n return result;\n }\n /**\n * Return the Arc3d section at vFraction\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const r = this.vFractionToRadius(vFraction);\n const transform = this._localToWorld;\n const center = transform.multiplyXYZ(0, 0, vFraction);\n const vector0 = transform.matrix.multiplyXYZ(r, 0, 0);\n const vector90 = transform.matrix.multiplyXYZ(0, r, 0);\n return Loop.create(Arc3d.create(center, vector0, vector90));\n }\n /** Extend `rangeToExtend` so it includes this `Cone` instance. */\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\n const arc0 = this.constantVSection(0.0)!;\n const arc1 = this.constantVSection(1.0)!;\n arc0.extendRange(rangeToExtend, transform);\n arc1.extendRange(rangeToExtend, transform);\n }\n /** Evaluate a point on the Cone surfaces, with\n * * v = 0 is the base plane.\n * * v = 1 is the top plane\n * * u = 0 to u = 1 wraps the angular range.\n */\n public uvFractionToPoint(uFraction: number, vFraction: number, result?: Point3d): Point3d {\n const theta = uFraction * Math.PI * 2.0;\n const r = Geometry.interpolate(this._radiusA, vFraction, this._radiusB);\n const cosTheta = Math.cos(theta);\n const sinTheta = Math.sin(theta);\n return this._localToWorld.multiplyXYZ(r * cosTheta, r * sinTheta, vFraction, result);\n }\n /** Evaluate a point tangent plane on the Cone surfaces, with\n * * v = 0 is the base plane.\n * * v = 1 is the top plane\n * * u = 0 to u = 1 wraps the angular range.\n */\n public uvFractionToPointAndTangents(uFraction: number, vFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\n const theta = uFraction * Math.PI * 2.0;\n const r = Geometry.interpolate(this._radiusA, vFraction, this._radiusB);\n const drdv = this._radiusB - this._radiusA;\n const cosTheta = Math.cos(theta);\n const sinTheta = Math.sin(theta);\n const fTheta = 2.0 * Math.PI;\n return Plane3dByOriginAndVectors.createOriginAndVectors(\n this._localToWorld.multiplyXYZ(r * cosTheta, r * sinTheta, vFraction),\n this._localToWorld.multiplyVectorXYZ(-r * sinTheta * fTheta, r * cosTheta * fTheta, 0),\n this._localToWorld.multiplyVectorXYZ(drdv * cosTheta, drdv * sinTheta, 1.0),\n result);\n }\n /**\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n return this.capped;\n }\n /**\n * Directional distance query\n * * u direction is around longitude circle at maximum distance from axis.\n * * v direction is on a line of longitude between the latitude limits.\n */\n public maxIsoParametricDistance(): Vector2d {\n const vectorX = this._localToWorld.matrix.columnX();\n const vectorY = this._localToWorld.matrix.columnY();\n const columnZ = this._localToWorld.matrix.columnZ();\n\n const xyNormal = vectorX.unitCrossProduct(vectorY)!;\n const hZ = xyNormal.dotProduct(columnZ);\n const zSkewVector = columnZ.plusScaled(xyNormal, hZ);\n const zSkewDistance = zSkewVector.magnitudeXY();\n return Vector2d.create(Math.PI * 2 * Math.max(this._radiusA, this._radiusB),\n Geometry.hypotenuseXY(Math.abs(this._radiusB - this._radiusA) + zSkewDistance, hZ));\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinearSweep.d.ts","sourceRoot":"","sources":["../../../src/solid/LinearSweep.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,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,GAAG,OAAO;IAQ5D,8DAA8D;IACvD,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;IAG/D;;;OAGG;IACI,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAMvE,uDAAuD;IAChD,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS;IAahE;;OAEG;IACH,IAAW,cAAc,IAAI,OAAO,CAEnC;CACF"}
|
|
@@ -82,11 +82,16 @@ class LinearSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
82
82
|
tryTransformInPlace(transform) {
|
|
83
83
|
if (transform.matrix.isSingular())
|
|
84
84
|
return false;
|
|
85
|
-
if (this._contour.tryTransformInPlace(transform))
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
if (!this._contour.tryTransformInPlace(transform))
|
|
86
|
+
return false;
|
|
87
|
+
transform.multiplyVector(this._direction, this._direction);
|
|
88
|
+
if (transform.matrix.determinant() < 0.0) {
|
|
89
|
+
// if mirror, reverse the sweep (origin and direction) to preserve outward normals
|
|
90
|
+
if (!this._contour.tryTransformInPlace(Transform_1.Transform.createTranslation(this._direction)))
|
|
91
|
+
return false;
|
|
92
|
+
this._direction.scaleInPlace(-1.0);
|
|
88
93
|
}
|
|
89
|
-
return
|
|
94
|
+
return true;
|
|
90
95
|
}
|
|
91
96
|
/** Return a coordinate frame (right handed unit vectors)
|
|
92
97
|
* * origin on base contour
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinearSweep.js","sourceRoot":"","sources":["../../../src/solid/LinearSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAS/F,wDAAqD;AACrD,wCAAqC;AACrC,wCAAqC;AAErC,mEAAyD;AACzD,yDAAsD;AAEtD,uDAAoD;AAEpD,qDAAkD;AAClD,iDAA8C;AAE9C;;;;;GAKG;AACH,MAAa,WAAY,SAAQ,+BAAc;IAC7C,wCAAwC;IACxB,kBAAk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G,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC7C,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChD,CAAC;QACD,aAAa,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;IAC7D,CAAC;CACF;AAnID,kCAmIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { AnyCurve } from \"../curve/CurveTypes\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { Path } from \"../curve/Path\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { XAndY } from \"../geometry3d/XYZProps\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\nimport { SweepContour } from \"./SweepContour\";\n\n/**\n * A LinearSweep is a `SolidPrimitive` defined by:\n * * A set of curves (any Loop, Path, or parityRegion). If the object is \"capped\", the curves must be planar.\n * * A sweep vector\n * @public\n */\nexport class LinearSweep extends SolidPrimitive {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"linearSweep\";\n\n private _contour: SweepContour;\n private _direction: Vector3d;\n\n private constructor(contour: SweepContour, direction: Vector3d, capped: boolean) {\n super(capped);\n this._contour = contour;\n this._direction = direction;\n }\n /**\n * Create a sweep of a starting contour.\n * @param contour contour to be swept, CAPTURED\n * @param direction sweep vector. The contour is swept the full length of the vector.\n * @param capped true to include end caps\n */\n public static create(contour: AnyCurve, direction: Vector3d, capped: boolean): LinearSweep | undefined {\n const sweepable = SweepContour.createForLinearSweep(contour, direction);\n if (!sweepable)\n return undefined;\n return new LinearSweep(sweepable, direction, capped);\n }\n /** Create a z-direction sweep of the polyline or polygon given as xy linestring values.\n * * If not capped, the xyPoints array is always used unchanged.\n * * If capped but the xyPoints array does not close, exact closure will be enforced by one of these:\n * * * If the final point is almost equal to the first, it is replaced by the exact first point.\n * * * if the final point is not close to the first an extra point is added.\n * * If capped, the point order will be reversed if necessary to produce positive volume.\n * @param xyPoints array of xy coordinates\n * @param z z value to be used for all coordinates\n * @param zSweep the sweep distance in the z direction.\n * @param capped true if caps are to be added.\n */\n public static createZSweep(xyPoints: XAndY[], z: number, zSweep: number, capped: boolean): LinearSweep | undefined {\n const xyz = LineString3d.createXY(xyPoints, z, capped);\n if (capped) {\n xyz.addClosurePoint();\n const area = PolygonOps.areaXY(xyz.points);\n if (area * zSweep < 0.0)\n xyz.points.reverse();\n }\n const contour: CurveCollection = capped ? Loop.create(xyz) : Path.create(xyz);\n return LinearSweep.create(contour, Vector3d.create(0, 0, zSweep), capped);\n }\n /** get a reference to the swept curves */\n public getCurvesRef(): CurveCollection { return this._contour.curves; }\n /** Get a reference to the `SweepContour` carrying the plane of the curves */\n public getSweepContourRef(): SweepContour { return this._contour; }\n /** return a clone of the sweep vector */\n public cloneSweepVector(): Vector3d { return this._direction.clone(); }\n /** Test if `other` is also an instance of `LinearSweep` */\n public isSameGeometryClass(other: any): boolean { return other instanceof LinearSweep; }\n /** Return a deep clone */\n public clone(): LinearSweep {\n return new LinearSweep(this._contour.clone(), this._direction.clone(), this.capped);\n }\n /**\n * Apply a transform to the curves and sweep vector\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n if (this._contour.tryTransformInPlace(transform)) {\n transform.multiplyVector(this._direction, this._direction);\n return true;\n }\n return false;\n }\n\n /** Return a coordinate frame (right handed unit vectors)\n * * origin on base contour\n * * x, y directions from base contour.\n * * z direction perpendicular\n */\n public getConstructiveFrame(): Transform | undefined {\n return this._contour.localToWorld.cloneRigid();\n }\n /**\n * Return a transformed clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): LinearSweep | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /** Test for near-equality of coordinates in `other` */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof LinearSweep) {\n return this._contour.isAlmostEqual(other._contour)\n && this._direction.isAlmostEqual(other._direction)\n && this.capped === other.capped;\n }\n return false;\n }\n /** Invoke strongly typed `handler.handleLinearSweep(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleLinearSweep(this);\n }\n /**\n * Return the curves at a fraction along the sweep direction.\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const section = this._contour.curves.clone();\n if (section && vFraction !== 0.0)\n section.tryTransformInPlace(Transform.createTranslation(this._direction.scale(vFraction)));\n return section;\n }\n /** Extend `rangeToExtend` to include this geometry. */\n public extendRange(rangeToExtend: Range3d, transform?: Transform) {\n const contourRange = this._contour.curves.range(transform);\n rangeToExtend.extendRange(contourRange);\n if (transform) {\n const transformedDirection = transform.multiplyVector(this._direction);\n contourRange.low.addInPlace(transformedDirection);\n contourRange.high.addInPlace(transformedDirection);\n } else {\n contourRange.low.addInPlace(this._direction);\n contourRange.high.addInPlace(this._direction);\n }\n rangeToExtend.extendRange(contourRange);\n }\n /**\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n return this.capped && this._contour.curves.isAnyRegionType;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LinearSweep.js","sourceRoot":"","sources":["../../../src/solid/LinearSweep.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AAC,CAAC;QAC7F,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,uDAAuD;IAChD,WAAW,CAAC,aAAsB,EAAE,SAAqB;QAC9D,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC3D,aAAa,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QACxC,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,oBAAoB,GAAG,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACvE,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;YAClD,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC7C,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChD,CAAC;QACD,aAAa,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;IAC7D,CAAC;CACF;AAxID,kCAwIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { AnyCurve } from \"../curve/CurveTypes\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { Path } from \"../curve/Path\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { XAndY } from \"../geometry3d/XYZProps\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\nimport { SweepContour } from \"./SweepContour\";\n\n/**\n * A LinearSweep is a `SolidPrimitive` defined by:\n * * A set of curves (any Loop, Path, or parityRegion). If the object is \"capped\", the curves must be planar.\n * * A sweep vector\n * @public\n */\nexport class LinearSweep extends SolidPrimitive {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"linearSweep\";\n\n private _contour: SweepContour;\n private _direction: Vector3d;\n\n private constructor(contour: SweepContour, direction: Vector3d, capped: boolean) {\n super(capped);\n this._contour = contour;\n this._direction = direction;\n }\n /**\n * Create a sweep of a starting contour.\n * @param contour contour to be swept, CAPTURED\n * @param direction sweep vector. The contour is swept the full length of the vector.\n * @param capped true to include end caps\n */\n public static create(contour: AnyCurve, direction: Vector3d, capped: boolean): LinearSweep | undefined {\n const sweepable = SweepContour.createForLinearSweep(contour, direction);\n if (!sweepable)\n return undefined;\n return new LinearSweep(sweepable, direction, capped);\n }\n /** Create a z-direction sweep of the polyline or polygon given as xy linestring values.\n * * If not capped, the xyPoints array is always used unchanged.\n * * If capped but the xyPoints array does not close, exact closure will be enforced by one of these:\n * * * If the final point is almost equal to the first, it is replaced by the exact first point.\n * * * if the final point is not close to the first an extra point is added.\n * * If capped, the point order will be reversed if necessary to produce positive volume.\n * @param xyPoints array of xy coordinates\n * @param z z value to be used for all coordinates\n * @param zSweep the sweep distance in the z direction.\n * @param capped true if caps are to be added.\n */\n public static createZSweep(xyPoints: XAndY[], z: number, zSweep: number, capped: boolean): LinearSweep | undefined {\n const xyz = LineString3d.createXY(xyPoints, z, capped);\n if (capped) {\n xyz.addClosurePoint();\n const area = PolygonOps.areaXY(xyz.points);\n if (area * zSweep < 0.0)\n xyz.points.reverse();\n }\n const contour: CurveCollection = capped ? Loop.create(xyz) : Path.create(xyz);\n return LinearSweep.create(contour, Vector3d.create(0, 0, zSweep), capped);\n }\n /** get a reference to the swept curves */\n public getCurvesRef(): CurveCollection { return this._contour.curves; }\n /** Get a reference to the `SweepContour` carrying the plane of the curves */\n public getSweepContourRef(): SweepContour { return this._contour; }\n /** return a clone of the sweep vector */\n public cloneSweepVector(): Vector3d { return this._direction.clone(); }\n /** Test if `other` is also an instance of `LinearSweep` */\n public isSameGeometryClass(other: any): boolean { return other instanceof LinearSweep; }\n /** Return a deep clone */\n public clone(): LinearSweep {\n return new LinearSweep(this._contour.clone(), this._direction.clone(), this.capped);\n }\n /**\n * Apply a transform to the curves and sweep vector\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n if (!this._contour.tryTransformInPlace(transform))\n return false;\n transform.multiplyVector(this._direction, this._direction);\n if (transform.matrix.determinant() < 0.0) {\n // if mirror, reverse the sweep (origin and direction) to preserve outward normals\n if (!this._contour.tryTransformInPlace(Transform.createTranslation(this._direction)))\n return false;\n this._direction.scaleInPlace(-1.0);\n }\n return true;\n }\n\n /** Return a coordinate frame (right handed unit vectors)\n * * origin on base contour\n * * x, y directions from base contour.\n * * z direction perpendicular\n */\n public getConstructiveFrame(): Transform | undefined {\n return this._contour.localToWorld.cloneRigid();\n }\n /**\n * Return a transformed clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): LinearSweep | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /** Test for near-equality of coordinates in `other` */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof LinearSweep) {\n return this._contour.isAlmostEqual(other._contour)\n && this._direction.isAlmostEqual(other._direction)\n && this.capped === other.capped;\n }\n return false;\n }\n /** Invoke strongly typed `handler.handleLinearSweep(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleLinearSweep(this);\n }\n /**\n * Return the curves at a fraction along the sweep direction.\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const section = this._contour.curves.clone();\n if (section && vFraction !== 0.0)\n section.tryTransformInPlace(Transform.createTranslation(this._direction.scale(vFraction)));\n return section;\n }\n /** Extend `rangeToExtend` to include this geometry. */\n public extendRange(rangeToExtend: Range3d, transform?: Transform) {\n const contourRange = this._contour.curves.range(transform);\n rangeToExtend.extendRange(contourRange);\n if (transform) {\n const transformedDirection = transform.multiplyVector(this._direction);\n contourRange.low.addInPlace(transformedDirection);\n contourRange.high.addInPlace(transformedDirection);\n } else {\n contourRange.low.addInPlace(this._direction);\n contourRange.high.addInPlace(this._direction);\n }\n rangeToExtend.extendRange(contourRange);\n }\n /**\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n return this.capped && this._contour.curves.isAnyRegionType;\n }\n}\n"]}
|
|
@@ -15,7 +15,7 @@ import { SweepContour } from "./SweepContour";
|
|
|
15
15
|
export type CurvePrimitiveMutator = (primitiveA: CurvePrimitive, primitiveB: CurvePrimitive) => CurvePrimitive | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* A ruled sweep (surface) is a collection of 2 or more contours.
|
|
18
|
-
* * All contours must have identical number and type of geometry
|
|
18
|
+
* * All contours must have identical number and type of geometry: (paths, loops, parity regions, lines, arcs, other curves).
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
21
|
export declare class RuledSweep extends SolidPrimitive {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuledSweep.d.ts","sourceRoot":"","sources":["../../../src/solid/RuledSweep.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAc,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAA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AS;IAwBvE,0CAA0C;IACnC,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI;IAKvE;;;;OAIG;WACW,cAAc,CAC1B,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,qBAAqB,GAClG,eAAe,GAAG,SAAS;IA6C9B;;OAEG;IACH,IAAW,cAAc,IAAI,OAAO,CAGnC;CACF"}
|
|
@@ -16,7 +16,7 @@ const SolidPrimitive_1 = require("./SolidPrimitive");
|
|
|
16
16
|
const SweepContour_1 = require("./SweepContour");
|
|
17
17
|
/**
|
|
18
18
|
* A ruled sweep (surface) is a collection of 2 or more contours.
|
|
19
|
-
* * All contours must have identical number and type of geometry
|
|
19
|
+
* * All contours must have identical number and type of geometry: (paths, loops, parity regions, lines, arcs, other curves).
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
22
|
class RuledSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
@@ -82,6 +82,10 @@ class RuledSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
82
82
|
if (!contour.tryTransformInPlace(transform))
|
|
83
83
|
return false;
|
|
84
84
|
}
|
|
85
|
+
if (transform.matrix.determinant() < 0.0) {
|
|
86
|
+
// if mirror, reverse the sweep order to preserve outward normals
|
|
87
|
+
this._contours.reverse();
|
|
88
|
+
}
|
|
85
89
|
return true;
|
|
86
90
|
}
|
|
87
91
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuledSweep.js","sourceRoot":"","sources":["../../../src/solid/RuledSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sFAAmF;AAEnF,8DAAuE;AACvE,4DAAyD;AAEzD,0CAAuC;AAIvC,qDAAkD;AAClD,iDAA8C;AAQ9C;;;;GAIG;AACH,MAAa,UAAW,SAAQ,+BAAc;IAC5C,yCAAyC;IACzB,kBAAkB,GAAG,YAAY,C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nB,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF;AAzMD,gCAyMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { ConstructCurveBetweenCurves } from \"../curve/ConstructCurveBetweenCurves\";\nimport { AnyCurve } from \"../curve/CurveTypes\";\nimport { CurveChain, CurveCollection } from \"../curve/CurveCollection\";\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { Geometry } from \"../Geometry\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\nimport { SweepContour } from \"./SweepContour\";\n\n/**\n * Type for a function argument taking 2 curves and returning another curve or failing with undefined.\n * * This is used (for instance) by `RuleSweep.mutatePartners`.\n * @public\n */\nexport type CurvePrimitiveMutator = (primitiveA: CurvePrimitive, primitiveB: CurvePrimitive) => CurvePrimitive | undefined;\n/**\n * A ruled sweep (surface) is a collection of 2 or more contours.\n * * All contours must have identical number and type of geometry. (paths, loops, parity regions, lines, arcs, other curves).\n * @public\n */\nexport class RuledSweep extends SolidPrimitive {\n /** String name for schema properties. */\n public readonly solidPrimitiveType = \"ruledSweep\";\n\n private _contours: SweepContour[];\n private constructor(contours: SweepContour[], capped: boolean) {\n super(capped);\n this._contours = contours;\n }\n /**\n * Create a ruled sweep from an array of contours.\n * * The contours are CAPTURED (not cloned).\n */\n public static create(contours: AnyCurve[], capped: boolean): RuledSweep | undefined {\n const sweepContours = [];\n for (const contour of contours) {\n const sweepable = SweepContour.createForLinearSweep(contour);\n if (sweepable === undefined)\n return undefined;\n sweepContours.push(sweepable);\n }\n return new RuledSweep(sweepContours, capped);\n }\n /** Return a reference to the array of SweepContour. */\n public sweepContoursRef(): SweepContour[] {\n return this._contours;\n }\n /**\n * Return clones of the sweep contours.\n * * See also [[cloneContours]], which returns the contours without their local coordinate system definitions.\n */\n public cloneSweepContours(): SweepContour[] {\n const result = [];\n for (const sweepable of this._contours) {\n result.push(sweepable.clone());\n }\n return result;\n }\n /**\n * Return clones of the sweep contours, each as a [[CurveCollection]].\n * * See also [[cloneSweepContours]], which returns the contours with their local coordinate system definitions.\n */\n public cloneContours(): CurveCollection[] {\n const result = [];\n for (const sweepable of this._contours) {\n result.push(sweepable.curves.clone());\n }\n return result;\n }\n /** Return a deep clone. */\n public clone(): RuledSweep {\n return new RuledSweep(this.cloneSweepContours(), this.capped);\n }\n /**\n * Transform all contours in place.\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n for (const contour of this._contours) {\n if (!contour.tryTransformInPlace(transform))\n return false;\n }\n return true;\n }\n /**\n * Return a transformed clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): RuledSweep | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /**\n * Return a coordinate frame (right handed unit vectors)\n * * origin on base contour.\n * * x, y directions from base contour.\n * * z direction perpendicular.\n */\n public getConstructiveFrame(): Transform | undefined {\n if (this._contours.length === 0)\n return undefined;\n return this._contours[0].localToWorld.cloneRigid();\n }\n /** Test if `other` is an instance of a `RuledSweep`. */\n public isSameGeometryClass(other: any): boolean {\n return other instanceof RuledSweep;\n }\n /** Test for near equality of two RuledSweeps. */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof RuledSweep) {\n if (this.capped !== other.capped)\n return false;\n if (this._contours.length !== other._contours.length)\n return false;\n for (let i = 0; i < this._contours.length; i++) {\n if (!this._contours[i].isAlmostEqual(other._contours[i]))\n return false;\n }\n return true;\n }\n return false;\n }\n /** Dispatch to strongly typed `handler.handleRuledSweep(this)`. */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleRuledSweep(this);\n }\n /**\n * Return the section curves at a fraction of the sweep.\n * @param vFraction fractional position along the sweep direction.\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const numSection = this._contours.length;\n if (numSection < 2)\n return undefined;\n const q = vFraction * numSection;\n let section0 = 0;\n if (vFraction >= 1.0)\n section0 = numSection - 1;\n else\n section0 = Math.floor(q);\n if (section0 + 1 >= numSection)\n section0 = numSection - 2;\n const section1 = section0 + 1;\n const localFraction = Geometry.clampToStartEnd(q - section0, 0, 1);\n return RuledSweep.mutatePartners(\n this._contours[section0].curves,\n this._contours[section1].curves,\n (primitive0: CurvePrimitive, primitive1: CurvePrimitive): CurvePrimitive | undefined => {\n const newPrimitive = ConstructCurveBetweenCurves.interpolateBetween(primitive0, localFraction, primitive1);\n if (newPrimitive instanceof CurvePrimitive) return newPrimitive;\n return undefined;\n },\n );\n }\n /** Pass each contour to `extendRange`. */\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\n for (const contour of this._contours)\n contour.curves.extendRange(rangeToExtend, transform);\n }\n\n /**\n * Construct a CurveCollection with the same structure as collectionA and collectionB, with primitives constructed\n * by the caller-supplied primitiveMutator function.\n * @returns Returns undefined if there is any type mismatch between the two collections.\n */\n public static mutatePartners(\n collectionA: CurveCollection, collectionB: CurveCollection, primitiveMutator: CurvePrimitiveMutator,\n ): CurveCollection | undefined {\n if (!collectionA.isSameGeometryClass(collectionB))\n return undefined;\n if (collectionA instanceof CurveChain && collectionB instanceof CurveChain) {\n const chainA = collectionA;\n const chainB = collectionB;\n const chainC = chainA.cloneEmptyPeer() as CurveChain;\n const childrenA = chainA.children;\n const childrenB = chainB.children;\n if (childrenA.length !== childrenB.length)\n return undefined;\n for (let i = 0; i < childrenA.length; i++) {\n const newChild = primitiveMutator(childrenA[i], childrenB[i]);\n if (!newChild)\n return undefined;\n chainC.children.push(newChild);\n }\n return chainC;\n } else if (collectionA instanceof CurveCollection && collectionB instanceof CurveCollection) {\n const collectionC = collectionA.cloneEmptyPeer();\n const childrenA = collectionA.children;\n const childrenB = collectionB.children;\n const childrenC = collectionC.children;\n if (childrenA === undefined || childrenB === undefined || childrenC === undefined || childrenA.length !== childrenB.length)\n return undefined;\n for (let i = 0; i < childrenA.length; i++) {\n const childA = childrenA[i];\n const childB = childrenB[i];\n if (childA instanceof CurvePrimitive && childB instanceof CurvePrimitive) {\n const newPrimitive = primitiveMutator(childA, childB);\n if (!newPrimitive)\n return undefined;\n childrenC.push(newPrimitive);\n } else if (childA instanceof CurveCollection && childB instanceof CurveCollection) {\n const newChild = this.mutatePartners(childA, childB, primitiveMutator);\n if (!newChild)\n return undefined;\n if (newChild instanceof CurveCollection)\n childrenC.push(newChild);\n }\n }\n return collectionC;\n }\n return undefined;\n }\n /**\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n const n = this._contours.length;\n return n > 1 && (this.capped || this._contours[0].isAlmostEqual(this._contours[n - 1]));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RuledSweep.js","sourceRoot":"","sources":["../../../src/solid/RuledSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sFAAmF;AAEnF,8DAAuE;AACvE,4DAAyD;AAEzD,0CAAuC;AAIvC,qDAAkD;AAClD,iDAA8C;AAQ9C;;;;GAIG;AACH,MAAa,UAAW,SAAQ,+BAAc;IAC5C,yCAAyC;IACzB,kBAAkB,GAAG,YAAY,CAAC;IAE1C,SAAS,CAAiB;IAClC,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AAI,CAAC,QAAQ,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC;YACD,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF;AA7MD,gCA6MC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { ConstructCurveBetweenCurves } from \"../curve/ConstructCurveBetweenCurves\";\nimport { AnyCurve } from \"../curve/CurveTypes\";\nimport { CurveChain, CurveCollection } from \"../curve/CurveCollection\";\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { Geometry } from \"../Geometry\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\nimport { SweepContour } from \"./SweepContour\";\n\n/**\n * Type for a function argument taking 2 curves and returning another curve or failing with undefined.\n * * This is used (for instance) by `RuleSweep.mutatePartners`.\n * @public\n */\nexport type CurvePrimitiveMutator = (primitiveA: CurvePrimitive, primitiveB: CurvePrimitive) => CurvePrimitive | undefined;\n/**\n * A ruled sweep (surface) is a collection of 2 or more contours.\n * * All contours must have identical number and type of geometry: (paths, loops, parity regions, lines, arcs, other curves).\n * @public\n */\nexport class RuledSweep extends SolidPrimitive {\n /** String name for schema properties. */\n public readonly solidPrimitiveType = \"ruledSweep\";\n\n private _contours: SweepContour[];\n private constructor(contours: SweepContour[], capped: boolean) {\n super(capped);\n this._contours = contours;\n }\n /**\n * Create a ruled sweep from an array of contours.\n * * The contours are CAPTURED (not cloned).\n */\n public static create(contours: AnyCurve[], capped: boolean): RuledSweep | undefined {\n const sweepContours = [];\n for (const contour of contours) {\n const sweepable = SweepContour.createForLinearSweep(contour);\n if (sweepable === undefined)\n return undefined;\n sweepContours.push(sweepable);\n }\n return new RuledSweep(sweepContours, capped);\n }\n /** Return a reference to the array of SweepContour. */\n public sweepContoursRef(): SweepContour[] {\n return this._contours;\n }\n /**\n * Return clones of the sweep contours.\n * * See also [[cloneContours]], which returns the contours without their local coordinate system definitions.\n */\n public cloneSweepContours(): SweepContour[] {\n const result = [];\n for (const sweepable of this._contours) {\n result.push(sweepable.clone());\n }\n return result;\n }\n /**\n * Return clones of the sweep contours, each as a [[CurveCollection]].\n * * See also [[cloneSweepContours]], which returns the contours with their local coordinate system definitions.\n */\n public cloneContours(): CurveCollection[] {\n const result = [];\n for (const sweepable of this._contours) {\n result.push(sweepable.curves.clone());\n }\n return result;\n }\n /** Return a deep clone. */\n public clone(): RuledSweep {\n return new RuledSweep(this.cloneSweepContours(), this.capped);\n }\n /**\n * Transform all contours in place.\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n for (const contour of this._contours) {\n if (!contour.tryTransformInPlace(transform))\n return false;\n }\n if (transform.matrix.determinant() < 0.0) {\n // if mirror, reverse the sweep order to preserve outward normals\n this._contours.reverse();\n }\n return true;\n }\n /**\n * Return a transformed clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): RuledSweep | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /**\n * Return a coordinate frame (right handed unit vectors)\n * * origin on base contour.\n * * x, y directions from base contour.\n * * z direction perpendicular.\n */\n public getConstructiveFrame(): Transform | undefined {\n if (this._contours.length === 0)\n return undefined;\n return this._contours[0].localToWorld.cloneRigid();\n }\n /** Test if `other` is an instance of a `RuledSweep`. */\n public isSameGeometryClass(other: any): boolean {\n return other instanceof RuledSweep;\n }\n /** Test for near equality of two RuledSweeps. */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof RuledSweep) {\n if (this.capped !== other.capped)\n return false;\n if (this._contours.length !== other._contours.length)\n return false;\n for (let i = 0; i < this._contours.length; i++) {\n if (!this._contours[i].isAlmostEqual(other._contours[i]))\n return false;\n }\n return true;\n }\n return false;\n }\n /** Dispatch to strongly typed `handler.handleRuledSweep(this)`. */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleRuledSweep(this);\n }\n /**\n * Return the section curves at a fraction of the sweep.\n * @param vFraction fractional position along the sweep direction.\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const numSection = this._contours.length;\n if (numSection < 2)\n return undefined;\n const q = vFraction * numSection;\n let section0 = 0;\n if (vFraction >= 1.0)\n section0 = numSection - 1;\n else\n section0 = Math.floor(q);\n if (section0 + 1 >= numSection)\n section0 = numSection - 2;\n const section1 = section0 + 1;\n const localFraction = Geometry.clampToStartEnd(q - section0, 0, 1);\n return RuledSweep.mutatePartners(\n this._contours[section0].curves,\n this._contours[section1].curves,\n (primitive0: CurvePrimitive, primitive1: CurvePrimitive): CurvePrimitive | undefined => {\n const newPrimitive = ConstructCurveBetweenCurves.interpolateBetween(primitive0, localFraction, primitive1);\n if (newPrimitive instanceof CurvePrimitive) return newPrimitive;\n return undefined;\n },\n );\n }\n /** Pass each contour to `extendRange`. */\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\n for (const contour of this._contours)\n contour.curves.extendRange(rangeToExtend, transform);\n }\n\n /**\n * Construct a CurveCollection with the same structure as collectionA and collectionB, with primitives constructed\n * by the caller-supplied primitiveMutator function.\n * @returns Returns undefined if there is any type mismatch between the two collections.\n */\n public static mutatePartners(\n collectionA: CurveCollection, collectionB: CurveCollection, primitiveMutator: CurvePrimitiveMutator,\n ): CurveCollection | undefined {\n if (!collectionA.isSameGeometryClass(collectionB))\n return undefined;\n if (collectionA instanceof CurveChain && collectionB instanceof CurveChain) {\n const chainA = collectionA;\n const chainB = collectionB;\n const chainC = chainA.cloneEmptyPeer() as CurveChain;\n const childrenA = chainA.children;\n const childrenB = chainB.children;\n if (childrenA.length !== childrenB.length)\n return undefined;\n for (let i = 0; i < childrenA.length; i++) {\n const newChild = primitiveMutator(childrenA[i], childrenB[i]);\n if (!newChild)\n return undefined;\n chainC.children.push(newChild);\n }\n return chainC;\n } else if (collectionA instanceof CurveCollection && collectionB instanceof CurveCollection) {\n const collectionC = collectionA.cloneEmptyPeer();\n const childrenA = collectionA.children;\n const childrenB = collectionB.children;\n const childrenC = collectionC.children;\n if (childrenA === undefined || childrenB === undefined || childrenC === undefined || childrenA.length !== childrenB.length)\n return undefined;\n for (let i = 0; i < childrenA.length; i++) {\n const childA = childrenA[i];\n const childB = childrenB[i];\n if (childA instanceof CurvePrimitive && childB instanceof CurvePrimitive) {\n const newPrimitive = primitiveMutator(childA, childB);\n if (!newPrimitive)\n return undefined;\n childrenC.push(newPrimitive);\n } else if (childA instanceof CurveCollection && childB instanceof CurveCollection) {\n const newChild = this.mutatePartners(childA, childB, primitiveMutator);\n if (!newChild)\n return undefined;\n if (newChild instanceof CurveCollection)\n childrenC.push(newChild);\n }\n }\n return collectionC;\n }\n return undefined;\n }\n /**\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n const n = this._contours.length;\n return n > 1 && (this.capped || this._contours[0].isAlmostEqual(this._contours[n - 1]));\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sphere.d.ts","sourceRoot":"","sources":["../../../src/solid/Sphere.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,KAAK,EA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,IAAI,SAAS;IAGrC,oCAAoC;IAC7B,mBAAmB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IAC/C,wCAAwC;IACxB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAQ5D;;;;;;;;;;;OAWG;IACI,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,YAAY;IAqD1G,yEAAyE;IAClE,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;IAI/D;;;OAGG;IACI,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK;IAWjD;;;OAGG;IACI,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAUhD,6CAA6C;IACtC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI;IAiB/D;;;OAGG;IACI,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAUzF;;;OAGG;IACI,4BAA4B,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,yBAAyB,GAAG,yBAAyB;IAexI;;;;;OAKG;IACH,IAAW,cAAc,IAAI,OAAO,CAEnC;IACD;;;;OAIG;IACI,wBAAwB,IAAI,QAAQ;CAa5C"}
|
package/lib/cjs/solid/Sphere.js
CHANGED
|
@@ -63,8 +63,11 @@ class Sphere extends SolidPrimitive_1.SolidPrimitive {
|
|
|
63
63
|
if (transform.matrix.isSingular())
|
|
64
64
|
return false;
|
|
65
65
|
transform.multiplyTransformTransform(this._localToWorld, this._localToWorld);
|
|
66
|
-
if (transform.matrix.determinant() < 0.0)
|
|
67
|
-
|
|
66
|
+
if (transform.matrix.determinant() < 0.0) {
|
|
67
|
+
// if mirror, reverse z-axis to preserve outward normals
|
|
68
|
+
this._localToWorld.matrix.scaleColumnsInPlace(1, 1, -1);
|
|
69
|
+
this._latitudeSweep.setStartEndRadians(-this._latitudeSweep.endRadians, -this._latitudeSweep.startRadians);
|
|
70
|
+
}
|
|
68
71
|
return true;
|
|
69
72
|
}
|
|
70
73
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sphere.js","sourceRoot":"","sources":["../../../src/solid/Sphere.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AAEvC,wDAAqD;AACrD,wCAAqC;AACrC,0DAAuD;AACvD,0CAAkD;AAClD,+CAA4C;AAC5C,yDAAsD;AAEtD,qDAAkD;AAClD,uFAAoF;AACpF,mEAAyD;AACzD,mEAAkE;AAElE,uDAAoD;AACpD,qDAAkD;AAElD;;;;;;;;;GASG;AACH,MAAa,MAAO,SAAQ,+BAAc;IACxC,wCAAwC;IACxB,kBAAkB,GAAG,QAAQ,CAAC;IAEtC,aAAa,CAAY,CAAE,4CAA4C;IACvE,cAAc,CAAa;IACnC,yDAAyD;IAClD,kBAAkB,CAAC,CAAS;QACjC,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,0DAA0D;IACnD,kBAAkB,CAAC,CAAS;QACjC,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;IAC3B,CAAC;IAED,kCAAkC;IAClC,YAAoB,YAAuB,EAAE,aAAyB,EAAE,MAAe;QACrF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;IAC3C,CAAC;IACD,0BAA0B;IACnB,KAAK;QACV,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAA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,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QAE/E,OAAO,0BAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;CACF;AA1TD,wBA0TC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { AngleSweep } from \"../geometry3d/AngleSweep\";\nimport { GeometryHandler, UVSurface } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\n\n/**\n * A unit sphere mapped by an arbitrary [[Transform]].\n * * Typically, the stored matrix has orthogonal columns. In this case, if two columns have equal length, the\n * resulting geometry is ellipsoidal; if all three columns have equal length, the resulting geometry is a sphere.\n * * Creating a Sphere without orthogonal columns is possible but not recommended, for the resulting geometry\n * lacks portability; for example, such a Sphere cannot be represented as a DGN element (see [[createDgnSphere]]).\n * * An optional latitude sweep allows for partial spheres with or without caps.\n * * Compare to [[Ellipsoid]], which has the same parameterization, but acts as a closed [[Clipper]].\n * @public\n */\nexport class Sphere extends SolidPrimitive implements UVSurface {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"sphere\";\n\n private _localToWorld: Transform; // local coordinates = unit sphere at origin\n private _latitudeSweep: AngleSweep;\n /** Return the latitude (in radians) all fractional v. */\n public vFractionToRadians(v: number): number {\n return this._latitudeSweep.fractionToRadians(v);\n }\n /** Return the longitude (in radians) all fractional u. */\n public uFractionToRadians(u: number): number {\n return u * Math.PI * 2.0;\n }\n\n /** Constructor CAPTURES inputs */\n private constructor(localToWorld: Transform, latitudeSweep: AngleSweep, capped: boolean) {\n super(capped);\n this._localToWorld = localToWorld;\n this._latitudeSweep = latitudeSweep;\n this._latitudeSweep.capLatitudeInPlace();\n }\n /** return a deep clone */\n public clone(): Sphere {\n return new Sphere(this._localToWorld.clone(), this._latitudeSweep.clone(), this.capped);\n }\n /**\n * Transform the sphere in place.\n * * Fails if the transform is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n transform.multiplyTransformTransform(this._localToWorld, this._localToWorld);\n if (transform.matrix.determinant() < 0.0)\n this._latitudeSweep.reverseInPlace();\n return true;\n }\n /**\n * Return a transformed clone.\n * * Fails if the transform is singular.\n */\n public cloneTransformed(transform: Transform): Sphere | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /**\n * Construct a rigid coordinate frame from the local coordinate frame.\n * * The returned frame is right-handed, with perpendicular unit axes.\n * * Compare to [[cloneLocalToWorld]].\n */\n public getConstructiveFrame(): Transform | undefined {\n return this._localToWorld.cloneRigid();\n }\n /** Return the latitude sweep as fraction of south pole to north pole. */\n public get latitudeSweepFraction(): number { return this._latitudeSweep.sweepRadians / Math.PI; }\n /** Create from center and radius, with optional restricted latitudes. */\n public static createCenterRadius(center: Point3d, radius: number, latitudeSweep?: AngleSweep, capped?: boolean): Sphere {\n const localToWorld = Transform.createOriginAndMatrix(center, Matrix3d.createUniformScale(radius));\n return new Sphere(localToWorld, latitudeSweep ? latitudeSweep.clone() : AngleSweep.createFullLatitude(), capped ?? false);\n }\n /** Create an ellipsoid which is a unit sphere mapped to position by an (arbitrary, possibly skewed and scaled) transform. */\n public static createEllipsoid(localToWorld: Transform, latitudeSweep?: AngleSweep, capped?: boolean): Sphere | undefined {\n return new Sphere(localToWorld.clone(), latitudeSweep ? latitudeSweep.clone() : AngleSweep.createFullLatitude(), capped ?? false);\n }\n\n /**\n * Create a sphere from the typical parameters of the DGN file.\n * * This method normalizes the input vectors, squares `vectorX` against `vectorZ`, and scales the radii by the vectors' original lengths.\n * * These restrictions allow the sphere to be represented by an element in the DGN file.\n */\n public static createDgnSphere(center: Point3d, vectorX: Vector3d, vectorZ: Vector3d, radiusXY: number, radiusZ: number, latitudeSweep?: AngleSweep, capped?: boolean): Sphere | undefined {\n const rigidMatrix = Matrix3d.createRigidFromColumns(vectorZ, vectorX, AxisOrder.ZXY);\n if (rigidMatrix) {\n radiusXY *= vectorX.magnitude();\n rigidMatrix.scaleColumns(radiusXY, radiusXY, radiusZ * vectorZ.magnitude(), rigidMatrix);\n const frame = Transform.createOriginAndMatrix(center, rigidMatrix);\n return new Sphere(frame, latitudeSweep ? latitudeSweep.clone() : AngleSweep.createFullLatitude(), capped ?? false);\n }\n return undefined;\n }\n\n /**\n * Create a sphere.\n * * If `axes` is supplied, its columns are scaled by the radii to form the sphere's local frame.\n */\n public static createFromAxesAndScales(center: Point3d, axes: undefined | Matrix3d, radiusX: number, radiusY: number, radiusZ: number,\n latitudeSweep?: AngleSweep,\n capped?: boolean): Sphere | undefined {\n const localToWorld = Transform.createOriginAndMatrix(center, axes);\n localToWorld.matrix.scaleColumnsInPlace(radiusX, radiusY, radiusZ);\n return new Sphere(localToWorld, latitudeSweep ? latitudeSweep.clone() : AngleSweep.createFullLatitude(), capped ?? false);\n }\n\n /** return (copy of) sphere center */\n public cloneCenter(): Point3d { return this._localToWorld.getOrigin(); }\n /** return the (full length, i.e. scaled by radius) X vector from the sphere transform */\n public cloneVectorX(): Vector3d { return this._localToWorld.matrix.columnX(); }\n /** return the (full length, i.e. scaled by radius) Y vector from the sphere transform */\n public cloneVectorY(): Vector3d { return this._localToWorld.matrix.columnY(); }\n /** return the (full length, i.e. scaled by radius) Z vector from the sphere transform */\n public cloneVectorZ(): Vector3d { return this._localToWorld.matrix.columnZ(); }\n /** return (a copy of) the sphere's angle sweep. */\n public cloneLatitudeSweep(): AngleSweep { return this._latitudeSweep.clone(); }\n /** Test if the geometry is a true sphere taking the transform (which might have nonuniform scaling) is applied. */\n public trueSphereRadius(): number | undefined {\n const factors = this._localToWorld.matrix.factorRigidWithSignedScale();\n if (!factors) return undefined;\n if (factors && factors.scale > 0) // why do we rule out mirror?\n return factors.scale;\n return undefined;\n }\n /**\n * Return the largest of the primary xyz axis radii\n */\n public maxAxisRadius(): number {\n const matrix = this._localToWorld.matrix;\n return Geometry.maxXYZ(matrix.columnXMagnitude(), matrix.columnYMagnitude(), matrix.columnZMagnitude());\n }\n /**\n * Return a (clone of) the sphere's local to world transformation.\n * * Compare to [[getConstructiveFrame]].\n */\n public cloneLocalToWorld(): Transform {\n return this._localToWorld.clone();\n }\n /** Test if `other` is a `Sphere` */\n public isSameGeometryClass(other: any): boolean { return other instanceof Sphere; }\n /** Test for same geometry in `other` */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof Sphere) {\n if (this.capped !== other.capped) return false;\n if (!this._localToWorld.isAlmostEqual(other._localToWorld)) return false;\n return true;\n }\n return false;\n }\n /**\n * Return strokes for the elliptical arc cross-section at latitude sweep fraction v.\n * * Optional inputs control the number of strokes along the cross-section:\n * * If `fixedStrokeCount` is supplied, it is taken as the cross-section stroke count.\n * * If `fixedStrokeCount` is undefined, stroke count is computed by applying `options` to the cross-section.\n * * If neither input is supplied, the stroke count default is 16.\n * * In any case, stroke count is clamped to the interval [4,64].\n * @param v fractional position along the sphere axis\n * @param fixedStrokeCount optional stroke count in u-direction\n * @param options optional stroke options in u-direction\n * @return strokes as line string\n */\n public strokeConstantVSection(v: number, fixedStrokeCount?: number, options?: StrokeOptions): LineString3d {\n let strokeCount = 16;\n if (fixedStrokeCount !== undefined && Number.isFinite(fixedStrokeCount)) {\n strokeCount = fixedStrokeCount;\n } else if (options instanceof StrokeOptions) {\n strokeCount = options.applyTolerancesToArc(Geometry.maxXY(this._localToWorld.matrix.columnXMagnitude(), this._localToWorld.matrix.columnYMagnitude()));\n }\n strokeCount = Geometry.clampToStartEnd(strokeCount, 4, 64);\n const transform = this._localToWorld;\n const phi = this.vFractionToRadians(v);\n const c1 = Math.cos(phi);\n const s1 = Math.sin(phi);\n let c0, s0;\n const result = LineString3d.createForStrokes(strokeCount, options);\n const deltaRadians = Math.PI * 2.0 / strokeCount;\n const fractions = result.fractions; // possibly undefined !!!\n const derivatives = result.packedDerivatives; // possibly undefined !!!\n const uvParams = result.packedUVParams; // possibly undefined !!\n const surfaceNormals = result.packedSurfaceNormals;\n const dXdu = Vector3d.create();\n const dXdv = Vector3d.create();\n const normal = Vector3d.create();\n let radians = 0;\n for (let i = 0; i <= strokeCount; i++) {\n if (i * 2 <= strokeCount)\n radians = i * deltaRadians;\n else\n radians = (i - strokeCount) * deltaRadians;\n c0 = Math.cos(radians);\n s0 = Math.sin(radians);\n const xyz = transform.multiplyXYZ(c1 * c0, c1 * s0, s1);\n result.addPoint(xyz);\n\n if (fractions)\n fractions.push(i / strokeCount);\n\n if (derivatives) {\n transform.matrix.multiplyXYZ(-c1 * s0, c1 * c0, 0.0, dXdu);\n derivatives.push(dXdu);\n }\n if (uvParams) {\n uvParams.pushXY(i / strokeCount, v);\n }\n if (surfaceNormals) {\n transform.matrix.multiplyXYZ(-s0, c0, 0, dXdu);\n transform.matrix.multiplyXYZ(-s1 * c0, -s1 * s0, c1, dXdv);\n dXdu.unitCrossProduct(dXdv, normal);\n surfaceNormals.push(normal);\n }\n }\n return result;\n }\n\n /** Second step of double dispatch: call `handler.handleSphere(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleSphere(this);\n }\n\n /**\n * Return the Arc3d section at uFraction. For the sphere, this is a meridian arc.\n * @param uFraction fractional position along the equator.\n */\n public constantUSection(uFraction: number): Arc3d {\n const phi = AngleSweep.fractionToSignedPeriodicFractionStartEnd(uFraction, 0, Angle.pi2Radians, false);\n const s1 = Math.sin(phi);\n const c1 = Math.cos(phi);\n const transform = this._localToWorld;\n const center = transform.getOrigin();\n const vector0 = transform.matrix.multiplyXYZ(c1, s1, 0);\n const vector90 = transform.matrix.multiplyXYZ(0, 0, 1);\n return Arc3d.create(center, vector0, vector90, this._latitudeSweep);\n }\n\n /**\n * Return the Arc3d section at vFraction. For the sphere, this is a latitude circle.\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): Loop {\n const phi = this._latitudeSweep.fractionToRadians(vFraction);\n const s1 = Math.sin(phi);\n const c1 = Math.cos(phi);\n const transform = this._localToWorld;\n const center = transform.multiplyXYZ(0, 0, s1);\n const vector0 = transform.matrix.multiplyXYZ(c1, 0, 0);\n const vector90 = transform.matrix.multiplyXYZ(0, c1, 0);\n return Loop.create(Arc3d.create(center, vector0, vector90));\n }\n /** Extend a range to contain this sphere. */\n public extendRange(range: Range3d, transform?: Transform): void {\n let placement = this._localToWorld;\n if (transform) {\n placement = transform.multiplyTransformTransform(placement);\n }\n\n range.extendTransformedXYZ(placement, -1, -1, -1);\n range.extendTransformedXYZ(placement, 1, -1, -1);\n range.extendTransformedXYZ(placement, -1, 1, -1);\n range.extendTransformedXYZ(placement, 1, 1, -1);\n\n range.extendTransformedXYZ(placement, -1, -1, 1);\n range.extendTransformedXYZ(placement, 1, -1, 1);\n range.extendTransformedXYZ(placement, -1, 1, 1);\n range.extendTransformedXYZ(placement, 1, 1, 1);\n\n }\n /** Evaluate as a uv surface\n * @param uFraction fractional position on minor arc (theta, longitude)\n * @param vFraction fractional position on major arc (phi, latitude)\n */\n public uvFractionToPoint(uFraction: number, vFraction: number, result?: Point3d): Point3d {\n // sphere with radius 1 . . .\n const thetaRadians = this.uFractionToRadians(uFraction);\n const phiRadians = this.vFractionToRadians(vFraction);\n const cosTheta = Math.cos(thetaRadians);\n const sinTheta = Math.sin(thetaRadians);\n const sinPhi = Math.sin(phiRadians);\n const cosPhi = Math.cos(phiRadians);\n return this._localToWorld.multiplyXYZ(cosTheta * cosPhi, sinTheta * cosPhi, sinPhi, result);\n }\n /** Evaluate as a uv surface, returning point and two vectors.\n * @param uFraction fractional position on minor arc (theta, longitude)\n * @param vFraction fractional position on major arc (phi, latitude)\n */\n public uvFractionToPointAndTangents(uFraction: number, vFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\n const thetaRadians = this.uFractionToRadians(uFraction);\n const phiRadians = this.vFractionToRadians(vFraction);\n const fTheta = Math.PI * 2.0;\n const fPhi = this._latitudeSweep.sweepRadians;\n const cosTheta = Math.cos(thetaRadians);\n const sinTheta = Math.sin(thetaRadians);\n const sinPhi = Math.sin(phiRadians);\n const cosPhi = Math.cos(phiRadians);\n return Plane3dByOriginAndVectors.createOriginAndVectors(\n this._localToWorld.multiplyXYZ(cosTheta * cosPhi, sinTheta * cosPhi, sinPhi),\n this._localToWorld.matrix.multiplyXYZ(-fTheta * sinTheta, fTheta * cosTheta, 0), // NOTE: cosPhi scale is omitted, so the u-derivative scale is wrong but at least at the poles it's nonzero\n this._localToWorld.matrix.multiplyXYZ(-fPhi * cosTheta * sinPhi, -fPhi * sinTheta * sinPhi, fPhi * cosPhi),\n result);\n }\n /**\n * * A sphere is can be closed two ways:\n * * full sphere (no caps needed for closure)\n * * incomplete but with caps\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n return this.capped || this._latitudeSweep.isFullLatitudeSweep;\n }\n /**\n * Directional distance query\n * * u direction is around latitude circle at maximum distance from axis.\n * * v direction is on a line of longitude between the latitude limits.\n */\n public maxIsoParametricDistance(): Vector2d {\n // approximate radius at equator .. if elliptic, this is not exact . . .\n const rX = this._localToWorld.matrix.columnXMagnitude();\n const rY = this._localToWorld.matrix.columnYMagnitude();\n const rZ = this._localToWorld.matrix.columnZMagnitude();\n const rMaxU = Math.max(rX, rY);\n let dMaxU = Math.PI * 2.0 * rMaxU;\n if (!this._latitudeSweep.isRadiansInSweep(0.0))\n dMaxU *= Math.max(Math.cos(Math.abs(this._latitudeSweep.startRadians)), Math.cos(Math.abs(this._latitudeSweep.endRadians)));\n const dMaxV = Math.max(rMaxU, rZ) * Math.abs(this._latitudeSweep.sweepRadians);\n\n return Vector2d.create(dMaxU, dMaxV);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Sphere.js","sourceRoot":"","sources":["../../../src/solid/Sphere.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AAEvC,wDAAqD;AACrD,wCAAqC;AACrC,0DAAuD;AACvD,0CAAkD;AAClD,+CAA4C;AAC5C,yDAAsD;AAEtD,qDAAkD;AAClD,uFAAoF;AACpF,mEAAyD;AACzD,mEAAkE;AAElE,uDAAoD;AACpD,qDAAkD;AAElD;;;;;;;;;GASG;AACH,MAAa,MAAO,SAAQ,+BAAc;IACxC,wCAAwC;IACxB,kBAAkB,GAAG,QAAQ,CAAC;IAEtC,aAAa,CAAY,CAAE,4CAA4C;IACvE,cAAc,CAAa;IACnC,yDAAyD;IAClD,kBAAkB,CAAC,CAAS;QACjC,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,0DAA0D;IACnD,kBAAkB,CAAC,CAAS;QACjC,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;IAC3B,CAAC;IAED,kCAAkC;IAClC,YAAoB,YAAuB,EAAE,aAAyB,EAAE,MAAe;QACrF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC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GAAG,GAAG,KAAK,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,GAAG,CAAC;YAC5C,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9H,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QAE/E,OAAO,0BAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;CACF;AA7TD,wBA6TC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { AngleSweep } from \"../geometry3d/AngleSweep\";\nimport { GeometryHandler, UVSurface } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\n\n/**\n * A unit sphere mapped by an arbitrary [[Transform]].\n * * Typically, the stored matrix has orthogonal columns. In this case, if two columns have equal length, the\n * resulting geometry is ellipsoidal; if all three columns have equal length, the resulting geometry is a sphere.\n * * Creating a Sphere without orthogonal columns is possible but not recommended, for the resulting geometry\n * lacks portability; for example, such a Sphere cannot be represented as a DGN element (see [[createDgnSphere]]).\n * * An optional latitude sweep allows for partial spheres with or without caps.\n * * Compare to [[Ellipsoid]], which has the same parameterization, but acts as a closed [[Clipper]].\n * @public\n */\nexport class Sphere extends SolidPrimitive implements UVSurface {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"sphere\";\n\n private _localToWorld: Transform; // local coordinates = unit sphere at origin\n private _latitudeSweep: AngleSweep;\n /** Return the latitude (in radians) all fractional v. */\n public vFractionToRadians(v: number): number {\n return this._latitudeSweep.fractionToRadians(v);\n }\n /** Return the longitude (in radians) all fractional u. */\n public uFractionToRadians(u: number): number {\n return u * Math.PI * 2.0;\n }\n\n /** Constructor CAPTURES inputs */\n private constructor(localToWorld: Transform, latitudeSweep: AngleSweep, capped: boolean) {\n super(capped);\n this._localToWorld = localToWorld;\n this._latitudeSweep = latitudeSweep;\n this._latitudeSweep.capLatitudeInPlace();\n }\n /** return a deep clone */\n public clone(): Sphere {\n return new Sphere(this._localToWorld.clone(), this._latitudeSweep.clone(), this.capped);\n }\n /**\n * Transform the sphere in place.\n * * Fails if the transform is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n transform.multiplyTransformTransform(this._localToWorld, this._localToWorld);\n if (transform.matrix.determinant() < 0.0) {\n // if mirror, reverse z-axis to preserve outward normals\n this._localToWorld.matrix.scaleColumnsInPlace(1, 1, -1);\n this._latitudeSweep.setStartEndRadians(-this._latitudeSweep.endRadians, -this._latitudeSweep.startRadians);\n }\n return true;\n }\n /**\n * Return a transformed clone.\n * * Fails if the transform is singular.\n */\n public cloneTransformed(transform: Transform): Sphere | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /**\n * Construct a rigid coordinate frame from the local coordinate frame.\n * * The returned frame is right-handed, with perpendicular unit axes.\n * * Compare to [[cloneLocalToWorld]].\n */\n public getConstructiveFrame(): Transform | undefined {\n return this._localToWorld.cloneRigid();\n }\n /** Return the latitude sweep as fraction of south pole to north pole. */\n public get latitudeSweepFraction(): number { return this._latitudeSweep.sweepRadians / Math.PI; }\n /** Create from center and radius, with optional restricted latitudes. */\n public static createCenterRadius(center: Point3d, radius: number, latitudeSweep?: AngleSweep, capped?: boolean): Sphere {\n const localToWorld = Transform.createOriginAndMatrix(center, Matrix3d.createUniformScale(radius));\n return new Sphere(localToWorld, latitudeSweep ? latitudeSweep.clone() : AngleSweep.createFullLatitude(), capped ?? false);\n }\n /** Create an ellipsoid which is a unit sphere mapped to position by an (arbitrary, possibly skewed and scaled) transform. */\n public static createEllipsoid(localToWorld: Transform, latitudeSweep?: AngleSweep, capped?: boolean): Sphere | undefined {\n return new Sphere(localToWorld.clone(), latitudeSweep ? latitudeSweep.clone() : AngleSweep.createFullLatitude(), capped ?? false);\n }\n\n /**\n * Create a sphere from the typical parameters of the DGN file.\n * * This method normalizes the input vectors, squares `vectorX` against `vectorZ`, and scales the radii by the vectors' original lengths.\n * * These restrictions allow the sphere to be represented by an element in the DGN file.\n */\n public static createDgnSphere(center: Point3d, vectorX: Vector3d, vectorZ: Vector3d, radiusXY: number, radiusZ: number, latitudeSweep?: AngleSweep, capped?: boolean): Sphere | undefined {\n const rigidMatrix = Matrix3d.createRigidFromColumns(vectorZ, vectorX, AxisOrder.ZXY);\n if (rigidMatrix) {\n radiusXY *= vectorX.magnitude();\n rigidMatrix.scaleColumns(radiusXY, radiusXY, radiusZ * vectorZ.magnitude(), rigidMatrix);\n const frame = Transform.createOriginAndMatrix(center, rigidMatrix);\n return new Sphere(frame, latitudeSweep ? latitudeSweep.clone() : AngleSweep.createFullLatitude(), capped ?? false);\n }\n return undefined;\n }\n\n /**\n * Create a sphere.\n * * If `axes` is supplied, its columns are scaled by the radii to form the sphere's local frame.\n */\n public static createFromAxesAndScales(center: Point3d, axes: undefined | Matrix3d, radiusX: number, radiusY: number, radiusZ: number,\n latitudeSweep?: AngleSweep,\n capped?: boolean): Sphere | undefined {\n const localToWorld = Transform.createOriginAndMatrix(center, axes);\n localToWorld.matrix.scaleColumnsInPlace(radiusX, radiusY, radiusZ);\n return new Sphere(localToWorld, latitudeSweep ? latitudeSweep.clone() : AngleSweep.createFullLatitude(), capped ?? false);\n }\n\n /** return (copy of) sphere center */\n public cloneCenter(): Point3d { return this._localToWorld.getOrigin(); }\n /** return the (full length, i.e. scaled by radius) X vector from the sphere transform */\n public cloneVectorX(): Vector3d { return this._localToWorld.matrix.columnX(); }\n /** return the (full length, i.e. scaled by radius) Y vector from the sphere transform */\n public cloneVectorY(): Vector3d { return this._localToWorld.matrix.columnY(); }\n /** return the (full length, i.e. scaled by radius) Z vector from the sphere transform */\n public cloneVectorZ(): Vector3d { return this._localToWorld.matrix.columnZ(); }\n /** return (a copy of) the sphere's angle sweep. */\n public cloneLatitudeSweep(): AngleSweep { return this._latitudeSweep.clone(); }\n /** Test if the geometry is a true sphere taking the transform (which might have nonuniform scaling) is applied. */\n public trueSphereRadius(): number | undefined {\n const factors = this._localToWorld.matrix.factorRigidWithSignedScale();\n if (!factors) return undefined;\n if (factors && factors.scale > 0) // why do we rule out mirror?\n return factors.scale;\n return undefined;\n }\n /**\n * Return the largest of the primary xyz axis radii\n */\n public maxAxisRadius(): number {\n const matrix = this._localToWorld.matrix;\n return Geometry.maxXYZ(matrix.columnXMagnitude(), matrix.columnYMagnitude(), matrix.columnZMagnitude());\n }\n /**\n * Return a (clone of) the sphere's local to world transformation.\n * * Compare to [[getConstructiveFrame]].\n */\n public cloneLocalToWorld(): Transform {\n return this._localToWorld.clone();\n }\n /** Test if `other` is a `Sphere` */\n public isSameGeometryClass(other: any): boolean { return other instanceof Sphere; }\n /** Test for same geometry in `other` */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof Sphere) {\n if (this.capped !== other.capped) return false;\n if (!this._localToWorld.isAlmostEqual(other._localToWorld)) return false;\n return true;\n }\n return false;\n }\n /**\n * Return strokes for the elliptical arc cross-section at latitude sweep fraction v.\n * * Optional inputs control the number of strokes along the cross-section:\n * * If `fixedStrokeCount` is supplied, it is taken as the cross-section stroke count.\n * * If `fixedStrokeCount` is undefined, stroke count is computed by applying `options` to the cross-section.\n * * If neither input is supplied, the stroke count default is 16.\n * * In any case, stroke count is clamped to the interval [4,64].\n * @param v fractional position along the sphere axis\n * @param fixedStrokeCount optional stroke count in u-direction\n * @param options optional stroke options in u-direction\n * @return strokes as line string\n */\n public strokeConstantVSection(v: number, fixedStrokeCount?: number, options?: StrokeOptions): LineString3d {\n let strokeCount = 16;\n if (fixedStrokeCount !== undefined && Number.isFinite(fixedStrokeCount)) {\n strokeCount = fixedStrokeCount;\n } else if (options instanceof StrokeOptions) {\n strokeCount = options.applyTolerancesToArc(Geometry.maxXY(this._localToWorld.matrix.columnXMagnitude(), this._localToWorld.matrix.columnYMagnitude()));\n }\n strokeCount = Geometry.clampToStartEnd(strokeCount, 4, 64);\n const transform = this._localToWorld;\n const phi = this.vFractionToRadians(v);\n const c1 = Math.cos(phi);\n const s1 = Math.sin(phi);\n let c0, s0;\n const result = LineString3d.createForStrokes(strokeCount, options);\n const deltaRadians = Math.PI * 2.0 / strokeCount;\n const fractions = result.fractions; // possibly undefined !!!\n const derivatives = result.packedDerivatives; // possibly undefined !!!\n const uvParams = result.packedUVParams; // possibly undefined !!\n const surfaceNormals = result.packedSurfaceNormals;\n const dXdu = Vector3d.create();\n const dXdv = Vector3d.create();\n const normal = Vector3d.create();\n let radians = 0;\n for (let i = 0; i <= strokeCount; i++) {\n if (i * 2 <= strokeCount)\n radians = i * deltaRadians;\n else\n radians = (i - strokeCount) * deltaRadians;\n c0 = Math.cos(radians);\n s0 = Math.sin(radians);\n const xyz = transform.multiplyXYZ(c1 * c0, c1 * s0, s1);\n result.addPoint(xyz);\n\n if (fractions)\n fractions.push(i / strokeCount);\n\n if (derivatives) {\n transform.matrix.multiplyXYZ(-c1 * s0, c1 * c0, 0.0, dXdu);\n derivatives.push(dXdu);\n }\n if (uvParams) {\n uvParams.pushXY(i / strokeCount, v);\n }\n if (surfaceNormals) {\n transform.matrix.multiplyXYZ(-s0, c0, 0, dXdu);\n transform.matrix.multiplyXYZ(-s1 * c0, -s1 * s0, c1, dXdv);\n dXdu.unitCrossProduct(dXdv, normal);\n surfaceNormals.push(normal);\n }\n }\n return result;\n }\n\n /** Second step of double dispatch: call `handler.handleSphere(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleSphere(this);\n }\n\n /**\n * Return the Arc3d section at uFraction. For the sphere, this is a meridian arc.\n * @param uFraction fractional position along the equator.\n */\n public constantUSection(uFraction: number): Arc3d {\n const phi = AngleSweep.fractionToSignedPeriodicFractionStartEnd(uFraction, 0, Angle.pi2Radians, false);\n const s1 = Math.sin(phi);\n const c1 = Math.cos(phi);\n const transform = this._localToWorld;\n const center = transform.getOrigin();\n const vector0 = transform.matrix.multiplyXYZ(c1, s1, 0);\n const vector90 = transform.matrix.multiplyXYZ(0, 0, 1);\n return Arc3d.create(center, vector0, vector90, this._latitudeSweep);\n }\n\n /**\n * Return the Arc3d section at vFraction. For the sphere, this is a latitude circle.\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): Loop {\n const phi = this._latitudeSweep.fractionToRadians(vFraction);\n const s1 = Math.sin(phi);\n const c1 = Math.cos(phi);\n const transform = this._localToWorld;\n const center = transform.multiplyXYZ(0, 0, s1);\n const vector0 = transform.matrix.multiplyXYZ(c1, 0, 0);\n const vector90 = transform.matrix.multiplyXYZ(0, c1, 0);\n return Loop.create(Arc3d.create(center, vector0, vector90));\n }\n /** Extend a range to contain this sphere. */\n public extendRange(range: Range3d, transform?: Transform): void {\n let placement = this._localToWorld;\n if (transform) {\n placement = transform.multiplyTransformTransform(placement);\n }\n\n range.extendTransformedXYZ(placement, -1, -1, -1);\n range.extendTransformedXYZ(placement, 1, -1, -1);\n range.extendTransformedXYZ(placement, -1, 1, -1);\n range.extendTransformedXYZ(placement, 1, 1, -1);\n\n range.extendTransformedXYZ(placement, -1, -1, 1);\n range.extendTransformedXYZ(placement, 1, -1, 1);\n range.extendTransformedXYZ(placement, -1, 1, 1);\n range.extendTransformedXYZ(placement, 1, 1, 1);\n\n }\n /** Evaluate as a uv surface\n * @param uFraction fractional position on minor arc (theta, longitude)\n * @param vFraction fractional position on major arc (phi, latitude)\n */\n public uvFractionToPoint(uFraction: number, vFraction: number, result?: Point3d): Point3d {\n // sphere with radius 1 . . .\n const thetaRadians = this.uFractionToRadians(uFraction);\n const phiRadians = this.vFractionToRadians(vFraction);\n const cosTheta = Math.cos(thetaRadians);\n const sinTheta = Math.sin(thetaRadians);\n const sinPhi = Math.sin(phiRadians);\n const cosPhi = Math.cos(phiRadians);\n return this._localToWorld.multiplyXYZ(cosTheta * cosPhi, sinTheta * cosPhi, sinPhi, result);\n }\n /** Evaluate as a uv surface, returning point and two vectors.\n * @param uFraction fractional position on minor arc (theta, longitude)\n * @param vFraction fractional position on major arc (phi, latitude)\n */\n public uvFractionToPointAndTangents(uFraction: number, vFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\n const thetaRadians = this.uFractionToRadians(uFraction);\n const phiRadians = this.vFractionToRadians(vFraction);\n const fTheta = Math.PI * 2.0;\n const fPhi = this._latitudeSweep.sweepRadians;\n const cosTheta = Math.cos(thetaRadians);\n const sinTheta = Math.sin(thetaRadians);\n const sinPhi = Math.sin(phiRadians);\n const cosPhi = Math.cos(phiRadians);\n return Plane3dByOriginAndVectors.createOriginAndVectors(\n this._localToWorld.multiplyXYZ(cosTheta * cosPhi, sinTheta * cosPhi, sinPhi),\n this._localToWorld.matrix.multiplyXYZ(-fTheta * sinTheta, fTheta * cosTheta, 0), // NOTE: cosPhi scale is omitted, so the u-derivative scale is wrong but at least at the poles it's nonzero\n this._localToWorld.matrix.multiplyXYZ(-fPhi * cosTheta * sinPhi, -fPhi * sinTheta * sinPhi, fPhi * cosPhi),\n result);\n }\n /**\n * * A sphere is can be closed two ways:\n * * full sphere (no caps needed for closure)\n * * incomplete but with caps\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n return this.capped || this._latitudeSweep.isFullLatitudeSweep;\n }\n /**\n * Directional distance query\n * * u direction is around latitude circle at maximum distance from axis.\n * * v direction is on a line of longitude between the latitude limits.\n */\n public maxIsoParametricDistance(): Vector2d {\n // approximate radius at equator .. if elliptic, this is not exact . . .\n const rX = this._localToWorld.matrix.columnXMagnitude();\n const rY = this._localToWorld.matrix.columnYMagnitude();\n const rZ = this._localToWorld.matrix.columnZMagnitude();\n const rMaxU = Math.max(rX, rY);\n let dMaxU = Math.PI * 2.0 * rMaxU;\n if (!this._latitudeSweep.isRadiansInSweep(0.0))\n dMaxU *= Math.max(Math.cos(Math.abs(this._latitudeSweep.startRadians)), Math.cos(Math.abs(this._latitudeSweep.endRadians)));\n const dMaxV = Math.max(rMaxU, rZ) * Math.abs(this._latitudeSweep.sweepRadians);\n\n return Vector2d.create(dMaxU, dMaxV);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TorusPipe.d.ts","sourceRoot":"","sources":["../../../src/solid/TorusPipe.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,8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BAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAUzE;;;OAGG;IACI,4BAA4B,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,yBAAyB,GAAG,yBAAyB;IAoBxH;;;;OAIG;IACI,wBAAwB,IAAI,QAAQ;IAK3C;;OAEG;IACH,IAAW,cAAc,IAAI,OAAO,CAEnC;CAEF"}
|
|
@@ -73,6 +73,10 @@ class TorusPipe extends SolidPrimitive_1.SolidPrimitive {
|
|
|
73
73
|
if (transform.matrix.isSingular())
|
|
74
74
|
return false;
|
|
75
75
|
transform.multiplyTransformTransform(this._localToWorld, this._localToWorld);
|
|
76
|
+
if (transform.matrix.determinant() < 0.0) {
|
|
77
|
+
// if mirror, reverse z-axis to preserve outward normals
|
|
78
|
+
this._localToWorld.matrix.scaleColumnsInPlace(1, 1, -1);
|
|
79
|
+
}
|
|
76
80
|
return true;
|
|
77
81
|
}
|
|
78
82
|
/**
|