ug4
extrusion

Algorithms to extrude geometry. More...

Enumerations

enum  ug::ExtrusionOptions { ug::EO_CREATE_FACES = 1 , ug::EO_CREATE_VOLUMES = 1 << 1 , ug::EO_DEFAULT }
 used to specify the behavior of ug::Extrude. More...
 

Functions

bool ug::ExtrudeCylinder (Grid &grid, SubsetHandler &sh, Vertex *vrt, const vector3 &direction, number height, number radius, number rimSnapThreshold, Grid::VertexAttachmentAccessor< APosition > &aaPos, int bottomSubInd=-1, int cylSubInd=-1, Selector *pSel=NULL)
 adapts the grid around the given vertex to a cylinder and extrudes it. More...
 
bool ug::ExtrudeCylinder (Grid &grid, Vertex *vrt, const vector3 &direction, number height, number radius, number rimSnapThreshold, Grid::VertexAttachmentAccessor< APosition > &aaPos, Selector *pSel=NULL)
 adapts the grid around the given vertex to a cylinder and extrudes it. More...
 
template<class vector_t >
void ug::Extrude (Grid &grid, std::vector< Vertex * > *pvVerticesInOut, std::vector< Edge * > *pvEdgesInOut, std::vector< Face * > *pvFacesInOut, const vector_t &direction, uint extrusionOptions=EO_DEFAULT, Attachment< vector_t > &aPos=aPosition, std::vector< Volume * > *pvVolsOut=NULL)
 extrudes geometry and creates new edges, faces and volumes. More...
 
template<class TAAPos >
void ug::Extrude (Grid &grid, std::vector< Vertex * > *pvVerticesInOut, std::vector< Edge * > *pvEdgesInOut, std::vector< Face * > *pvFacesInOut, const typename TAAPos::ValueType &direction, TAAPos aaPos, uint extrusionOptions, std::vector< Volume * > *pvVolsOut)
 extrudes geometry and creates new edges, faces and volumes. More...
 

Detailed Description

Algorithms to extrude geometry.

Through extrusion on can manipulate an existing geometry in different ways. It is for example possible to create a ug::Prism from a ug::Triangle or a ug::Hexahedron from a ug::Quadrilateral. The creation of higher-dimensional geometric objects is however not obligatory.

Of course extrusion can be applied to multiple elements at once.

Enumeration Type Documentation

◆ ExtrusionOptions

used to specify the behavior of ug::Extrude.

Enumerator
EO_CREATE_FACES 
EO_CREATE_VOLUMES 
EO_DEFAULT 

Function Documentation

◆ Extrude() [1/2]

template<class TAAPos >
void ug::Extrude ( Grid grid,
std::vector< Vertex * > *  pvVerticesInOut,
std::vector< Edge * > *  pvEdgesInOut,
std::vector< Face * > *  pvFacesInOut,
const typename TAAPos::ValueType &  direction,
TAAPos  aaPos,
uint  extrusionOptions,
std::vector< Volume * > *  pvVolsOut 
)

extrudes geometry and creates new edges, faces and volumes.

For each vertex in pvVerticesInOut a new edge will be created. NULL is a valid parameter for pvVerticesInOut.

For each edge in pvEdgesInOut a new edge. if EO_CREATE_FACES is enabled, a new face that connects the two edges will be created too. NULL is a valid parameter for pvEdgesInOut.

For each face in pvFacesInOut a new face will be created. if EO_CREATE_VOLUMES is enabled a new volume that connects the two faces will be created too. NULL is a valid parameter for pvFacesInOut.

The element from which new elements are extruded is passed to each new element as the parent element.

Pass any or-combination of const in ExtrusionOptions as extrusionOptions.

After the algorithm has finished, the in-out-vectors hold the elements which have been created from the input-elements of those vectors. The in-out-vectors thus can be directly used in a new call to Extrude.

All newly created volume-elements will be pushed to pvVolsOut if that vector was specified (NULL by default). Volume elements are created in the order in which faces are specified in pvFacesInOut.

If you need to have access to all newly created elements you could use a ug::Selector with enabled autoselection.

References ug::Grid::create(), ug::Grid::create_by_cloning(), ug::EO_CREATE_FACES, ug::EO_CREATE_VOLUMES, ug::ExtrusionHelper_CheckOrientation(), ug::Grid::get_attachment_data_index(), ug::Hexahedron::get_flipped_orientation(), ug::Prism::get_flipped_orientation(), ug::LIB_GRID, ug::FaceVertices::num_vertices(), UG_DLOG, ug::VecAdd(), ug::EdgeVertices::vertex(), and ug::FaceVertices::vertex().

Referenced by ug::Extrude().

◆ Extrude() [2/2]

template<class vector_t >
void ug::Extrude ( Grid grid,
std::vector< Vertex * > *  pvVerticesInOut,
std::vector< Edge * > *  pvEdgesInOut,
std::vector< Face * > *  pvFacesInOut,
const vector_t &  direction,
uint  extrusionOptions = EO_DEFAULT,
Attachment< vector_t > &  aPos = aPosition,
std::vector< Volume * > *  pvVolsOut = NULL 
)

extrudes geometry and creates new edges, faces and volumes.

For each vertex in pvVerticesInOut a new edge will be created. NULL is a valid parameter for pvVerticesInOut.

For each edge in pvEdgesInOut a new edge. if EO_CREATE_FACES is enabled, a new face that connects the two edges will be created too. NULL is a valid parameter for pvEdgesInOut.

For each face in pvFacesInOut a new face will be created. if EO_CREATE_VOLUMES is enabled a new volume that connects the two faces will be created too. NULL is a valid parameter for pvFacesInOut.

The element from which new elements are extruded is passed to each new element as the parent element.

Pass any or-combination of const in ExtrusionOptions as extrusionOptions.

After the algorithm has finished, the in-out-vectors hold the elements which have been created from the input-elements of those vectors. The in-out-vectors thus can be directly used in a new call to Extrude.

All newly created volume-elements will be pushed to pvVolsOut if that vector was specified (NULL by default). Volume elements are created in the order in which faces are specified in pvFacesInOut.

If you need to have access to all newly created elements you could use a ug::Selector with enabled autoselection.

References ug::Grid::attach_to_vertices(), ug::Extrude(), ug::Grid::has_vertex_attachment(), ug::LIB_GRID, and UG_DLOG.

Referenced by ug::ExtrudeCylinder(), ug::ExtrudeLayers(), ug::RepeatedEdgeExtrusion(), ug::RepeatedFaceExtrusion(), and ug::RepeatedVertexExtrusion().

◆ ExtrudeCylinder() [1/2]

bool ug::ExtrudeCylinder ( Grid grid,
SubsetHandler sh,
Vertex vrt,
const vector3 direction,
number  height,
number  radius,
number  rimSnapThreshold,
Grid::VertexAttachmentAccessor< APosition > &  aaPos,
int  bottomSubInd = -1,
int  cylSubInd = -1,
Selector pSel = NULL 
)

adapts the grid around the given vertex to a cylinder and extrudes it.

If you're not interested in the subsets of the extruded geometry, or if you want to handle them yourself, please use a overloaded version of this method.

Todo:
: Add a parameter that allows to specify whether the source-faces of the extrusion shall be erased.
Parameters
gridThe Grid
shThe SubsetHandler
vrtThe Vertex
directionthe direction
heightThe actual extrude-amount is determined by scaling direction with height. Note that if height is negative, the orientation of the extruded geometrie will be inverted.
radiusradius
rimSnapThresholdIf a vertex lies closer to the rim than rimSnapThreshold, then it will be projected to the rim.
aaPosposition attachment accessor
bottomSubInddefault value is -1. Defines the subset into which the bottom-faces of the cylinder will go
cylSubInddefault value is -1. Defines the subset into which the bottom-faces of the cylinder will go
pSelYou may pass a pointer to a selector that may be used by this method internally. This makes sense if you call this method repeatedly, since a repeated allocation and deallocation can be avoided.

References ug::ExtrudeCylinder().

◆ ExtrudeCylinder() [2/2]

bool ug::ExtrudeCylinder ( Grid grid,
Vertex vrt,
const vector3 direction,
number  height,
number  radius,
number  rimSnapThreshold,
Grid::VertexAttachmentAccessor< APosition > &  aaPos,
Selector pSel = NULL 
)

adapts the grid around the given vertex to a cylinder and extrudes it.

If you want the method to automatically assign subset-indices to the extruded geometry, then please use an overloaded version of this method.

Todo:
: Add a parameter that allows to specify whether the source-faces of the extrusion shall be erased.
Parameters
gridThe Grid
vrtThe Vertex
directionthe direction
radiusradius
rimSnapThresholdIf a vertex lies closer to the rim than rimSnapThreshold, then it will be projected to the rim.
aaPosposition attachment accessor
heightThe actual extrude-amount is determined by scaling direction with height. Note that if height is negative, the orientation of the extruded geometrie will be inverted.
pSelYou may pass a pointer to a selector that may be used by this method internally. This makes sense if you call this method repeatedly, since a repeated allocation and deallocation can be avoided.
minDotFaces whose normal has a dot-product lower that minDot whith the given direction are not regarded as cylinder- bottom faces and are thus not extruded.

Referenced by ug::ExtrudeCylinder().