1 / 5

Intersecting a Bounding Sphere

Intersecting a Bounding Sphere. float intersectRaySphere (Ray ray,Sphere sphere) { Vec dst = ray.o - sphere.o ; Real B = dot( dst,ray.d ); Real C = dot( dst,dst ) - sphere.r2; Real D = B*B - C; return D > 0 ? - B - sqrt (D) : std:: numeric_limits <float>::infinity(); }. Quaternions.

kerem
Download Presentation

Intersecting a Bounding Sphere

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Intersecting a Bounding Sphere • float intersectRaySphere(Ray ray,Sphere sphere) { Vecdst = ray.o - sphere.o; Real B = dot(dst,ray.d); Real C = dot(dst,dst) - sphere.r2; Real D = B*B - C; return D > 0 ? - B - sqrt(D) : std::numeric_limits<float>::infinity(); }

  2. Quaternions

  3. What are Quaternions? • An element of the 4-Dimensional vector-space

  4. Why do you need quaternions? • No Gimbal Lock • They only require 4 numbers, to represent the equiv. of a 3x3 Matrix (9 Numbers) • Angle / Axis conversions are simple • Normalising Quaternions vs. Orthogonalising Matrices • Multiplicative like matrices

  5. What a Quaternion looks like • w + xi + yj + zk (i, j, and k are imaginary numbers)

More Related