Small functions used throughout the codebase.
More...
|
| template<typename T > |
| __host__ __device__ T | reg23::Square (const T &x) |
| | Returns the square of the given value.
|
| |
| template<typename T > |
| __host__ __device__ T | reg23::Modulo (const T &x, const T &y) |
| | Modulo operation that respect the sign.
|
| |
| template<typename T > |
| __host__ __device__ T | reg23::Sign (const T &x) |
| |
| template<typename T , std::size_t faceCount> |
| __host__ __device__ T | reg23::RayConvexPolyhedronDistance (const std::array< Vec< T, 3 >, faceCount > &facePoints, const std::array< Vec< T, 3 >, faceCount > &faceOutUnitNormals, const Vec< T, 3 > &rayPoint, const Vec< T, 3 > &rayUnitDirection) |
| | Calculate the length of the intersection between a ray and a convex polyhedron.
|
| |
Small functions used throughout the codebase.
◆ Modulo()
Modulo operation that respect the sign.
- Template Parameters
-
| T | Type of the parameters and result |
- Parameters
-
- Returns
- x modulo y, respecting the sign of x.
◆ RayConvexPolyhedronDistance()
Calculate the length of the intersection between a ray and a convex polyhedron.
- Template Parameters
-
| T | Real type |
| faceCount | Number of faces of the polyhedron |
- Parameters
-
| facePoints | An array of points, one for each polyhedron face, where each point lies on its corresponding face |
| faceOutUnitNormals | An array of unit vectors, one for each polyhedron face, where each vector is the outward-facing normal vector of its corresponding face |
| rayPoint | A point that lies on the given ray |
| rayUnitDirection | A unit vector parallel to the given ray's direction |
- Returns
- The length of the section of the given ray that lies within the given polyhedron. If such a section doesn't exist, 0 is returned.
The polyhedron is defined by its faces. Each face is defined with an intersecting point and a unit normal vector. The ray is defined by an intersecting point and a unit direction vector. The ray is considered to be infinite; this function will return the same value if rayUnitDirection is multiplied by -1. The number of faces that the polyhedron has must be known at compile time.
◆ Sign()
◆ Square()
Returns the square of the given value.
- Template Parameters
-
| T | Type of parameter and result |
- Parameters
-
- Returns
- The input value squared using
operator*