BoundingVolumeHierarchies

所属分类:其他
开发工具:Julia
文件大小:0KB
下载次数:0
上传日期:2019-08-28 09:12:08
上 传 者sh-1993
说明:  基于轴对齐包围盒(AABB)的包围体层次结构可以加速三角网格线段相交检测...
(Bounding Volume Hierarchies based on axis aligned bounding boxes (AABB) to speed up line segment intersection detection with triangular meshes.)

文件列表:
Manifest.toml (3389, 2019-08-28)
Project.toml (425, 2019-08-28)
examples/ (0, 2019-08-28)
examples/example.jl (2360, 2019-08-28)
images/ (0, 2019-08-28)
images/cat_bvh.png (393293, 2019-08-28)
images/cat_segment_intersection.png (369256, 2019-08-28)
src/ (0, 2019-08-28)
src/AABB.jl (829, 2019-08-28)
src/BVH.jl (2492, 2019-08-28)
src/BoundingVolumeHierarchies.jl (893, 2019-08-28)
src/BoxedCells.jl (2715, 2019-08-28)
src/Intersection.jl (2042, 2019-08-28)
test/ (0, 2019-08-28)
test/runtests.jl (1351, 2019-08-28)

This package implements some basic functionality of a __Bounding Volume Hierarchy__ (`BVH`) of face indices from a triangular mesh, in particular a `intersection(segment::Segment, bvh::BVH, vertices, faces, facenormals)` function which gives `true/false` if the segment intersects with the mesh. As the face indices are stored in a `BVH`, this method seeks to minimize the needed number of evaluated cell intersection checks. The bounding volumes are axis aligned bounding boxes (`AABB`). The implementation uses `GeometryTypes.jl`, in particular it assumes that all points is of type `Point{3, Float32}` (denoted `PointT` in the code). _Discalimer_: If you look for a performant BVH library for e.g. ray tracing, look elsewhere. I made this mostly for educational purposes, and had no prior experience in computer graphics. Please let me know if there are simple algorithmic or implementation specific changes which could speed it up. ### Images Generated by [`examples/example.jl`](https://github.com/jonalm/BoundingVolumeHierarchies.jl/blob/master/examples/example.jl) Plot of a cat mesh together with the bounding boxes (AABB) in the bounding volume hierarchy (BVH): Plot of a mesh together with a scatter of the end points of a set of segments. All segments starts at the same center point (large orange ball), and end on a plane on the opposite side of the cat mesh. End points are colored black if the segment intersects with the cat mesh and orange otherwise. ### API See `examples/example.jl` for more details. Assume that the triangular mesh is identified by a `vertices` buffer, a `faces` buffer, (containing triplets of indices of the vertex buffer which identifies mesh cells) and a `facenormals` buffer which contains normal vectors for each cell. Create a bounding volume hierarchy of the indices of the faces. The cells are divided greedily based on a "Surface Area Heuristic" method [described in section 2.2 here](https://github.com/jonalm/BoundingVolumeHierarchies.jl/blob/master/http://www.sci.utah.edu/~wald/Publications/2007/ParallelBVHBuild/fastbuild.pdf). ``` bvh = buildBVM(vertices, faces) ``` Create a line segment from point `a` to point `b`. ``` seg = Segment(a, b) ``` Check whether the line segment crosses any of the faces in the mesh. ``` hit = intersection(seg, bvh, vertices, faces, facenormals) # true/false ``` Note: The intersection assumes signed mesh cells, and directional `Segments` (from `a` to `b`). An intersection occurs only if the line segments crosses the positive side of the cell, in the positive segment direction (i.e. `a` has to be on the positive side of the cell, and `b` has to be on the negative side).

近期下载者

相关文件


收藏者