ug4
|
Functions | |
int | ug::BinomCoeff (int n, int k) |
Returns the BinomialCoefficient. More... | |
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 ¢erOut, const vector_t *pointSet, size_t numPoints) |
calculates the center of a point-set More... | |
void | ug::CalculateCovarianceMatrix (matrix33 &matOut, const vector3 *pointSet, const vector3 ¢er, size_t numPoints) |
Calculates the covariance matrix of a given point-set. More... | |
number | ug::CalculateHexahedronVolume (const vector3 &a, const vector3 &b, const vector3 &c, const vector3 &d, const vector3 &e, const vector3 &f, const vector3 &g, const vector3 &h) |
number | ug::CalculateOctahedronVolume (const vector3 &a, const vector3 &b, const vector3 &c, const vector3 &d, const vector3 &e, const vector3 &f) |
number | ug::CalculatePrismVolume (const vector3 &a, const vector3 &b, const vector3 &c, const vector3 &d, const vector3 &e, const vector3 &f) |
number | ug::CalculatePyramidVolume (const vector3 &a, const vector3 &b, const vector3 &c, const vector3 &d, const vector3 &e) |
number | ug::CalculateTetrahedronVolume (const vector3 &a, const vector3 &b, const vector3 &c, const vector3 &d) |
template<class TNumber > | |
TNumber | ug::clip (TNumber val, TNumber lowerBound, TNumber upperBound) |
clips a number to the given interval [lowerBound, upperBound]. More... | |
bool | ug::ConstructOrthonormalSystem (matrix33 &matOut, const vector3 &v, size_t vColInd) |
constructs a orthonormal matrix given a vector in 3d. More... | |
template<class TNumber > | |
TNumber | ug::deg_to_rad (TNumber deg) |
number | ug::DistanceLineToLine (const vector3 &a1, const vector3 &a2, const vector3 &b1, const vector3 &b2) |
calculates the distance between two 3d line segments More... | |
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 (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... | |
bool | ug::FindClosestPlane (vector3 ¢erOut, vector3 &normalOut, const vector3 *pointSet, size_t numPoints) |
Finds the plane which minimizes the distance to the given point set. More... | |
bool | ug::FindNormal (vector3 &normOut, const vector3 &v) |
finds a normal to the given vector in 3d. 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... | |
bool | ug::LineLineIntersection3d (vector3 &aOut, vector3 &bOut, const vector3 &a1, const vector3 &a2, const vector3 &b1, const vector3 &b2) |
intersects two 3d line segments 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 ¢er, number radius) |
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<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... | |
bool | ug::RayCylinderIntersection (number &tMinOut, number &tMaxOut, const vector3 &rayFrom, const vector3 &rayDir, const vector3 &cylCenter, const vector3 &cylAxis, number cylRadius) |
returns the parameter values at which a given ray intersects an infinite cylinder. 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... | |
bool | ug::RayRayIntersection3d (vector3 &aOut, vector3 &bOut, const vector3 &p0, const vector3 &dir0, const vector3 &p1, const vector3 &dir1) |
intersects two 3d rays 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 ¢er, 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... | |
bool | ug::TransformPointSetTo2D (vector2 *pointSetOut, const vector3 *pointSet, size_t numPoints) |
transforms points from 3d space to 2d space. 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... | |
UG_API bool | ug::TriangleBoxIntersection (const MathVector< 3 > &p0, const MathVector< 3 > &p1, const MathVector< 3 > &p2, const MathVector< 3 > &boxMin, const MathVector< 3 > &boxMax) |
checks whether a triangle and an axis-aligned box intersect. 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... | |
UG_API bool | ug::TriangleTriangleIntersection (const MathVector< 3 > &p0, const MathVector< 3 > &p1, const MathVector< 3 > &p2, const MathVector< 3 > &q0, const MathVector< 3 > &q1, const MathVector< 3 > &q2, MathVector< 3 > *ip1Out=NULL, MathVector< 3 > *ip2Out=NULL, number snapThreshold=SMALL) |
checks whether two triangles intersect and returns the intervals, if they do. 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... | |
bool | ug::TriangleCircumcenter (vector2 ¢erOut, const vector2 &p1, const vector2 &p2, const vector2 &p3) |
Calculates the circumcenter of a triangle. More... | |
bool | ug::TriangleCircumcenter (vector3 ¢erOut, const vector3 &p1, const vector3 &p2, const vector3 &p3) |
Calculates the circumcenter of a triangle. More... | |
UG_API int ug::BinomCoeff | ( | int | n, |
int | k | ||
) |
Returns the BinomialCoefficient.
Returns:
k! (n-k)!
Referenced by ug::LagrangeNumDoFOnSub(), ug::LagrangeNumDoFs(), ug::LagrangeLSFS< ReferenceTetrahedron, TOrder >::mapped_index(), ug::FlexLagrangeLSFS< ReferenceTetrahedron >::mapped_index(), ug::LagrangeLSFS< ReferenceTetrahedron, TOrder >::mapped_multi_index(), ug::FlexLagrangeLSFS< ReferenceTetrahedron >::mapped_multi_index(), ug::FlexLagrangeLSFS< ReferenceTriangle >::set_order(), ug::FlexLagrangeLSFS< ReferenceTetrahedron >::set_order(), and ug::FlexLagrangeLSFS< ReferencePrism >::set_order().
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.
v.size() has to be the same or less than boxMin.size() and boxMax.size(). If this condition is met, the method supports vectors of arbitrary dimension.
Referenced by ug::AABox< vector_t >::contains_point(), ug::node_tree::CreateSubOctrees(), ug::node_tree::Traverser_ProjectPoint::handle_boxed_group(), ug::RayBoxIntersection(), and ug::TriangleFill().
bool ug::BoxBoxIntersection | ( | const vector_t & | box1Min, |
const vector_t & | box1Max, | ||
const vector_t & | box2Min, | ||
const vector_t & | box2Max | ||
) |
checks whether two boxes intersect.
Make sure that all parameters have the same size.
Referenced by ug::node_tree::Traverser_ProjectPoint::handle_boxed_group(), and ug::AABox< vector_t >::overlaps_line().
void ug::CalculateCenter | ( | vector_t & | centerOut, |
const vector_t * | pointSet, | ||
size_t | numPoints | ||
) |
calculates the center of a point-set
References ug::VecAdd(), and ug::VecScale().
Referenced by ug::ArteExpandFracs3D::establishNewVertices< false, ArteExpandFracs3D::VrtxFracProptsStatus::oneFracSuDoAtt >(), ug::ArteExpandFracs3D::establishNewVertices< true, ArteExpandFracs3D::VrtxFracProptsStatus::oneFracSuDoAtt >(), ug::Partitioner_DynamicBisection< TElem, dim >::bisect_elements(), ug::Partitioner_DynamicBisection< TElem, dim >::calculate_global_dimensions(), ug::CalculateBoundingSphere(), ug::CalculateCenter(), ug::CalculateCreaseNormal(), ug::CalculateGridObjectCenter(), ug::CalculateHexahedronAspectRatio(), ug::CalculateHexahedronVolume(), ug::CalculateOuterNormal(), ug::CalculatePrismVolume(), ug::CalculatePyramidVolume(), ug::CheckOrientation(), ug::ArteExpandFracs3D::countAndSelectFracBaseNums(), ug::DistributeExpansionMarks3D(), ug::Geometry< dim, attachmentDim >::element_center(), ug::ExpandFractures2dArte(), ug::expandSingleFractureAtGivenSide(), ug::ExtrudeLayers(), ug::FindClosestByCoordinate(), ug::FindClosestPlane(), ug::ArteExpandFracs3D::generateVertexInfos(), ug::BalanceWeightsLuaCallback< TDomain >::get_weight_impl(), ug::GetDirection(), ug::GetGridObjectCenter(), ug::IdentifySubsets(), ug::Partitioner_DynamicBisection< TElem, dim >::improve_split_values(), ug::IntersectCoplanarTriangles(), ug::NeuriteProjector::IsElementInsideSphere(), ug::MakeDelaunay(), ug::MarkForCoarsen_ElementsByLuaCallback(), ug::MarkForRefinement_CloseToSurface(), ug::MarkForRefinement_ElementsByLuaCallback(), ug::ParallelShiftIdentifier< TPosAA >::match_impl(), ug::ObtainSimpleGrid_CollapseEdge(), ug::ToElementPosition< TElem, TAVrtPos >::operator()(), ug::PartitionElements_RegularGrid(), ug::QualityGridGeneration(), and ug::TrySplit().
UG_API void ug::CalculateCovarianceMatrix | ( | matrix33 & | matOut, |
const vector3 * | pointSet, | ||
const vector3 & | center, | ||
size_t | numPoints | ||
) |
Calculates the covariance matrix of a given point-set.
Please note that you have to specify the point-set together with its center-point.
Referenced by ug::FindClosestPlane().
number ug::CalculateHexahedronVolume | ( | const vector3 & | a, |
const vector3 & | b, | ||
const vector3 & | c, | ||
const vector3 & | d, | ||
const vector3 & | e, | ||
const vector3 & | f, | ||
const vector3 & | g, | ||
const vector3 & | h | ||
) |
References ug::CalculateCenter(), and ug::CalculatePyramidVolume().
Referenced by ug::CalculateVolume().
number ug::CalculateOctahedronVolume | ( | const vector3 & | a, |
const vector3 & | b, | ||
const vector3 & | c, | ||
const vector3 & | d, | ||
const vector3 & | e, | ||
const vector3 & | f | ||
) |
(compare to lib_disc/common/geometry_util.h) This function returns the volume of an octhedron in 3d by calculating the volumes of the upper and lower pyramid the octahedron consists of. The pyramidal volumes are computed via: V = 1/3 * (S * h) with
The corner coordinates must be given as prescribed by the reference element
[in] | a,...,f | 3d Vectors of corner coordinates (6 corners) |
References ug::VecCross(), ug::VecDot(), and ug::VecSubtract().
Referenced by ug::CalculateVolume().
number ug::CalculatePrismVolume | ( | const vector3 & | a, |
const vector3 & | b, | ||
const vector3 & | c, | ||
const vector3 & | d, | ||
const vector3 & | e, | ||
const vector3 & | f | ||
) |
References ug::CalculateCenter(), ug::CalculatePyramidVolume(), and ug::CalculateTetrahedronVolume().
Referenced by ug::CalculateVolume().
number ug::CalculatePyramidVolume | ( | const vector3 & | a, |
const vector3 & | b, | ||
const vector3 & | c, | ||
const vector3 & | d, | ||
const vector3 & | e | ||
) |
References ug::CalculateCenter(), ug::DistancePointToPlane(), ug::VecCross(), ug::VecLength(), and ug::VecSubtract().
Referenced by ug::CalculateHexahedronVolume(), ug::CalculatePrismVolume(), and ug::CalculateVolume().
UG_API number ug::CalculateTetrahedronVolume | ( | const vector3 & | a, |
const vector3 & | b, | ||
const vector3 & | c, | ||
const vector3 & | d | ||
) |
References ug::VecCross(), ug::VecDot(), and ug::VecSubtract().
Referenced by ug::CalculatePrismVolume(), ug::CalculateTetrahedronVolToRMSFaceAreaRatio(), and ug::CalculateVolume().
TNumber ug::clip | ( | TNumber | val, |
TNumber | lowerBound, | ||
TNumber | upperBound | ||
) |
clips a number to the given interval [lowerBound, upperBound].
constructs a orthonormal matrix given a vector in 3d.
Given a vector in 3d, this method constructs an orthonormal system. The given vector correspond to one of the matrix columns, the others are found so that matOut is orthonormal (inv(matOut) == trans(matOut)). Please note that matOut is not unique.
This method assumes that the matrix is accessed as follows: m[colInd][rowInd].
matOut | Matrix |
v | vector |
vColInd | specifies in which column to put v. |
References ug::FindNormal(), ug::VecCross(), and ug::VecNormalize().
Referenced by ug::IntersectCoplanarTriangles(), and ug::TransformPointSetTo2D().
|
inline |
References ug::PI.
Referenced by ug::DelaunayInfo< TAAPos >::enable_face_classification(), ug::MarkCorners(), ug::MarkForRefinementByDirection(), ug::QualityGridGeneration(), ug::SelectEdgesByDirection(), ug::SelectKinkVertices(), ug::SelectLinkedFlatAndDegeneratedFaces(), ug::SelectLinkedFlatFaces(), ug::SelectSmoothEdgePath(), ug::SelectSubsetEdgesByDirection(), and ug::SimplifyPolylines().
UG_API number ug::DistanceLineToLine | ( | const vector3 & | a1, |
const vector3 & | a2, | ||
const vector3 & | b1, | ||
const vector3 & | b2 | ||
) |
calculates the distance between two 3d line segments
Calculates the distance between the two finite line segments a (given by endpoints a1, a2) and b (given by endpoints b1, b2).
This method internally uses the IntersectLineSegments algorithm by Graham Rhodes. Please have a look at lineintersect_utils.h for more information.
References IntersectLineSegments(), ug::SMALL, and ug::VecLength().
Referenced by ug::IsSliver().
|
inline |
calculates the distance of a point to a line segment
Referenced by ug::node_tree::Traverser_ProjectPoint::handle_collision_edges(), and ug::QualityGridGeneration().
number ug::DistancePointToLine | ( | number & | tOut, |
const vector_t & | v, | ||
const vector_t & | v1, | ||
const vector_t & | v2 | ||
) |
References ug::DropAPerpendicular(), and ug::VecDistance().
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.
References p, ug::ProjectPointToPlane(), and ug::VecDistance().
Referenced by ug::CalculateMinVolumeHeight(), ug::CalculatePyramidVolume(), ug::CutEdgesWithPlane(), and ug::ResolveTriangleIntersections().
|
inline |
calculates the distance of a point to a ray
References ug::ProjectPointToRay(), and ug::VecDistance().
Referenced by ug::AdaptSurfaceGridToCylinder(), ug::CalculateMinTriangleHeight(), ug::DistancePointToTriangle(), ug::CylinderProjector::perform_projection(), and ug::SomaProjector::perform_projection().
|
inline |
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.
Distance is measured between the point p and the point on the triangle which is closest to p.
The triangle is defined by the three corner-points v1, v2 and v3.
n specifies the normal of the triangle. It does not have do be normalized.
The closest point on the triangle is written to vOut. Its barycentric coordinate is written to bc1Out and bc2Out.
The method returns the minimal distance of the point to the triangle.
References ug::DistancePointToRay(), p, ug::RayTriangleIntersection(), ug::VecDistance(), and ug::VecSubtract().
Referenced by ug::node_tree::Traverser_ProjectPoint::handle_collision_triangles(), and ug::ProjectPointToSurface().
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
projects v onto the line defined by v0 and v1. The projected point is returned in vOut.
returns s so that vOut = (1.0-s)*v0 + s*v1
References s, ug::SMALL, ug::VecAdd(), ug::VecDot(), ug::VecScale(), and ug::VecSubtract().
Referenced by ug::CalculateCreaseNormal(), ug::CalculateOuterNormal(), ug::DistancePointToLine(), ug::ExpandFractures2dArte(), ug::expandSingleFractureAtGivenSide(), and ug::ResolveVertexEdgeIntersection().
UG_API bool ug::FindClosestPlane | ( | vector3 & | centerOut, |
vector3 & | normalOut, | ||
const vector3 * | pointSet, | ||
size_t | numPoints | ||
) |
Finds the plane which minimizes the distance to the given point set.
The method returns the true if the calculation was a success and false if not. If true is returned, then centerOut and normalOut will contain the center and the normal of the plane which minimizes the distance to the given point set.
References ug::CalculateCenter(), ug::CalculateCovarianceMatrix(), ug::CalculateEigenvalues(), and ug::VecNormalize().
Referenced by ug::TransformPointSetTo2D().
finds a normal to the given vector in 3d.
References ug::VecDot(), ug::VecNormalize(), ug::VecScale(), and ug::VecSubtract().
Referenced by ug::ConstructOrthonormalSystem().
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.
returns the minimal dot-product of each normal of the triangle-corners with the triangles normal.
References ug::VecDot().
Referenced by ug::TryCollapse().
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.
vector_t has to feature a static 'Size' member and index access
References ug::RayBoxIntersection(), and ug::VecSubtract().
Referenced by ug::node_tree::CreateSubOctrees().
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
The lines are specified through their endpoints: (from0, to0) describes the first line, (from1, to1) the second line.
If the method succeeds (the lines intersects) the methods returns true and writes the position of the intersection to vOut. t0Out and t1Out will contain the local coordinate of the intersection regarding the lines parameter form.
References ug::RayRayIntersection2d(), and ug::VecSubtract().
Referenced by ug::IntersectCoplanarTriangles().
UG_API bool ug::LineLineIntersection3d | ( | vector3 & | aOut, |
vector3 & | bOut, | ||
const vector3 & | a1, | ||
const vector3 & | a2, | ||
const vector3 & | b1, | ||
const vector3 & | b2 | ||
) |
intersects two 3d line segments
Returns true, if the lines intersect. If they don't, the output parameters are filled with the points, at which the lines have the minimal distance. Specify lines a (given by endpoints a1, a2) and b (given by endpoints b1, b2).
Output-parameters: aOut, bOut represent the closest points on the two lines.
This method internally uses the IntersectLineSegments algorithm by Graham Rhodes. Please have a look at lineintersect_utils.h for more information.
References IntersectLineSegments(), and ug::SMALL.
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.
returns true if the closest points lie inside the line segments.
References ug::RayRayProjection(), and ug::VecSubtract().
Referenced by ug::ResolveEdgeEdgeIntersection().
int ug::LineSphereIntersection | ( | number & | s1Out, |
number & | s2Out, | ||
const vector_t & | v1, | ||
const vector_t & | v2, | ||
const vector_t & | center, | ||
number | radius | ||
) |
References ug::RaySphereIntersection(), and ug::VecSubtract().
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.
This method should only be used if v, v0, v1, v2, and v3 do lie in the same x-y-plane.
References ug::SMALL, ug::VecDot(), ug::VecSubtract(), and ug::VecTwoNormSq().
Referenced by ug::ContainsPoint().
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.
This method does not care about the orientation of the tetrahedron. This however makes it a little slower than a method that only works for correctly orientated tetrahedrons.
References ug::SMALL, ug::VecCross(), ug::VecDot(), ug::VecSubtract(), and ug::VecTwoNormSq().
Referenced by ug::PointIsInsideTetrahedron(), ug::SeparateRegions(), and ug::TetReferenceMappingTest().
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.
This method should only be used if v, v0, v1, and v2 do lie in the same x-y-plane.
References ug::SMALL, ug::VecDot(), ug::VecSubtract(), and ug::VecTwoNormSq().
Referenced by ug::ContainsPoint(), ug::IntersectCoplanarTriangles(), ug::PointIsInsideTriangle_HighAcc(), and ug::TriangleFill().
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.
This method should only be used if v, v0, v1, and v2 do lie in the same x-y-plane.
The method has a higher accuracy than PointIsInsideTriangle, however it also has a higher performance overhead.
References ug::PointIsInsideTriangle().
vector_t ug::PointOnRay | ( | const vector_t & | from, |
const vector_t & | dir, | ||
number | s | ||
) |
returns the point described by a relative ray coordinate
References s.
Referenced by ug::OverlyingSubsetFinder< TDomain >::findOverlyingSubset(), ug::ZRayTracer< TDomain >::get_min_at(), and ug::DomainRayTracer::trace_ray().
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
projects v onto the line defined by from and to. The projected point is returned in vOut.
returns s so that vOut = from + s * (to-from)
References ug::ProjectPointToRay(), and ug::VecSubtract().
Referenced by ug::ProjectVerticesToCloseEdges(), and ug::ResolveVertexFaceIntersection().
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.
The result is written to vOut.
References p, ug::VecDot(), ug::VecNormalize(), ug::VecScale(), and ug::VecSubtract().
Referenced by ug::DistancePointToPlane(), ug::ExpandFractures3d(), ug::ResolveVertexFaceIntersection(), ug::TangentialSmooth(), and ug::TangentialSmoothSimple().
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
projects v onto the ray defined by from and dir. The projected point is returned in vOut.
returns s so that vOut = from + s*dir
References s, ug::SMALL, ug::VecAdd(), ug::VecDot(), ug::VecScale(), and ug::VecSubtract().
Referenced by ug::AdaptSurfaceGridToCylinder(), ug::DistancePointToRay(), ug::CylinderProjector::perform_projection(), ug::SomaProjector::perform_projection(), ug::ProjectPointToLine(), ug::RaySphereIntersection(), ug::SpacialVertexSort(), and ug::TriangleCircumcenter().
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
References ug::TriangleArea().
Referenced by ug::QuadrilateralAspectRatio().
|
inline |
References ug::PI.
Referenced by ug::CheckDirection(), and ug::QualityGridGeneration().
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
vector_t has to feature a static 'Size' member and index access
rayFrom | |
rayDir | |
boxMin | |
boxMax | |
tNearOut | can be NULL |
tFarOut | can be NULL |
References ug::BoxBoundProbe(), and ug::SMALL.
Referenced by ug::LineBoxIntersection(), and ug::lg_ntree_traits_base< tree_dim, world_dim, elem_t_, common_data_t_ >::ray_box_intersection().
UG_API bool ug::RayCylinderIntersection | ( | number & | tMinOut, |
number & | tMaxOut, | ||
const vector3 & | rayFrom, | ||
const vector3 & | rayDir, | ||
const vector3 & | cylCenter, | ||
const vector3 & | cylAxis, | ||
number | cylRadius | ||
) |
returns the parameter values at which a given ray intersects an infinite cylinder.
References ug::RayRayIntersection3d(), ug::SMALL, ug::VecDistance(), ug::VecDot(), ug::VecLength(), ug::VecNormalize(), ug::VecScale(), and ug::VecSubtract().
Referenced by ug::AdaptSurfaceGridToCylinder(), and ug::CylinderCutProjector::new_vertex().
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
You have to pass the line corners through p0 and p1 together with a point on the ray (vFrom) and the rays direction (vDir).
If the method succeeds (the ray intersects the line) the methods returns true and writes the position of the intersection to vOut. Furthermore the local (barycentric) coordinate of the intersection is written to bcOut. tOut will contain the local coordinate of the intersection regarding the rays parameter form.
References ug::RayRayIntersection2d(), and ug::VecSubtract().
Referenced by ug::ElementSideRayIntersectionWrapper< TRefElem, 2, 2 >::apply(), ug::SCVFofSCVRayIntersectionWrapper< 2, 2 >::apply(), and ug::RayElementIntersection().
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.
References p, ug::SMALL_SQ, ug::VecAdd(), ug::VecDot(), ug::VecScale(), and ug::VecSubtract().
Referenced by ug::CutEdgesWithPlane(), ug::DelaunayLineLineIntersection(), ug::IntersectPlaneWithTetrahedron(), ug::PlaneCutProjector::new_vertex(), ug::EllipticCylinderProjector::radial_ellipse_coord(), ug::EllipticCylinderProjector::scale_point_to_radius(), ug::SlopeSmooth(), and ug::TriangleCircumcenter().
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
If the two rays intersect (are not parallel), the method returns true. It writes its results to the parameters vOut (intersection point), t0Out (vOut = p0 + t0Out * dir0) and t1Out (vOut = p1 + t1Out * dir1).
You have to specify a point of each ray (p0 and p1) and the directions of each ray (dir0 and dir1).
References ug::Determinant(), ug::Inverse(), ug::MatVecMult(), ug::VecScaleAppend(), and ug::VecSubtract().
Referenced by ug::LineLineIntersection2d(), ug::RayLineIntersection2d(), and ug::TriangleCircumcenter().
UG_API bool ug::RayRayIntersection3d | ( | vector3 & | aOut, |
vector3 & | bOut, | ||
const vector3 & | p0, | ||
const vector3 & | dir0, | ||
const vector3 & | p1, | ||
const vector3 & | dir1 | ||
) |
intersects two 3d rays
Returns true, if the rays intersect. If they don't, the output parameters are filled with the points, at which the rays have the minimal distance. Specify each ray by one point on the ray (p0 and p1) and the direction of the ray (dir0 and dir1).
Output-parameters: aOut, bOut represent the closest points on the two rays.
This method internally uses the IntersectLineSegments algorithm by Graham Rhodes. Please have a look at lineintersect_utils.h for more information.
References IntersectLineSegments(), ug::SMALL, and ug::VecAdd().
Referenced by ug::RayCylinderIntersection().
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.
Returns true if the calculation was successfull (e.g. if the rays were not parallel).
References ug::SMALL, ug::SMALL_SQ, ug::VecDot(), and ug::VecSubtract().
Referenced by ug::LineLineProjection().
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.
The function returns the number of intersections and the values of s at which the line segment intersects.
References p, ug::ProjectPointToRay(), s, ug::SMALL, ug::VecDistance(), and ug::VecLength().
Referenced by ug::LineSphereIntersection(), and ug::ProjectVerticesToSphere().
|
inline |
calculates the intersection of a ray with a triangle
vector_t has to feature a x, y and z component.
You have to pass the triangles corners through p0, p1, p2 together with a point on the ray (vFrom) and the rays direction (vDir).
If the method succeeds (the ray intersects the triangle) the methods returns true and writes the position of the intersection to vOut.
References ug::RayTriangleIntersection(), and s.
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
vector_t has to feature a x, y and z component.
You have to pass the triangles corners through p0, p1, p2 together with a point on the ray (vFrom) and the rays direction (vDir).
If the method succeeds (the ray intersects the triangle) the methods returns true and writes the position of the intersection to vOut. Furthermore the local (barycentric) coordinates of the intersection are written to bc1Out and bc2Out. tOut will contain the local coordinate of the intersection regarding the rays parameter form.
Referenced by ug::ElementSideRayIntersectionWrapper< TRefElem, 3, 3 >::apply(), ug::DistancePointToTriangle(), ug::RayElementIntersection(), ug::RayTriangleIntersection(), ug::ResolveEdgeFaceIntersection(), ug::ResolveVertexFaceIntersection(), ug::Valence3VertexIsObsolete(), and ug::Valence4VertexIsObsolete().
void ug::ReflectVectorAtPlane | ( | vector_t & | vReflectedOut, |
const vector_t & | v, | ||
const vector_t & | n, | ||
const vector_t & | r0 | ||
) |
reflects a vector at a plane
This method reflects a given vector at a plane specified by n and r0, i.e. the plane P is given such that for all \( \vec{x} in P \) it holds that
\[ (\vec{x} - \vec{r0}) \cdot \vec{n} = 0. \]
vReflectedOut | the reflected vector |
v | the original vector, that is reflected |
n | normal for plane specification |
r0 | root point of plane |
References s, ug::VecDot(), and ug::VecScaleAdd().
|
inline |
returns the square of a value (val*val)
Referenced by ug::bridge::Evaluate::CloseVertexExists(), ug::Sphere< vector_t >::contains_point(), ug::EvaluateGradientJump_SideIntegral(), ug::GetAspectRatioInfo(), ug::IntersectCloseEdges(), ug::IntersectCoplanarTriangles(), ug::Sphere< vector_t >::intersects(), ug::NeuriteProjector::IsElementInsideSphere(), ug::MarkAnisotropic_LongEdges(), ug::MarkForAdaption_L2ErrorExact(), ug::MarkForAdaption_ResidualErrorP1Absolute(), ug::MarkForAnisotropicRefinement(), ug::MarkForRefinement_AnisotropicDirection(), ug::PerformCollapses(), ug::PerformSplits(), ug::PrintElementEdgeRatios(), ug::ProjectVerticesToCloseEdges(), and ug::ProjectVerticesToCloseFaces().
UG_API bool ug::TransformPointSetTo2D | ( | vector2 * | pointSetOut, |
const vector3 * | pointSet, | ||
size_t | numPoints | ||
) |
transforms points from 3d space to 2d space.
This method calculates the plane that minimizes the distances between the points and the plane. It then transforms all points to 2d so that the normal of the new min-distance-plane would point along the z-axis. It the projects all points onto the x-y-plane using the trivial projection.
pointSetOut | An array of 2d-points of size numPoints. |
pointSet | An array of 3d-points of size numPoints. |
numPoints | Specifies the size of the point sets. |
References ug::ConstructOrthonormalSystem(), ug::FindClosestPlane(), ug::TransposedMatVecMult(), and ug::VecSubtract().
Referenced by ug::grid_intersection_impl::DebugSave2d(), ug::TriangleFill(), and ug::TriangleFill_SweepLine().
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
References ug::GenVecCross(), ug::VecLength(), and ug::VecSubtract().
Referenced by ug::FaceArea(), ug::QuadrilateralArea(), ug::TriangleAspectRatio(), ug::TriangleQuality_Area(), ug::Valence3VertexIsObsolete(), and ug::Valence4VertexIsObsolete().
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)
References ug::VecScaleAdd().
bool ug::TriangleBoxIntersection | ( | const MathVector< 3 > & | p0, |
const MathVector< 3 > & | p1, | ||
const MathVector< 3 > & | p2, | ||
const MathVector< 3 > & | boxMin, | ||
const MathVector< 3 > & | boxMax | ||
) |
checks whether a triangle and an axis-aligned box intersect.
p0,p1,p2 | the corners of the triangle. |
boxMin | has to contain the minimal-coordinates of the box. |
boxMax | has to contain the maximal-coordinates of the box. |
References INSIDE, ug::TRI::m_P, ug::TriCubeIntersection(), and ug::VecSubtract().
Referenced by ug::node_tree::CreateSubOctrees(), and ug::node_tree::Traverser_IntersectFaces::handle_boxed_group().
UG_API bool ug::TriangleCircumcenter | ( | vector2 & | centerOut, |
const vector2 & | p1, | ||
const vector2 & | p2, | ||
const vector2 & | p3 | ||
) |
Calculates the circumcenter of a triangle.
Calculates the center of the circle, on which all three points lie. In cases where this is not possible (all three points lie on a line), the method returns false. If the method succeeds, the calculated center is written to centerOut.
References ug::RayRayIntersection2d(), ug::VecDistanceSq(), ug::VecScaleAdd(), and ug::VecSubtract().
Referenced by ug::DelaunayInfo< TAAPos >::classify_face(), ug::MakeDelaunay(), and ug::QualityGridGeneration().
UG_API bool ug::TriangleCircumcenter | ( | vector3 & | centerOut, |
const vector3 & | p1, | ||
const vector3 & | p2, | ||
const vector3 & | p3 | ||
) |
Calculates the circumcenter of a triangle.
Calculates the center of the circle, on which all three points lie. In cases where this is not possible (all three points lie on a line), the method returns false. If the method succeeds, the calculated center is written to centerOut.
References ug::ProjectPointToRay(), ug::RayPlaneIntersection(), ug::SMALL, ug::VecDistanceSq(), ug::VecDot(), ug::VecScaleAdd(), and ug::VecSubtract().
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.
The quality is measured by comparing the triangles area with the sum of the squared length of each side.
a triangle whose sides have all zero length is considered to be a bad triangle - 0 is returned.
References ug::SMALL, ug::TriangleArea(), and ug::VecDistanceSq().
Referenced by ug::ReplaceLowValenceVertices(), and ug::ShapeQualityDegree().
bool ug::TriangleTriangleIntersection | ( | const MathVector< 3 > & | p0, |
const MathVector< 3 > & | p1, | ||
const MathVector< 3 > & | p2, | ||
const MathVector< 3 > & | q0, | ||
const MathVector< 3 > & | q1, | ||
const MathVector< 3 > & | q2, | ||
MathVector< 3 > * | ip1Out = NULL , |
||
MathVector< 3 > * | ip2Out = NULL , |
||
number | snapThreshold = SMALL |
||
) |
checks whether two triangles intersect and returns the intervals, if they do.
Uses code by Tomas Moller. See article "A Fast Triangle-Triangle Intersection Test", Journal of Graphics Tools, 2(2), 1997
returns true if the triangles intersect. If ip1Out and ip2Out are specified and if the triangles intersect, ip1Out and ip2Pit will contain the endpoints of the line segment which resembles the intersection. Please specify either both or none.
References tri_tri_intersect().
Referenced by ug::node_tree::Traverser_IntersectFaces::handle_collision_triangles(), and ug::ResolveTriangleIntersections().
TNumber ug::urand | ( | TNumber | lowerBound, |
TNumber | upperBound | ||
) |
uniform distributed random numbers in [lowerBound, upperBound[. Use srand to set a seed.
Referenced by ug::LognormalRandomField< TData, dim, TRet >::gasdev(), ug::RandomizeDomain(), ug::ScalarSubVectorAdapter< InVT, ST >::set_random(), ug::Vector< TValueType >::set_random(), and ug::LognormalRandomField< TData, dim, TRet >::undev().