ug4
edge util

contains methods to manipulate edges More...

Functions

template<class TAAPosVRT >
number ug::CalculateAverageEdgeLength (Grid &grid, TAAPosVRT &aaPos)
 Returns the average length of edges in the given grid. More...
 
template<class TVertexPositionAttachmentAccessor >
UG_API TVertexPositionAttachmentAccessor::ValueType ug::CalculateCenter (const Edge *e, TVertexPositionAttachmentAccessor &aaPosVRT)
 Calculates the center of an edge. More...
 
template<class TAAPosVRT , class TAAWeightVRT >
UG_API TAAPosVRT::ValueType ug::CalculateCenter (const EdgeVertices *e, TAAPosVRT &aaPos, TAAWeightVRT &aaWeight)
 returns the weighted center of the vertices of the given edge More...
 
int ug::CalculateNormal (vector3 &vNormOut, Grid &grid, Edge *e, Grid::AttachmentAccessor< Vertex, APosition > &aaPos, Grid::AttachmentAccessor< Face, ANormal > *paaNormFACE=NULL)
 Calculates the normal of the given edge. More...
 
int ug::CalculateNormalNoNormalize (vector3 &vNormOut, Grid &grid, Edge *e, Grid::VertexAttachmentAccessor< APosition > &aaPos, Grid::FaceAttachmentAccessor< ANormal > *paaNormFACE=NULL)
 Calculates the normal of the given edge. More...
 
bool ug::CollapseEdge (Grid &grid, Edge *e, Vertex *newVrt)
 Collapses the specified edge performs local grid restructuring. More...
 
UG_API bool ug::CompareVertices (const EdgeVertices *ev1, const EdgeVertices *ev2)
 Checks whether ev1 and ev2 contain the same vertices. More...
 
template<class vector_t , class TAAPos >
UG_API bool ug::ContainsPoint (const EdgeVertices *e, const vector_t &p, TAAPos aaPos)
 Returns true if the given point lies on the given edge. More...
 
bool ug::CreateEdgeSplitGeometry (Grid &destGrid, Grid &srcGrid, Edge *e, Vertex *newVertex, AVertex *paAssociatedVertices=NULL)
 given an edge and a vertex (the split-vertex) this method constructs the split-geometry. More...
 
bool ug::CutEdgesWithPlane (Selector &sel, const vector3 &p, const vector3 &n, APosition &aPos=aPosition)
 refines all edges in sel which cut the given plane. More...
 
bool ug::EdgeCollapseIsValid (Grid &grid, Edge *e)
 Checks if an edge-collapse would invalidate the current topology. More...
 
bool ug::EdgeContains (EdgeVertices *e, Vertex *vrt)
 
bool ug::EdgeContains (EdgeVertices *e, Vertex *vrt1, Vertex *vrt2)
 
template<class TAAPosVRT >
UG_API number ug::EdgeLength (const EdgeVertices *e, TAAPosVRT &aaPos)
 Calculates the length of the given edge. More...
 
template<class TAAPosVRT >
UG_API number ug::EdgeLengthSq (const EdgeVertices *e, TAAPosVRT &aaPos)
 Calculates the squared length of the given edge. More...
 
template<class TEdgeIterator , class TAAPosVRT >
UG_API Edgeug::FindShortestEdge (TEdgeIterator edgesBegin, TEdgeIterator edgesEnd, TAAPosVRT &aaPos)
 Returns the shortest edge in a list of edges. More...
 
template<class TEdgeIterator >
UG_API void ug::FixEdgeOrientation (Grid &grid, TEdgeIterator edgesBegin, TEdgeIterator edgesEnd)
 creates uniform orientation of neighboured edges. More...
 
int ug::GetAssociatedFaces (Face **facesOut, Grid &grid, Edge *e, int maxNumFaces)
 writes associated faces of e to facesOut. More...
 
Edgeug::GetConnectingEdge (Grid &grid, Face *f1, Face *f2)
 
int ug::GetEdgeIndex (Face *f, Edge *e)
 returns the index at which edge e is found in the given object More...
 
int ug::GetEdgeIndex (Volume *vol, Edge *e)
 returns the index at which edge e is found in the given object More...
 
template<class face_iter_t >
void ug::GetInnerEdgesOfFaceSoup (std::vector< Edge * > &edgesOut, Grid &g, face_iter_t facesBegin, face_iter_t facesEnd)
 
Vertexug::GetVertex (Edge *e, size_t i)
 returns the i'th vertex of an edge More...
 
bool ug::IsBoundaryEdge (Grid &grid, Edge *e, Grid::face_traits::callback funcIsSurfFace)
 returns true if the edge is connected to exactly one surface face. More...
 
bool ug::IsBoundaryEdge2D (Grid &grid, Edge *e)
 returns whether an edge lies on the boundary of a 2D grid. More...
 
bool ug::IsBoundaryEdge3D (Grid &grid, Edge *e)
 returns whether an edge lies on the boundary of a 3D grid. More...
 
bool ug::LiesOnBoundary (Grid &grid, Edge *e)
 returns true, if the edge lies on a 2d or 3d boundary More...
 
template<class EdgeIterator , class TAAPos >
UG_API void ug::MinimizeEdgeLength_SwapsOnly (Grid &grid, EdgeIterator edgesBegin, EdgeIterator edgesEnd, TAAPos &aaPos)
 Transforms the given edge-set so that the sum of the length the edges is minimized. More...
 
int ug::NumAssociatedFaces (Grid &grid, Edge *e)
 returns the number of associated faces of the given edge More...
 
template<class TVertex >
TVertex * ug::SplitEdge (Grid &destGrid, Grid &srcGrid, Edge *e, AVertex *paAssociatedVertices=NULL, bool bConservative=false)
 inserts new triangles and one new vertex by splitting the specified edge. More...
 
template<class TVertex >
TVertex * ug::SplitEdge (Grid &grid, Edge *e, bool bConservative=false)
 inserts new triangles and one new vertex by splitting the specified edge. More...
 
Edgeug::SwapEdge (Grid &grid, Edge *e)
 swaps e and thus reconnects its two adjacent triangles. More...
 
template<class TEdgeIterator >
UG_API void ug::AdjustEdgeOrientationToFaceOrientation (Grid &grid, TEdgeIterator edgesBegin, TEdgeIterator edgesEnd)
 Orientates boundary edges in the given edge set to the orientation of associated faces. More...
 
template<class TEdgeIterator >
UG_API void ug::AdjustEdgeOrientationToFaceOrientation (Grid &grid, TEdgeIterator edgesBegin, TEdgeIterator edgesEnd, Grid::face_traits::callback considerFace)
 Orientates boundary edges in the given edge set to the orientation of associated faces. More...
 

Detailed Description

contains methods to manipulate edges

Function Documentation

◆ AdjustEdgeOrientationToFaceOrientation() [1/2]

template<class TEdgeIterator >
UG_API void ug::AdjustEdgeOrientationToFaceOrientation ( Grid grid,
TEdgeIterator  edgesBegin,
TEdgeIterator  edgesEnd 
)

Orientates boundary edges in the given edge set to the orientation of associated faces.

The orientation of boundary edges will match the orientation of associated faces, after this algorithm terminates.

One may optionally specify a callback defines whether a face should be considered during oriantation adjustment. This can e.g. be used if an interior interface has to be oriented. One could select the faces on one side of the interface, select their associated edges (e.g. using CloseSelection) and then call

AdjustEdgeOrientationToFaceOrientation(
grid,
sel.begin<Edge>(),
sel.end<Edge>(),
IsSelected(sel));

where 'sel' is an instance of the Selector class containing the selection performed above.

References ug::EdgeOrientationMatches(), ug::Grid::flip_orientation(), and ug::GetAssociatedFaces().

◆ AdjustEdgeOrientationToFaceOrientation() [2/2]

template<class TEdgeIterator >
UG_API void ug::AdjustEdgeOrientationToFaceOrientation ( Grid grid,
TEdgeIterator  edgesBegin,
TEdgeIterator  edgesEnd,
Grid::face_traits::callback  considerFace 
)

Orientates boundary edges in the given edge set to the orientation of associated faces.

The orientation of boundary edges will match the orientation of associated faces, after this algorithm terminates.

One may optionally specify a callback defines whether a face should be considered during oriantation adjustment. This can e.g. be used if an interior interface has to be oriented. One could select the faces on one side of the interface, select their associated edges (e.g. using CloseSelection) and then call

AdjustEdgeOrientationToFaceOrientation(
grid,
sel.begin<Edge>(),
sel.end<Edge>(),
IsSelected(sel));

where 'sel' is an instance of the Selector class containing the selection performed above.

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

◆ CalculateAverageEdgeLength()

template<class TAAPosVRT >
number ug::CalculateAverageEdgeLength ( Grid grid,
TAAPosVRT &  aaPos 
)

Returns the average length of edges in the given grid.

Note
The method works properly, but is not necessarily optimized for speed
Parameters
[in]grid
Template Parameters

References ug::Grid::begin(), ug::EdgeLength(), ug::Grid::end(), and ug::Grid::num_edges().

◆ CalculateCenter() [1/2]

template<class TVertexPositionAttachmentAccessor >
UG_API TVertexPositionAttachmentAccessor::ValueType ug::CalculateCenter ( const Edge e,
TVertexPositionAttachmentAccessor &  aaPosVRT 
)

Calculates the center of an edge.

References ug::VecAdd(), ug::VecScale(), ug::VecSet(), and ug::EdgeVertices::vertex().

◆ CalculateCenter() [2/2]

template<class TAAPosVRT , class TAAWeightVRT >
UG_API TAAPosVRT::ValueType ug::CalculateCenter ( const EdgeVertices e,
TAAPosVRT &  aaPos,
TAAWeightVRT &  aaWeight 
)

returns the weighted center of the vertices of the given edge

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

References ug::VecScale(), ug::VecScaleAdd(), ug::VecSet(), and ug::EdgeVertices::vertex().

◆ CalculateNormal()

UG_API int ug::CalculateNormal ( vector3 vNormOut,
Grid grid,
Edge e,
Grid::AttachmentAccessor< Vertex, APosition > &  aaPos,
Grid::AttachmentAccessor< Face, ANormal > *  paaNormFACE = NULL 
)

Calculates the normal of the given edge.

This method indirectly uses ug::Grid::mark.

The normal is calculated as the normized sum of associated face normals. If there are no associated faces, it is assumed, that the edge lies in the xy plane. Its normal will be calculated to the right.

Parameters
vNormOutnormal
gridGrid
eRegularEdge
aaPosvertec attachment accessor
paaNormFACEAn optional parameter that allows to specify an accessor for precalculated face normals.
Returns
the number of faces that are associated with the edge.

References ug::CalculateNormalNoNormalize(), ug::GetAssociatedFaces(), ug::VecAdd(), ug::VecNormalize(), ug::VecSubtract(), and ug::EdgeVertices::vertex().

Referenced by ug::CalculateBoundaryVertexNormal3D(), ug::CalculateCreaseNormal(), ug::CalculateHexahedronAspectRatio(), ug::CalculateMinCurvature(), ug::CalculateMinVolumeHeight(), ug::CalculateNormal(), ug::CalculateOuterNormal(), ug::CalculatePyramidAspectRatio(), ug::CalculateVertexNormal(), ug::CalculateVertexNormals(), ug::CheckOrientation(), ug::MarkCreaseEdges(), ug::MinimizeEdgeLength_SwapsOnly(), ug::PointFaceTest(), ug::ClusterElementStacks< elem_t, vector_t >::post_process(), ug::QualityGridGeneration(), ug::ResolveTriangleIntersections(), ug::ResolveVertexFaceIntersection(), ug::SaveGridToSTL(), ug::SelectCreaseEdges(), ug::SelectLinkedFlatAndDegeneratedFaces(), ug::SelectLinkedFlatFaces(), ug::SelectSmoothEdgePath(), ug::SeparateFaceSubsetsByNormal(), ug::TangentialSmooth(), ug::TangentialSmoothSimple(), and ug::TrySplit().

◆ CalculateNormalNoNormalize()

UG_API int ug::CalculateNormalNoNormalize ( vector3 vNormOut,
Grid grid,
Edge e,
Grid::VertexAttachmentAccessor< APosition > &  aaPos,
Grid::FaceAttachmentAccessor< ANormal > *  paaNormFACE = NULL 
)

Calculates the normal of the given edge.

This method indirectly uses ug::Grid::mark.

The normal is calculated as the normized sum of associated face normals. If there are no associated faces, it is assumed, that the edge lies in the xy plane. Its normal will be calculated to the right.

Parameters
vNormOutnormal
gridGrid
eRegularEdge
aaPosvertec attachment accessor
paaNormFACEAn optional parameter that allows to specify an accessor for precalculated face normals.
Returns
the number of faces that are associated with the edge.

References ug::GetAssociatedFaces(), ug::VecAdd(), ug::VecNormalize(), ug::VecScale(), ug::VecSubtract(), and ug::EdgeVertices::vertex().

Referenced by ug::CalculateNormal(), and ug::ContainsPoint().

◆ CollapseEdge()

UG_API bool ug::CollapseEdge ( Grid grid,
Edge e,
Vertex newVrt 
)

Collapses the specified edge performs local grid restructuring.

The edge e will be replaced by newVrt. Before calling this method you should check if an edge-collapse won't destroy the topology of your grid. You can do this by calling EdgeCollapseIsValid. During an edge-collapse all adjacent faces will be deleted or replaced by new ones. Same for volumes. Several edges will be deleted as well.

References ug::Grid::associated_elements(), ug::Face::collapse_edge(), ug::Volume::collapse_edge(), end_for, ug::Grid::erase(), for_each_in_vec, ug::Grid::get_edge(), ug::Grid::get_face(), ug::GetConnectedVertex(), ug::GetEdgeIndex(), ug::GetSharedVertex(), ug::Face::num_edges(), ug::Grid::num_faces(), ug::VolumeVertices::num_vertices(), ug::Grid::num_volumes(), ug::Grid::objects_will_be_merged(), ug::Grid::register_element(), ug::Grid::replace_vertex(), ug::PointerConstArray< TPtr >::size(), boost::target(), and ug::EdgeVertices::vertex().

Referenced by ug::TryCollapse().

◆ CompareVertices()

bool ug::CompareVertices ( const EdgeVertices ev1,
const EdgeVertices ev2 
)
inline

Checks whether ev1 and ev2 contain the same vertices.

Can be used to compare Edge with Edge, EdgeDescriptor with EdgeDescriptor or Edge with EdgeDescriptor.

References ug::EdgeVertices::vertex().

◆ ContainsPoint()

template<class vector_t , class TAAPos >
UG_API bool ug::ContainsPoint ( const EdgeVertices e,
const vector_t &  p,
TAAPos  aaPos 
)

◆ CreateEdgeSplitGeometry()

UG_API bool ug::CreateEdgeSplitGeometry ( Grid destGrid,
Grid srcGrid,
Edge e,
Vertex newVertex,
AVertex paAssociatedVertices = NULL 
)

given an edge and a vertex (the split-vertex) this method constructs the split-geometry.

The new triangles are copied to destGrid. e has to be a member of srcGrid. The old edge (e) will not be deleted. paAssociatedVertices has to be specified if destGrid and srcGrid do not match. If destGrid and srcGrid do match, paAssociatedVertices may be specified optionally. paAssociatedVertices has to be a vertex-attachment of srcGrid, that stores for each vertex in srcGrid the associated vertex of destGrid. NULL indicates that no associated vertex exists in destGrid. New ones will be automatically constructed in this case by cloning the associated ones in srcGrid.

References ug::Grid::AttachmentAccessor< TElem, TAttachment >::access(), ug::Grid::attach_to_vertices_dv(), ug::CollectFaces(), ug::CollectVolumes(), ug::Grid::create(), ug::Grid::create_by_cloning(), ug::Face::create_faces_by_edge_split(), ug::Grid::get_edge(), ug::GetEdgeIndex(), ug::Grid::has_vertex_attachment(), ug::Grid::num(), ug::Volume::num_edges(), ug::FaceVertices::num_vertices(), ug::VolumeVertices::num_vertices(), ug::Grid::pass_on_values(), ug::Volume::refine(), ug::Grid::register_element(), ug::EdgeVertices::vertex(), ug::FaceVertices::vertex(), and ug::VolumeVertices::vertex().

Referenced by ug::SplitEdge().

◆ CutEdgesWithPlane()

UG_API bool ug::CutEdgesWithPlane ( Selector sel,
const vector3 p,
const vector3 n,
APosition aPos = aPosition 
)

◆ EdgeCollapseIsValid()

UG_API bool ug::EdgeCollapseIsValid ( Grid grid,
Edge e 
)

Checks if an edge-collapse would invalidate the current topology.

returns true if the topology would not be affected by the collapse. returns false if the topology would be affected.

References ug::CollectFaces(), ug::CollectNeighbors(), ug::CompareVertices(), ug::FaceDescriptor::set_vertex(), and ug::EdgeVertices::vertex().

Referenced by ug::TryCollapse().

◆ EdgeContains() [1/2]

◆ EdgeContains() [2/2]

bool ug::EdgeContains ( EdgeVertices e,
Vertex vrt1,
Vertex vrt2 
)
inline

returns true if the given edge contains the given vertices

References ug::EdgeVertices::vertex().

◆ EdgeLength()

template<class TAAPosVRT >
UG_API number ug::EdgeLength ( const EdgeVertices e,
TAAPosVRT &  aaPos 
)
inline

◆ EdgeLengthSq()

template<class TAAPosVRT >
UG_API number ug::EdgeLengthSq ( const EdgeVertices e,
TAAPosVRT &  aaPos 
)
inline

◆ FindShortestEdge()

template<class TEdgeIterator , class TAAPosVRT >
UG_API Edge* ug::FindShortestEdge ( TEdgeIterator  edgesBegin,
TEdgeIterator  edgesEnd,
TAAPosVRT &  aaPos 
)

Returns the shortest edge in a list of edges.

TEdgeIterator has to point to values of type Edge* and has to be an stl-iterator compatible iterator. TAAPosVRT has to be an attachment accessor which provides a position value (vector1, vector2, vector3, ...) for the vertices of the edge. If the specified list is empty, NULL is returned. If multiple shortest edges exist, the first one is returned.

References ug::EdgeLengthSq().

◆ FixEdgeOrientation()

template<class TEdgeIterator >
UG_API void ug::FixEdgeOrientation ( Grid grid,
TEdgeIterator  edgesBegin,
TEdgeIterator  edgesEnd 
)

creates uniform orientation of neighboured edges.

This algorithm uses Grid::mark

swaps orientation of edges so that all neighboured edges share the same.

Value type of TEdgeIterator has to be compatible with Edge*.

Note that all edges between edgesBegin and edgesEnd have to be members of the specified grid.

The orientation can only be successfully fixed, if vertices between the given edges share at most 2 edges between edgesBegin and edgesEnd.

References ug::Grid::associated_edges_begin(), ug::Grid::associated_edges_end(), ug::Grid::begin_marking(), ug::Grid::end_marking(), ug::Grid::flip_orientation(), ug::GetVertexIndex(), ug::Grid::is_marked(), ug::Grid::mark(), ug::Grid::unmark(), and ug::EdgeVertices::vertex().

Referenced by ug::AdjustSubsetsForLgmNg().

◆ GetAssociatedFaces()

UG_API int ug::GetAssociatedFaces ( Face **  facesOut,
Grid grid,
Edge e,
int  maxNumFaces 
)

writes associated faces of e to facesOut.

Associated faces of e are written to facesOut. facesOut has to be an array of size maxNumFaces. If there are more then maxNumFaces associated faces, they are not written to facesOut.

The method returns the number of total number of associated faces.

References ug::Grid::associated_faces_begin(), ug::Grid::associated_faces_end(), ug::EDGEOPT_STORE_ASSOCIATED_FACES, ug::FaceVertices::num_vertices(), ug::Grid::option_is_enabled(), ug::EdgeVertices::vertex(), and ug::FaceVertices::vertex().

Referenced by ug::AdjustEdgeOrientationToFaceOrientation(), ug::CalculateNormal(), ug::CalculateNormalNoNormalize(), ug::CollectSurfaceNeighborsSorted(), ug::DelaunayInfo< TAAPos >::init_marks(), ug::MakeDelaunay(), ug::MarkCreaseEdges(), ug::MinimizeEdgeLength_SwapsOnly(), ug::QualityGridGeneration(), ug::SelectCreaseEdges(), ug::SwapEdge(), and ug::TrySwap().

◆ GetConnectingEdge()

UG_API Edge * ug::GetConnectingEdge ( Grid grid,
Face f1,
Face f2 
)

returns the first edge found which is shared by both faces or NULL if no such edge exists.

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

Referenced by ug::CreateQuadrilateral_NoRegistration(), and ug::ReplaceByQuadrilateral().

◆ GetEdgeIndex() [1/2]

UG_API int ug::GetEdgeIndex ( Face f,
Edge e 
)

returns the index at which edge e is found in the given object

returns -1 if the edge was not found.

References ug::CompareVertices(), ug::Face::edge_desc(), and ug::Face::num_edges().

Referenced by ug::HangingNodeRefinerBase< TSelector >::assign_hnode_marks(), ug::CalculateSmoothManifoldPosInParentLevelButterflyScheme(), and ug::IRefiner::get_local_edge_mark().

◆ GetEdgeIndex() [2/2]

UG_API int ug::GetEdgeIndex ( Volume vol,
Edge e 
)

returns the index at which edge e is found in the given object

returns -1 if the edge was not found.

References ug::CompareVertices(), ug::Volume::edge_desc(), and ug::Volume::num_edges().

Referenced by ug::CollapseEdge(), and ug::CreateEdgeSplitGeometry().

◆ GetInnerEdgesOfFaceSoup()

template<class face_iter_t >
void ug::GetInnerEdgesOfFaceSoup ( std::vector< Edge * > &  edgesOut,
Grid g,
face_iter_t  facesBegin,
face_iter_t  facesEnd 
)

pushes all edges which are connected to at least 2 faces from the specified sequence to edgesOut

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

Referenced by ug::ReplaceByQuadrilaterals_FaceBased(), and ug::ReplaceByQuadrilaterals_FaceBasedNoSort().

◆ GetVertex()

Vertex * ug::GetVertex ( Edge e,
size_t  i 
)
inline

returns the i'th vertex of an edge

This function simply returns the i'th vertex of an edge

References boost::num_vertices(), UG_ASSERT, and ug::EdgeVertices::vertex().

◆ IsBoundaryEdge()

UG_API bool ug::IsBoundaryEdge ( Grid grid,
Edge e,
Grid::face_traits::callback  funcIsSurfFace 
)

returns true if the edge is connected to exactly one surface face.

If the given callback returns true for a given face, then the face is considered to be part of a surface. If exactly one of the faces adjacent to the given edge is part of a surface, then the edge is considered to be a boundary edge and true is returned. Take a look at existing standard callbacks, if you want to use this method.

References ug::Grid::associated_faces_begin(), ug::Grid::associated_faces_end(), ug::CollectFaces(), ug::EDGEOPT_STORE_ASSOCIATED_FACES, and ug::Grid::option_is_enabled().

◆ IsBoundaryEdge2D()

UG_API bool ug::IsBoundaryEdge2D ( Grid grid,
Edge e 
)

returns whether an edge lies on the boundary of a 2D grid.

An edge is regarded as a boundary edge if it is adjacent to exactly one face. if EDGEOPT_STORE_ASSOCIATED_FACES is enabled, the algorithm will be faster.

References ug::NumAssociatedFaces().

Referenced by ug::AssignInnerAndBoundarySubsets(), ug::CalculateBoundaryVertexNormal2D(), ug::IsBoundaryVertex2D(), ug::LiesOnBoundary(), ug::ProjectToLimitPLoop(), ug::ProjectToLimitSubdivBoundary(), ug::SelectCreaseEdges(), and ug::SlopeSmooth().

◆ IsBoundaryEdge3D()

UG_API bool ug::IsBoundaryEdge3D ( Grid grid,
Edge e 
)

returns whether an edge lies on the boundary of a 3D grid.

An edge is regarded as a boundary edge in 3d if it is adjacent to at least one boundary face. if EDGEOPT_STORE_ASSOCIATED_FACES is enabled, the algorithm will be faster.

Please Note: This algorithm requires the grid option VOLOPT_AUTOGENERATE_FACES. If it is not enabled, this algorithm will enable it.

Todo:
This algorithm should work without VOLOPT_AUTOGENERATE_FACES, too.

References ug::Grid::associated_faces_begin(), ug::Grid::associated_faces_end(), ug::CollectFaces(), ug::EDGEOPT_STORE_ASSOCIATED_FACES, ug::Grid::enable_options(), ug::IsBoundaryFace3D(), ug::Grid::option_is_enabled(), UG_LOG, and ug::VOLOPT_AUTOGENERATE_FACES.

Referenced by ug::DistributeExpansionMarks3D(), ug::LiesOnBoundary(), and ug::ProjectToLimitPLoop().

◆ LiesOnBoundary()

UG_API bool ug::LiesOnBoundary ( Grid grid,
Edge e 
)

◆ MinimizeEdgeLength_SwapsOnly()

template<class EdgeIterator , class TAAPos >
UG_API void ug::MinimizeEdgeLength_SwapsOnly ( Grid grid,
EdgeIterator  edgesBegin,
EdgeIterator  edgesEnd,
TAAPos &  aaPos 
)

Transforms the given edge-set so that the sum of the length the edges is minimized.

Removes edges that connect the same two vertices as another edge. ** THIS ALGORITHM USES Grid::mark*‍/ Currently only works for 3d position attachments.

Todo:
add support for 2d position attachments.

References ug::Grid::attach_to_edges_dv(), ug::CalculateNormal(), ug::CollectAssociated(), ug::Grid::detach_from_edges(), ug::EdgeLengthSq(), ug::GetAssociatedFaces(), ug::GetConnectedVertex(), boost::num_vertices(), ug::FaceDescriptor::set_num_vertices(), ug::FaceDescriptor::set_vertex(), ug::SwapEdge(), UG_ASSERT, ug::VecDot(), ug::EdgeVertices::vertex(), and ug::VertexDistanceSq().

◆ NumAssociatedFaces()

◆ SplitEdge() [1/2]

template<class TVertex >
TVertex * ug::SplitEdge ( Grid destGrid,
Grid srcGrid,
Edge e,
AVertex paAssociatedVertices = NULL,
bool  bConservative = false 
)

inserts new triangles and one new vertex by splitting the specified edge.

returns the newly created vertex. The vertex that will be created will be of type TVertex. The new vertex and triangles are copied to destGrid. e has to be a member of srcGrid. If bConservative == false then SplitEdge will replace e and its adjacent geometry by the newly generated geometry. paAssociatedVertices has to be specified if destGrid and srcGrid do not match. If destGrid and srcGrid do match, paAssociatedVertices may be specified optionally. paAssociatedVertices has to be a vertex-attachment of srcGrid, that stores for each vertex in srcGrid the associated vertex of destGrid. NULL indicates that no associated vertex exists in destGrid. New ones will be automatically constructed in this case.

References ug::CollectFaces(), ug::CollectVolumes(), ug::Grid::create(), ug::CreateEdgeSplitGeometry(), ug::Grid::erase(), ug::FACEOPT_AUTOGENERATE_EDGES, ug::Grid::option_is_enabled(), ug::VOLOPT_AUTOGENERATE_EDGES, and ug::VOLOPT_AUTOGENERATE_FACES.

◆ SplitEdge() [2/2]

template<class TVertex >
TVertex * ug::SplitEdge ( Grid grid,
Edge e,
bool  bConservative = false 
)

inserts new triangles and one new vertex by splitting the specified edge.

returns the newly created vertex if everything went right, NULL if not. The vertex that will be created will be of type TVertex. If bConservative == false then SplitEdge will replace e and its adjacent geometry by the newly generated geometry.

◆ SwapEdge()

UG_API Edge * ug::SwapEdge ( Grid grid,
Edge e 
)

swaps e and thus reconnects its two adjacent triangles.

A swap is only allowed if e has exactly 2 adjacent triangles. The method erases the old edge and triangles and constructs new ones. Old elements are passed as parents to the grids creation method.

The swapped edge is returned.

References ug::Grid::begin_marking(), ug::Grid::create(), ug::Grid::create_by_cloning(), ug::Grid::end_marking(), ug::Grid::erase(), ug::Grid::get_edge(), ug::GetAssociatedFaces(), ug::Grid::is_marked(), ug::Grid::mark(), boost::num_vertices(), UG_LOG, ug::EdgeVertices::vertex(), and ug::FaceVertices::vertex().

Referenced by ug::MinimizeEdgeLength_SwapsOnly().