This repository has been archived on 2024-12-30. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2024CG-project-render/lab1/Plane.cpp
Tibo De Peuter d9cf26902e
Some checks failed
CMake / build (zip, zip, [self-hosted Linux], raytracing, ux) (push) Has been cancelled
CMake / build (zip, zip, [self-hosted Windows], Release/raytracing.exe, win) (push) Has been cancelled
chore: Cleanup
2024-10-25 17:50:44 +02:00

16 lines
380 B
C++

#include "Plane.h"
#include "Ray.h"
bool Plane::intersect(
const Ray &ray, const double min_t, double &t, Eigen::Vector3d &n) const {
/* Based on
* Computer Graphics, Chapter 4. Ray Tracing
* Peter Lambert & Glenn Van Wallendael
*/
t = -1;
t = (point - ray.origin).dot(normal) / ray.direction.dot(normal);
n = normal;
return min_t < t;
}