Harium / propan

3D engine based on Etyl and LibGDX
0 stars 1 forks source link

Add collision between ray and cylinder #9

Open yuripourre opened 5 years ago

yuripourre commented 5 years ago

Maybe ray and circumference would be enough.

http://woo4.me/raytracer/translations/ http://woo4.me/wootracer/cylinder-intersection/

Displace Ray https://github.com/dom767/wootracer/blob/master/CoreTracer/CoreTracer/Code/RenderObject.cpp#L58

Calculate intersection https://github.com/dom767/wootracer/blob/master/CoreTracer/CoreTracer/Code/RenderCylinder.cpp#L20

yuripourre commented 5 years ago

https://github.com/lambdabaa/RayTracer/blob/master/ray/ray/surface/Cylinder.java

Transform your ray by the inverse of your cylinder matrix this way you have the ray in the local space of the cylinder. Then you can use the equation to find the intersection. https://forums.khronos.org/showthread.php/55954

https://www.csie.ntu.edu.tw/~cyy/courses/rendering/pbrt-2.00/html/cylinder_8cpp_source.html

Quadric - Ray Intersection https://gamedev.stackexchange.com/a/112895

yuripourre commented 5 years ago

Transform position and direction (and normalize)

https://gamedev.stackexchange.com/q/72440

Vector2.Transform() // applies the entire Matrix to the vector
Vector2.TransformNormal() // only applies the Scale and Rotational parts of the Matrix to the vector.