/** * 3-D ray/segment intersection tests (geometry breadth follow-up): ray↔triangle * (Möller–Trumbore), ray↔plane, and closest-points-between-two-segments. * * Points/vectors are plain `number[]` of length 3, matching the convention * used throughout `../typed/geometry.ts` and `intersect.ts`. * * @packageDocumentation */ /** Result of {@link rayTriangleIntersect} / {@link rayPlaneIntersect}: the hit point and ray parameter `t`. */ export interface RayHit { /** Point of intersection: `origin + t·dir`. */ point: number[]; /** Ray parameter at the hit (distance along `dir`, when `dir` is unit length). */ t: number; } /** * Ray↔triangle intersection via the Möller–Trumbore algorithm. Returns the * hit point and ray parameter `t`, or `null` if the ray misses the triangle, * is parallel to its plane, or the hit is behind the ray origin (`t < 0`). * * @example * rayTriangleIntersect([0.25, 0.25, -1], [0, 0, 1], [0, 0, 0], [1, 0, 0], [0, 1, 0]) * // { point: [0.25, 0.25, 0], t: 1 } */ export declare function rayTriangleIntersect(origin: readonly number[], dir: readonly number[], v0: readonly number[], v1: readonly number[], v2: readonly number[]): RayHit | null; /** * Ray↔plane intersection. The plane is given by a point on it and its normal. * Returns the hit point and ray parameter `t`, or `null` if the ray is * parallel to the plane. * * @example * rayPlaneIntersect([0, 0, -1], [0, 0, 1], [0, 0, 0], [0, 0, 1]) * // { point: [0, 0, 0], t: 1 } */ export declare function rayPlaneIntersect(origin: readonly number[], dir: readonly number[], planePoint: readonly number[], planeNormal: readonly number[]): RayHit | null; /** Result of {@link segmentSegmentClosest}: the closest point on each segment and their distance. */ export interface SegmentClosestResult { /** Closest point on segment `[p1, p2]`. */ point1: number[]; /** Closest point on segment `[q1, q2]`. */ point2: number[]; /** Euclidean distance between `point1` and `point2`. */ distance: number; } /** * Closest points between two 3-D line segments `[p1, p2]` and `[q1, q2]` * (Ericson, *Real-Time Collision Detection*, `ClosestPtSegmentSegment`). * Returns the closest point on each segment and the distance between them * (`0` when the segments intersect). * * @example * segmentSegmentClosest([0,0,0], [1,1,0], [0,1,0], [1,0,0]) * // { point1: [0.5, 0.5, 0], point2: [0.5, 0.5, 0], distance: 0 } */ export declare function segmentSegmentClosest(p1: readonly number[], p2: readonly number[], q1: readonly number[], q2: readonly number[]): SegmentClosestResult; //# sourceMappingURL=intersect3d.d.ts.map