Class NwcSpatialIndex
- Namespace
- NwcIO.Model.Spatial
- Assembly
- NwcIO.dll
A fast 3D Bounding Volume Hierarchy (BVH) spatial index over polygon meshes, enabling sub-millisecond bounding box queries, raycasting, and element selection.
public sealed class NwcSpatialIndexInheritance
Inherited Members
Constructors
NwcSpatialIndex(IReadOnlyList<NwcMesh>)
public NwcSpatialIndex(IReadOnlyList<NwcMesh> meshes)Parameters
meshesIReadOnlyList<NwcMesh>
Properties
Bounds
public BoundingBox3d Bounds { get; }Property Value
LeafCount
public int LeafCount { get; }Property Value
MaxDepth
public int MaxDepth { get; }Property Value
MeshCount
public int MeshCount { get; }Property Value
NodeCount
public int NodeCount { get; }Property Value
Methods
IntersectTriangle(Vector3d, Vector3d, Vector3d, Vector3d, Vector3d, out double, out Vector3d)
Möller–Trumbore ray-triangle intersection algorithm.
public static bool IntersectTriangle(Vector3d origin, Vector3d dir, Vector3d v0, Vector3d v1, Vector3d v2, out double t, out Vector3d normal)Parameters
Returns
QueryBox(BoundingBox3d)
Finds all meshes whose world bounding box intersects box.
public IReadOnlyList<NwcMesh> QueryBox(BoundingBox3d box)Parameters
boxBoundingBox3d
Returns
Raycast(Vector3d, Vector3d, out RaycastHit, double)
Performs a 3D raycast and returns the closest geometric intersection hit, if any.
public bool Raycast(Vector3d origin, Vector3d direction, out RaycastHit hit, double maxDistance = Infinity)Parameters
originVector3ddirectionVector3dhitRaycastHitmaxDistancedouble
Returns
RaycastAll(Vector3d, Vector3d, double)
Performs a 3D raycast and returns all geometric intersections sorted by distance.
public IReadOnlyList<RaycastHit> RaycastAll(Vector3d origin, Vector3d direction, double maxDistance = Infinity)