RayMarching  0.0.1
Simple 3D engine based on a ray marching rendering
algebra.h
1 #ifndef RAYMARCHING_ALGEBRA_H
2 #define RAYMARCHING_ALGEBRA_H
3 
4 #include <cfloat>
5 #include <cmath>
6 #include <iostream>
7 #include <Eigen/Dense>
8 
9 namespace RayMarching {
10 
14  class Line {
15  private:
16  Eigen::Vector3d begin;
17  Eigen::Vector3d direction;
18  double _dir_norm;
19  double _t;
20  public:
21  Line(Eigen::Vector3d direction, Eigen::Vector3d begin)
22  : begin(std::move(begin)), direction(std::move(direction)), _t(0), _dir_norm(direction.norm()) {}
23 
24  void moveBy(double distance);
25  void reset() { _t = 0; }
26  [[nodiscard]] Eigen::Vector3d getVec() const;
27  [[nodiscard]] Eigen::Vector3d getDirection() const { return direction; }
28  };
29 }
30 
31 #endif //RAYMARCHING_ALGEBRA_H
Marching Ray implementation.
Definition: algebra.h:14
Namespace containing all tools implemented within RayMarching package.
Definition: algebra.h:9