Commit af3ce67a authored by Will Schroeder's avatar Will Schroeder
Browse files

*** empty log message ***

parent 08bfdd05
......@@ -27,8 +27,10 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "Object.hh"
#include "FPoints.hh"
#include "FScalars.hh"
#include "CellArr.hh"
#include "IdList.hh"
#include "CellType.hh"
class vlCellArray;
class vlCell : public vlObject
{
......@@ -41,20 +43,36 @@ public:
// objects, and because they are used internally, do not use memory
// reference counting.
// Number of points in cell
int GetNumberOfPoints() {return this->PointIds.GetNumberOfIds();};
// Type of cell
virtual int GetCellType() = 0;
// Dimensionality of cell (0,1,2, or 3)
virtual int CellDimension() = 0;
virtual int GetCellDimension() = 0;
// Point coordinates for cell.
vlFloatPoints *GetPoints() {return &this->Points;};
// Number of points (and other topological entities) in cell
int GetNumberOfPoints() {return this->PointIds.GetNumberOfIds();};
virtual int GetNumberOfEdges() = 0;
virtual int GetNumberOfFaces() = 0;
// Get topological entities
vlIdList *GetPointIds() {return &this->PointIds;};
int GetPointId(int ptId) {return this->PointIds.GetId(ptId);};
virtual vlCell *GetEdge(int edgeId) = 0;
virtual vlCell *GetFace(int faceId) = 0;
// given a point x[3] return inside(=1) or outside(=0) cell; evaluate
// parametric coordinates, sub-cell id (!=0 only if cell is composite), and
// parametric coordinates, sub-cell id (!=0 only if cell is composite),
// distance squared of point x[3] to cell (in particular, the sub-cell
// indicated).
virtual int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2) = 0;
// indicated), and interpolation weights in cell.
virtual int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]) = 0;
// Determine global coordinate from subId and parametric coordinates
virtual void EvaluateLocation(int& subId, float pcoords[3], float x[3]) = 0;
virtual void EvaluateLocation(int& subId, float pcoords[3],
float x[3], float weights[MAX_CELL_SIZE]) = 0;
// Generate contouring primitives
virtual void Contour(float value, vlFloatScalars *cellScalars,
......@@ -68,12 +86,6 @@ public:
// Quick intersection of cell bounding box. Returns != 0 for hit.
char HitBBox(float bounds[6], float origin[3], float dir[3], float coord[3]);
// Point coordinates for cell.
vlFloatPoints *GetPoints() {return &this->Points;};
// Point ids for cell.
vlIdList *GetPointIds() {return &this->PointIds;};
// left public for quick computational access
vlFloatPoints Points;
vlIdList PointIds;
......
......@@ -5,6 +5,7 @@
#define __vlCellArray_h
#include "IntArray.hh"
#include "Cell.hh"
class vlCellArray : public vlObject
{
......@@ -15,6 +16,21 @@ public:
vlCellArray (const int sz, const int ext=1000):NumberOfCells(0),Location(0),Ia(sz,ext){};
vlCellArray(const vlCellArray& ca);
~vlCellArray() {};
int GetNumberOfCells() {return this->NumberOfCells;};
// utility routines to help manage memory of cell data structure. EstimateSize()
// returns a value used to initialize cell array based on number of cells and
// maximum number of points making up cell. If every cell is the same size (in
// terms of number of points) then the estimate is guaranteed exact.
// The Squeeze() function recovers memory from estimated size.
int EstimateSize(int numCells, int maxPtsPerCell)
{return numCells*(1+maxPtsPerCell);};
void Squeeze() {this->Ia.Squeeze();};
// efficient method of traversing cell array. Use InitTraveral() and then repeated
// calls to GetNextCell()
void InitTraversal() {this->Location=0;};
int GetNextCell(int& npts, int* &pts)
{
if ( this->Ia.GetMaxId() >= 0 && this->Location <= this->Ia.GetMaxId() )
......@@ -29,6 +45,8 @@ public:
return 0;
}
}
// create a cell by specifying the number of pts and an array of point id's
void InsertNextCell(int npts, int* pts)
{
int id = this->Ia.GetMaxId() + npts + 1;
......@@ -37,6 +55,9 @@ public:
for (int i=0; i<npts-1; i++) this->Ia[id-npts+i+1] = pts[i];
NumberOfCells++;
}
// create cells by specifying count, and then adding points one at a time using
// method InsertCellPoint()
void InsertNextCell(int npts)
{
this->Location = this->Ia.InsertNextValue(npts) + 1;
......@@ -44,11 +65,19 @@ public:
}
void InsertCellPoint(int id)
{this->Ia.InsertValue(this->Location++,id);};
int GetNumberOfCells() {return NumberOfCells;};
void InitTraversal() {this->Location=0;};
void Squeeze() {this->Ia.Squeeze();};
int EstimateSize(int numCells, int maxPtsPerCell)
{return numCells*(1+maxPtsPerCell);};
// create a cell from a cell object
void InsertNextCell(vlCell *cell)
{
int npts = cell->GetNumberOfPoints();
int id = this->Ia.GetMaxId() + npts + 1;
this->Ia.InsertValue(id,cell->PointIds.GetId(npts-1));
this->Ia[id-npts] = npts;
for (int i=0; i<npts-1; i++) this->Ia[id-npts+i+1] = cell->PointIds.GetId(i);
NumberOfCells++;
}
// access methods for building data structures
int GetSize() {return Ia.GetSize();};
void GetCell(int loc, int &npts, int* &pts)
{npts=this->Ia.GetValue(loc++); pts=this->Ia.GetPtr(loc);};
......
......@@ -20,7 +20,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#define __vlDataSetFilter_h
#include "Filter.hh"
#include "DataSetF.hh"
#include "DataSet.hh"
class vlDataSetFilter : public vlFilter
{
......
......@@ -29,12 +29,21 @@ public:
vlHexahedron() {};
char *GetClassName() {return "vlHexahedron";};
int CellDimension() {return 3;};
int GetCellType() {return vlHEXAHEDRON;};
int GetCellDimension() {return 3;};
int GetNumberOfEdges() {return 12;};
int GetNumberOfFaces() {return 6;};
vlCell *GetEdge(int edgeId);
vlCell *GetFace(int faceId);
void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points, vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys, vlFloatScalars *s);
int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3],
float weights[MAX_CELL_SIZE]);
void ShapeFunctions(float pcoords[3], float sf[8]);
void ShapeDerivs(float pcoords[3], float derivs[24]);
......
......@@ -29,13 +29,21 @@ public:
vlLine() {};
char *GetClassName() {return "vlLine";};
int CellDimension() {return 1;};
int GetCellType() {return vlLINE;};
int GetCellDimension() {return 1;};
int GetNumberOfEdges() {return 0;};
int GetNumberOfFaces() {return 0;};
vlCell *GetEdge(int edgeId) {return 0;};
vlCell *GetFace(int faceId) {return 0;};
void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points, vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys,
vlFloatScalars *s);
int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3],
float weights[MAX_CELL_SIZE]);
Intersection(float x[3], float xray[3], float x1[3], float x2[3],
float& u, float& v);
......
......@@ -29,13 +29,23 @@ public:
vlRectangle() {};
char *GetClassName() {return "vlRectangle";};
int CellDimension() {return 2;};
int GetCellType() {return vlRECTANGLE;};
int GetCellDimension() {return 2;};
int GetNumberOfEdges() {return 4;};
int GetNumberOfFaces() {return 0;};
vlCell *GetEdge(int edgeId);
vlCell *GetFace(int faceId) {return 0;};
void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points, vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys, vlFloatScalars *s);
int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3],
float weights[MAX_CELL_SIZE]);
void ShapeFunctions(float pcoords[3], float sf[4]);
};
#endif
......
......@@ -26,8 +26,6 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "CellArr.hh"
#include "FNormals.hh"
#define MAX_RESOLUTION MAX_VERTS
class vlPolyLine : public vlCell
{
public:
......@@ -36,14 +34,21 @@ public:
int GenerateNormals(vlPoints *, vlCellArray *, vlFloatNormals *);
int CellDimension() {return 1;};
int GetCellType() {return vlPOLY_LINE;};
int GetCellDimension() {return 1;};
int GetNumberOfEdges() {return 0;};
int GetNumberOfFaces() {return 0;};
vlCell *GetEdge(int edgeId) {return 0;};
vlCell *GetFace(int faceId) {return 0;};
void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points, vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys,
vlFloatScalars *s);
int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3],
float weights[MAX_CELL_SIZE]);
};
#endif
......
......@@ -29,12 +29,21 @@ public:
vlPolyPoints() {};
char *GetClassName() {return "vlPolyPoints";};
int CellDimension() {return 0;};
int GetCellType() {return vlPOLY_POINTS;};
int GetCellDimension() {return 0;};
int GetNumberOfEdges() {return 0;};
int GetNumberOfFaces() {return 0;};
vlCell *GetEdge(int edgeId) {return 0;};
vlCell *GetFace(int faceId) {return 0;};
void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points, vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys, vlFloatScalars *s);
int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3],
float weights[MAX_CELL_SIZE]);
};
......
......@@ -24,8 +24,6 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "Cell.hh"
#include "Points.hh"
#define MAX_RESOLUTION MAX_VERTS
class vlPolygon : public vlCell
{
public:
......@@ -36,12 +34,21 @@ public:
void ComputeNormal(float v1[3], float v2[3], float v3[3], float n[3]);
void ComputeNormal(vlFloatPoints *p, float n[3]);
int CellDimension() {return 2;};
int GetCellType() {return vlPOLYGON;};
int GetCellDimension() {return 2;};
int GetNumberOfEdges() {return this->GetNumberOfPoints();};
int GetNumberOfFaces() {return 0;};
vlCell *GetEdge(int edgeId);
vlCell *GetFace(int faceId) {return 0;};
void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points,vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys, vlFloatScalars *s);
int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3],
float weights[MAX_CELL_SIZE]);
void ComputeWeights(float x[3], float weights[MAX_CELL_SIZE]);
int ParameterizePolygon(float p0[3], float p10[3], float &l10,
float p20[3], float &l20, float n[3]);
......
......@@ -30,14 +30,20 @@ class vlPointData : public vlObject
public:
vlPointData() : Scalars(0), Vectors(0), Normals(0), TCoords(0) {};
void Initialize();
void CopyInitialize(vlPointData* pd, int sFlg=1, int vFlg=1, int nFlg=1, int tFlg=1, int sze=0, int ext=1000);
~vlPointData();
char *GetClassName() {return "vlPointData";};
void PrintSelf(ostream& os, vlIndent indent);
vlPointData (const vlPointData& pd);
vlPointData &operator=(vlPointData& pd);
virtual void Update() {};
void CopyData(vlPointData *from_pd, int from_id, int to_id);
// use to copy data
void CopyInitialize(vlPointData* pd, int sze=0, int ext=1000, int sFlg=1, int vFlg=1, int nFlg=1, int tFlg=1);
void CopyData(vlPointData *fromPd, int fromId, int toId);
// use to interpolate data
void InterpolateInitialize(vlPointData* pd, int sze=0, int ext=1000, int sFlg=1, int vFlg=1, int nFlg=1, int tFlg=1);
void InterpolatePoint(vlPointData *fromPd, int toId, vlIdList *ptIds, float *weights);
vlSetObjectMacro (Scalars, vlScalars);
vlGetObjectMacro (Scalars, vlScalars);
......
......@@ -29,12 +29,20 @@ public:
vlQuad() {};
char *GetClassName() {return "vlQuad";};
int CellDimension() {return 2;};
int GetCellType() {return vlQUAD;};
int GetCellDimension() {return 2;};
int GetNumberOfEdges() {return 4;};
int GetNumberOfFaces() {return 0;};
vlCell *GetEdge(int edgeId);
vlCell *GetFace(int faceId) {return 0;};
void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points, vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys, vlFloatScalars *s);
int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3],
float weights[MAX_CELL_SIZE]);
void ShapeFunctions(float pcoords[3], float sf[4]);
void ShapeDerivs(float pcoords[3], float derivs[12]);
......
......@@ -22,6 +22,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#define __vlStructuredDataSet_h
#include "DataSet.hh"
#include "CArray.hh"
#define SINGLE_POINT 0
#define X_LINE 1
......@@ -43,14 +44,25 @@ public:
// dataset interface
int GetNumberOfCells();
int GetNumberOfPoints();
void Initialize();
void SetDimensions(int i, int j, int k);
void SetDimensions(int dim[3]);
vlGetVectorMacro(Dimensions,int);
void BlankingOn();
void BlankingOff();
int GetBlanking() {return this->Blanking;};
void BlankPoint(int ptId);
void UnBlankPoint(int ptId);
int IsPointVisible(int ptId) {if (!this->Blanking) return 1;
else return this->PointVisibility->GetValue(ptId);}
protected:
int Dimensions[3];
int DataDescription;
int Blanking;
vlCharArray *PointVisibility;
};
#endif
......@@ -36,6 +36,7 @@ public:
float *GetPoint(int ptId);
vlCell *GetCell(int cellId);
vlMapper *MakeMapper() {return (vlMapper *)0;};
void Initialize();
vlSetVector3Macro(AspectRatio,float);
vlGetVectorMacro(AspectRatio,float);
......
......@@ -29,12 +29,20 @@ public:
vlTetra() {};
char *GetClassName() {return "vlTetra";};
int CellDimension() {return 3;};
int GetCellType() {return vlTETRA;};
int GetCellDimension() {return 3;};
int GetNumberOfEdges() {return 6;};
int GetNumberOfFaces() {return 4;};
vlCell *GetEdge(int edgeId);
vlCell *GetFace(int faceId);
void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points, vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys, vlFloatScalars *s);
int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3],
float weights[MAX_CELL_SIZE]);
};
......
......@@ -29,13 +29,21 @@ public:
vlTriangleStrip() {};
char *GetClassName() {return "vlTriangleStrip";};
int CellDimension() {return 2;};
int GetCellType() {return vlTRIANGLE_STRIP;};
int GetCellDimension() {return 2;};
int GetNumberOfEdges() {return this->GetNumberOfPoints();};
int GetNumberOfFaces() {return 0;};
vlCell *GetEdge(int edgeId);
vlCell *GetFace(int faceId) {return 0;};
void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points, vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys,
vlFloatScalars *s);
int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3],
float weights[MAX_CELL_SIZE]);
};
......
......@@ -29,13 +29,21 @@ public:
vlTriangle() {};
char *GetClassName() {return "vlTriangle";};
int CellDimension() {return 2;};
int GetCellType() {return vlTRIANGLE;};
int GetCellDimension() {return 2;};
int GetNumberOfEdges() {return 3;};
int GetNumberOfFaces() {return 0;};
vlCell *GetEdge(int edgeId);
vlCell *GetFace(int faceId) {return 0;};
void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points, vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys,
vlFloatScalars *s);
int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3],
float weights[MAX_CELL_SIZE]);
};
......
......@@ -29,12 +29,20 @@ public:
vlPoint() {};
char *GetClassName() {return "vlPoint";};
int CellDimension() {return 0;};
int GetCellType() {return vlPOINT;};
int GetCellDimension() {return 0;};
int GetNumberOfEdges() {return 0;};
int GetNumberOfFaces() {return 0;};
vlCell *GetEdge(int edgeId) {return 0;};
vlCell *GetFace(int faceId) {return 0;};
void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points, vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys, vlFloatScalars *s);
int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3],
float weights[MAX_CELL_SIZE]);
};
......
......@@ -29,14 +29,22 @@ public:
vlBrick() {};
char *GetClassName() {return "vlBrick";};
int CellDimension() {return 3;};
int GetCellType() {return vlBRICK;};
int GetCellDimension() {return 3;};
int GetNumberOfEdges() {return 12;};
int GetNumberOfFaces() {return 6;};
vlCell *GetEdge(int edgeId);
vlCell *GetFace(int faceId);
void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points, vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys, vlFloatScalars *s);
int EvaluatePosition(float x[3], int& subId, float pcoords[3], float& dist2);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
int EvaluatePosition(float x[3], int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3],
float weights[MAX_CELL_SIZE]);
void ShapeFunctions(float pcoords[3], float sf[8]);
void ShapeDerivs(float pcoords[3], float derivs[24]);
};
......
......@@ -20,7 +20,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
vlCutter::vlCutter(vlImplicitFunction *cf)
{
this->CutFunction = cf;
if ( cf ) cf->Register((void *) this);
if ( cf ) this->CutFunction->Register((void *) this);
}
vlCutter::~vlCutter()
......@@ -28,8 +28,20 @@ vlCutter::~vlCutter()
if ( this->CutFunction ) this->CutFunction->UnRegister((void *) this);
}
//
// Cut through data generating surface. Point values can be determined using
// ProbeFilter.
//
void vlCutter::Execute()
{
int cellId, i;
vlFloatPoints *cellPts;
vlFloatScalars cellScalars(MAX_CELL_SIZE);
vlCell *cell;
vlFloatScalars *newScalars;
vlCellArray *newVerts, *newLines, *newPolys;
vlFloatPoints *newPoints;
float value, *x, s;
vlDebugMacro(<< "Executing cutter");
//
......@@ -42,5 +54,71 @@ void vlCutter::Execute()
vlErrorMacro(<<"No cut function specified");
return;
}
//
// Create objects to hold output of contour operation
//
newPoints = new vlFloatPoints(1000,1000);
newVerts = new vlCellArray(1000,1000);
newLines = new vlCellArray(1000,10000);
newPolys = new vlCellArray(1000,10000);
newScalars = new vlFloatScalars(3000,30000);
//
// Loop over all cells creating scalar function determined by evaluating cell
// points using cut function.
//
value = 0.0;
for (cellId=0; cellId<Input->GetNumberOfCells(); cellId++)
{
cell = Input->GetCell(cellId);
cellPts = cell->GetPoints();
for (i=0; i<cellPts->GetNumberOfPoints(); i++)
{
x = cellPts->GetPoint(i);
s = this->CutFunction->Evaluate(x[0], x[1], x[2]);
cellScalars.SetScalar(i,s);
}
cell->Contour(value, &cellScalars, newPoints, newVerts, newLines, newPolys, newScalars);