Commit 8a9eb4af authored by Will Schroeder's avatar Will Schroeder
Browse files

*** empty log message ***

parent 4a8d0251
......@@ -120,10 +120,11 @@ public:
// Special method flips ordering of current cell. Works in conjunction with
// cell traversal methods.
void ReverseOrder(int npts)
void ReverseCell(int loc)
{
int i, tmp, loc=this->Location - npts;
int *pts=this->Ia.GetPtr(loc);
int i, tmp;
int npts=this->Ia.GetValue(loc);
int *pts=this->Ia.GetPtr(loc+1);
for (i=0; i < (npts/2); i++)
{
tmp = pts[i];
......@@ -131,6 +132,13 @@ public:
pts[npts-i-1] = tmp;
}
}
void ReplaceCell(int loc, vlIdList& ptIds)
{
int i;
int npts=this->Ia.GetValue(loc);
int *pts=this->Ia.GetPtr(loc+1);
for (i=0; i < npts; i++) pts[i] = ptIds.GetId(i);
}
protected:
int NumberOfCells;
......
......@@ -10,6 +10,8 @@ class vlIdList {
public:
vlIdList(const int sz=128, const int ext=100):Ia(sz,ext) {};
~vlIdList() {};
vlIdList &operator=(const vlIdList& ids) {this->Ia = ids.Ia;};
void Squeeze() {this->Ia.Squeeze();};
int GetNumberOfIds() {return (this->Ia.GetMaxId() + 1);};
int GetId(const int i) {return this->Ia[i];};
......
......@@ -67,6 +67,10 @@ public:
// create verts, lines, polys, tmeshes from cell object
void InsertNextCell(int type, int npts, int pts[MAX_CELL_SIZE]);
// special operations on cell
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);
......
......@@ -452,31 +452,15 @@ void vlPolyData::GetCellPoints(int cellId, vlIdList *ptIds)
switch (type)
{
case vlPOINT:
this->Verts->GetCell(loc,numPts,pts);
break;
case vlPOLY_POINTS:
case vlPOINT: case vlPOLY_POINTS:
this->Verts->GetCell(loc,numPts,pts);
break;
case vlLINE:
this->Lines->GetCell(loc,numPts,pts);
break;
case vlPOLY_LINE:
case vlLINE: case vlPOLY_LINE:
this->Lines->GetCell(loc,numPts,pts);
break;
case vlTRIANGLE:
this->Polys->GetCell(loc,numPts,pts);
break;
case vlQUAD:
this->Polys->GetCell(loc,numPts,pts);
break;
case vlPOLYGON:
case vlTRIANGLE: case vlQUAD: case vlPOLYGON:
this->Polys->GetCell(loc,numPts,pts);
break;
......@@ -532,3 +516,59 @@ void vlPolyData::InsertNextCell(int type, int npts, int pts[MAX_CELL_SIZE])
}
}
void vlPolyData::ReverseCell(int cellId)
{
int loc, type;
if ( this->Cells == NULL ) this->BuildCells();
loc = this->Cells->GetCellLocation(cellId);
type = this->Cells->GetCellType(cellId);
switch (type)
{
case vlPOINT: case vlPOLY_POINTS:
this->Verts->ReverseCell(loc);
break;
case vlLINE: case vlPOLY_LINE:
this->Lines->ReverseCell(loc);
break;
case vlTRIANGLE: case vlQUAD: case vlPOLYGON:
this->Polys->ReverseCell(loc);
break;
case vlTRIANGLE_STRIP:
this->Strips->ReverseCell(loc);
break;
}
}
void vlPolyData::ReplaceCell(int cellId, vlIdList& ptIds)
{
int loc, type;
if ( this->Cells == NULL ) this->BuildCells();
loc = this->Cells->GetCellLocation(cellId);
type = this->Cells->GetCellType(cellId);
switch (type)
{
case vlPOINT: case vlPOLY_POINTS:
this->Verts->ReplaceCell(loc,ptIds);
break;
case vlLINE: case vlPOLY_LINE:
this->Lines->ReplaceCell(loc,ptIds);
break;
case vlTRIANGLE: case vlQUAD: case vlPOLYGON:
this->Polys->ReplaceCell(loc,ptIds);
break;
case vlTRIANGLE_STRIP:
this->Strips->ReplaceCell(loc,ptIds);
break;
}
}
Markdown is supported
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