12 #ifndef RAYPLANEHITTEST_H_6014714286
13 #define RAYPLANEHITTEST_H_6014714286
15 #include <Carna/Carna.h>
48 template<
typename VectorType,
typename ScalarType >
53 VectorType myHitLocation;
86 template<
typename VectorType,
typename ScalarType >
88 : myHitExists( false )
93 template<
typename VectorType,
typename ScalarType >
100 template<
typename VectorType,
typename ScalarType >
104 return myHitLocation;
108 template<
typename VectorType,
typename ScalarType >
111 ,
const VectorType& planeNormal
112 , ScalarType planeOriginOffset )
115 CARNA_ASSERT( isEqual< ScalarType >( planeNormal.norm(), 1 ) );
119 if( isEqual< ScalarType >( ray.
direction.dot( planeNormal ), 0 ) )
125 const ScalarType rayLength = ( planeOriginOffset - ray.
origin.dot( planeNormal ) ) / ray.
direction.dot( planeNormal );
147 #endif // RAYPLANEHITTEST_H_6014714286
Defines Carna::base::math namespace and CARNA_FOR_VECTOR3UI.
RayPlaneHitTest()
Instantiates.
bool hitExists() const
Tells whether a hit exists.
VectorType origin
Holds the origin of this ray.
void compute(const Ray< VectorType > &ray, const VectorType &planeNormal, ScalarType planeOriginOffset)
Performs a hit test of ray with the plane with planeNormal and planeOriginOffset. Use hitExists and h...
Defines ray in where is the Scalar type derived from VectorType and is dimension of VectorType...
VectorType direction
Holds the direction of this ray.
Defines Carna::base::CarnaException, Carna::base::AssertionFailure.
const VectorType & hitLocation() const
References the location of the hit.
bool isEqual(const InputType &x, const InputType &y)
Tells whether two objects are equal respectively to epsilon.
Defines Carna::base::math::Ray.
#define CARNA_ASSERT(expression)
If the given expression is false, a break point is raised in debug mode and an AssertionFailure throw...
Tests whether particular plane is hit by a Ray object.