import { MultiLineStringDataVariant } from "../geometry3d/IndexedXYZCollection"; import { Range3d } from "../geometry3d/Range"; import { Ray3d } from "../geometry3d/Ray3d"; import { Transform } from "../geometry3d/Transform"; import { CurveCollection } from "./CurveCollection"; import { CurvePrimitive } from "./CurvePrimitive"; import { AnyChain, AnyCurve } from "./CurveTypes"; import { LineString3d } from "./LineString3d"; import { Loop } from "./Loop"; import { OffsetOptions } from "./OffsetOptions"; import { Path } from "./Path"; import { StrokeOptions } from "./StrokeOptions"; /** * Options bundle for use in [[CurveOps.isPlanar]] and [[CurveOps.isColinear]]. * @public */ export interface PlanarColinearOptions { /** Maximum allowable distance that geometry can deviate from planarity/colinearity. Default is [[Geometry.smallMetricDistance]]. */ maxDeviation?: number; /** Whether colinearity test ignores z-coordinates. Default is `false`. */ xyColinear?: boolean; /** Radian tolerance for xy-colinearity, measuring maximum angular deviation from a vertical plane. Default is [[Geometry.smallAngleRadians]]. */ radianTolerance?: number; /** Pre-allocated object to populate with the computed plane-to-world transformation and return when planarity test succeeds. */ localToWorld?: Transform; /** Pre-allocated object to populate with the computed line and return when colinear test succeeds. */ colinearRay?: Ray3d; } /** * Static methods for miscellaneous curve operations. * @public */ export declare class CurveOps { /** Recursively sum curve lengths, allowing CurvePrimitive, CurveCollection, or array of such at any level. */ static sumLengths(curves: AnyCurve | AnyCurve[]): number; /** Recursively extend the range by each curve's range, allowing CurvePrimitive, CurveCollection, or array of such at any level. */ static extendRange(range: Range3d, curves: AnyCurve | AnyCurve[], transform?: Transform): Range3d; /** * Construct a separate xy-offset for each input curve. * * For best offset results, the inputs should be parallel to the xy-plane. * @param curves input curve(s), z-coordinates ignored. Only curves of type [[AnyChain]] are handled. * @param offset offset distance (positive to left of curve, negative to right) * @param result array to collect offset curves * @returns summed length of offset curves */ static appendXYOffsets(curves: AnyCurve | AnyCurve[] | undefined, offset: number, result: AnyCurve[]): number; /** * Restructure curve fragments as Paths and Loops, and construct xy-offsets of the chains. * * If the inputs do not form Loop(s), the classification of offsets is suspect. * * For best offset results, the inputs should be parallel to the xy-plane. * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed. * @param fragments fragments to be chained and offset * @param offsetDistance offset distance, applied to both sides of each fragment to produce inside and outside xy-offset curves. * @param gapTolerance distance to be treated as "effectively zero" when joining head-to-tail * @returns object with named chains, insideOffsets, outsideOffsets */ static collectInsideAndOutsideXYOffsets(fragments: AnyCurve[], offsetDistance: number, gapTolerance: number): { insideOffsets: AnyCurve[]; outsideOffsets: AnyCurve[]; chains?: AnyChain; }; /** * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z). * * The construction will remove "some" local effects of features smaller than the offset distance, but will not detect self intersection among widely separated edges. * @param curves base curves. * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object. */ static constructCurveXYOffset(curves: Path | Loop, offsetDistanceOrOptions: number | OffsetOptions): CurveCollection | undefined; /** * Create the offset of a single curve primitive as viewed in the xy-plane (ignoring z). * @param curve primitive to offset * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object */ static createSingleOffsetPrimitiveXY(curve: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined; /** * Restructure curve fragments as Paths and Loops. * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed. * @param fragments fragments to be chained * @param gapTolerance distance to be treated as "effectively zero" when assembling fragments head-to-tail * @param planeTolerance tolerance for considering a closed chain to be planar. If undefined, only create Path. If defined, create Loops for closed chains within tolerance of a plane. * @returns chains, possibly wrapped in a [[BagOfCurves]]. */ static collectChains(fragments: AnyCurve[], gapTolerance?: number, planeTolerance?: number): AnyChain | undefined; /** * Restructure curve fragments, to be stroked and passed into the callback. * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed. * @param fragments fragments to be chained and stroked * @param announceChain callback to process each stroked Path and Loop * @param strokeOptions options for stroking the chains * @param gapTolerance distance to be treated as "effectively zero" when assembling fragments head-to-tail. Also used for removing duplicate points in the stroked chains. * @param _planeTolerance unused, pass undefined */ static collectChainsAsLineString3d(fragments: AnyCurve[], announceChain: (chainPoints: LineString3d) => void, strokeOptions?: StrokeOptions, gapTolerance?: number, _planeTolerance?: number): void; /** * Compute the range of the curves in the local coordinates of a constructed localToWorld frame. * @param curves input geometry: curves or points. * @param localRange pre-allocated object to populate with the computed local range. * @param localToWorld optional pre-allocated object to populate with the computed frame. * @returns whether the frame was successfully computed. */ static computeLocalRange(curves: AnyCurve | MultiLineStringDataVariant, localRange: Range3d, localToWorld?: Transform): boolean; /** * Check whether or not the curves are planar, and if so, return a localToWorld frame. * @param curves input geometry: curves or points. * @param options bundle of options. * @returns localToWorld frame `T` for coplanar curves, or undefined if they are not coplanar. * `T` satisfies: * * `T.origin` is in the plane. * * `T.matrix.columnZ()` is the plane unit normal (or its negative). * * `T.matrix.isRigid()` returns true. * * `T.inverse()` is worldToLocal; apply to input geometry to rotate it into the xy-plane. */ static isPlanar(curves: AnyCurve | MultiLineStringDataVariant, options?: PlanarColinearOptions): Transform | undefined; /** * Check whether or not the curves lie in a straight line, and if so, return a colinear ray. * * This test does not take curve traversal or point order into account. * @param curves input geometry: curves or points. * @param options bundle of options. * @returns ray colinear with input, or undefined if input is not colinear. */ static isColinear(curves: AnyCurve | MultiLineStringDataVariant, options?: PlanarColinearOptions): Ray3d | undefined; } //# sourceMappingURL=CurveOps.d.ts.map