diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-09 23:29:00 +0100 | 
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-09 23:29:00 +0100 | 
| commit | b6b3944e9507f337f77a72ea44b5c0ccba7a2c01 (patch) | |
| tree | a487df54853522f973ed987006e787117804b9eb /lib/geometricPlane.h | |
| parent | Swap messy glmvec wrapper for OpenMesh Point/Normal with real glm::vec and a ... (diff) | |
| parent | Move remaining split/plane functions to use library (diff) | |
| download | ilt-b6b3944e9507f337f77a72ea44b5c0ccba7a2c01.tar.bz2 ilt-b6b3944e9507f337f77a72ea44b5c0ccba7a2c01.tar.xz ilt-b6b3944e9507f337f77a72ea44b5c0ccba7a2c01.zip | |
Merge branch 'model-factory-textures'
Diffstat (limited to 'lib/geometricPlane.h')
| -rw-r--r-- | lib/geometricPlane.h | 22 | 
1 files changed, 22 insertions, 0 deletions
| diff --git a/lib/geometricPlane.h b/lib/geometricPlane.h new file mode 100644 index 0000000..dc8df50 --- /dev/null +++ b/lib/geometricPlane.h @@ -0,0 +1,22 @@ +#pragma once + +#include <glm/vec3.hpp> +#include <optional> + +class Ray; + +class GeometricPlane { +public: +	struct DistAndPosition { +		float dist; +		glm::vec3 position; +	}; +	enum class PlaneRelation { Above, Below, On }; + +	glm::vec3 origin, normal; + +	PlaneRelation getRelation(glm::vec3 point) const; +	std::optional<DistAndPosition> getRayIntersectPosition(const Ray &) const; + +	static bool isIntersect(PlaneRelation a, PlaneRelation b); +}; | 
