sphere drawing, but stretched horizontally... have to figure that out yet
git-svn-id: svn://anubis/fart/trunk@40 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
1 parent
97b9fa9eab
commit
a1c81e5adc
4 files changed
+28
-8
No files matched your search
+5
-1
@@ -1,10 +1,13 @@
|
||||
|
||||
#include "Sphere.h"
|
||||
#include "util/Solver.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
Sphere::Sphere(double radius)
|
||||
{
|
||||
m_radius = radius;
|
||||
m_radius2 = radius * radius;
|
||||
}
|
||||
|
||||
Solver::Result Sphere::intersect(const Ray & ray)
|
||||
@@ -16,7 +19,8 @@ Solver::Result Sphere::intersect(const Ray & ray)
|
||||
+ ray.getOrigin()[2] * ray.getDirection()[2] ),
|
||||
ray.getOrigin()[0] * ray.getOrigin()[0]
|
||||
+ ray.getOrigin()[1] * ray.getOrigin()[1]
|
||||
+ ray.getOrigin()[2] * ray.getOrigin()[2] );
|
||||
+ ray.getOrigin()[2] * ray.getOrigin()[2]
|
||||
- m_radius2);
|
||||
Solver::Result quadSolutions = solver.solve();
|
||||
int resIdx = 0;
|
||||
for (int i = 0; i < quadSolutions.numResults; i++)
|
||||
|
||||
@@ -12,6 +12,7 @@ class Sphere : public Shape
|
||||
|
||||
private:
|
||||
double m_radius;
|
||||
double m_radius2;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user