|
1 | 1 | # RayCaster.jl |
2 | 2 |
|
| 3 | +[](https://github.com/JuliaGeometry/RayCaster.jl/actions/workflows/ci.yml?query=branch%3Amaster) |
| 4 | +[](https://juliageometry.github.io/RayCaster.jl/stable/) |
| 5 | +[](https://juliageometry.github.io/RayCaster.jl/dev/) |
| 6 | + |
3 | 7 | Performant ray intersection engine for CPU and GPU. |
| 8 | + |
| 9 | +## Getting Started |
| 10 | + |
| 11 | +To get started with RayCaster.jl, first add the package to your Julia environment: |
| 12 | + |
| 13 | +```julia |
| 14 | +using Pkg |
| 15 | +Pkg.add("RayCaster") |
| 16 | +``` |
| 17 | + |
| 18 | +Then you can create a basic ray intersection scene: |
| 19 | + |
| 20 | +```julia |
| 21 | +using RayCaster, GeometryBasics, LinearAlgebra |
| 22 | + |
| 23 | +# Create some simple spheres |
| 24 | +function LowSphere(radius, contact=Point3f(0); ntriangles=10) |
| 25 | + return Tesselation(Sphere(contact .+ Point3f(0, 0, radius), radius), ntriangles) |
| 26 | +end |
| 27 | + |
| 28 | +# Build a scene with multiple objects |
| 29 | +s1 = LowSphere(0.5f0, Point3f(-0.5, 0.0, 0); ntriangles=10) |
| 30 | +s2 = LowSphere(0.3f0, Point3f(1, 0.5, 0); ntriangles=10) |
| 31 | + |
| 32 | +# Create BVH acceleration structure |
| 33 | +bvh = RayCaster.BVHAccel([s1, s2]) |
| 34 | + |
| 35 | +# Perform ray-scene intersections |
| 36 | +viewdir = normalize(Vec3f(0, 0, -1)) |
| 37 | +hitpoints, centroid = RayCaster.get_centroid(bvh, viewdir) |
| 38 | +``` |
| 39 | + |
| 40 | +## Documentation |
| 41 | + |
| 42 | +For detailed examples and API documentation, see the [full documentation](https://juliageometry.github.io/RayCaster.jl/). |
0 commit comments