ug4
misc geometric object util

contains miscellaneus methods that are related to GridObjects. More...

Functions

template<class vector_t , class TIterator , class TAAPos >
UG_API void ug::CalculateBoundingBox (vector_t &vMinOut, vector_t &vMaxOut, TIterator begin, TIterator end, TAAPos &aaPos)
 Calculates the bounding box of a set of geometric objects. More...
 
template<class TIterator , class TAAPosVRT >
UG_API TAAPosVRT::ValueType ug::CalculateCenter (TIterator begin, TIterator end, TAAPosVRT &aaPos)
 calculates the center for a set of elements More...
 
template<class TAAPosVRT >
UG_API TAAPosVRT::ValueType ug::CalculateGridObjectCenter (const GridObject *o, TAAPosVRT &aaPosVRT)
 calculates the center for arbitrary geometric object More...
 
template<class TAAPosVRT , class TAAWeightVRT >
UG_API TAAPosVRT::ValueType ug::CalculateGridObjectCenter (const GridObject *o, TAAPosVRT &aaPosVRT, TAAWeightVRT &aaWeight)
 returns the weighted center of the vertices of the given geometric object More...
 
template<class TElem1 , class TElem2 , class TAAPos >
bool ug::CheckDirection (TElem1 *e1, TElem2 *e2, const TAAPos &aaPos, const typename TAAPos::ValueType &dir, number minAngle, number maxAngle)
 Checks whether the center of e2 can be reached from the center of e1 in the given direction. More...
 
template<class TElem , class TAAPos >
number ug::ElementDiameter (Grid &grid, TAAPos &aaPos, TElem *elem)
 returns the maximal distance between to element vertices More...
 
template<class TAAPos >
number ug::ElementDiameterSq (Grid &grid, TAAPos &aaPos, GridObject *elem)
 returns the maximal squared distance between to element vertices More...
 
template<class TElem , class TAAPos >
number ug::ElementDiameterSq (Grid &grid, TAAPos &aaPos, TElem *elem)
 returns the maximal squared distance between to element vertices More...
 
void ug::EraseConnectingElements (Grid &grid, Vertex *v1, Vertex *v2)
 erases all elements that connect v1 and v2 More...
 
template<class TElem >
UG_API void ug::EraseElements (Grid &grid, typename geometry_traits< TElem >::iterator iterBegin, typename geometry_traits< TElem >::iterator iterEnd)
 erases all elements between iterBegin and iterEnd. More...
 
template<class TElem , class TVertexPositionAttachmentAccessor >
UG_API TElem * ug::FindClosestByCoordinate (const typename TVertexPositionAttachmentAccessor::ValueType &coord, typename geometry_traits< TElem >::iterator iterBegin, typename geometry_traits< TElem >::iterator iterEnd, TVertexPositionAttachmentAccessor &aaPosVRT)
 returns the element of the given type, whose center is closest to coord. More...
 
template<class TElem1 , class TElem2 , class TAAPos >
TAAPos::ValueType ug::GetDirection (TElem1 *e1, TElem2 *e2, const TAAPos &aaPos)
 Returns the direction from the center of e1 to the center of e2. More...
 
template<class TElem >
UG_API TElem::side * ug::GetSharedSide (Grid &grid, TElem *e1, TElem *e2)
 returns the shared side between the two elements or NULL if no such side exists. More...
 
template<class TAAPos , class TIterator >
number ug::MaxElementDiameter (Grid &grid, TAAPos &aaPos, TIterator iterBegin, TIterator iterEnd)
 returns the maximal diameter of all elements between iterBegin and iterEnd. More...
 
template<class TAAPos , class TIterator >
number ug::MinElementDiameter (Grid &grid, TAAPos &aaPos, TIterator iterBegin, TIterator iterEnd)
 returns the minimal diameter of all elements between iterBegin and iterEnd. More...
 
template<class TElemPtr1 , class TElemPtr2 >
UG_API size_t ug::NumSharedVertices (Grid &grid, TElemPtr1 elem1, TElemPtr2 elem2)
 returns the number of vertices that are shared by two objects More...
 

Detailed Description

contains miscellaneus methods that are related to GridObjects.

Function Documentation

◆ CalculateBoundingBox()

template<class vector_t , class TIterator , class TAAPos >
UG_API void ug::CalculateBoundingBox ( vector_t &  vMinOut,
vector_t &  vMaxOut,
TIterator  begin,
TIterator  end,
TAAPos &  aaPos 
)

Calculates the bounding box of a set of geometric objects.

TIterator has to be an iterator to a set containing elements of type Edge*, Face* or Volume*. An overload for Vertex* exists.

Make sure that TAAPos::ValueType == vector_t.

References dim, ug::GetVertex(), ug::NumVertices(), and ug::VecSet().

◆ CalculateCenter()

template<class TIterator , class TAAPosVRT >
UG_API TAAPosVRT::ValueType ug::CalculateCenter ( TIterator  begin,
TIterator  end,
TAAPosVRT &  aaPos 
)

calculates the center for a set of elements

TIterator::value_type has to be compatible with Vertex*, Edge*, Face* or Volume*.

References ug::CalculateCenter(), ug::VecAdd(), ug::VecScale(), and ug::VecSet().

◆ CalculateGridObjectCenter() [1/2]

template<class TAAPosVRT >
UG_API TAAPosVRT::ValueType ug::CalculateGridObjectCenter ( const GridObject o,
TAAPosVRT &  aaPosVRT 
)
inline

calculates the center for arbitrary geometric object

References ug::GridObject::base_object_id(), ug::CalculateCenter(), ug::EDGE, ug::FACE, UG_THROW, ug::VERTEX, and ug::VOLUME.

Referenced by ug::LaplacianSmooth().

◆ CalculateGridObjectCenter() [2/2]

template<class TAAPosVRT , class TAAWeightVRT >
UG_API TAAPosVRT::ValueType ug::CalculateGridObjectCenter ( const GridObject o,
TAAPosVRT &  aaPosVRT,
TAAWeightVRT &  aaWeight 
)
inline

returns the weighted center of the vertices of the given geometric object

TAAWeightVRT has to be an attachment to the vertices of the grid in which the object is contained, with ValueType number (or compatible).

References ug::GridObject::base_object_id(), ug::CalculateCenter(), ug::EDGE, ug::FACE, UG_THROW, ug::VERTEX, and ug::VOLUME.

◆ CheckDirection()

template<class TElem1 , class TElem2 , class TAAPos >
bool ug::CheckDirection ( TElem1 *  e1,
TElem2 *  e2,
const TAAPos &  aaPos,
const typename TAAPos::ValueType &  dir,
number  minAngle,
number  maxAngle 
)

Checks whether the center of e2 can be reached from the center of e1 in the given direction.

Parameters
minAngleminimal allowed deviation angle from 'dir' in degrees. Normally set to 0.
maxAnglemaximal allowed deviation angle from 'dir' in degrees

References ug::GetDirection(), ug::rad_to_deg(), and ug::VecAngle().

Referenced by ug::ExtendSelectionInDirection().

◆ ElementDiameter()

template<class TElem , class TAAPos >
number ug::ElementDiameter ( Grid grid,
TAAPos &  aaPos,
TElem *  elem 
)

returns the maximal distance between to element vertices

References ug::ElementDiameterSq().

◆ ElementDiameterSq() [1/2]

template<class TAAPos >
number ug::ElementDiameterSq ( Grid grid,
TAAPos &  aaPos,
GridObject elem 
)

returns the maximal squared distance between to element vertices

References ug::GridObject::base_object_id(), ug::EDGE, ug::ElementDiameterSq(), ug::FACE, UG_THROW, ug::VERTEX, and ug::VOLUME.

◆ ElementDiameterSq() [2/2]

template<class TElem , class TAAPos >
number ug::ElementDiameterSq ( Grid grid,
TAAPos &  aaPos,
TElem *  elem 
)

returns the maximal squared distance between to element vertices

References ug::Grid::associated_elements(), ug::PointerConstArray< TPtr >::size(), and ug::VecDistanceSq().

◆ EraseConnectingElements()

◆ EraseElements()

template<class TElem >
UG_API void ug::EraseElements ( Grid grid,
typename geometry_traits< TElem >::iterator  iterBegin,
typename geometry_traits< TElem >::iterator  iterEnd 
)

erases all elements between iterBegin and iterEnd.

References ug::Grid::erase().

◆ FindClosestByCoordinate()

template<class TElem , class TVertexPositionAttachmentAccessor >
UG_API TElem* ug::FindClosestByCoordinate ( const typename TVertexPositionAttachmentAccessor::ValueType &  coord,
typename geometry_traits< TElem >::iterator  iterBegin,
typename geometry_traits< TElem >::iterator  iterEnd,
TVertexPositionAttachmentAccessor &  aaPosVRT 
)

returns the element of the given type, whose center is closest to coord.

Returns the element, whose center is closest to the given coordinate.

TVertexPositionAttachmentAccessor has to be an AttachmentAccessor, where AttachmentAccessor::ValueType is a vector-type compatible to the lgmath vector descriptor. The Accessor has to access an attachment of the vertices, to which the faces between iterBegin and iterEnd refer.

References ug::CalculateCenter(), and ug::VecDistanceSq().

◆ GetDirection()

template<class TElem1 , class TElem2 , class TAAPos >
TAAPos::ValueType ug::GetDirection ( TElem1 *  e1,
TElem2 *  e2,
const TAAPos &  aaPos 
)

Returns the direction from the center of e1 to the center of e2.

References ug::CalculateCenter().

Referenced by ug::CheckDirection().

◆ GetSharedSide()

template<class TElem >
UG_API TElem::side * ug::GetSharedSide ( Grid grid,
TElem *  e1,
TElem *  e2 
)

returns the shared side between the two elements or NULL if no such side exists.

References ug::Grid::associated_elements(), and ug::PointerConstArray< TPtr >::size().

◆ MaxElementDiameter()

template<class TAAPos , class TIterator >
number ug::MaxElementDiameter ( Grid grid,
TAAPos &  aaPos,
TIterator  iterBegin,
TIterator  iterEnd 
)

returns the maximal diameter of all elements between iterBegin and iterEnd.

In parallel, the global max diameter is returned.

References pcl::ProcessCommunicator::allreduce(), ug::ElementDiameterSq(), and PCL_RO_MAX.

◆ MinElementDiameter()

template<class TAAPos , class TIterator >
number ug::MinElementDiameter ( Grid grid,
TAAPos &  aaPos,
TIterator  iterBegin,
TIterator  iterEnd 
)

returns the minimal diameter of all elements between iterBegin and iterEnd.

In parallel, the global min diameter is returned.

References pcl::ProcessCommunicator::allreduce(), ug::ElementDiameterSq(), and PCL_RO_MIN.

◆ NumSharedVertices()

template<class TElemPtr1 , class TElemPtr2 >
UG_API size_t ug::NumSharedVertices ( Grid grid,
TElemPtr1  elem1,
TElemPtr2  elem2 
)

returns the number of vertices that are shared by two objects

This algorithm uses Grid::mark.

Valid types are Edge*, Face*, Volume* and derivates of those. You may combine different types in one query.

References ug::Grid::begin_marking(), ug::Grid::end_marking(), ug::Grid::is_marked(), and ug::Grid::mark().

Referenced by ug::ResolveTriangleIntersections().