RobinTrace
shape.h
Go to the documentation of this file.
1 
2 #ifndef SHAPE_H
3 #define SHAPE_H
4 
5 #include "ray/ray.h"
6 #include "base/Vec3.h"
7 #include <cmath>
8 #include <string>
9 #include <sstream>
10 
12 class shape {
13  private:
15  virtual void intersect (ray &r) = 0;
17  virtual Vec3 normal (const ray &r) = 0;
19  virtual std::string print_str () const = 0;
20 
22  friend std::ostream& operator<< (std::ostream &out, const shape &shp) {
23  out << shp.print_str();
24  return out;
25  };
26 };
27 
28 #endif //SHAPE_H
Eigen::Vector3d Vec3
Definition: Vec3.h:11
Class for individual rays.
Definition: ray.h:9
Virtual class for shapes.
Definition: shape.h:12
friend std::ostream & operator<<(std::ostream &out, const shape &shp)
Printer.
Definition: shape.h:22
virtual std::string print_str() const =0
String for printing the object.
virtual void intersect(ray &r)=0
Operate the intersection of ray r with shape.
virtual Vec3 normal(const ray &r)=0
Compute the normal of shape at current ray r position.