Performant ray intersection engine for CPU and GPU.
To get started with RayCaster.jl, first add the package to your Julia environment:
using Pkg
Pkg.add(url="https://github.com/JuliaGeometry/RayCaster.jl")
Then you can create a basic ray intersection scene:
using RayCaster, GeometryBasics, LinearAlgebra
# Create some simple spheres
function LowSphere(radius, contact=Point3f(0); ntriangles=10)
return Tesselation(Sphere(contact .+ Point3f(0, 0, radius), radius), ntriangles)
end
# Build a scene with multiple objects
s1 = LowSphere(0.5f0, Point3f(-0.5, 0.0, 0); ntriangles=10)
s2 = LowSphere(0.3f0, Point3f(1, 0.5, 0); ntriangles=10)
# Create BVH acceleration structure
bvh = RayCaster.BVHAccel([s1, s2])
# Perform ray-scene intersections
viewdir = normalize(Vec3f(0, 0, -1))
hitpoints, centroid = RayCaster.get_centroid(bvh, viewdir)
For detailed examples and API documentation, see the full documentation.