Commit 3c4c1925 authored by Will Schroeder's avatar Will Schroeder
Browse files

*** empty log message ***

parent 7271e896
......@@ -21,25 +21,36 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlCell_h
#define __vlCell_h
#define MAX_CELL_SIZE 128
#define TOL 1.e-05 // Tolerance for geometric calculation
#include "Object.hh"
#include "FPoints.hh"
#include "IdList.hh"
class vlCell : public vlObject
{
public:
vlCell():Points(0) {};
vlCell(): Points(MAX_CELL_SIZE), PointIds(MAX_CELL_SIZE) {};
void Initialize(int npts, int *pts, vlPoints *p);
char *GetClassName() {return "vlCell";};
void SetPoints(vlFloatPoints *pts) {this->Points = pts;};
// Because these objects (cells and derived classes) are computational
// objects, and because they are used internally, do not use memory
// reference counting.
// Point coordinates for cell.
vlFloatPoints *GetPoints() {return &this->Points;};
// Point ids for cell.
vlIdList *GetPointIds() {return &this->PointIds;};
// Dimensionality of cell (0,1,2, or 3)
virtual int CellDimension() = 0;
// return inside cell (!=0) if <= tolerance squared; evaluate parametric
// coordinates, sub-cell id (if cell is composite), and distance squared
// of point x[3] to cell.
virtual float EvaluatePosition(float x[3], int& subId, float pcoords[3]) = 0;
// virtual int EvaluatePosition(float x[3], float& tol2,
// int& subId, float pcoords[3], float& dist2) = 0;
// Determine global coordinate from subId and parametric coordinates
virtual void EvaluateLocation(int& subId, float pcoords[3], float x[3]) = 0;
......@@ -50,8 +61,9 @@ 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]);
protected:
vlFloatPoints *Points;
// left public for quick computational access
vlFloatPoints Points;
vlIdList PointIds;
};
......
......@@ -12,7 +12,8 @@ public:
vlCellArray() : NumberOfCells(0), Location(0) {};
int Initialize(const int sz, const int ext=1000)
{return this->Ia.Initialize(sz,ext);};
vlCellArray (const int sz, const int ext=1000):NumberOfCells(0),Location(0),InsertPoint(0),Ia(sz,ext){};
vlCellArray (const int sz, const int ext=1000):NumberOfCells(0),Location(0),Ia(sz,ext){};
vlCellArray(const vlCellArray& ca);
~vlCellArray() {};
int GetNextCell(int& npts, int* &pts)
{
......@@ -38,23 +39,25 @@ public:
}
void InsertNextCell(int npts)
{
this->InsertPoint = this->Ia.InsertNextValue(npts) + 1;
this->Location = this->Ia.InsertNextValue(npts) + 1;
NumberOfCells++;
}
void InsertCellPoint(int id)
{this->Ia.InsertValue(this->InsertPoint++,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);};
int GetSize() {return Ia.GetSize();};
void GetCell(int loc, int &npts, int* &pts)
{npts=this->Ia.GetValue(loc++); pts=this->Ia.GetPtr(loc);};
int GetLocation() {return this->Location;};
protected:
int NumberOfCells;
int Location;
vlIntArray Ia;
int InsertPoint;
};
#endif
......@@ -21,7 +21,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "Object.hh"
struct vlCell {
struct vlCell_s {
unsigned char type;
int loc;
};
......@@ -32,20 +32,20 @@ public:
vlCellList(const int sz, const int ext);
~vlCellList();
char *GetClassName() {return "vlCellList";};
vlCell &GetCell(const int id) {return this->Array[id];};
vlCell_s &GetCell(const int id) {return this->Array[id];};
unsigned char GetCellType(const int id) {return this->Array[id].type;};
int GetCellLoc(const int id) {return this->Array[id].loc;};
int GetCellLocation(const int id) {return this->Array[id].loc;};
void InsertCell(const int id, const unsigned char type, const int loc);
int InsertNextCell(const unsigned char type, const int pos);
void Squeeze();
void Reset();
private:
vlCell *Array; // pointer to data
vlCell_s *Array; // pointer to data
int Size; // allocated size of data
int MaxId; // maximum index inserted thus far
int Extend; // grow array by this point
vlCell *Resize(const int sz); // function to resize data
vlCell_s *Resize(const int sz); // function to resize data
};
#endif
......@@ -23,7 +23,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "PolySrc.hh"
#define MAX_RESOLUTION MAX_VERTS
#define MAX_RESOLUTION MAX_CELL_SIZE
class vlConeSource : public vlPolySource
{
......
......@@ -21,7 +21,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "PolySrc.hh"
#define MAX_RESOLUTION MAX_VERTS
#define MAX_RESOLUTION MAX_CELL_SIZE
class vlCylinderSource : public vlPolySource
{
......
......@@ -3,8 +3,8 @@
Program: Visualization Library
Module: DS2DSF.hh
Language: C++
Date: $Date$
Version: $Revision$
Date: 2/17/94
Version: 1.8
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
......@@ -30,16 +30,15 @@ public:
~vlDataSetToDataSetFilter();
char *GetClassName() {return "vlDataSetToDataSetFilter";};
void PrintSelf(ostream& os, vlIndent indent);
// dataset interface
vlDataSet *MakeObject() {return this->DataSet->MakeObject();};
int NumberOfCells() {return this->DataSet->NumberOfCells();}
int NumberOfPoints() {return this->DataSet->NumberOfPoints();}
int CellDimension(int cellId) {return this->DataSet->CellDimension(cellId);}
void CellPoints(int cellId, vlIdList& ptId)
{this->DataSet->CellPoints(cellId, ptId);}
void Initialize();
float *GetPoint(int i) {return this->DataSet->GetPoint(i);}
void GetPoints(vlIdList& ptId, vlFloatPoints& fp)
{this->DataSet->GetPoints(ptId,fp);}
vlCell *GetCell(int cellId) {return this->DataSet->GetCell(cellId);}
void Initialize();
void ComputeBounds() {this->DataSet->ComputeBounds();};
vlMapper *MakeMapper();
void Update();
......
......@@ -24,8 +24,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "FPoints.hh"
#include "PtData.hh"
#include "Mapper.hh"
#define MAX_CELL_SIZE 128
#include "Cell.hh"
class vlDataSet : virtual public vlObject
{
......@@ -33,14 +32,14 @@ public:
vlDataSet();
char *GetClassName() {return "vlDataSet";};
void PrintSelf(ostream& os, vlIndent indent);
virtual vlDataSet *MakeObject() = 0;
virtual int NumberOfCells() = 0;
virtual int NumberOfPoints() = 0;
virtual int CellDimension(int cellId) = 0;
virtual void CellPoints(int cellId, vlIdList& ptId) = 0;
virtual float *GetPoint(int ptId) = 0;
virtual vlCell *GetCell(int cellId) = 0;
virtual vlMapper *MakeMapper() = 0;
virtual void Initialize();
virtual float *GetPoint(int i) = 0;
virtual void GetPoints(vlIdList& ptId, vlFloatPoints& fp) = 0;
virtual void Update() {};
unsigned long int GetMTime();
......@@ -52,8 +51,6 @@ public:
vlPointData *GetPointData() {return &this->PointData;};
virtual vlMapper *MakeMapper() = 0;
protected:
vlPointData PointData; // Scalars, vectors, etc. associated w/ each point
vlTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
......
......@@ -10,10 +10,11 @@ class vlIdList {
public:
vlIdList(const int sz, const int ext=100):Ia(sz,ext) {};
~vlIdList() {};
int &operator[](const int id) {return this->Ia[id];};
void Reset() {this->Ia.Reset();};
int NumberOfIds() {return (this->Ia.GetMaxId() + 1);};
int InsertNextId(const int i) {return Ia.InsertNextValue(i);};
void InsertId(const int i, const int id) {this->Ia.InsertValue(i,id);};
int InsertNextId(const int id) {return this->Ia.InsertNextValue(id);};
int GetId(const int i) {return this->Ia[i];};
void operator+=(vlIdList& ids) {this->Ia += ids.Ia;};
void operator+=(const int i) {this->Ia += i;};
int getChunk(const int sz) { // get chunk of memory
......@@ -21,7 +22,9 @@ public:
this->Ia.InsertValue(pos+sz-1,0);
return pos;
}
private:
void Reset() {this->Ia.Reset();};
protected:
vlIntArray Ia;
};
......
......@@ -31,6 +31,8 @@ public:
char *GetClassName() {return "vlImplicitModeller";};
void PrintSelf(ostream& os, vlIndent indent);
float ComputeModelBounds();
vlSetClampMacro(MaximumDistance,float,0.0,1.0);
vlGetMacro(MaximumDistance,float);
......
......@@ -29,6 +29,7 @@ public:
vlLine() {};
char *GetClassName() {return "vlLine";};
int CellDimension() {return 1;};
float EvaluatePosition(float x[3], int& subId, float pcoords[3]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
......
......@@ -32,8 +32,12 @@ public:
vlPlane() {};
char *GetClassName() {return "vlPlane";};
// project point onto plane, returning coordinates
int ProjectPoint(float x[3], float origin[3], float normal[3], float xproj[3]);
float Evaluate(float normal[3], float origin[3], float x[3])
{return normal[0]*(x[0]-origin[0]) + normal[1]*(x[1]-origin[1]) +
normal[2]*(x[2]-origin[2]);};
};
#endif
......
......@@ -23,34 +23,35 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "DataSet.hh"
#include "FPoints.hh"
#include "CellArr.hh"
#define MAX_VERTS MAX_CELL_SIZE
#include "CellList.hh"
#include "LinkList.hh"
class vlPolyData : public vlDataSet
{
public:
// dataset interface
vlPolyData();
vlPolyData(const vlPolyData& pd);
~vlPolyData();
vlDataSet *MakeObject();
char *GetClassName() {return "vlPolyData";};
void PrintSelf(ostream& os, vlIndent indent);
int NumberOfCells();
// dataset interface
vlDataSet *MakeObject();
int NumberOfPoints();
int CellDimension(int cellId);
void CellPoints(int cellId, vlIdList& ptId);
int NumberOfCells();
float *GetPoint(int ptId) {return this->Points->GetPoint(ptId);};
vlCell *GetCell(int cellId);
vlMapper *MakeMapper();
void Initialize();
float *GetPoint(int i) {return this->Points->GetPoint(i);};
void GetPoints(vlIdList& ptId, vlFloatPoints& fp);
void ComputeBounds();
vlMapper *MakeMapper();
// PolyData specific stuff follows
vlSetObjectMacro(Points,vlPoints);
vlGetObjectMacro(Points,vlPoints);
// Can't use macros to support traversal methods
// Can't use macros to set/get following cell arrays. This is due to tricks
// required to support traversal methods.
void SetVerts (vlCellArray* v);
vlCellArray *GetVerts();
......@@ -68,7 +69,38 @@ public:
int NumberOfPolys();
int NumberOfStrips();
private:
// following stuff supports cell structure
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);
LoadAll() {this->LoadVertsOn(); this->LoadLinesOn();
this->LoadPolysOn(); this->LoadStripsOn();};
LoadNone() {this->LoadVertsOff(); this->LoadLinesOff();
this->LoadPolysOff(); this->LoadStripsOff();};
SetReadOnly() {this->SetWritable(0);};
vlBooleanMacro(Writable,int);
vlSetMacro(Writable,int)
vlGetMacro(Writable,int);
vlBooleanMacro(TriangleMesh,int);
vlSetMacro(TriangleMesh,int);
vlGetMacro(TriangleMesh,int);
protected:
// point data (i.e., scalars, vectors, normals, tcoords) inherited
vlPoints *Points;
vlCellArray *Verts;
......@@ -77,6 +109,18 @@ private:
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 TriangleMesh;
int Writable;
vlCellList *Cells;
vlLinkList *Links;
void BuildCells();
void BuildLinks();
};
#endif
......
......@@ -36,6 +36,7 @@ public:
int GenerateNormals(vlPoints *, vlCellArray *, vlFloatNormals *);
int CellDimension() {return 1;};
float EvaluatePosition(float x[3], int& subId, float pcoords[3]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
......
/*=========================================================================
Program: Visualization Library
......@@ -30,6 +29,7 @@ public:
vlPolyPoints() {};
char *GetClassName() {return "vlPolyPoints";};
int CellDimension() {return 0;};
float EvaluatePosition(float x[3], int& subId, float pcoords[3]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
......
......@@ -36,6 +36,7 @@ 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;};
float EvaluatePosition(float x[3], int& subId, float pcoords[3]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
......@@ -43,6 +44,15 @@ public:
float p20[3], float &l20, float n[3]);
int PointInPolygon(float bounds[6], float x[3], float n[3]);
int Triangulate(vlIdList &outTris);
int FastTriangulate(int numVerts, int *verts, vlIdList& Tris);
int CanSplitLoop(int fedges[2], int numVerts, int *verts, int& n1, int *l1,
int& n2, int *l2, float& ar);
void SplitLoop (int fedges[2], int numVerts, int *verts, int& n1, int *l1,
int& n2, int* l2);
};
#endif
......
......@@ -29,6 +29,7 @@ public:
vlQuad() {};
char *GetClassName() {return "vlQuad";};
int CellDimension() {return 2;};
float EvaluatePosition(float x[3], int& subId, float pcoords[3]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
void ShapeFunctions(float pcoords[3], float sf[4]);
......
......@@ -16,7 +16,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Structured points (e.g., volume, image, etc.)
// Structured points (e.g., volume(3D), image(2D), etc.)
//
#ifndef __vlStructuredPoints_h
#define __vlStructuredPoints_h
......@@ -25,27 +25,33 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "IdList.hh"
#include "FPoints.hh"
#define SINGLE_POINT 0
#define X_LINE 1
#define Y_LINE 2
#define Z_LINE 3
#define XY_PLANE 4
#define YZ_PLANE 5
#define XZ_PLANE 6
#define XYZ_GRID 7
class vlStructuredPoints : public vlDataSet {
public:
vlStructuredPoints();
vlStructuredPoints(const vlStructuredPoints& v);
~vlStructuredPoints();
vlDataSet *MakeObject() {return new vlStructuredPoints(*this);};
char *GetClassName() {return "vlStructuredPoints";};
void PrintSelf(ostream& os, vlIndent indent);
int NumberOfCells()
{int nCells=(Dimension[0]-1)*(Dimension[1]-1)*(Dimension[2]-1);
return (nCells < 0 ? 0 : nCells);};
int NumberOfPoints()
{int nPts=Dimension[0]*Dimension[1]*Dimension[2];
return (nPts < 0 ? 0 : nPts);};
int CellDimension(int cellId);
float *GetPoint(int i);
void GetPoints(vlIdList& ptId, vlFloatPoints& fp);
void CellPoints(int cellId, vlIdList& ptId);
// dataset interface
vlDataSet *MakeObject() {return new vlStructuredPoints(*this);};
int NumberOfCells();
int NumberOfPoints();
float *GetPoint(int ptId);
vlCell *GetCell(int cellId);
vlMapper *MakeMapper() {return (vlMapper *)0;};
vlSetVector3Macro(Dimension,int);
void SetDimension(int i, int j, int k);
void SetDimension(int dim[3]);
vlGetVectorMacro(Dimension,int);
vlSetVector3Macro(AspectRatio,float);
......@@ -56,8 +62,9 @@ public:
protected:
int Dimension[3];
float AspectRatio[3];
float Origin[3];
float AspectRatio[3];
int DataDescription;
};
#endif
......@@ -29,6 +29,7 @@ public:
vlTetra() {};
char *GetClassName() {return "vlTetra";};
int CellDimension() {return 3;};
float EvaluatePosition(float x[3], int& subId, float pcoords[3]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
......
......@@ -29,6 +29,7 @@ public:
vlTriangleStrip() {};
char *GetClassName() {return "vlTriangleStrip";};
int CellDimension() {return 2;};
float EvaluatePosition(float x[3], int& subId, float pcoords[3]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
......
......@@ -29,6 +29,7 @@ public:
vlTriangle() {};
char *GetClassName() {return "vlTriangle";};
int CellDimension() {return 2;};
float EvaluatePosition(float x[3], int& subId, float pcoords[3]);
void EvaluateLocation(int& subId, float pcoords[3], float x[3]);
......
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