ug4
math_util_impl.hpp File Reference

Go to the source code of this file.

Namespaces

 ug
 the ug namespace
 

Functions

template<class vector_t >
bool ug::BoxBoundProbe (const vector_t &v, const vector_t &boxMin, const vector_t &boxMax)
 Returns true if the point lies inside or on the boundary of the box. More...
 
template<class vector_t >
bool ug::BoxBoxIntersection (const vector_t &box1Min, const vector_t &box1Max, const vector_t &box2Min, const vector_t &box2Max)
 checks whether two boxes intersect. More...
 
template<class vector_t >
void ug::CalculateCenter (vector_t &centerOut, const vector_t *pointSet, size_t numPoints)
 calculates the center of a point-set More...
 
template<class TNumber >
TNumber ug::clip (TNumber val, TNumber lowerBound, TNumber upperBound)
 clips a number to the given interval [lowerBound, upperBound]. More...
 
template<class TNumber >
TNumber ug::deg_to_rad (TNumber deg)
 
template<class vector_t >
number ug::DistancePointToLine (const vector_t &v, const vector_t &v1, const vector_t &v2)
 calculates the distance of a point to a line segment More...
 
template<class vector_t >
number ug::DistancePointToLine (number &tOut, const vector_t &v, const vector_t &v1, const vector_t &v2)
 
template<class vector_t >
number ug::DistancePointToPlane (const vector_t &v, const vector_t &p, const vector_t &n)
 Calculates the distance between the specified point and the plane. More...
 
template<class vector_t >
number ug::DistancePointToRay (const vector_t &v, const vector_t &from, const vector_t &dir)
 calculates the distance of a point to a ray More...
 
template<class vector_t >
number ug::DistancePointToRay (vector_t &vOut, number &tOut, const vector_t &v, const vector_t &from, const vector_t &dir)
 
template<class vector_t >
number ug::DistancePointToTriangle (vector_t &vOut, number &bc1Out, number &bc2Out, const vector_t &p, const vector_t &v1, const vector_t &v2, const vector_t &v3, const vector_t &n)
 calculates the minimal distance of a point to a triangle.
More...
 
template<class vector_t >
number ug::DropAPerpendicular (vector_t &vOut, const vector_t &v, const vector_t &v0, const vector_t &v1)
 finds the projection of v onto the line defined by v0 and v1 More...
 
template<class vector_t >
number ug::GeometricApproximationDegree (vector_t &n1, vector_t &n2, vector_t &n3, vector_t &tn)
 the returned degree lies between 0 and 1. The closer to 1 the better. More...
 
template<class vector_t >
bool ug::LineBoxIntersection (const vector_t &v1, const vector_t &v2, const vector_t &boxMin, const vector_t &boxMax)
 checks whether the given line-segment (v1, v2) intersect the given box. More...
 
template<class vector_t >
bool ug::LineLineIntersection2d (vector_t &vOut, number &t0Out, number &t1Out, const vector_t &from0, const vector_t &to0, const vector_t &from1, const vector_t &to1, const number threshold=0)
 calculates the intersection of a two lines in 2d More...
 
template<class vector_t >
bool ug::LineLineProjection (number &t1Out, number &t2Out, const vector_t &a1, const vector_t &a2, const vector_t &b1, const vector_t &b2)
 calculates the closest point between the rays through the given lines. More...
 
template<class vector_t >
int ug::LineSphereIntersection (number &s1Out, number &s2Out, const vector_t &v1, const vector_t &v2, const vector_t &center, number radius)
 
template<>
bool ug::PointIsInsideQuadrilateral (const MathVector< 3 > &v, const MathVector< 3 > &v0, const MathVector< 3 > &v1, const MathVector< 3 > &v2, const MathVector< 3 > &v3)
 
template<class vector_t >
bool ug::PointIsInsideQuadrilateral (const vector_t &v, const vector_t &v0, const vector_t &v1, const vector_t &v2, const vector_t &v3)
 Returns true if the point lies inside or on the boundary of a quadrilateral. More...
 
template<class vector_t >
bool ug::PointIsInsideTetrahedron (const vector_t &v, const vector_t &v0, const vector_t &v1, const vector_t &v2, const vector_t &v3)
 Returns true if the point lies inside or on the boundary of a tetrahedron. More...
 
template<>
bool ug::PointIsInsideTriangle (const MathVector< 3 > &v, const MathVector< 3 > &v0, const MathVector< 3 > &v1, const MathVector< 3 > &v2)
 
template<class vector_t >
bool ug::PointIsInsideTriangle (const vector_t &v, const vector_t &v0, const vector_t &v1, const vector_t &v2)
 Returns true if the point lies inside or on the boundary of a triangle. More...
 
template<class vector_t >
bool ug::PointIsInsideTriangle_HighAcc (const vector_t &v, const vector_t &v0, const vector_t &v1, const vector_t &v2)
 Returns true if the point lies inside or on a side of the given triangle. More...
 
template<class vector_t >
vector_t ug::PointOnRay (const vector_t &from, const vector_t &dir, number s)
 returns the point described by a relative ray coordinate More...
 
template<class vector_t >
number ug::ProjectPointToLine (vector_t &vOut, const vector_t &v, const vector_t &from, const vector_t &to)
 finds the projection of v onto the line defined by from and to More...
 
template<class vector_t >
void ug::ProjectPointToPlane (vector_t &vOut, const vector_t &v, const vector_t &p, const vector_t &n)
 projects v onto the plane defined by the point p and the planes normal n. More...
 
template<class vector_t >
number ug::ProjectPointToRay (vector_t &vOut, const vector_t &v, const vector_t &from, const vector_t &dir)
 finds the projection of v onto the ray defined by from and dir More...
 
template<class vector_t >
number ug::QuadrilateralArea (const vector_t &p1, const vector_t &p2, const vector_t &p3, const vector_t &p4)
 calculates the are of the triangle defined by p1, p2 and p3 More...
 
template<class TNumber >
TNumber ug::rad_to_deg (TNumber rad)
 
template<class vector_t >
bool ug::RayBoxIntersection (const vector_t &rayFrom, const vector_t &rayDir, const vector_t &boxMin, const vector_t &boxMax, number *tNearOut=NULL, number *tFarOut=NULL)
 checks if a ray is intersecting a box More...
 
template<class vector_t >
bool ug::RayLineIntersection2d (vector_t &vOut, number &bcOut, number &tOut, const vector_t &p0, const vector_t &p1, const vector_t &vFrom, const vector_t &vDir, number sml=0)
 calculates the intersection of a ray with a Line in 2d More...
 
template<class vector_t >
bool ug::RayPlaneIntersection (vector_t &vOut, number &tOut, const vector_t &rayFrom, const vector_t &rayDir, const vector_t &p, const vector_t &n)
 calculates the intersection of the ray rayFrom+t*rayDir and the plane (x-p)*n=0. More...
 
template<class vector_t >
bool ug::RayRayIntersection2d (vector_t &vOut, number &t0Out, number &t1Out, const vector_t &p0, const vector_t &dir0, const vector_t &p1, const vector_t &dir1)
 calculates the intersection of two Rays in 2d More...
 
template<class vector_t >
bool ug::RayRayProjection (number &t1Out, number &t2Out, const vector_t &from1, const vector_t &dir1, const vector_t &from2, const vector_t &dir2)
 Calculates the parameter values at wich two rays are closest. More...
 
template<class vector_t >
int ug::RaySphereIntersection (number &s1Out, number &s2Out, const vector_t &v, const vector_t &dir, const vector_t &center, number radius)
 checks whether the line segment (v1, v2) intersect the given sphere. More...
 
template<class vector_t >
bool ug::RayTriangleIntersection (vector_t &vOut, const vector_t &p0, const vector_t &p1, const vector_t &p2, const vector_t &vFrom, const vector_t &vDir)
 calculates the intersection of a ray with a triangle More...
 
template<class vector_t >
bool ug::RayTriangleIntersection (vector_t &vOut, number &bc1Out, number &bc2Out, number &tOut, const vector_t &p0, const vector_t &p1, const vector_t &p2, const vector_t &vFrom, const vector_t &vDir, const number small=SMALL)
 calculates the intersection of a ray with a triangle More...
 
template<class vector_t >
void ug::ReflectVectorAtPlane (vector_t &vReflectedOut, const vector_t &v, const vector_t &n, const vector_t &r0)
 reflects a vector at a plane More...
 
template<class TNumber >
TNumber ug::sq (TNumber val)
 returns the square of a value (val*val) More...
 
template<class vector_t >
number ug::TriangleArea (const vector_t &p1, const vector_t &p2, const vector_t &p3)
 calculates the are of the triangle defined by p1, p2 and p3 More...
 
template<class vector_t >
vector_t ug::TriangleBarycenter (const vector_t &p1, const vector_t &p2, const vector_t &p3)
 Calculates the barycenter of a triangle (1/3) * (p1+p2+p3) More...
 
template<class vector_t >
number ug::TriangleQuality_Area (const vector_t &p1, const vector_t &p2, const vector_t &p3)
 returns a value between 0 and 1. The higher the better. More...
 
template<class TNumber >
TNumber ug::urand (TNumber lowerBound, TNumber upperBound)
 uniform distributed random numbers in [lowerBound, upperBound[. Use srand to set a seed. More...