gramods
Loading...
Searching...
No Matches
IntersectionLine.hh
1
2#ifndef GRAMODS_GRAPHICS_INTERSECTIONLINE
3#define GRAMODS_GRAPHICS_INTERSECTIONLINE
4
5#include <gmGraphics/config.hh>
6
7#include <Eigen/Eigen>
8#include <optional>
9
10BEGIN_NAMESPACE_GMGRAPHICS;
11
20 static IntersectionLine lineSegment(Eigen::Vector3f p0, Eigen::Vector3f p1);
21
26 static IntersectionLine forwardRay(Eigen::Vector3f p0, Eigen::Vector3f dir);
27
32 static IntersectionLine infiniteRay(Eigen::Vector3f p0, Eigen::Vector3f dir);
33
37 IntersectionLine getInSpace(const Eigen::Affine3f &M) const;
38
43 inline Eigen::Vector3f getPosition(float ratio) { return p0 + dir * ratio; }
44
45 const Eigen::Vector3f p0; //< Segment start
46 const Eigen::Vector3f dir; //< Segment edge
47 const Eigen::Vector3f dir_inv; //< Inverted edge
48 const std::optional<float> start; //< Start ratio on segment
49 const std::optional<float> stop; //< End ratio on segment
50};
51
52END_NAMESPACE_GMGRAPHICS;
53
54#endif
Line for intersection with ray or segment.
Definition IntersectionLine.hh:15
Eigen::Vector3f getPosition(float ratio)
Returns the position on the line that corresponds to the specified ratio.
Definition IntersectionLine.hh:43