Skip to content

janmodderman/TriangleIntersect.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Fast ray-triangle intersections for raytracing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Julia 100.0%