@realsee/five
Version:
Realsee Renderer SDK
30 lines (29 loc) • 1.34 kB
TypeScript
import type { BVHVector3, BVHBox3 } from "./bvhMath";
/**
* A node in the BVH structure
* @param extents - the min coords of this node's bounding box
* @param startIndex - an index in the bbox array, where the first element of this node is located
* @param endIndex - an index in the bbox array, where the last of this node is located, plus 1 (meaning that its non-inclusive).
* @param level - distance of this node from the root for the bvh tree. root node has level=0, its children have level=1 etc.
*/
export declare class BVHNode {
id: number;
extents: number[];
startIndex: number;
endIndex: number;
deepth: number;
node0?: BVHNode;
node1?: BVHNode;
constructor(id: number, extents: number[], startIndex: number, endIndex: number, deepth: number);
}
export declare const BYTES_PER_NODE: number;
export declare function packBVHNode(root: BVHNode, length: number): ArrayBuffer;
export declare function containsNodeBox(point: BVHVector3, box: BVHBox3, threshold?: number): boolean;
/**
* 计算射线和 BVHNode 的相交
* @param rayOrigin - 射线原点
* @param invRayDirection - 1 / 射线方向
* @param node - BVHNode
* @param threshold - 扩大
*/
export declare function intersectNodeBox(rayOrigin: BVHVector3, invRayDirection: BVHVector3, box: BVHBox3, threshold?: number): number | null;