summaryrefslogtreecommitdiff
path: root/lib/ray.hpp
blob: 8bef1c868dcccfdea67543ca2e06a464504f22e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#pragma once

#include <glm/glm.hpp>
#include <span>

class Ray {
public:
	Ray(glm::vec3 start, glm::vec3 direction) : start {start}, direction {direction} { }

	glm::vec3 start;
	glm::vec3 direction;

	float distanceToLine(const glm::vec3 & a, const glm::vec3 & b) const;
	bool passesCloseToEdges(const std::span<const glm::vec3> positions, float distance) const;
};