TriangleIntersect.jl

Fast ray-triangle intersections for raytracing
Popularity
13 Stars
Updated Last
9 Months Ago
Started In
October 2014

Build Status Coverage Status

TriangleIntersect

Find if and where a light ray intersects a triangle (in 3D of course). This is optimized for speed. See nice general explanation here

Installation

Pkg.clone("git://github.com/JuliaGeometry/TriangleIntersect.jl.git")

#Usage Import and create some points:

using TriangleIntersect
a = Point(0,0,0)
b = Point(1,0,0)
c = Point(0,1,0)

Create a triangle

t = Triangle(b,a,c)

Cast a ray:

r = Ray(Point(0.1,0.1,1), Point(0.1,0.1,-1))

Check the intersection:

intersect(r, t) # -> Intersection(Point(0.2,0.2,0.0),1.02,true)

The Intersection type is simply defined as:

immutable Intersection
    ip::Point # intersecting point
    id::Float64 # intersecting distance
    is_intersection::Bool
end