/** @packageDocumentation * @module CartesianGeometry */ import { Arc3d } from "../curve/Arc3d"; import { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive, CurvePrimitive } from "../curve/CurvePrimitive"; import { LineSegment3d } from "../curve/LineSegment3d"; import { GrowableXYZArray } from "../geometry3d/GrowableXYZArray"; import { IndexedXYZCollection } from "../geometry3d/IndexedXYZCollection"; import { Point3d } from "../geometry3d/Point3dVector3d"; import { Range1d, Range3d } from "../geometry3d/Range"; import { Ray3d } from "../geometry3d/Ray3d"; import { GrowableXYZArrayCache } from "../geometry3d/ReusableObjectCache"; import { Segment1d } from "../geometry3d/Segment1d"; import { Transform } from "../geometry3d/Transform"; import { Matrix4d } from "../geometry4d/Matrix4d"; import { ClipPlane } from "./ClipPlane"; import { Clipper, ClipPlaneContainment, PolygonClipper } from "./ClipUtils"; import { ConvexClipPlaneSet, ConvexClipPlaneSetProps } from "./ConvexClipPlaneSet"; /** * Wire format describing a [[UnionOfConvexClipPlaneSets]]. * @public */ export type UnionOfConvexClipPlaneSetsProps = ConvexClipPlaneSetProps[]; /** * A collection of ConvexClipPlaneSets. * * A point is "in" the clip plane set if it is "in" one or more of the ConvexClipPlaneSets. * * Hence the boolean logic is that the ClipPlaneSet is a UNION of its constituents. * @public */ export declare class UnionOfConvexClipPlaneSets implements Clipper, PolygonClipper { private _convexSets; /** (property accessor) Return the (reference to the) array of `ConvexClipPlaneSet` */ get convexSets(): ConvexClipPlaneSet[]; private constructor(); /** Return an array with the `toJSON` form of each `ConvexClipPlaneSet` */ toJSON(): UnionOfConvexClipPlaneSetsProps; /** Convert json `UnionOfConvexClipPlaneSets`, using `setFromJSON`. */ static fromJSON(json: UnionOfConvexClipPlaneSetsProps | undefined, result?: UnionOfConvexClipPlaneSets): UnionOfConvexClipPlaneSets; /** Create a `UnionOfConvexClipPlaneSets` with no members. */ static createEmpty(result?: UnionOfConvexClipPlaneSets): UnionOfConvexClipPlaneSets; /** * Return true if all member convex sets are almostEqual to corresponding members of other. This includes * identical order in array. * @param other clip plane to compare. */ isAlmostEqual(other: UnionOfConvexClipPlaneSets): boolean; /** Create a `UnionOfConvexClipPlaneSets` with given `ConvexClipPlaneSet` members. */ static createConvexSets(convexSets: ConvexClipPlaneSet[], result?: UnionOfConvexClipPlaneSets): UnionOfConvexClipPlaneSets; /** Return a deep copy. */ clone(result?: UnionOfConvexClipPlaneSets): UnionOfConvexClipPlaneSets; /** * Append `toAdd` to the array of `ConvexClipPlaneSet`. * * undefined toAdd is ignored. */ addConvexSet(toAdd: ConvexClipPlaneSet | undefined): void; /** * Test if there is any intersection with a ray defined by origin and direction. * * Optionally record the range (null or otherwise) in caller-allocated result. * * If the ray is unbounded inside the clip, result can contain positive or negative * "Geometry.largeCoordinateResult" values. * * If no result is provide, there are no object allocations. * @param maximalRange optional Range1d to receive parameters along the ray. */ hasIntersectionWithRay(ray: Ray3d, maximalRange?: Range1d): boolean; /** * Return true if true is returned for any contained convex set returns true for * `convexSet.isPointInside (point, tolerance)`. */ isPointInside(point: Point3d): boolean; /** * Return true if true is returned for any contained convex set returns true for * `convexSet.isPointOnOrInside (point, tolerance)`. */ isPointOnOrInside(point: Point3d, tolerance?: number): boolean; /** * Return true if true is returned for any contained convex set returns true for * `convexSet.isSphereOnOrInside (point, tolerance)`. */ isSphereInside(point: Point3d, radius: number): boolean; /** Test if any part of a line segment is within the volume. */ isAnyPointInOrOnFromSegment(segment: LineSegment3d): boolean; /** Returns the fractions of the segment that pass through the set region, as 1 dimensional pieces. */ appendIntervalsFromSegment(segment: LineSegment3d, intervals: Segment1d[]): void; /** Apply `transform` to all the ConvexClipPlaneSet's. */ transformInPlace(transform: Transform): void; /** Returns 1, 2, or 3 based on whether point is strongly inside, ambiguous, or strongly outside respectively. */ classifyPointContainment(points: Point3d[], onIsOutside: boolean): ClipPlaneContainment; /** * Clip a polygon to the planes of the clip sets, returning new polygon boundaries. * * The output polygons may lie next to each other, or be disconnected. * * For a convex input polygon, the output polygon(s) are also convex. * * For non-convex input, the output polygon(s) may have double-back edges along plane intersections. This is still a * valid clip in a parity sense (overlapping regions cancel). * * This method differs from [[appendPolygonClip]] by clipping the same input polygon with each [[ConvexClipPlaneSet]] * in the instance, and returning only the inside pieces. * @param input polygon, usually convex. Unchanged. * @param output output polygon * @param work optional work array. * @param planeToSkip if this plane is found in the convex set, it is NOT applied. * This is useful when caller knows the polygon lies in one of the instance planes. * @param tolerance distance tolerance for "on plane" decision. Default value is [[Geometry.smallMetricDistance]]. * @see appendPolygonClip */ polygonClip(input: GrowableXYZArray | Point3d[], output: GrowableXYZArray[], work?: GrowableXYZArray, planeToSkip?: ClipPlane, tolerance?: number): void; /** Method from [[Clipper]] interface. */ announceClippedSegmentIntervals(f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber): boolean; private static _clipFractionArray; /** Method from [[Clipper]] interface. */ announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean; /** Method from [[Clipper]] interface. */ announceClippedCurveIntervals(curve: CurvePrimitive, announce?: AnnounceNumberNumberCurvePrimitive): boolean; /** * Collect the output from computePlanePlanePlaneIntersections in all the contained convex sets. * @param points (optional) array to which computed points are to be added. * @param rangeToExtend (optional) range to be extended by the computed points. * @param transform (optional) transform to apply to the accepted points. * @param testContainment if true, test each point to see if it is within the convex set (send false if confident * that the convex set is rectilinear set such as a slab. Send true if chiseled corners are possible). * @returns number of points. */ computePlanePlanePlaneIntersectionsInAllConvexSets(points: Point3d[] | undefined, rangeToExtend: Range3d | undefined, transform?: Transform, testContainment?: boolean): number; /** * Multiply all ClipPlanes DPoint4d by matrix. * @param matrix matrix to apply. * @param invert if true, use in verse of the matrix. * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter). * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect * on the plane is the inverse transpose of matrixA. * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency. * * Both params default to true to get the full effect of transforming space. * @param matrix matrix to apply */ multiplyPlanesByMatrix4d(matrix: Matrix4d, invert?: boolean, transpose?: boolean): boolean; /** Recursively call `setInvisible` on all member convex sets. */ setInvisible(invisible: boolean): void; /** add convex sets that accept points below `zLow` and above `zHigh` */ addOutsideZClipSets(invisible: boolean, zLow?: number, zHigh?: number): void; /** Move convex sets from source.*/ takeConvexSets(source: UnionOfConvexClipPlaneSets): void; /** * Implement appendPolygonClip, as defined in interface PolygonClipper. * * This method differs from [[polygonClip]] by clipping the outside fragments resulting from the previous * [[ConvexClipPlaneSet]] with the following one, and returning both inside and outside pieces. * In this way, it always produces disjoint inside fragments, even if the clippers are not disjoint (uncommon). * @param xyz convex polygon. This is not changed. * @param insideFragments Array to receive "inside" fragments. Each fragment is a GrowableXYZArray grabbed from * the cache. This is NOT cleared. * @param outsideFragments Array to receive "outside" fragments. Each fragment is a GrowableXYZArray grabbed from * the cache. This is NOT cleared. * @param arrayCache cache for reusable GrowableXYZArray. * @see polygonClip */ appendPolygonClip(xyz: IndexedXYZCollection, insideFragments: GrowableXYZArray[], outsideFragments: GrowableXYZArray[], arrayCache: GrowableXYZArrayCache): void; } //# sourceMappingURL=UnionOfConvexClipPlaneSets.d.ts.map