Search:
Forum
General C++ Programming
Ray sphere intersection
Ray sphere intersection
Nov 26, 2021 at 6:14pm UTC
Sruthi04
(1)
I would need to create a ray sphere intersection in C++. Kindly help me with creating a sphere first then do a ray sphere intersection.
Nov 26, 2021 at 7:00pm UTC
jonnin
(11437)
Sruthi04 (1)
I would need to create a ray sphere intersection in C++. Kindly help me with creating a sphere first then do a ray sphere intersection.
a sphere is simply x*x+y*y + z*z - r*r = 0
that is the surface, so an inequality gives you the volume if you need all the points inside it too.
if a ray intersects it, then, the equation of the ray (3d line, read this and pick a way to handle it
https://math.stackexchange.com/questions/404440/what-is-the-equation-for-a-3d-line)
is going to be equal to the above (for the same x,y, and z in both equations).
if there is no solution, they do not intersect.
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs