updated a bit
git-svn-id: svn://anubis/gvsu@371 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
1 parent
19223f3d3f
commit
ad262d3484
9 files changed
+87
-4
No files matched your search
@@ -4,7 +4,7 @@ OBJS := $(patsubst %.cc,%.o,$(wildcard *.cc))
|
||||
all: $(OBJS)
|
||||
|
||||
%.o: %.cc
|
||||
$(CXX) -c -o $@ $(CXXFLAGS) $<
|
||||
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
|
||||
|
||||
# Make dependency files
|
||||
%.dep: %.cc
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
#include "Sphere.h"
|
||||
#include "util/Solver.h"
|
||||
|
||||
Sphere::Sphere(double radius)
|
||||
{
|
||||
m_radius = radius;
|
||||
}
|
||||
|
||||
Solver::Result Sphere::intersect(const Ray & ray)
|
||||
{
|
||||
Solver::Result res;
|
||||
QuadraticSolver solver(1.0,
|
||||
2 * ( ray.getOrigin()[0] * ray.getDirection()[0]
|
||||
+ ray.getOrigin()[1] * ray.getDirection()[1]
|
||||
+ ray.getOrigin()[2] * ray.getDirection()[2] ),
|
||||
ray.getOrigin()[0] * ray.getOrigin()[0]
|
||||
+ ray.getOrigin()[1] * ray.getOrigin()[1]
|
||||
+ ray.getOrigin()[2] * ray.getOrigin()[2] );
|
||||
Solver::Result quadSolutions = solver.solve();
|
||||
return res;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
#ifndef SPHERE_H
|
||||
#define SPHERE_H SPHERE_H
|
||||
|
||||
#include "Shape.h"
|
||||
|
||||
class Sphere : public Shape
|
||||
{
|
||||
public:
|
||||
Sphere(double radius);
|
||||
Solver::Result intersect(const Ray & ray);
|
||||
|
||||
private:
|
||||
double m_radius;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user