VCG Library
Loading...
Searching...
No Matches
Namespaces | Classes | Functions | Variables
vcg::tri Namespace Reference

Namespaces

namespace  io
 

Classes

class  Allocator
 Class to safely add and delete elements in a mesh. More...
 
class  AnisotropicDistance
 
class  Append
 Class to safely duplicate and append (portion of) meshes. More...
 
struct  BaseInterpolator
 
struct  BasicCrossFunctor
 
struct  CenterPointBarycenter
 
class  Clean
 Class of static functions to clean//restore meshs. More...
 
class  CoM
 A class for managing curves on a 2-manifold (Curve on Manifold - CoM). More...
 
class  ConnectedComponentIterator
 
class  EdgeConnectedComponentIterator
 
class  EdgeLen
 
class  EdgeSplSphere
 
struct  EuclideanDistance
 
class  Fitmaps
 
class  Geodesic
 Class for computing approximate geodesic distances on a mesh. More...
 
class  HalfEdgeTopology
 Class containing functions to modify the topology of a halfedge based mesh. More...
 
class  HausdorffSampler
 
class  Inertia
 Methods for computing Polyhedral Mass properties (like inertia tensor, volume, etc) More...
 
class  IsotropicDistance
 
class  MeshSampler
 
struct  MidPoint
 
struct  MidPointArc
 
struct  MidPointArcNaive
 
struct  MidPointButterfly
 
struct  MidPointButterfly2
 
struct  MidPointSphere
 
class  QualityEdgePredicate
 
class  QualityMidPointFunctor
 
class  RedetailSampler
 
class  RefinedFaceData
 
class  SelectionStack
 A stack for saving and restoring selection. More...
 
class  Split
 
class  SurfaceSampling
 Main Class of the Sampling framework. More...
 
class  TriSplit
 Triangle split Simple templated function for splitting a triangle with a internal point. It can be templated on a CenterPoint class that is used to generate the position of the internal point. More...
 
class  TrivialPointerSampler
 
class  TrivialSampler
 A basic sampler class that show the required interface used by the SurfaceSampling class. More...
 
class  UpdateBounding
 This class is used to compute or update the bounding box of a mesh.. More...
 
class  UpdateColor
 Generation and processing of per-vertex and per-face colors according to various strategy. More...
 
class  UpdateComponentEP
 This class is used to compute or update the precomputed data used to efficiently compute point-face distances. More...
 
class  UpdateCurvature
 Management, updating and computation of per-vertex and per-face normals. More...
 
class  UpdateCurvatureFitting
 Computation of per-vertex directions and values of curvature. More...
 
class  UpdateFlags
 Management, updating and computation of per-vertex and per-face flags (like border flags). More...
 
class  UpdateHalfEdges
 This class is used to build edge based data structure from indexed data structure and viceversa. More...
 
struct  UpdateIndexed
 
class  UpdateNormal
 Management, updating and computation of per-vertex, per-face, and per-wedge normals. More...
 
class  UpdatePosition
 This class is used to update vertex position according to a transformation matrix. More...
 
class  UpdateQuality
 Generation of per-vertex and per-face qualities. More...
 
class  UpdateSelection
 Management, updating and conditional computation of selections (per-vertex, per-edge, and per-face). More...
 
class  UpdateTexture
 This class is used to update/generate texcoord position according to various critera. More...
 
class  UpdateTopology
 Generation of per-vertex and per-face topological information. More...
 

Functions

template<class MeshType >
size_t Index (const MeshType &m, const typename MeshType::VertexType &v)
 
template<class MeshType >
size_t Index (const MeshType &m, const typename MeshType::FaceType &f)
 
template<class MeshType >
size_t Index (const MeshType &m, const typename MeshType::EdgeType &e)
 
template<class MeshType >
size_t Index (const MeshType &m, const typename MeshType::HEdgeType &h)
 
template<class MeshType >
size_t Index (const MeshType &m, const typename MeshType::TetraType &t)
 
template<class MeshType >
size_t Index (const MeshType &m, const typename MeshType::VertexType *vp)
 
template<class MeshType >
size_t Index (const MeshType &m, const typename MeshType::FaceType *fp)
 
template<class MeshType >
size_t Index (const MeshType &m, const typename MeshType::EdgeType *e)
 
template<class MeshType >
size_t Index (const MeshType &m, const typename MeshType::HEdgeType *h)
 
template<class MeshType >
size_t Index (const MeshType &m, const typename MeshType::TetraType *t)
 
template<class MeshType >
bool IsValidPointer (MeshType &m, const typename MeshType::VertexType *vp)
 
template<class MeshType >
bool IsValidPointer (MeshType &m, const typename MeshType::EdgeType *ep)
 
template<class MeshType >
bool IsValidPointer (MeshType &m, const typename MeshType::FaceType *fp)
 
template<class MeshType >
bool IsValidPointer (MeshType &m, const typename MeshType::HEdgeType *hp)
 
template<class MeshType >
bool IsValidPointer (MeshType &m, const typename MeshType::TetraType *tp)
 
template<class MeshType , class ATTR_CONT >
void ReorderAttribute (ATTR_CONT &c, std::vector< size_t > &newVertIndex, MeshType &)
 
template<class MeshType , class ATTR_CONT >
void ResizeAttribute (ATTR_CONT &c, size_t sz, MeshType &)
 
template<class MeshType , typename Callable >
void ForEachFacePos (const MeshType &m, Callable action)
 
template<class MeshType , typename Callable >
void ForEachFacePos (MeshType &m, Callable action)
 
template<class MeshType , typename Callable >
void ForEachFace (const MeshType &m, Callable action)
 
template<class MeshType , typename Callable >
void ForEachFace (MeshType &m, Callable action)
 
template<class MeshType , typename Callable >
void ForEachVertex (const MeshType &m, Callable action)
 
template<class MeshType , typename Callable >
void ForEachVertex (MeshType &m, Callable action)
 
template<class MeshType , typename Callable >
void ForEachHEdge (const MeshType &m, Callable action)
 
template<class MeshType , typename Callable >
void ForEachHEdge (MeshType &m, Callable action)
 
template<class MeshType , typename Callable >
void ForEachEdge (const MeshType &m, Callable action)
 
template<class MeshType , typename Callable >
void ForEachEdge (MeshType &m, Callable action)
 
template<class MeshType , typename Callable >
void ForEachTetra (const MeshType &m, Callable action)
 
template<class MeshType , typename Callable >
void ForEachTetra (MeshType &m, Callable action)
 
template<class MeshType >
MeshType::ScalarType ComputePoissonDiskRadius (MeshType &origMesh, int sampleNum)
 
template<class MeshType >
void MontecarloSampling (MeshType &m, MeshType &mm, int sampleNum)
 
template<class MeshType >
void MontecarloSampling (MeshType &m, std::vector< Point3f > &montercarloSamples, int sampleNum)
 
template<class MeshType >
void PoissonSampling (MeshType &m, std::vector< typename MeshType::CoordType > &poissonSamples, int sampleNum, typename MeshType::ScalarType &radius, typename MeshType::ScalarType radiusVariance=1, typename MeshType::ScalarType PruningByNumberTolerance=0.04f, unsigned int randSeed=0)
 
template<class MeshType >
void PoissonPruning (MeshType &m, std::vector< typename MeshType::VertexPointer > &poissonSamples, float radius, unsigned int randSeed=0)
 Low level wrapper for Poisson Disk Pruning.
 
template<class MeshType >
void PoissonPruning (MeshType &m, std::vector< typename MeshType::CoordType > &poissonSamples, float radius, unsigned int randSeed=0)
 Low level wrapper for Poisson Disk Pruning.
 
template<class MeshType >
void PoissonPruningExact (MeshType &m, std::vector< typename MeshType::VertexPointer > &poissonSamples, typename MeshType::ScalarType &radius, int sampleNum, float tolerance=0.04, int maxIter=20, unsigned int randSeed=0)
 Very simple wrapping for the Exact Poisson Disk Pruning.
 
template<class MESH_TYPE , class MIDPOINT , class EDGEPRED >
bool RefineE (MESH_TYPE &m, MIDPOINT &mid, EDGEPRED &ep, bool RefineSelected=false, CallBackPos *cb=0)
 
template<class MESH_TYPE , class MIDPOINT >
bool Refine (MESH_TYPE &m, MIDPOINT mid, typename MESH_TYPE::ScalarType thr=0, bool RefineSelected=false, CallBackPos *cb=0)
 
template<class MeshType >
void TrivialMidPointRefine (MeshType &m, bool onlySelected=false)
 Trivial function for 1->4 triangle split.
 
template<class MESH_TYPE , class EDGEPRED >
bool RefineMidpoint (MESH_TYPE &m, EDGEPRED &ep, bool RefineSelected=false, CallBackPos *cb=0)
 
template<class TetraMeshType >
void Tetrahedron (TetraMeshType &in)
 Build a tetrahedron as a triangular mesh.
 
template<class DodMeshType >
void Dodecahedron (DodMeshType &in)
 Build a dodecahedron as a triangular mesh.
 
template<class DodMeshType >
void DodecahedronSym (DodMeshType &in)
 Build a symmetric dodecahedron as a triangular mesh.
 
template<class OctMeshType >
void Octahedron (OctMeshType &in)
 Build an octahedron as a triangular mesh.
 
template<class IcoMeshType >
void Icosahedron (IcoMeshType &in)
 Build an icosahedron as a triangular mesh.
 
template<class MeshType >
void Hexahedron (MeshType &in)
 Build a hexahedron (cube) as a triangular mesh.
 
template<class MeshType >
void Square (MeshType &in)
 Build a unit square in the XY plane as two triangles.
 
template<class MeshType >
void SphericalCap (MeshType &in, float angleRad, const int subdiv=3)
 Build a spherical cap from a hexagon refined on the sphere.
 
template<class MeshType >
void Sphere (MeshType &in, const int subdiv=3)
 Build a geodesic sphere by recursive icosahedron refinement.
 
template<class MeshType >
void Sphere (MeshType &m, const typename MeshType::CoordType &position, typename MeshType::ScalarType radius=0, const int subdiv=3)
 Convenience overload: build and place a sphere at a position with a radius.
 
template<class MeshType >
void Cone (MeshType &in, const typename MeshType::ScalarType r1, const typename MeshType::ScalarType r2, const typename MeshType::ScalarType h, const int SubDiv=36)
 r1 = raggio 1, r2 = raggio2, h = altezza (asse y)
 
template<class MeshType >
void OrientedCone (MeshType &m, const typename MeshType::CoordType origin, const typename MeshType::CoordType end, const typename MeshType::ScalarType r1, const typename MeshType::ScalarType r2, const int SubDiv=36)
 Build a cone/frustum oriented from origin to end.
 
template<class MeshType >
void Box (MeshType &in, const typename MeshType::BoxType &bb)
 Build a box aligned with the axes from a bounding box.
 
template<class MeshType >
void Torus (MeshType &m, float hRingRadius, float vRingRadius, int hRingDiv=24, int vRingDiv=12)
 Build a torus mesh around Z axis.
 
template<class MeshType >
void SuperToroid (MeshType &m, float hRingRadius, float vRingRadius, float vSquareness, float hSquareness, int hRingDiv=24, int vRingDiv=12)
 Build a supertoroid (superquadric torus).
 
template<class MeshType >
void SuperEllipsoid (MeshType &m, float rFeature, float sFeature, float tFeature, int hRingDiv=24, int vRingDiv=12)
 Build a superellipsoid (superquadric sphere-like surface).
 
template<class MeshType , class InCoordType , class InFaceIndexType >
void BuildMeshFromCoordVectorIndexVector (MeshType &in, const std::vector< InCoordType > &v, const std::vector< InFaceIndexType > &f)
 Build a mesh from coordinate and face-index vectors.
 
template<class MeshType , class V >
void BuildMeshFromCoordVector (MeshType &in, const V &v)
 Build a point-only mesh from coordinate vector (no faces).
 
template<class TriMeshType , class EdgeMeshType >
void BuildFromFaceEdgeSel (TriMeshType &in, EdgeMeshType &out)
 Build an edge mesh from the selected edges of a triangle mesh.
 
template<class MeshType >
void Grid (MeshType &in, int w, int h, float wl, float hl, float *data=0)
 Build a regular height-field grid mesh (vertices and faces).
 
template<class MeshType >
void FaceGrid (MeshType &in, int w, int h)
 Build faces for a regular grid given pre-allocated vertices.
 
template<class MeshType >
void SparseFaceGrid (MeshType &in, const std::vector< int > &grid, int w, int h)
 Build faces for a sparsely sampled regular grid.
 
template<class MeshType >
void Annulus (MeshType &m, float externalRadius, float internalRadius, int slices)
 Build an annulus (ring) in the XY plane.
 
template<class MeshType >
void OrientedAnnulus (MeshType &m, typename MeshType::CoordType center, typename MeshType::CoordType norm, float externalRadius, float internalRadius, int slices)
 Build an oriented annulus in 3D, centered and rotated.
 
template<class MeshType >
void Circle2D (MeshType &m, float radius=1.0, int sides=32)
 Build a 2D circle as a polyline (edges only) in XY plane.
 
template<class MeshType >
void Disk (MeshType &m, int slices)
 Build a unit disk (triangle fan) in the XY plane.
 
template<class MeshType >
void OrientedDisk (MeshType &m, typename MeshType::CoordType center, typename MeshType::CoordType norm, float radius, int slices)
 Build a disk oriented in 3D space.
 
template<class MeshType >
void OrientedEllipticPrism (MeshType &m, const typename MeshType::CoordType origin, const typename MeshType::CoordType end, float radius, float xScale, float yScale, bool capped, int slices=32, int stacks=4)
 Build an oriented elliptic prism (scaled cylinder), optionally capped.
 
template<class MeshType >
void OrientedCylinder (MeshType &m, const typename MeshType::CoordType origin, const typename MeshType::CoordType end, float radius, bool capped, int slices=32, int stacks=4)
 Build an oriented cylinder along a segment, optionally capped.
 
template<class MeshType >
void Cylinder (MeshType &m, int slices, int stacks, bool capped=false)
 Build a unit cylinder aligned to Y, optionally capped.
 
template<class MeshType >
void BuildPrismFaceShell (MeshType &mIn, MeshType &mOut, float height=0, float inset=0, bool smoothFlag=false)
 Build a shell made of face-aligned prisms for each face.
 
template<class MeshType >
void BuildCylinderEdgeShell (MeshType &mIn, MeshType &mOut, float radius=0, int slices=16, int stacks=1)
 Build a tubular shell around edges using oriented cylinders.
 
template<class MeshType >
void BuildSphereVertexShell (MeshType &mIn, MeshType &mOut, float radius=0, int recDiv=2)
 Build a spherical shell on each vertex by instancing a small sphere.
 
template<class MeshType >
void BuildCylinderVertexShell (MeshType &mIn, MeshType &mOut, float radius=0, float height=0, int slices=16, int stacks=1)
 Build a cylindrical shell on each vertex aligned with its normal.
 
template<class MeshType >
void GenerateCameraMesh (MeshType &in)
 Build a simple camera-shaped mesh (mainly for visualization).
 
template<class MeshType >
void OrientedRect (MeshType &square, float width, float height, typename MeshType::CoordType c, typename MeshType::CoordType dir=typename MeshType::CoordType(0, 0, 0), float angleDeg=0, typename MeshType::CoordType preRotTra=typename MeshType::CoordType(0, 0, 0))
 Build a rectangle in 3D with orientation and optional pre-rotation.
 
template<class MeshType >
void OrientedSquare (MeshType &square, float width, typename MeshType::CoordType c, typename MeshType::CoordType dir=typename MeshType::CoordType(0, 0, 0), float angleDeg=0, typename MeshType::CoordType preRotTra=typename MeshType::CoordType(0, 0, 0))
 Build an oriented square (special case of OrientedRect).
 

Variables

const Split SplitTab [8]
 

Detailed Description

Everything about triangular meshes lie in this namespace

Function Documentation

◆ Annulus()

template<class MeshType >
void vcg::tri::Annulus ( MeshType &  m,
float  externalRadius,
float  internalRadius,
int  slices 
)

Build an annulus (ring) in the XY plane.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mOutput mesh.
externalRadiusOuter radius.
internalRadiusInner radius.
slicesNumber of angular segments.

◆ Box()

template<class MeshType >
void vcg::tri::Box ( MeshType &  in,
const typename MeshType::BoxType &  bb 
)

Build a box aligned with the axes from a bounding box.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
inOutput mesh.
bbBounding box providing min/max corners.

◆ BuildCylinderEdgeShell()

template<class MeshType >
void vcg::tri::BuildCylinderEdgeShell ( MeshType &  mIn,
MeshType &  mOut,
float  radius = 0,
int  slices = 16,
int  stacks = 1 
)

Build a tubular shell around edges using oriented cylinders.

Template Parameters
MeshTypeMesh type (input/output).
Parameters
mInInput mesh.
mOutOutput mesh (append mode).
radiusCylinder radius (auto from bbox if 0).
slicesAngular segments.
stacksLongitudinal segments.

◆ BuildCylinderVertexShell()

template<class MeshType >
void vcg::tri::BuildCylinderVertexShell ( MeshType &  mIn,
MeshType &  mOut,
float  radius = 0,
float  height = 0,
int  slices = 16,
int  stacks = 1 
)

Build a cylindrical shell on each vertex aligned with its normal.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mInInput mesh.
mOutOutput mesh (append mode).
radiusCylinder radius (auto if 0).
heightHalf-height along the vertex normal (auto if 0).
slicesAngular segments.
stacksLongitudinal segments.

◆ BuildFromFaceEdgeSel()

template<class TriMeshType , class EdgeMeshType >
void vcg::tri::BuildFromFaceEdgeSel ( TriMeshType &  in,
EdgeMeshType &  out 
)

Build an edge mesh from the selected edges of a triangle mesh.

Template Parameters
TriMeshTypeTriangle mesh type (input).
EdgeMeshTypeEdge mesh type (output).
Parameters
inInput triangle mesh with face-edge selection.
outOutput edge mesh with selected edges.

◆ BuildMeshFromCoordVector()

template<class MeshType , class V >
void vcg::tri::BuildMeshFromCoordVector ( MeshType &  in,
const V &  v 
)

Build a point-only mesh from coordinate vector (no faces).

Template Parameters
MeshTypeMesh type.
VCoordinate container type.
Parameters
inOutput mesh; cleared and filled with vertices only.
vInput vertex coordinates.

◆ BuildMeshFromCoordVectorIndexVector()

template<class MeshType , class InCoordType , class InFaceIndexType >
void vcg::tri::BuildMeshFromCoordVectorIndexVector ( MeshType &  in,
const std::vector< InCoordType > &  v,
const std::vector< InFaceIndexType > &  f 
)

Build a mesh from coordinate and face-index vectors.

Template Parameters
MeshTypeTriangular mesh type.
InCoordTypeInput coordinate type supporting operator[] for xyz.
InFaceIndexTypeInput face index type supporting operator[] for 3 vertex indices.
Parameters
inOutput mesh; cleared and filled.
vInput vertex coordinates (size = vn).
fInput triangle indices (size = fn).

◆ BuildPrismFaceShell()

template<class MeshType >
void vcg::tri::BuildPrismFaceShell ( MeshType &  mIn,
MeshType &  mOut,
float  height = 0,
float  inset = 0,
bool  smoothFlag = false 
)

Build a shell made of face-aligned prisms for each face.

Template Parameters
MeshTypeTriangular mesh type supporting polygonal faux edges.
Parameters
mInInput mesh.
mOutOutput mesh (append mode).
heightPrism height (auto from bbox if 0).
insetInset amount along face to shrink border (auto if 0).
smoothFlagApply smoothing on side strips if true.

◆ BuildSphereVertexShell()

template<class MeshType >
void vcg::tri::BuildSphereVertexShell ( MeshType &  mIn,
MeshType &  mOut,
float  radius = 0,
int  recDiv = 2 
)

Build a spherical shell on each vertex by instancing a small sphere.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mInInput mesh.
mOutOutput mesh (append mode).
radiusSphere radius (auto from bbox if 0).
recDivSphere recursion divisions.

◆ Circle2D()

template<class MeshType >
void vcg::tri::Circle2D ( MeshType &  m,
float  radius = 1.0,
int  sides = 32 
)

Build a 2D circle as a polyline (edges only) in XY plane.

Template Parameters
MeshTypeEdge-capable mesh type.
Parameters
mOutput mesh.
radiusCircle radius.
sidesNumber of segments.

◆ Cone()

template<class MeshType >
void vcg::tri::Cone ( MeshType &  in,
const typename MeshType::ScalarType  r1,
const typename MeshType::ScalarType  r2,
const typename MeshType::ScalarType  h,
const int  SubDiv = 36 
)

r1 = raggio 1, r2 = raggio2, h = altezza (asse y)

Build a cone or truncated cone aligned to Y axis.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
inOutput mesh (cleared and filled).
r1Radius at y = -h/2 (base).
r2Radius at y = +h/2 (top). Use 0 for apex.
hHeight of the cone (along Y).
SubDivNumber of radial slices.

◆ Cylinder()

template<class MeshType >
void vcg::tri::Cylinder ( MeshType &  m,
int  slices,
int  stacks,
bool  capped = false 
)

Build a unit cylinder aligned to Y, optionally capped.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
slicesAngular segments.
stacksLongitudinal segments.
mOutput mesh.
cappedAdd end caps if true.

◆ Disk()

template<class MeshType >
void vcg::tri::Disk ( MeshType &  m,
int  slices 
)

Build a unit disk (triangle fan) in the XY plane.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mOutput mesh.
slicesNumber of angular segments.

◆ Dodecahedron()

template<class DodMeshType >
void vcg::tri::Dodecahedron ( DodMeshType &  in)

Build a dodecahedron as a triangular mesh.

Template Parameters
DodMeshTypeTriangular mesh type with Coord/Vertex/Face types.
Parameters
inMesh to fill; each pentagon is split into 3 triangles; faux edges are marked.
Note
Symmetry is not preserved by this triangulation.

◆ DodecahedronSym()

template<class DodMeshType >
void vcg::tri::DodecahedronSym ( DodMeshType &  in)

Build a symmetric dodecahedron as a triangular mesh.

Template Parameters
DodMeshTypeTriangular mesh type with Coord/Vertex/Face types.
Parameters
inMesh to fill; each pentagon is star-triangulated using a center vertex (5 triangles).

◆ FaceGrid()

template<class MeshType >
void vcg::tri::FaceGrid ( MeshType &  in,
int  w,
int  h 
)

Build faces for a regular grid given pre-allocated vertices.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
inMesh with at least w*h vertices.
wGrid width (columns).
hGrid height (rows).

◆ GenerateCameraMesh()

template<class MeshType >
void vcg::tri::GenerateCameraMesh ( MeshType &  in)

Build a simple camera-shaped mesh (mainly for visualization).

Template Parameters
MeshTypeTriangular mesh type.
Parameters
inOutput mesh.

◆ Grid()

template<class MeshType >
void vcg::tri::Grid ( MeshType &  in,
int  w,
int  h,
float  wl,
float  hl,
float *  data = 0 
)

Build a regular height-field grid mesh (vertices and faces).

Template Parameters
MeshTypeTriangular mesh type.
Parameters
inOutput mesh; cleared and filled.
wGrid width (number of columns).
hGrid height (number of rows).
wlPhysical width.
hlPhysical height.
dataOptional height buffer (row-major, size w*h).

◆ Hexahedron()

template<class MeshType >
void vcg::tri::Hexahedron ( MeshType &  in)

Build a hexahedron (cube) as a triangular mesh.

Template Parameters
MeshTypeTriangular mesh type with Coord/Vertex/Face types.
Parameters
inMesh to fill with 8 vertices and 12 faces.

◆ Icosahedron()

template<class IcoMeshType >
void vcg::tri::Icosahedron ( IcoMeshType &  in)

Build an icosahedron as a triangular mesh.

Template Parameters
IcoMeshTypeTriangular mesh type with Coord/Vertex/Face types.
Parameters
inMesh to fill with 12 vertices and 20 faces.

◆ Octahedron()

template<class OctMeshType >
void vcg::tri::Octahedron ( OctMeshType &  in)

Build an octahedron as a triangular mesh.

Template Parameters
OctMeshTypeTriangular mesh type with Coord/Vertex/Face types.
Parameters
inMesh to fill with 6 vertices and 8 faces.

◆ OrientedAnnulus()

template<class MeshType >
void vcg::tri::OrientedAnnulus ( MeshType &  m,
typename MeshType::CoordType  center,
typename MeshType::CoordType  norm,
float  externalRadius,
float  internalRadius,
int  slices 
)

Build an oriented annulus in 3D, centered and rotated.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mOutput mesh.
centerCenter position.
normNormal direction.
externalRadiusOuter radius.
internalRadiusInner radius.
slicesNumber of segments.

◆ OrientedCone()

template<class MeshType >
void vcg::tri::OrientedCone ( MeshType &  m,
const typename MeshType::CoordType  origin,
const typename MeshType::CoordType  end,
const typename MeshType::ScalarType  r1,
const typename MeshType::ScalarType  r2,
const int  SubDiv = 36 
)

Build a cone/frustum oriented from origin to end.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mOutput mesh.
originStart point of the axis.
endEnd point of the axis.
r1Radius at origin end.
r2Radius at end point.
SubDivNumber of radial slices.

◆ OrientedCylinder()

template<class MeshType >
void vcg::tri::OrientedCylinder ( MeshType &  m,
const typename MeshType::CoordType  origin,
const typename MeshType::CoordType  end,
float  radius,
bool  capped,
int  slices = 32,
int  stacks = 4 
)

Build an oriented cylinder along a segment, optionally capped.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mOutput mesh.
originCylinder base center.
endCylinder top center.
radiusCylinder radius.
cappedAdd end caps if true.
slicesAngular segments.
stacksLongitudinal segments.

◆ OrientedDisk()

template<class MeshType >
void vcg::tri::OrientedDisk ( MeshType &  m,
typename MeshType::CoordType  center,
typename MeshType::CoordType  norm,
float  radius,
int  slices 
)

Build a disk oriented in 3D space.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mOutput mesh.
centerDisk center.
normDisk normal.
radiusDisk radius.
slicesNumber of segments.

◆ OrientedEllipticPrism()

template<class MeshType >
void vcg::tri::OrientedEllipticPrism ( MeshType &  m,
const typename MeshType::CoordType  origin,
const typename MeshType::CoordType  end,
float  radius,
float  xScale,
float  yScale,
bool  capped,
int  slices = 32,
int  stacks = 4 
)

Build an oriented elliptic prism (scaled cylinder), optionally capped.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mOutput mesh.
originPrism start point.
endPrism end point.
radiusBase radius before scaling.
xScaleScale along local X.
yScaleScale along local Z.
cappedAdd end caps if true.
slicesAngular segments.
stacksLongitudinal segments.

◆ OrientedRect()

template<class MeshType >
void vcg::tri::OrientedRect ( MeshType &  square,
float  width,
float  height,
typename MeshType::CoordType  c,
typename MeshType::CoordType  dir = typename MeshType::CoordType(0,0,0),
float  angleDeg = 0,
typename MeshType::CoordType  preRotTra = typename MeshType::CoordType(0,0,0) 
)

Build a rectangle in 3D with orientation and optional pre-rotation.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
squareOutput mesh.
widthRectangle width (X extent).
heightRectangle height (Y extent).
cCenter position.
dirRotation axis.
angleDegRotation angle in degrees around dir.
preRotTraTranslation applied before rotation (to rotate around custom pivot).

◆ OrientedSquare()

template<class MeshType >
void vcg::tri::OrientedSquare ( MeshType &  square,
float  width,
typename MeshType::CoordType  c,
typename MeshType::CoordType  dir = typename MeshType::CoordType(0,0,0),
float  angleDeg = 0,
typename MeshType::CoordType  preRotTra = typename MeshType::CoordType(0,0,0) 
)

Build an oriented square (special case of OrientedRect).

Template Parameters
MeshTypeTriangular mesh type.
Parameters
squareOutput mesh.
widthSide length.
cCenter position.
dirRotation axis.
angleDegRotation angle in degrees.
preRotTraPre-rotation translation.

◆ PoissonPruning() [1/2]

template<class MeshType >
void vcg::tri::PoissonPruning ( MeshType &  m,
std::vector< typename MeshType::CoordType > &  poissonSamples,
float  radius,
unsigned int  randSeed = 0 
)

Low level wrapper for Poisson Disk Pruning.

This function simply takes a mesh containing a point cloud to be pruned and a radius It returns a vector of CoordType listing the "surviving" points.

◆ PoissonPruning() [2/2]

template<class MeshType >
void vcg::tri::PoissonPruning ( MeshType &  m,
std::vector< typename MeshType::VertexPointer > &  poissonSamples,
float  radius,
unsigned int  randSeed = 0 
)

Low level wrapper for Poisson Disk Pruning.

This function simply takes a mesh and a radius and returns a vector of vertex pointers listing the "surviving" points.

◆ PoissonPruningExact()

template<class MeshType >
void vcg::tri::PoissonPruningExact ( MeshType &  m,
std::vector< typename MeshType::VertexPointer > &  poissonSamples,
typename MeshType::ScalarType &  radius,
int  sampleNum,
float  tolerance = 0.04,
int  maxIter = 20,
unsigned int  randSeed = 0 
)

Very simple wrapping for the Exact Poisson Disk Pruning.

This function simply takes a mesh and an expected number of points and returns vector of points. It performs multiple attempts with varius radii to correctly get the expected number of samples. It is obviously much slower than the other versions...

Parameters
poissonSamplesthe mesh that has to be pruned
radiusthe vector that will contain the chosen set of points

◆ SparseFaceGrid()

template<class MeshType >
void vcg::tri::SparseFaceGrid ( MeshType &  in,
const std::vector< int > &  grid,
int  w,
int  h 
)

Build faces for a sparsely sampled regular grid.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
inMesh with vertices; not necessarily w*h of them.
gridIndex grid mapping (size w*h), -1 for missing vertices.
wGrid width.
hGrid height.

◆ Sphere() [1/2]

template<class MeshType >
void vcg::tri::Sphere ( MeshType &  in,
const int  subdiv = 3 
)

Build a geodesic sphere by recursive icosahedron refinement.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
inOutput mesh; if empty, an icosahedron is used as base. Vertices are projected on unit sphere.
subdivNumber of refinement steps.

◆ Sphere() [2/2]

template<class MeshType >
void vcg::tri::Sphere ( MeshType &  m,
const typename MeshType::CoordType &  position,
typename MeshType::ScalarType  radius = 0,
const int  subdiv = 3 
)

Convenience overload: build and place a sphere at a position with a radius.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mOutput mesh (cleared and filled).
positionCenter of the sphere.
radiusSphere radius.
subdivNumber of refinement steps.

◆ SphericalCap()

template<class MeshType >
void vcg::tri::SphericalCap ( MeshType &  in,
float  angleRad,
const int  subdiv = 3 
)

Build a spherical cap from a hexagon refined on the sphere.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
inOutput mesh (cleared and filled).
angleRadAngular aperture (cap diameter) in radians.
subdivNumber of refinement steps on the initial hexagon.

◆ Square()

template<class MeshType >
void vcg::tri::Square ( MeshType &  in)

Build a unit square in the XY plane as two triangles.

Template Parameters
MeshTypeTriangular mesh type with Coord/Vertex/Face types.
Parameters
inMesh to fill with 4 vertices and 2 faces.

◆ SuperEllipsoid()

template<class MeshType >
void vcg::tri::SuperEllipsoid ( MeshType &  m,
float  rFeature,
float  sFeature,
float  tFeature,
int  hRingDiv = 24,
int  vRingDiv = 12 
)

Build a superellipsoid (superquadric sphere-like surface).

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mOutput mesh.
rFeatureExponent along X.
sFeatureExponent along Y.
tFeatureExponent along Z.
hRingDivVertical divisions.
vRingDivHorizontal divisions.

◆ SuperToroid()

template<class MeshType >
void vcg::tri::SuperToroid ( MeshType &  m,
float  hRingRadius,
float  vRingRadius,
float  vSquareness,
float  hSquareness,
int  hRingDiv = 24,
int  vRingDiv = 12 
)

Build a supertoroid (superquadric torus).

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mOutput mesh.
hRingRadiusMain ring radius.
vRingRadiusTube radius.
vSquarenessExponent along torus axis (u power).
hSquarenessExponent around tube (v power).
hRingDivSegments around the main ring.
vRingDivSegments around the tube.

◆ Tetrahedron()

template<class TetraMeshType >
void vcg::tri::Tetrahedron ( TetraMeshType &  in)

Build a tetrahedron as a triangular mesh.

A set of functions that builds meshes that represent surfaces of platonic solids, and other simple shapes.

The 1st parameter is usually the mesh that will be filled with the solid.

Template Parameters
TetraMeshTypeTriangular mesh type with Coord/Vertex/Face types.
Parameters
inMesh to fill; cleared and populated with 4 vertices and 4 faces.

◆ Torus()

template<class MeshType >
void vcg::tri::Torus ( MeshType &  m,
float  hRingRadius,
float  vRingRadius,
int  hRingDiv = 24,
int  vRingDiv = 12 
)

Build a torus mesh around Z axis.

Template Parameters
MeshTypeTriangular mesh type.
Parameters
mOutput mesh.
hRingRadiusMain ring radius (distance from center).
vRingRadiusTube radius.
hRingDivNumber of segments around the main ring.
vRingDivNumber of segments around the tube.

◆ TrivialMidPointRefine()

template<class MeshType >
void vcg::tri::TrivialMidPointRefine ( MeshType &  m,
bool  onlySelected = false 
)

Trivial function for 1->4 triangle split.

It does not require any topology information, Face Attributes are copied to the new faces. Vertex Attributes are not interpolated Warning if the mesh has FFAdjacency it will be corrupted, and if only a subset of the faces are selected T-vertices will be created.

Variable Documentation

◆ SplitTab

const Split vcg::tri::SplitTab[8]
Initial value:
={
{1, {{0,1,2},{0,0,0},{0,0,0},{0,0,0}}, {{0,0},{0,0}}, {{0,1,2},{0,0,0},{0,0,0},{0,0,0}} },
{2, {{0,3,2},{3,1,2},{0,0,0},{0,0,0}}, {{0,0},{0,0}}, {{0,3,2},{0,1,3},{0,0,0},{0,0,0}} },
{2, {{0,1,4},{0,4,2},{0,0,0},{0,0,0}}, {{0,0},{0,0}}, {{0,1,3},{3,1,2},{0,0,0},{0,0,0}} },
{3, {{3,1,4},{0,3,2},{4,2,3},{0,0,0}}, {{0,4},{3,2}}, {{0,1,3},{0,3,2},{1,3,3},{0,0,0}} },
{2, {{0,1,5},{5,1,2},{0,0,0},{0,0,0}}, {{0,0},{0,0}}, {{0,3,2},{3,1,2},{0,0,0},{0,0,0}} },
{3, {{0,3,5},{3,1,5},{2,5,1},{0,0,0}}, {{3,2},{5,1}}, {{0,3,2},{0,3,3},{2,3,1},{0,0,0}} },
{3, {{2,5,4},{0,1,5},{4,5,1},{0,0,0}}, {{0,4},{5,1}}, {{2,3,1},{0,3,2},{3,3,1},{0,0,0}} },
{4, {{3,4,5},{0,3,5},{3,1,4},{5,4,2}}, {{0,0},{0,0}}, {{3,3,3},{0,3,2},{0,1,3},{3,1,2}} },
}