KrisLibrary  1.0.0
Classes | Typedefs | Enumerations | Functions | Variables
Meshing Namespace Reference

The namespace for all classes/functions in the Meshing package. More...

Classes

struct  AddTriOffset
 
class  ApproximateGeodesic
 Computes an approximate geodesic distance over a mesh, from a single source. More...
 
struct  BarycentricCoords
 
struct  FillRasterizer2D
 A rasterizer that flat-fills elements of a grid. More...
 
class  LSConformalMapping
 An approximately-conformal parameterization a genus-0 mesh, found by a least-squares method. More...
 
class  PointCloud3D
 A 3D point cloud class. More...
 
struct  Rasterizer2D
 A base class that allows rasterizing of 2D triangles into a grid. More...
 
struct  SmoothFillRasterizer2D
 A smooth-fill rasterizer. More...
 
struct  SplitCallback
 
struct  TriangleClosestPointData
 
struct  TriMesh
 A basic triangle mesh. More...
 
struct  TriMeshAtlas
 TODO: a non-genus 0 mesh partitioned into charts. More...
 
struct  TriMeshChart
 A chart maps a genus 0 triangle mesh to a 2d disk. More...
 
struct  TriMeshEdge
 
struct  TrimeshFeature
 
struct  TriMeshTraversalCallback
 A callback base class for traversing triangle mesh topology. More...
 
struct  TriMeshWithTopology
 A triangle mesh that contains connectivity relations between vertices and triangles. More...
 
struct  TriSplitter
 A class that allows incremental plane-splitting of a triangle mesh. More...
 
struct  Vector3Hash
 
class  VectorHash
 
struct  VolumeGridIterator
 Iterator over a 3D volume grid. More...
 
class  VolumeGridTemplate
 A 3D array over an axis-aligned 3D volume, containing Real values. More...
 

Typedefs

typedef VolumeGridTemplate< Real > VolumeGrid
 

Enumerations

enum  FMMStatus { Accepted, Considered, Far }
 

Functions

template<class T >
void TSDFMarchingCubes (const Array3D< T > &input, T isoLevel, T truncationDistance, const AABB3D &bb, TriMesh &m)
 
int ClosestPointDescent (const TriMeshWithTopology &m, const Vector3 &p, int tri, Vector3 &cp)
 
void GetEdges (const TriMeshWithTopology &in, vector< TriMeshEdge > &edges)
 
void GetPairedEdges (const TriMeshWithTopology &in, vector< TriMeshEdge > &edges)
 
void Expand (const TriMeshWithTopology &in, Real distance, int divs, TriMesh &m)
 
void Expand2Sided (const TriMeshWithTopology &in, Real distance, int divs, TriMesh &m)
 
bool CanLoadTriMeshExt (const char *ext)
 Returns true if the extension is a file type that we can load from.
 
bool CanSaveTriMeshExt (const char *ext)
 Returns true if the extension is a file type that we can save to.
 
bool Import (const char *fn, TriMesh &tri)
 Import will try to determine the file type via the file extension.
 
bool Import (const char *fn, TriMesh &tri, GeometryAppearance &app)
 Import will try to determine the file type via the file extension. More...
 
bool Export (const char *fn, const TriMesh &tri)
 Export will try to determine the file type via the file extension.
 
bool Export (const char *fn, const TriMesh &tri, const GLDraw::GeometryAppearance &appearance)
 Export will try to determine the file type via the file extension.
 
bool LoadVRML (std::istream &in, TriMesh &tri)
 Loads from VRML file format. More...
 
bool SaveVRML (std::ostream &out, const TriMesh &tri)
 Saves to VRML file format. More...
 
bool LoadOFF (std::istream &in, TriMesh &tri)
 Loads from the GeomView Object File Format (OFF)
 
bool SaveOFF (std::ostream &out, const TriMesh &tri)
 Saves to the GeomView Object File Format (OFF)
 
bool fscanto (FILE *f, char endc)
 
bool fgetline (FILE *f, char *buf, int bufsize)
 
bool LoadOBJMaterial (const char *path, const char *file, GeometryAppearance &app)
 
bool LoadOBJ (const char *fn, FILE *f, TriMesh &tri, GeometryAppearance &app)
 Loads from the Wavefront OBJ format, with per-vertex colors? More...
 
bool LoadOBJ (const char *fn, TriMesh &tri)
 Loads from the Wavefront OBJ file format.
 
bool LoadOBJ (const char *fn, TriMesh &tri, GLDraw::GeometryAppearance &app)
 Loads from the Wavefront OBJ file format (can get per-vertex colors)
 
bool SaveOBJ (const char *fn, const TriMesh &tri)
 Saves to the Wavefront OBJ file format.
 
bool SaveOBJ (const char *fn, const TriMesh &tri, const GLDraw::GeometryAppearance &app)
 Saves to the Wavefront OBJ file format (per-vertex colors not supported yet) More...
 
bool LoadAssimp (const char *fn, TriMesh &tri)
 Loads using Assimp if available on your system.
 
bool LoadAssimp (const char *fn, vector< TriMesh > &meshes)
 Loads using Assimp if available on your system, extracts individual meshes.
 
bool SaveAssimp (const char *fn, const TriMesh &tri)
 Saves using Assimp if available on your system (not implemented)
 
bool LoadAssimp (const char *fn, TriMesh &tri, GLDraw::GeometryAppearance &appearance)
 Loads using Assimp if available on your system.
 
bool LoadAssimp (const char *fn, vector< TriMesh > &meshes, vector< GLDraw::GeometryAppearance > &appearances)
 Loads using Assimp if available on your system, extracts individual meshes.
 
bool SaveAssimp (const char *fn, const TriMesh &tri, const GLDraw::GeometryAppearance &appearance)
 Saves using Assimp if available on your system (not implemented)
 
Vector3 MulCubeOffset (const Vector3 &dx, int v)
 
void EvaluateCube (ScalarFieldFunction &f, const Vector3 &x, const Vector3 &dx, Real vals[8])
 
void EvaluateCube (Real(*f)(Real, Real, Real), const Vector3 &x, const Vector3 &dx, Real vals[8])
 
template<class T >
void EvaluateCube (const Array3D< T > &a, int i, int j, int k, T vals[8])
 
Vector3 EvalCubeEdge (const Vector3 &x0, const Vector3 &dx, Real u, int v1, int v2)
 
void MarchingCubes (ScalarFieldFunction &f, Real isoval, const AABB3D &bb, const int dims[3], TriMesh &m)
 Takes a 3D function as input, meshes the isosurface at f(x)=isoval.
 
void MarchingCubes (Real(*f)(Real, Real, Real), Real isoval, const AABB3D &bb, const int dims[3], TriMesh &m)
 Takes a 3D function as input, meshes the isosurface at f(x)=isoval.
 
template<class T >
void MarchingCubes (const Array3D< T > &input, T isoLevel, const AABB3D &bb, TriMesh &m)
 
void CubeToMesh (const Real origvals[8], Real isoLevel, const AABB3D &bb, TriMesh &m)
 
template void MarchingCubes< char > (const Array3D< char > &input, char isoLevel, const AABB3D &bb, TriMesh &m)
 
template void MarchingCubes< int > (const Array3D< int > &input, int isoLevel, const AABB3D &bb, TriMesh &m)
 
template void MarchingCubes< float > (const Array3D< float > &input, float isoLevel, const AABB3D &bb, TriMesh &m)
 
template void MarchingCubes< double > (const Array3D< double > &input, double isoLevel, const AABB3D &bb, TriMesh &m)
 
template void TSDFMarchingCubes< char > (const Array3D< char > &input, char isoLevel, char truncationValue, const AABB3D &bb, TriMesh &m)
 
template void TSDFMarchingCubes< int > (const Array3D< int > &input, int isoLevel, int truncationValue, const AABB3D &bb, TriMesh &m)
 
template void TSDFMarchingCubes< float > (const Array3D< float > &input, float isoLevel, float truncationValue, const AABB3D &bb, TriMesh &m)
 
template void TSDFMarchingCubes< double > (const Array3D< double > &input, double isoLevel, double truncationValue, const AABB3D &bb, TriMesh &m)
 
Real SegmentInterpolation (Real a, Real b)
 
int DelaunaySplit (const Vector3 &a, const Vector3 &b, const Vector3 &c, const Vector3 &d)
 
int DelaunaySplit (const Vector2 &a, const Vector2 &b, const Vector2 &c, const Vector2 &d)
 
int OddMan (Real a, Real b, Real c, Real tol)
 
int SplitTriangle (const Triangle3D &t, const Plane3D &p, Vector3 newPts[2], IntTriple newTris[3], bool triPositive[3], Real tol)
 Splits the triangle t by the plane p. Returns the number of resulting triangles (up to 3). More...
 
int SplitTriangle (const Triangle2D &_t, const Plane2D &p, Vector2 newPts[2], IntTriple newTris[3], bool triPositive[3], Real tol)
 
void GetCoplanarTris (const TriMesh &mesh, int t, Real tol, vector< int > &tris)
 
void GetConnectedCoplanarTris (TriMeshWithTopology &mesh, int t, Real tol, vector< int > &tris)
 
void GetConnectedCoplanarTris (const TriMeshWithTopology &mesh, int t, Real tol, vector< int > &tris)
 
void MakeTriPlane (int m, int n, TriMesh &mesh)
 makes a unit square on z=0 with m,n divisions in the x,y directions
 
void MakeTriPlane (int m, int n, Real x, Real y, TriMesh &mesh)
 makes a square of size [x,y] with m,n divisions in the x,y directions
 
void MakeTriCube (int m, int n, int p, TriMesh &mesh)
 makes a unit cube with m,n,p divisions in the x,y,z directions
 
void MakeTriBox (int m, int n, int p, Real x, Real y, Real z, TriMesh &mesh)
 makes a [x,y,z] sized box with m,n,p divisions in the x,y,z directions
 
void MakeTriCenteredCube (int m, int n, int p, TriMesh &mesh)
 makes a unit cube centered at 0 with m,n,p divisions in the x,y,z directions
 
void MakeTriCenteredBox (int m, int n, int p, Real x, Real y, Real z, TriMesh &mesh)
 makes a [x,y,z] sized cube centered at 0 with m,n,p divisions in the x,y,z directions
 
void MakeTriSphere (int numStacks, int numSlices, TriMesh &mesh)
 makes a unit sphere with the given stacks and slices (axis in z direction)
 
void MakeTriSphere (int numStacks, int numSlices, Real r, TriMesh &mesh)
 makes a radius r sphere with the given stacks and slices (axis in z direction)
 
void MakeTriCone (int numSlices, TriMesh &mesh)
 makes a unit height cone with unit base radius (base at origin, tip pointing in z direction)
 
void MakeTriCone (int numSlices, Real h, Real rbase, TriMesh &mesh)
 makes a cone with height h, base radius rbase
 
void MakeTriCylinder (int numSlices, TriMesh &mesh)
 makes a unit height cylinder with unit base radius (centered at origin, extending in z direction)
 
void MakeTriCylinder (int numSlices, Real h, Real rbase, TriMesh &mesh)
 makes a cylinder with height h, base radius rbase
 
void MakeTriMesh (const Sphere3D &geom, int numStacks, int numSlices, TriMesh &mesh)
 makes a triangle mesh from a sphere
 
void MakeTriMesh (const Triangle3D &geom, TriMesh &mesh)
 makes a triangle mesh from a triangle
 
void MakeTriMesh (const AABB3D &geom, TriMesh &mesh)
 makes a triangle mesh from an AABB
 
void MakeTriMesh (const Box3D &geom, TriMesh &mesh)
 makes a triangle mesh from a box
 
void MakeTriMesh (const Ellipsoid3D &geom, int numStacks, int numSlices, TriMesh &mesh)
 makes a triangle mesh from an ellipsoid
 
void MakeTriMesh (const Cylinder3D &geom, int numSlices, TriMesh &mesh)
 makes a triangle mesh from a cylinder
 
void MakeTriMesh (const Polygon3D &geom, TriMesh &mesh)
 makes a triangle mesh from a polygon (one sided) More...
 
void MakeTriMesh (const GeometricPrimitive3D &geom, TriMesh &mesh, int numDivs)
 makes a triangle mesh from a generic geometric primitive
 
void CropTriangles (vector< Triangle2D > &tris, const Plane2D &p)
 
void Clip (const AABB2D &aabb, std::vector< Triangle2D > &tris, std::vector< BarycentricCoords > &bary)
 
void GetSegmentCells (const Segment2D &s, vector< IntPair > &cells)
 Returns a list of cells that the segment overlaps, given an infinite unit grid.
 
void GetTriangleCells_Clipped (const Triangle2D &tri, std::vector< IntPair > &cells, int imin, int jmin, int imax, int jmax)
 Returns a list of cells that the triangle overlaps, in a unit grid from [imin,imax)x[jmin,jmax)
 
void GetTriangleCells (const Triangle2D &t, vector< IntPair > &cells)
 Returns a list of cells that the triangle overlaps, given an infinite unit grid.
 
void GetSegmentCells (const Segment2D &tri, std::vector< IntPair > &cells)
 Returns a list of cells that the segment overlaps, given an infinite unit grid.
 
void GetTriangleCells (const Triangle2D &tri, std::vector< IntPair > &cells)
 Returns a list of cells that the triangle overlaps, given an infinite unit grid.
 
bool LoadTriMesh (FILE *f, TriMesh &tri)
 
bool LoadMultipleTriMeshes (const char *fn, TriMesh &tri)
 
istream & operator>> (istream &in, TriMesh &tri)
 
ostream & operator<< (ostream &out, const TriMesh &tri)
 
bool IncidentTriangleOrdering (const TriMeshWithTopology &mesh, int v, vector< list< int > > &triStrips)
 Returns true if the vertex is a boundary vertex. More...
 
Real VertexGaussianCurvature (const TriMeshWithTopology &mesh, int v)
 
Real VertexAbsMeanCurvature (const TriMeshWithTopology &mesh, int v)
 
Vector3 Mat3Solve (const Vector3 &a, const Vector3 &b, const Vector3 &c, Real amount)
 
void MergeVertices (TriMeshWithTopology &mesh, Real tolerance=0)
 
int ApproximateShrink (TriMeshWithTopology &mesh, Real amount)
 
Real Angle (const Vector3 &e1, const Vector3 &e2)
 Returns the angle between two vectors.
 
int CCWNeighbor (const TriMeshWithTopology &mesh, int t, int v)
 Returns the triangle neighboring t CCW about v.
 
int CWNeighbor (const TriMeshWithTopology &mesh, int t, int v)
 Returns the triangle neighboring t CW about v.
 
IntPair Neighbors (const TriMeshWithTopology &mesh, int t, int v)
 Returns the (CCW neighbor,CW neighbor) of t about v.
 
int CCWAdjacentVertex (const TriMeshWithTopology &mesh, int t, int v)
 Returns the vertex adjacent to v on the CCW side of t.
 
int CWAdjacentVertex (const TriMeshWithTopology &mesh, int t, int v)
 Returns the vertex adjacent to v on the CCW side of t.
 
IntPair AdjacentVertices (const TriMeshWithTopology &mesh, int t, int v)
 Returns the vertices on t adjacent to v in (CCW,CW) order.
 
bool FloatingVertex (const TriMeshWithTopology &mesh, int v)
 Returns true if the vertex is "floating".
 
bool BoundaryVertex (const TriMeshWithTopology &mesh, int v)
 Returns true if the vertex is a boundary vertex.
 
Real IncidentTriangleArea (const TriMeshWithTopology &mesh, int v)
 
template<class T >
std::istream & operator>> (std::istream &in, VolumeGridTemplate< T > &grid)
 
template<class T >
std::ostream & operator<< (std::ostream &out, const VolumeGridTemplate< T > &grid)
 
void FitGridToMesh (int m, int n, int p, AABB3D &bb, const TriMesh &mesh)
 
template<class T >
void FitGridToMesh (const Array3D< T > &cells, AABB3D &bb, const TriMesh &m)
 
template<class T >
void GetGridCell (const Array3D< T > &cells, const AABB3D &bb, const IntTriple &index, AABB3D &cell)
 
template<class T >
void GetGridCellCenter (const Array3D< T > &cells, const AABB3D &bb, const IntTriple &index, Vector3 &c)
 
bool QueryGrid (int m, int n, int p, const AABB3D &grid, const Vector3 &query, IntTriple &index)
 
template<class T >
bool QueryGrid (const Array3D< T > &cells, const AABB3D &grid, const Vector3 &query, IntTriple &index)
 
bool QueryGrid (int m, int n, int p, const AABB3D &grid, const AABB3D &query, IntTriple &low, IntTriple &high)
 
template<class T >
bool QueryGrid (const Array3D< T > &cells, const AABB3D &grid, const AABB3D &query, IntTriple &low, IntTriple &high)
 
Real GridCellDensity (const AABB3D &cell, const Plane3D &p)
 
void GetTriangleBuckets (const TriMesh &m, const AABB3D &bb, Array3D< list< int > > &triangles)
 
void GetSegmentCells (const Segment3D &s, vector< IntTriple > &cells)
 Returns a list of cells that the segment overlaps, given an infinite unit grid.
 
void GetSegmentCells (const Segment3D &s, int m, int n, int p, const AABB3D &bb, vector< IntTriple > &cells)
 Returns a list of cells that the segment overlaps, given a grid of size m,n,p over range bb.
 
void GetTriangleCells (const Triangle3D &tri, vector< IntTriple > &cells)
 Returns a list of cells that the triangle overlaps, given an infinite unit grid.
 
void GetTriangleCells (const Triangle3D &tri, int m, int n, int p, const AABB3D &bb, vector< IntTriple > &cells)
 Returns a list of cells that the triangle overlaps, given a grid of size m,n,p over range bb.
 
template<class T >
void RasterizeXYSegment (const Segment3D &s, int i, int j, const Array3D< T > &grid, const AABB3D &bb, vector< IntTriple > &cells)
 
void RasterizeXQuadrilateral (const Segment3D &s1, const Segment3D &s2, int i, int n, int p, vector< IntTriple > &cells)
 
void GetTriangleCells2 (const Triangle3D &torig, int m, int n, int p, const AABB3D &bb, vector< IntTriple > &cells)
 
template<class T >
void GetTriangleCells2 (const Triangle3D &torig, const Array3D< T > &grid, const AABB3D &bb, vector< IntTriple > &cells)
 
void SurfaceOccupancyGrid (const TriMesh &m, Array3D< bool > &occupied, AABB3D &bb)
 Sets cells of a boolean 3D grid (occupied,bb) that overlap the surface of m to true. More...
 
void VolumeOccupancyGrid_FloodFill (const TriMesh &m, Array3D< bool > &occupied, AABB3D &bb, const IntTriple &seed, bool seedOccupied)
 Sets cells of a boolean 3D grid (occupied,bb) to true if the cell's center is in the interior of the mesh, and false otherwise. Occupancy is determined by a flood-fill algorithm starting from the seed point.
 
void DensityEstimate_FloodFill (const TriMeshWithTopology &m, Array3D< Real > &density, AABB3D &bb, const IntTriple &seed)
 Fills in a density estimate on a 3D grid (occupied,bb) using a flood fill to determine inside/outside, more accurate calculation for density. More...
 
void VolumeOccupancyGrid_CenterShooting (const TriMesh &m, Array3D< bool > &occupied, AABB3D &bb, int shootDirection=0)
 Sets cells of a boolean 3D grid (occupied,bb) to true if the cell's center is in the interior of the mesh, and false otherwise. Occupancy is determined by sweeping a ray through the mesh.
 
void DensityEstimate_CenterShooting (const TriMesh &m, Array3D< Real > &density, AABB3D &bb, int shootDirection=0)
 Estimates the object's density filling the grid using a shooting method.
 
void DensityEstimate_RandomShooting (const TriMesh &m, Array3D< Real > &density, AABB3D &bb, int numSamples, int shootDirection=0)
 Estimates the object's density filling the grid using a shooting method.
 
void SweepVisibilityGrid (const TriMesh &m, int direction, Array3D< bool > &visible, AABB3D &bb, bool singleSided=true)
 From one "visible" side of the grid, sweeps the visibility across the volume until a mesh surface is hit. After that, visible is marked as false. More...
 
int to_pair (const TrimeshFeature &f)
 
void FastMarchingMethod (const TriMeshWithTopology &m, Array3D< Real > &distance, Array3D< Vector3 > &gradient, AABB3D &bb, vector< IntTriple > &surfaceCells)
 Fills in a distance field on a 3D grid (occupied,bb) using the fast marching method initialized at the surface m. More...
 
void FastMarchingMethod_Fill (const TriMeshWithTopology &m, Array3D< Real > &distance, Array3D< Vector3 > &gradient, AABB3D &bb, vector< IntTriple > &surfaceCells)
 Same as FastMarchingMethod but constrains start points to the exterior of the mesh (sometimes avoids artifacts from internal structures)
 
void DensityEstimate_FMM (const TriMeshWithTopology &m, Array3D< Real > &density, AABB3D &bb)
 Fills in a density estimate on a 3D grid (occupied,bb) using the FMM distance measurement.
 
void DensityEstimate_FMM (const Array3D< Real > &distance, const Array3D< Vector3 > &gradient, const AABB3D &bb, Array3D< Real > &density)
 Fills in a density estimate on a 3D grid (occupied,bb) using the density, gradient output from running FMM.
 

Variables

const int MCEdgeTable [256]
 
const int MCTriTable [256][16]
 

Detailed Description

The namespace for all classes/functions in the Meshing package.

Function Documentation

int Meshing::ClosestPointDescent ( const TriMeshWithTopology m,
const Vector3 p,
int  tri,
Vector3 cp 
)

Finds the closest point to p on m by a gradient descent starting from triangle tri

References ClosestPointDescent(), Meshing::TriMesh::GetTriangle(), and Meshing::TriMeshWithTopology::triNeighbors.

Referenced by ClosestPointDescent().

bool Meshing::Import ( const char *  fn,
TriMesh tri,
GLDraw::GeometryAppearance appearance 
)

Import will try to determine the file type via the file extension.

Import will try to determine the file type via the file extension. If the file format does not contain any appearance information, then the appearance argument will be untouched.

References FileExtension(), GetFilePath(), Import(), LoadAssimp(), LoadOBJ(), LoadOFF(), and LoadVRML().

bool Meshing::LoadOBJ ( const char *  fn,
FILE *  f,
TriMesh tri,
GeometryAppearance app 
)

Loads from the Wavefront OBJ format, with per-vertex colors?

normal

just vertex

References GetFilePath(), LoadOBJ(), GLDraw::GeometryAppearance::texcoords, and GLDraw::GeometryAppearance::vertexColors.

Referenced by Import(), and LoadOBJ().

bool Meshing::LoadVRML ( std::istream &  in,
TriMesh tri 
)

Loads from VRML file format.

Loads from VRML file format: not implemented.

References LoadVRML().

Referenced by Import(), and LoadVRML().

bool Meshing::SaveOBJ ( const char *  fn,
const TriMesh tri,
const GeometryAppearance app 
)

Saves to the Wavefront OBJ file format (per-vertex colors not supported yet)

TODO: save vertex colors

References FileExtension(), LoadAssimp(), SaveAssimp(), SaveOBJ(), GLDraw::GeometryAppearance::tex1D, GLDraw::GeometryAppearance::texcoords, GLDraw::GeometryAppearance::vertexColor, and GLDraw::GeometryAppearance::vertexColors.

bool Meshing::SaveVRML ( std::ostream &  out,
const TriMesh tri 
)

Saves to VRML file format.

Saves to VRML file format: not implemented.

References SaveVRML().

Referenced by Export(), and SaveVRML().