MVE - Multi-View Environment mve-devel
|
Computation of geometric quantities and predicates. More...
Functions | |
template<typename T , int N> | |
bool | box_box_overlap (math::Vector< T, N > const &b1min, math::Vector< T, N > const &b1max, math::Vector< T, N > const &b2min, math::Vector< T, N > const &b2max) |
Returns true if the given boxes overlap, false otherwise. | |
template<typename T > | |
math::Vector< T, 3 > | circumsphere_center (math::Vector< T, 3 > const &a, math::Vector< T, 3 > const &b, math::Vector< T, 3 > const &c, math::Vector< T, 3 > const &d) |
Returns the center of the circumsphere defined by the four given vertices. | |
template<typename T > | |
float | circumsphere_radius (math::Vector< T, 3 > const &a, math::Vector< T, 3 > const &b, math::Vector< T, 3 > const &c, math::Vector< T, 3 > const &d) |
Returns the circumsphere radius of the sphere defined by a, b, c, d. | |
template<typename T > | |
float | circumsphere_test (math::Vector< T, 3 > const &a, math::Vector< T, 3 > const &b, math::Vector< T, 3 > const &c, math::Vector< T, 3 > const &d, math::Vector< T, 3 > const &p) |
Tests whether vertex 'p' is contained in the circumsphere defined by the four vertices a,b,c,d. | |
template<typename T > | |
float | insphere_radius (math::Vector< T, 3 > const &a, math::Vector< T, 3 > const &b, math::Vector< T, 3 > const &c, math::Vector< T, 3 > const &d) |
Returns the insphere radius of the tetrahedron defined by a, b, c, d. | |
template<typename T > | |
bool | plane_box_overlap (math::Vector< T, 3 > const &normal, math::Vector< T, 3 > const &pos, math::Vector< T, 3 > const &boxhalfsize) |
Returns true if the given plane (in Hesse normal form) and a box in the origin given by 'boxhalfsizes' overlap, false otherwise. | |
template<typename T , int N> | |
bool | point_box_overlap (math::Vector< T, N > const &point, math::Vector< T, N > const &aabb_min, math::Vector< T, N > const &aabb_max) |
Returns true if the given point overlaps with the axis-aligned box. | |
template<typename T > | |
bool | points_coplanar (math::Vector< T, 3 > const &a, math::Vector< T, 3 > const &b, math::Vector< T, 3 > const &c, math::Vector< T, 3 > const &d, T const &cos_angle) |
Tests whether four points are coplanar. | |
template<typename T > | |
bool | ray_box_overlap (math::Vector< T, 3 > const &origin, math::Vector< T, 3 > const &dir, math::Vector< T, 3 > const &box_min, math::Vector< T, 3 > const &box_max) |
Returns true if the given ray intersects with the given axis-aligned bounding box, false otherwise. | |
template<typename T > | |
math::Vector< T, 2 > | ray_ray_intersect (math::Vector< T, 3 > const &p1, math::Vector< T, 3 > const &d1, math::Vector< T, 3 > const &p2, math::Vector< T, 3 > const &d2) |
Intersects the given rays with each other. | |
template<typename T > | |
T | ray_triangle_intersect (math::Vector< T, 3 > const &origin, math::Vector< T, 3 > const &dir, math::Vector< T, 3 > const &a, math::Vector< T, 3 > const &b, math::Vector< T, 3 > const &c, float *bary=0) |
Intersects the given ray with the given triangle and returns the 't' parameter of the intersection point wrt the ray. | |
template<typename T > | |
math::Vector< T, 3 > | tetrahedron_bary (math::Vector< T, 3 > const &a, math::Vector< T, 3 > const &b, math::Vector< T, 3 > const &c, math::Vector< T, 3 > const &d, math::Vector< T, 3 > const &p) |
Calculates the barycentric coordinates of point 'p' with respect to the tetrahedron given by vertices a,b,c,d. | |
template<typename T > | |
T | tetrahedron_orientation (math::Vector< T, 3 > const &a, math::Vector< T, 3 > const &b, math::Vector< T, 3 > const &c, math::Vector< T, 3 > const &d) |
Calculates the orientation of the given tetrahedron. | |
template<typename T > | |
T | tetrahedron_volume (math::Vector< T, 3 > const &a, math::Vector< T, 3 > const &b, math::Vector< T, 3 > const &c, math::Vector< T, 3 > const &d) |
Calculates the volume of the given tetraheron. | |
template<typename T > | |
T | triangle_area (math::Vector< T, 3 > const &a, math::Vector< T, 3 > const &b, math::Vector< T, 3 > const &c) |
Calculates the area of the given triangle. | |
template<typename T > | |
bool | triangle_box_overlap (math::Vector< T, 3 > const &boxcenter, math::Vector< T, 3 > const &boxhalfsize, math::Vector< T, 3 > const &a, math::Vector< T, 3 > const &b, math::Vector< T, 3 > const &c) |
Returns true if the given triangle and box overlap, false otherwise. | |
Computation of geometric quantities and predicates.
bool math::geom::box_box_overlap | ( | math::Vector< T, N > const & | b1min, |
math::Vector< T, N > const & | b1max, | ||
math::Vector< T, N > const & | b2min, | ||
math::Vector< T, N > const & | b2max | ||
) |
Returns true if the given boxes overlap, false otherwise.
Defined for boxes in arbitrary dimension.
Definition at line 321 of file octree_tools.h.
math::Vector< T, 3 > math::geom::circumsphere_center | ( | math::Vector< T, 3 > const & | a, |
math::Vector< T, 3 > const & | b, | ||
math::Vector< T, 3 > const & | c, | ||
math::Vector< T, 3 > const & | d | ||
) |
Returns the center of the circumsphere defined by the four given vertices.
The vertices are expected to be in general position. http://www.cgafaq.info/wiki/Tetrahedron_Circumsphere
Definition at line 129 of file geometry.h.
float math::geom::circumsphere_radius | ( | math::Vector< T, 3 > const & | a, |
math::Vector< T, 3 > const & | b, | ||
math::Vector< T, 3 > const & | c, | ||
math::Vector< T, 3 > const & | d | ||
) |
Returns the circumsphere radius of the sphere defined by a, b, c, d.
Involves one square root.
Definition at line 151 of file geometry.h.
float math::geom::circumsphere_test | ( | math::Vector< T, 3 > const & | a, |
math::Vector< T, 3 > const & | b, | ||
math::Vector< T, 3 > const & | c, | ||
math::Vector< T, 3 > const & | d, | ||
math::Vector< T, 3 > const & | p | ||
) |
Tests whether vertex 'p' is contained in the circumsphere defined by the four vertices a,b,c,d.
The function returns a positive value if the point is contained in the sphere, and a negative value otherwise. The returned valued is actually the different between the squared radius of the sphere minus the squared distance of the point to the circumsphere center. http://www.cgafaq.info/wiki/Tetrahedron_Circumsphere
Definition at line 184 of file geometry.h.
float math::geom::insphere_radius | ( | math::Vector< T, 3 > const & | a, |
math::Vector< T, 3 > const & | b, | ||
math::Vector< T, 3 > const & | c, | ||
math::Vector< T, 3 > const & | d | ||
) |
Returns the insphere radius of the tetrahedron defined by a, b, c, d.
Involves four square roots.
Definition at line 167 of file geometry.h.
bool math::geom::plane_box_overlap | ( | math::Vector< T, 3 > const & | normal, |
math::Vector< T, 3 > const & | pos, | ||
math::Vector< T, 3 > const & | boxhalfsize | ||
) |
Returns true if the given plane (in Hesse normal form) and a box in the origin given by 'boxhalfsizes' overlap, false otherwise.
Definition at line 188 of file octree_tools.h.
bool math::geom::point_box_overlap | ( | math::Vector< T, N > const & | point, |
math::Vector< T, N > const & | aabb_min, | ||
math::Vector< T, N > const & | aabb_max | ||
) |
Returns true if the given point overlaps with the axis-aligned box.
Defined for points and boxes in arbitrary dimension.
Definition at line 357 of file octree_tools.h.
bool math::geom::points_coplanar | ( | math::Vector< T, 3 > const & | a, |
math::Vector< T, 3 > const & | b, | ||
math::Vector< T, 3 > const & | c, | ||
math::Vector< T, 3 > const & | d, | ||
T const & | cos_angle | ||
) |
Tests whether four points are coplanar.
Involves two square roots! This is done by calculating a "normalized" version of the triple product of three edges such that the resulting value is the cosine of an angle, which is zero if the points are coplanar.
Definition at line 277 of file geometry.h.
bool math::geom::ray_box_overlap | ( | math::Vector< T, 3 > const & | origin, |
math::Vector< T, 3 > const & | dir, | ||
math::Vector< T, 3 > const & | box_min, | ||
math::Vector< T, 3 > const & | box_max | ||
) |
Returns true if the given ray intersects with the given axis-aligned bounding box, false otherwise.
Definition at line 229 of file octree_tools.h.
math::Vector< T, 2 > math::geom::ray_ray_intersect | ( | math::Vector< T, 3 > const & | p1, |
math::Vector< T, 3 > const & | d1, | ||
math::Vector< T, 3 > const & | p2, | ||
math::Vector< T, 3 > const & | d2 | ||
) |
Intersects the given rays with each other.
It returns t1 and t2 with the minimal distance between (t1*d1+p1) and (t2*d2+p2).
Definition at line 334 of file octree_tools.h.
T math::geom::ray_triangle_intersect | ( | math::Vector< T, 3 > const & | origin, |
math::Vector< T, 3 > const & | dir, | ||
math::Vector< T, 3 > const & | a, | ||
math::Vector< T, 3 > const & | b, | ||
math::Vector< T, 3 > const & | c, | ||
float * | bary = 0 |
||
) |
Intersects the given ray with the given triangle and returns the 't' parameter of the intersection point wrt the ray.
If the ray does not hit the triangle, 't'=0 is returned. The algorithm optionally returns the barycentric coordinates in 'bary' if 'bary' is not null.
Definition at line 267 of file octree_tools.h.
math::Vector< T, 3 > math::geom::tetrahedron_bary | ( | math::Vector< T, 3 > const & | a, |
math::Vector< T, 3 > const & | b, | ||
math::Vector< T, 3 > const & | c, | ||
math::Vector< T, 3 > const & | d, | ||
math::Vector< T, 3 > const & | p | ||
) |
Calculates the barycentric coordinates of point 'p' with respect to the tetrahedron given by vertices a,b,c,d.
Definition at line 252 of file geometry.h.
|
inline |
Calculates the orientation of the given tetrahedron.
The orientation is given by the sign of the returned value. If the returned value is near zero or zero, the tetrahedron is degenerated.
Definition at line 241 of file geometry.h.
|
inline |
Calculates the volume of the given tetraheron.
Depending on the orientation of the tetrahedron, this volume may be negative.
Definition at line 218 of file geometry.h.
T math::geom::triangle_area | ( | math::Vector< T, 3 > const & | a, |
math::Vector< T, 3 > const & | b, | ||
math::Vector< T, 3 > const & | c | ||
) |
Calculates the area of the given triangle.
Depending on the orientation of the triangle, this area may be negative.
Definition at line 208 of file geometry.h.
bool math::geom::triangle_box_overlap | ( | math::Vector< T, 3 > const & | boxcenter, |
math::Vector< T, 3 > const & | boxhalfsize, | ||
math::Vector< T, 3 > const & | a, | ||
math::Vector< T, 3 > const & | b, | ||
math::Vector< T, 3 > const & | c | ||
) |
Returns true if the given triangle and box overlap, false otherwise.
The triangle is given by vertices 'a', 'b' and 'c' and the axis-aligned box is given by box center 'boxcenter' and box half sizes aligned with the axis 'halfsize'.
Definition at line 141 of file octree_tools.h.