cone.h 798 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * Cone header
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #ifndef DORAYME_CONE_H
  10. #define DORAYME_CONE_H
  11. #include <shape.h>
  12. #include <ray.h>
  13. #include <intersect.h>
  14. #include <renderstat.h>
  15. class Cone : public Shape {
  16. protected:
  17. Intersect localIntersect(Ray r);
  18. Tuple localNormalAt(Tuple point);
  19. bool checkCap(Ray r, double t, double y);
  20. void intersectCaps(Ray r, Intersect &xs);
  21. public:
  22. bool isClosed;
  23. double minCap;
  24. double maxCap;
  25. Cone() : minCap(-INFINITY), maxCap(INFINITY), isClosed(false), Shape(SHAPE_CONE) { stats.addCone(); };
  26. BoundingBox getBounds();
  27. bool haveFiniteBounds() { return !(isinf(this->minCap) || isinf(this->maxCap)); };
  28. };
  29. #endif /* DORAYME_CONE_H */