Added missing power
This commit is contained in:
parent
48432337c6
commit
f37b8bc9c6
1 changed files with 2 additions and 3 deletions
|
@ -12,8 +12,6 @@ Sphere::Sphere(Vector3d const ¢er, float radius, std::shared_ptr<Shader> con
|
|||
// Primitive functions /////////////////////////////////////////////////////////
|
||||
|
||||
bool Sphere::intersect(Ray &ray) const {
|
||||
// IMPLEMENT ME!
|
||||
|
||||
// Determine whether the ray intersects the sphere
|
||||
float A = pow(ray.direction[Vector3d::Dimension::X], 2) +
|
||||
pow(ray.direction[Vector3d::Dimension::Y], 2) +
|
||||
|
@ -25,7 +23,8 @@ bool Sphere::intersect(Ray &ray) const {
|
|||
);
|
||||
float C = pow(ray.origin[Vector3d::Dimension::X], 2) +
|
||||
pow(ray.origin[Vector3d::Dimension::Y], 2) +
|
||||
pow(ray.origin[Vector3d::Dimension::Z], 2) - this->radius;
|
||||
pow(ray.origin[Vector3d::Dimension::Z], 2) -
|
||||
pow(this->radius, 2);
|
||||
|
||||
float t = INFINITY;
|
||||
|
||||
|
|
Loading…
Reference in a new issue