import { PerpParallelOptions, PlaneAltitudeEvaluator } from "../Geometry"; import { Angle } from "../geometry3d/Angle"; import { AngleSweep } from "../geometry3d/AngleSweep"; import { Ellipsoid, GeodesicPathPoint } from "../geometry3d/Ellipsoid"; import { IndexedXYZCollection } from "../geometry3d/IndexedXYZCollection"; import { Plane3dByOriginAndUnitNormal } from "../geometry3d/Plane3dByOriginAndUnitNormal"; import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d"; import { Ray3d } from "../geometry3d/Ray3d"; import { XAndY } from "../geometry3d/XYZProps"; import { IndexedPolyface } from "../polyface/Polyface"; import { RuledSweep } from "../solid/RuledSweep"; import { Arc3d } from "./Arc3d"; import { CurveChain } from "./CurveCollection"; import { CurvePrimitive } from "./CurvePrimitive"; import { AnyCurve } from "./CurveTypes"; import { GeometryQuery } from "./GeometryQuery"; import { LineString3d } from "./LineString3d"; import { Loop } from "./Loop"; import { Path } from "./Path"; import { IntegratedSpiralTypeName } from "./spiral/TransitionSpiral3d"; import { StrokeOptions } from "./StrokeOptions"; /** * Interface to carry parallel arrays of planes and sections, and optional geometry assembled from them, * as returned by [CurveFactory.createMiteredSweepSections]. * @public */ export interface SectionSequenceWithPlanes { /** The plane of each section. */ planes: Plane3dByOriginAndUnitNormal[]; /** Section curve projected onto the corresponding plane. */ sections: AnyCurve[]; /** * Optional `RuledSweep` generated from the sections. * * The `RuledSweep` and sections array refer to the same section objects. */ ruledSweep?: RuledSweep; /** Optional mesh generated from the `RuledSweep` generated from the sections. */ mesh?: IndexedPolyface; } /** * Enumeration of geometric output for [CurveFactory.createMiteredSweepSections]. * @public */ export declare enum MiteredSweepOutputSelect { /** Output only the parallel arrays of planes and sections. */ Sections = 0, /** Output planes and sections, as well as the assembled ruled sweep. */ AlsoRuledSweep = 1, /** Output planes and sections, as well as the assembled ruled sweep and its stroked mesh. */ AlsoMesh = 2 } /** * Interface bundling options for [CurveFactory.createMiteredSweepSections]. * @public */ export interface MiteredSweepOptions { /** Whether first and last planes are averaged and equated when the centerline is physically closed. Default value is `false`. */ wrapIfPhysicallyClosed?: boolean; /** Whether to output sections only, or sections plus optional geometry constructed from them. Default value is `MiteredSweepOutputSelect.Sections`. */ outputSelect?: MiteredSweepOutputSelect; /** How to stroke smooth input curves. If undefined, default stroke options are used. */ strokeOptions?: StrokeOptions; /** Whether to cap the ruled sweep if outputting a ruled sweep or mesh. Default value is `false`. */ capped?: boolean; /** The first section's normal is aligned to this vector, typically the start tangent of the smooth curve stroked for the centerline. */ startTangent?: Vector3d; /** The last section's normal is aligned to this vector, typically the end tangent of the smooth curve stroked for the centerline. */ endTangent?: Vector3d; } /** * Interface bundling options for [[CurveFactory.createFilletsInLineString]]. * @public */ export interface CreateFilletsInLineStringOptions { /** * Whether to allow cusps in the output `Path`. Default value is `true`. * * A _cusp_ forms when a fillet's radius is large enough to consume an adjacent line string segment, or when two * fillets intersect. * * Each cusp results in a retrograde "cusp segment" or gap in the output `Path`, as per the `cuspSegments` option. * * The length of cusp segments in the output `Path` is bounded above by the `cuspTolerance` option. * * When this option is `false`, cusps are avoided by suppressing one or both of their constituent fillets. Where two * fillets combine to form a cusp, but either fillet by itself does not form a cusp, the fillet with smaller chain * index survives. */ allowCusp?: boolean; /** * Whether to fillet the closure of the input line string. Default value is `false`. * * If `true`, the input line string is treated as a polygon (closure point optional), and the output `Path` is * closed and has a fillet at its start point. If both first and last input points are identical, the last point's * entry in the radius array is ignored. * * If `false`, the first and last points receive no fillet and their respective entries in the radius array are * ignored. */ filletClosure?: boolean; /** * An absolute distance tolerance for comparing points. Default value is [[Geometry.smallMetricDistance]]. * * If the first and last input points are within this distance, the line string is considered to be closed. * * This distance is used when `filletClosure` is `true` to detect whether the last point is redundant and thus to * be ignored during processing. * * This distance is also used when `simplifyPath` is `true` to detect small line segments. */ closureTolerance?: number; /** * Maximum allowable length of a cusp when `allowCusp` is `true`. Default value is [[Geometry.smallMetricDistance]]. * * A cusp's length is defined to be the length of its "cusp segment", regardless of whether the cusp segment * appears in the output `Path` (cf. option `cuspSegments`). * * A cusp whose length exceeds `cuspTolerance` is avoided by suppressing one or both of the cusp's constituent * fillets. Where two fillets combine to form such a cusp, but either fillet by itself produces a cusp shorter than * `cuspTolerance`, the fillet that generates the shorter cusp survives; if the fillets by themselves generate equal * length cusps, the fillet with smaller chain index survives. */ cuspTolerance?: number; /** * Whether to output a `LineSegment3d` for each cusp segment. Default value is `true`. * * The _cusp segment_ of a cusp is the retrograde line segment that bridges the gap formed by the cusp along its * consumed line string edge, possibly extended. * * When `allowCusp` and `cuspSegments` are `true` (and `simplifyPath` is `false`), the output `Path` is guaranteed * to be continuous; otherwise, it may have gaps, and downstream processing may not tolerate these gaps if they are * too large. * * Compare this option to `allowCusp`, which controls the presence of cusps in output, and to `simplifyPath`, * which removes small cusp segments in output. */ cuspSegments?: boolean; /** * Whether to post-process the resulting Path to remove line segments smaller than `closureTolerance` and to * consolidate adjacent fillets. Default value is `false`. */ simplifyPath?: boolean; } /** * Options used for method [[CurveFactory.fromFilletedLineString]]. * @public */ export interface FilletedLineStringOptions { /** * Options for {@link Vector3d.isParallelTo}. * Default: See the documentation for {@link PerpParallelOptions} */ parallelOptions?: PerpParallelOptions; /** * Distance tolerance for detecting equal points. * Default: {@link Geometry.smallMetricDistance}. */ distanceTol?: number; /** * Whether to allow relaxed validation of the filleted linestring, which allows more chains to serve as valid input. * Default: false. */ relaxedValidation?: boolean; } /** * The `CurveFactory` class contains methods for specialized curve constructions. * @public */ export declare class CurveFactory { /** (Cautiously) construct and save a line segment between fractional positions. */ private static addPartialSegment; /** * Create a circular arc defined by start point, tangent at start point, and end point. * * The circular arc is swept from start to end toward direction of the `tangentAtStart`. * * If tangent is parallel to line segment from start to end, return `undefined`. */ static createArcPointTangentPoint(start: Point3d, tangentAtStart: Vector3d, end: Point3d): Arc3d | undefined; /** * Construct a sequence of alternating lines and arcs with each arc creating a smooth transition between consecutive edges. * * If the radius parameter is a number, that radius is used throughout. * * If the radius parameter is an array of numbers, `radius[i]` is applied at `point[i]`. * * A zero radius for any point indicates to leave the as a simple corner. * @param points point source. * @param radius fillet radius or array of radii indexed to correspond to the points. * @param allowCuspOrOptions flag to allow cusps in output (default `true`), or a list of extended options. */ static createFilletsInLineString(points: LineString3d | IndexedXYZCollection | Point3d[], radius: number | number[], allowCuspOrOptions?: boolean | CreateFilletsInLineStringOptions): Path | undefined; /** If an open filletedLineString starts/ends with an arc, add a zero-length line segment to its start/end. */ private static validateOpenPathStartEnd; /** * Split `arc` according to the partition given by `fractions` and append the pieces to `output` with zero-length * line segments in between. * @param fractions a complete partition of the fractional parameter space, e.g., [0, 0.5, 1] splits the arc into * two pieces. */ private static splitAndAppendArc; /** * Update the path for relaxed validation: * * If there are 2 connected arcs, add a zero-length line segment between them. * * If there is a pair of arc and line segment/string with non-parallel tangents, add a zero-length line segment * between them. * * If there is an arc with sweep degrees in (120, 240], break the arc into 2 pieces separated by a zero-length * line segment. Similarly, break arcs with sweep in (240, 360] into 3 pieces separated by 2 zero-length line segments. * Return `undefined` if there is an arc with sweep greater than 360 degrees. */ private static updatePathForRelaxedValidation; /** * Verify each neighboring curve to an arc is a line segment/string. Also verify arc tangents are parallel * (but not anti-parallel) to neighboring line segment/string tangents. */ private static validateArcNeighbors; /** Validate a filleted line string. */ private static validateFilletedLineString; /** If we have 2 connected arcs (with a zero-length line segment in between), add the joint with zero radius. */ private static addJointBetweenConnectedArcs; /** * Extract points and radii from a valid filleted linestring. * * A valid filleted linestring is a `CurveChain` that satisfies the following conditions: * * Its children have type `Arc3d`, `LineSegment3d`, or `LineString3d`. * * Each `Arc3d` is circular. * * Each `Arc3d` sweep is less than 180 degrees. * * Each `Arc3d` cannot be adjacent to another `Arc3d`. * * Each `Arc3d` is G1 continuous with each of its neighbors, i.e., at their common point, the curves have the same * tangent direction. * * To treat more input chains as valid, pass `options.relaxedValidation = true`. Internally, this setting performs * several transformations on the input to produce a valid filleted linestring: * * `Arc3d`s with large sweep are uniformly split into 2 or 3 smaller arcs to improve the proximity of their _PI_ * points (cf. {@link Arc3d.computeTangentIntersection}). Arcs with sweep greater than 360 degrees are not allowed. * * Adjacent `Arc3d`s are separated by a zero-length `LineSegment3d`. * * An `Arc3d` that is not G1 continuous with its linear neighbor is separated from it by a zero-length * `LineSegment3d` to preserve the corner. * @param filletedLineString A linestring with corner fillets, e.g., as created by {@link CurveFactory.createFilletsInLineString}. * @param options optional validation settings. * @returns Array of [point, radius] pairs extracted from input, or `undefined` if the input is not valid. A radius * of zero means no fillet at the vertex. */ static fromFilletedLineString(filletedLineString: CurveChain, options?: FilletedLineStringOptions): Array<[Point3d, number]> | undefined; /** * Create a `Loop` with given xy corners and fixed z. * * The corners always proceed counter clockwise from lower left. * * If the radius is too large for the outer rectangle size, it is reduced to half of the the smaller x or y size. */ static createRectangleXY(x0: number, y0: number, x1: number, y1: number, z?: number, filletRadius?: number): Loop; /** * If `arcB` is a continuation of `arcA`, extend `arcA` (in place) to include the range of `arcB` * * This only succeeds if the two arcs are part of identical complete arcs and end of `arcA` matches the beginning of `arcB`. * @param arcA first arc, modified in place. * @param arcB second arc, unmodified. * @param allowReversed whether to consolidate even when second arc is reversed (default is `false`). * @param tolerance optional coordinate tolerance for point equality (default is `Geometry.smallMetricDistance`). * @returns whether `arcA` was modified. */ static appendToArcInPlace(arcA: Arc3d, arcB: Arc3d, allowReverse?: boolean, tolerance?: number): boolean; /** * Return a `Path` containing arcs are on the surface of an ellipsoid and pass through a sequence of points. * * Each arc passes through the two given endpoints and in the plane containing the true surface normal at * given `fractionForIntermediateNormal` * @param ellipsoid * @param pathPoints * @param fractionForIntermediateNormal fractional position for surface normal used to create the section plane. */ static assembleArcChainOnEllipsoid(ellipsoid: Ellipsoid, pathPoints: GeodesicPathPoint[], fractionForIntermediateNormal?: number): Path; private static appendGeometryQueryArray; /** * Create solid primitives for pipe segments (e.g. Cone or TorusPipe) around line and arc primitives. * @param centerline centerline geometry. * @param pipeRadius radius of pipe. */ static createPipeSegments(centerline: CurvePrimitive | CurveChain, pipeRadius: number): GeometryQuery | GeometryQuery[] | undefined; /** Get start point and tangent for variant curve data. */ private static startPointAndTangent; /** Create an [[Arc3d]] from `sectionData` that has its center at the start point of the centerline. */ static createArcFromSectionData(centerline: IndexedXYZCollection | Point3d[] | CurvePrimitive, sectionData: number | XAndY | Arc3d): Arc3d | undefined; /** * Create section arcs for mitered pipe. * * At the end of each pipe segment, the pipe is mitered by the plane that bisects the angle between successive * centerline segments. * * The section arcs are constructed so that lines between corresponding fractional positions on the arcs are * axial lines on the pipes. * * This means that the initial arc's vector0 and vector90 lengths and angular separation are _not_ preserved in * the section arcs. * * Circular or elliptical pipe cross sections can be specified by supplying either a radius, a pair of semi-axis * lengths, or an Arc3d: * * For semi-axis length input, x and y correspond to ellipse local axes perpendicular to each other and to the * start tangent. * * For Arc3d input, the center is translated to the centerline start point. For best results, ensure this arc * is perpendicular to the centerline start tangent. * * This function internally calls [[createMiteredSweepSections]] with default options. * @param centerline centerline of pipe. For best results, ensure no successive duplicate points with e.g., * [[GrowableXYZArray.createCompressed]]. * @param sectionData circle radius, ellipse semi-axis lengths, or full Arc3d (if not full, function makes it full). * @returns array of sections or empty array if section creation failed. */ static createMiteredPipeSections(centerline: IndexedXYZCollection, sectionData: number | XAndY | Arc3d): Arc3d[]; /** For a smooth curve, stroke and return unnormalized start/end tangents. */ private static strokeSmoothCurve; /** * Align two bisector plane normals to given smooth rail tangents or optional overrides. * * Optionally average the normals for physically closed rail. */ private static alignFirstAndLastBisectorPlanes; /** Reverse a closed curve or region if necessary so that its orientation is CCW with respect to the plane normal. */ private static alignClosedCurveToPlane; /** * Projection to target plane, constructing sweep direction from two given planes. * * If successful, push the target plane and swept section to the output arrays and return the swept section. * * If unsuccessful, leave the output arrays alone and return the input section. */ private static doSweepToPlane; /** * Sweep the `initialSection` along each segment of the (stroked) `centerline` until it hits the bisector plane at * the next vertex. * * For best results, the caller should place `initialSection` in a plane perpendicular to the `centerline` * start tangent. * * This plane is commonly (but not necessarily) through the centerline start point itself. * * To compute the sections, `initialSection` is projected in the direction of the centerline start tangent onto * the first bisector plane at the centerline start. The result of this projection will be likewise projected onto * the second plane, and so on in sequence. * * By default, the first/last bisector plane normals are set to the centerline start/end tangents. The caller can * override these with tangents supplied in `options`. If the centerline is physically closed and * `options.wrapIfPhysicallyClosed` is true, the first and last plane normals are averaged and equated. * * The centerline path does NOT have to be planar, however non-planarity will result in twisting of the sections * in the bisector planes. * @param centerline sweep path. Will be stroked if smooth. * @param initialSection profile curve to be swept. As noted above, this should be on a plane perpendicular to the * centerline start tangent. * @param options options for computation and output. * @return array of sections, formed from projecting `initialSection` successively onto the bisector planes. */ static createMiteredSweepSections(centerline: IndexedXYZCollection | Point3d[] | CurvePrimitive | CurveChain, initialSection: AnyCurve, options?: MiteredSweepOptions): SectionSequenceWithPlanes | undefined; /** * Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep. * * The vector from start point to center is in the direction of upVector crossed with tangentA. * @param start start point. * @param tangentAtStart vector in tangent direction at the start. * @param radius signed radius. * @param upVector optional out-of-plane vector. Defaults to positive Z. * @param sweep angular range. If single `Angle` is given, start angle is at 0 degrees (the start point). */ static createArcPointTangentRadius(start: Point3d, tangentAtStart: Vector3d, radius: number, upVector?: Vector3d, sweep?: Angle | AngleSweep): Arc3d | undefined; /** * Compute 2 spirals (all in XY) for a symmetric line-to-line transition. * * First spiral begins at given start point. * * first tangent aims at shoulder. * * outbound spiral joins line from shoulder to target. * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE. * @param startPoint inbound start point. * @param shoulder point target point for (both) spiral-to-line tangencies. * @return array with the computed spirals, or undefined if failure. */ static createLineSpiralSpiralLine(spiralType: IntegratedSpiralTypeName, startPoint: Point3d, shoulderPoint: Point3d, targetPoint: Point3d): GeometryQuery[] | undefined; /** * Compute 2 spirals (all in XY) for a symmetric line-to-line transition. * * Spiral length is given. * * tangency points float on both lines. * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE. * @param pointA inbound start point. * @param shoulder point target point for (both) spiral-to-line tangencies. * @param spiralLength for each part of the spiral pair. * @return array with the computed spirals, or undefined if failure. */ static createLineSpiralSpiralLineWithSpiralLength(spiralType: IntegratedSpiralTypeName, pointA: Point3d, pointB: Point3d, pointC: Point3d, spiralLength: number): GeometryQuery[] | undefined; /** * Compute 2 spirals and an arc (all in XY) for a symmetric line-to-line transition. * Spiral lengths and arc radius are given (e.g., from design speed standards). * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE. * @param pointA inbound start point. * @param pointB shoulder (target) point for (both) spiral-to-line tangencies. * @param lengthA inbound spiral length. * @param lengthB outbound spiral length. * @return array with the computed spirals, or undefined if failure. */ static createLineSpiralArcSpiralLine(spiralType: IntegratedSpiralTypeName, pointA: Point3d, pointB: Point3d, pointC: Point3d, lengthA: number, lengthB: number, arcRadius: number): GeometryQuery[] | undefined; /** Return the intersection point of 3 planes. */ static planePlaneIntersectionRay(planeA: PlaneAltitudeEvaluator, planeB: PlaneAltitudeEvaluator): Ray3d | undefined; } //# sourceMappingURL=CurveFactory.d.ts.map