3DCoat  3D-COAT 4.9.xx
3DCoat is the one application that has all the tools you need to take your 3D idea from a block of digital clay all the way to a production ready, fully textured organic or hard surface model.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ReconstructMeshFromEdges Class Reference

EdgeMesher allows to create the polygonal mesh from the set of edges in space. More...

#include <ReconstructMeshFromEdges.h>

Classes

struct  vertex
 Initially, mesh consists of edges that connects two un-indexed vertices. This is the un-indexed vertex. More...
 

Public Member Functions

void addEdge (const vertex &n1, const vertex &n2)
 Add non-indexed edge to the mesh. More...
 
 ReconstructMeshFromEdges ()
 constructor does not require anything. More...
 
void MakeMesh (cList< vertex > &outPositions, cList< int > &outFaces, int maxring=12, float AbsoluteWeldRatio=0.00001, float LocalWeldRatio=0.05)
 Generate connective mesh using just edges as the input. More...
 

Protected Member Functions

void AutoWeld (float AbsoluteWeldRatio, float LocalWeldRatio)
 Weld vertices without the pre-defined distance. Weld distance determined locally basing on the locally gathered edges lengths. More...
 

Protected Attributes

cList< vertexvertices
 the initial list of vertices, weld will decrease the amount More...
 
cList< DWORDS2edges
 the edges list passed by the calls of the addEdge More...
 

Detailed Description

EdgeMesher allows to create the polygonal mesh from the set of edges in space.

The usual pattern of usage:

EdgeMesher em;
// ...add multiple edges... only coordinate and normal required, normal required for the correct face orientation.
em.addEdge(EdgeMesher::vertex(p1, n1), EdgeMesher::vertex(p2, n2));
// ...
em.MakeMesh(positions, faces);
// now we got connective mesh as described below

Constructor & Destructor Documentation

ReconstructMeshFromEdges::ReconstructMeshFromEdges ( )

constructor does not require anything.

Member Function Documentation

void ReconstructMeshFromEdges::addEdge ( const vertex n1,
const vertex n2 
)

Add non-indexed edge to the mesh.

Parameters
n1- the first vertex of the edge. Consists of position and normal and (optionally) identifier that is kept during the future mesh construction.
n2- the second vertex of the edge.

References edges, and vertices.

void ReconstructMeshFromEdges::AutoWeld ( float  AbsoluteWeldRatio,
float  LocalWeldRatio 
)
protected

Weld vertices without the pre-defined distance. Weld distance determined locally basing on the locally gathered edges lengths.

Parameters
AbsoluteWeldRatio- the weld distance in relation to the average edge length.
LocalWeldRatio- the weld distance in relation to the average edges length in the local neighborhood.

weld fist

collect nearby vertices as candidates for welding

now all nearby vertices welded, edges are referring welded vertices, ready to create the surface

References edges, and vertices.

Referenced by MakeMesh().

void ReconstructMeshFromEdges::MakeMesh ( cList< vertex > &  outPositions,
cList< int > &  outFaces,
int  maxring = 12,
float  AbsoluteWeldRatio = 0.00001,
float  LocalWeldRatio = 0.05 
)

Generate connective mesh using just edges as the input.

Parameters
outPositions- the output vertex list will be written there
outFaces- the output faces wil be written there, array of int in format: [face1_verts_count, face1_vert1_index, face1_vert2_index ..., face2_verts_count, face2_vert1_index, face2_vert2_index ...,...]
maxring- the maximal edges count for the resulting N-gons
AbsoluteWeldRatio- the weld distance in relation to the average edge length.
LocalWeldRatio- the weld distance in relation to the average edges length in the local neighborhood.

walk through edges in attempt to complete faces. Faces direction defined by normals sign.

in the first pass we walk only through valence 4 vertices

References AutoWeld(), edges, and vertices.

Member Data Documentation

cList<DWORDS2> ReconstructMeshFromEdges::edges
protected

the edges list passed by the calls of the addEdge

Referenced by addEdge(), AutoWeld(), and MakeMesh().

cList<vertex> ReconstructMeshFromEdges::vertices
protected

the initial list of vertices, weld will decrease the amount

Referenced by addEdge(), AutoWeld(), and MakeMesh().


The documentation for this class was generated from the following files: