Commit 2d7d566d authored by Will Schroeder's avatar Will Schroeder
Browse files

*** empty log message ***

parent a732458f
......@@ -71,34 +71,6 @@ public:
void ReverseCell(int cellId);
void ReplaceCell(int cellId, vlIdList& ptIds);
// following stuff supports cell structure
// Booleans control whether certain types of data are loaded.
vlBooleanMacro(LoadVerts,int);
vlSetMacro(LoadVerts,int);
vlGetMacro(LoadVerts,int);
vlBooleanMacro(LoadLines,int);
vlSetMacro(LoadLines,int);
vlGetMacro(LoadLines,int);
vlBooleanMacro(LoadPolys,int);
vlSetMacro(LoadPolys,int);
vlGetMacro(LoadPolys,int);
vlBooleanMacro(LoadStrips,int);
vlSetMacro(LoadStrips,int);
vlGetMacro(LoadStrips,int);
void LoadAll() {this->LoadVertsOn(); this->LoadLinesOn();
this->LoadPolysOn(); this->LoadStripsOn();};
void LoadNone() {this->LoadVertsOff(); this->LoadLinesOff();
this->LoadPolysOff(); this->LoadStripsOff();};
void SetReadOnly() {this->SetWritable(0);};
vlBooleanMacro(Writable,int);
vlSetMacro(Writable,int)
vlGetMacro(Writable,int);
protected:
// points inherited
// point data (i.e., scalars, vectors, normals, tcoords) inherited
......@@ -106,14 +78,12 @@ protected:
vlCellArray *Lines;
vlCellArray *Polys;
vlCellArray *Strips;
// dummy static member below used as a trick to simplify traversal
static vlCellArray *Dummy;
// supports building Cell structure
int LoadVerts;
int LoadLines;
int LoadPolys;
int LoadStrips;
int Writable;
// supporting structures for more complex topological operations
// built only when necessary
vlCellList *Cells;
vlLinkList *Links;
void BuildCells();
......
......@@ -36,7 +36,7 @@ void vlFeatureEdges::Execute()
vlFloatPoints *newPts;
vlFloatScalars *newScalars;
vlCellArray *newLines;
vlPolyData Mesh(*this->Input);
vlPolyData Mesh;
int i, j, numNei, cellId;
int numBEdges, numNonManifoldEdges, numFedges;
float scalar, n[3], *x1, *x2, cosAngle;
......@@ -60,11 +60,8 @@ void vlFeatureEdges::Execute()
return;
}
// build cell structure
Mesh.LoadVertsOff();
Mesh.LoadLinesOff();
Mesh.LoadStripsOff();
Mesh.BuildLinks();
// build cell structure. Only operate with polygons.
Mesh.SetPolys(this->Input->GetPolys());
//
// Allocate storage for lines/points
//
......
......@@ -40,13 +40,6 @@ vlPolyData::vlPolyData ()
// static variable, initialized only once.
if (!this->Dummy) this->Dummy = new vlCellArray;
this->LoadVerts = 1;
this->LoadLines = 1;
this->LoadPolys = 1;
this->LoadStrips = 1;
this->Writable = 0;
this->Cells = NULL;
this->Links = NULL;
}
......@@ -66,13 +59,6 @@ vlPointSet(pd)
this->Strips = pd.Strips;
if (this->Strips) this->Strips->Register(this);
this->LoadVerts = pd.LoadVerts;
this->LoadLines = pd.LoadLines;
this->LoadPolys = pd.LoadPolys;
this->LoadStrips = pd.LoadStrips;
this->Writable = pd.Writable;
this->Cells = pd.Cells;
if (this->Cells) this->Cells->Register(this);
......@@ -304,12 +290,6 @@ void vlPolyData::PrintSelf(ostream& os, vlIndent indent)
os << indent << "Number Of Lines: " << this->GetNumberOfLines() << "\n";
os << indent << "Number Of Polygons: " << this->GetNumberOfPolys() << "\n";
os << indent << "Number Of Triangle Strips: " << this->GetNumberOfStrips() << "\n";
os << indent << "Load Verts: " << (this->LoadVerts ? "On\n" : "Off\n");
os << indent << "Load Lines: " << (this->LoadLines ? "On\n" : "Off\n");
os << indent << "Load Polys: " << (this->LoadPolys ? "On\n" : "Off\n");
os << indent << "Load Strips: " << (this->LoadStrips ? "On\n" : "Off\n");
os << indent << "Writable: " << (this->Writable ? "On\n" : "Off\n");
}
}
......@@ -345,75 +325,37 @@ void vlPolyData::BuildCells()
this->Cells->Register(this);
}
//
// If we are just reading the data structure, can use the input data
// without any copying or allocation. Otherwise have to allocate
// working storage that is a copy of the input data.
//
if ( ! this->Writable )
{
if (this->LoadVerts) verts = inVerts;
if (this->LoadLines) lines = inLines;
if (this->LoadPolys) polys = inPolys;
if (this->LoadStrips) strips = inStrips;
}
else
{
if (this->LoadVerts && inVerts) verts = new vlCellArray(*inVerts);
if (this->LoadLines && inLines) lines = new vlCellArray(*inLines);
if (this->LoadPolys && inPolys) polys = new vlCellArray(*inPolys);
if (this->LoadStrips && inStrips) strips = new vlCellArray(*inStrips);
}
//
// Update ourselves
//
this->SetVerts(verts);
this->SetLines(lines);
this->SetPolys(polys);
this->SetStrips(strips);
//
// Now traverse various lists to create cell array
// Traverse various lists to create cell array
//
if ( verts )
for (inVerts->InitTraversal(); inVerts->GetNextCell(npts,pts); )
{
for (verts->InitTraversal(); verts->GetNextCell(npts,pts); )
{
if ( npts > 1 )
cells->InsertNextCell(vlPOLY_POINTS,verts->GetLocation(npts));
else
cells->InsertNextCell(vlPOINT,verts->GetLocation(npts));
}
if ( npts > 1 )
cells->InsertNextCell(vlPOLY_POINTS,inVerts->GetLocation(npts));
else
cells->InsertNextCell(vlPOINT,inVerts->GetLocation(npts));
}
if ( lines )
for (lines->InitTraversal(); lines->GetNextCell(npts,pts); )
{
for (lines->InitTraversal(); lines->GetNextCell(npts,pts); )
{
if ( npts > 2 )
cells->InsertNextCell(vlPOLY_LINE,lines->GetLocation(npts));
else
cells->InsertNextCell(vlLINE,lines->GetLocation(npts));
}
if ( npts > 2 )
cells->InsertNextCell(vlPOLY_LINE,lines->GetLocation(npts));
else
cells->InsertNextCell(vlLINE,lines->GetLocation(npts));
}
if ( polys )
for (polys->InitTraversal(); polys->GetNextCell(npts,pts); )
{
for (polys->InitTraversal(); polys->GetNextCell(npts,pts); )
{
if ( npts == 3 )
cells->InsertNextCell(vlTRIANGLE,polys->GetLocation(npts));
else if ( npts == 4 )
cells->InsertNextCell(vlQUAD,polys->GetLocation(npts));
else
cells->InsertNextCell(vlPOLYGON,polys->GetLocation(npts));
}
if ( npts == 3 )
cells->InsertNextCell(vlTRIANGLE,polys->GetLocation(npts));
else if ( npts == 4 )
cells->InsertNextCell(vlQUAD,polys->GetLocation(npts));
else
cells->InsertNextCell(vlPOLYGON,polys->GetLocation(npts));
}
if ( strips )
for (strips->InitTraversal(); strips->GetNextCell(npts,pts); )
{
for (strips->InitTraversal(); strips->GetNextCell(npts,pts); )
{
cells->InsertNextCell(vlTRIANGLE_STRIP,strips->GetLocation(npts));
}
cells->InsertNextCell(vlTRIANGLE_STRIP,strips->GetLocation(npts));
}
}
......
......@@ -76,21 +76,15 @@ void vlPolyNormals::Execute()
// mesh used to perform topological queries. The other is used to write into
// and modify the connectivity of the mesh.
//
OldMesh = new vlPolyData(*this->Input);
OldMesh->LoadNone();
OldMesh->LoadPolysOn();
OldMesh->SetReadOnly();
OldMesh->BuildLinks(); // need full-blown data structure
OldMesh = new vlPolyData;
OldMesh->SetPolys(this->Input->GetPolys());
pd = this->Input->GetPointData();
NewMesh = new vlPolyData(*this->Input);
NewMesh->LoadNone();
NewMesh->LoadPolysOn();
NewMesh->WritableOn();
NewMesh->BuildCells(); // just need random access to cells
newPolys = NewMesh->GetPolys();
NewMesh = new vlPolyData;
// create a copy because we're modifying it
newPolys = new vlCellArray(*(this->Input->GetPolys()));
NewMesh->SetPolys(newPolys);
//
// The visited array keeps track of which polygons have been visited.
//
......@@ -256,7 +250,7 @@ void vlPolyNormals::Execute()
}
this->PointData.SetNormals(newNormals);
this->SetPolys(NewMesh->GetPolys());
this->SetPolys(newPolys);
delete OldMesh;
delete NewMesh;
......
......@@ -35,7 +35,7 @@ void vlStripper::Execute()
vlIdList edge(2);
vlIdList cellIds(MAX_CELL_SIZE);
int neighbor;
vlPolyData Mesh(*this->Input);
vlPolyData Mesh;
char *visited;
int pts[MAX_CELL_SIZE];
int numStripPts, *stripPts;
......@@ -44,10 +44,9 @@ void vlStripper::Execute()
this->Initialize();
// build cell structure
Mesh.LoadVertsOff();
Mesh.LoadLinesOff();
Mesh.BuildLinks();
// build cell structure. Only operate with polygons and triangle strips.
Mesh.SetPolys(this->Input->GetPolys());
Mesh.SetStrips(this->Input->GetStrips());
// check input
if ( (numCells=Mesh.GetNumberOfCells()) < 1 )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment