Commit 5dbee87f authored by Ken Martin's avatar Ken Martin
Browse files

Approximate VTK 2.1 release

The VTK 2.1 release tag in CVS was moved file-wise as fixes were made.
Therefore the true history of the 'branch' is gone.  This commit was
manufactured during conversion from CVS to represent the version as a
merge from all the commits whose files have the tag.
......@@ -33,7 +33,6 @@ vtkImageSource \
vtkLocator \
vtkMapper2D \
vtkPointSet \
vtkProp2D \
vtkViewport \
vtkWindow
......
......@@ -38,6 +38,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
#include "vtkActor2D.h"
#include "vtkProperty2D.h"
#include "vtkMapper2D.h"
......@@ -48,13 +49,52 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// orientation 0, scale (1,1), layer 0, visibility on
vtkActor2D::vtkActor2D()
{
this->Orientation = 0.0;
this->Scale[0] = 1.0;
this->Scale[1] = 1.0;
this->LayerNumber = 0;
this->Visibility = 1; // ON
this->SelfCreatedProperty = 0;
this->Property = (vtkProperty2D*) NULL;
this->Mapper = (vtkMapper2D*) NULL;
this->PositionCoordinate = vtkCoordinate::New();
this->PositionCoordinate->SetCoordinateSystem(VTK_VIEWPORT);
}
// Description:
// Destroy an actor2D.
// Destroy an actor2D. If the actor2D created it's own
// property, that property is deleted.
vtkActor2D::~vtkActor2D()
{
if (this->SelfCreatedProperty) this->Property->Delete();
this->PositionCoordinate->Delete();
this->PositionCoordinate = NULL;
}
void vtkActor2D::PrintSelf(ostream& os, vtkIndent indent)
{
this->vtkReferenceCount::PrintSelf(os,indent);
os << indent << "Orientation: " << this->Orientation << "\n";
os << indent << "Scale: (" << this->Scale[0] << ", " << this->Scale[1] << ")\n";
os << indent << "Layer Number: " << this->LayerNumber << "\n";
os << indent << "Visibility: " << (this->Visibility ? "On\n" : "Off\n");
os << indent << "PositionCoordinate: " << this->PositionCoordinate << "\n";
this->PositionCoordinate->PrintSelf(os, indent.GetNextIndent());
os << indent << "Self Created Property: " << (this->SelfCreatedProperty ? "Yes\n" : "No\n");
os << indent << "Property: " << this->Property << "\n";
if (this->Property) this->Property->PrintSelf(os, indent.GetNextIndent());
os << indent << "Mapper: " << this->Mapper << "\n";
if (this->Mapper) this->Mapper->PrintSelf(os, indent.GetNextIndent());
}
// Description:
// Set the actor2D's position in display coordinates.
void vtkActor2D::SetDisplayPosition(int XPos, int YPos)
{
this->PositionCoordinate->SetCoordinateSystem(VTK_DISPLAY);
this->PositionCoordinate->SetValue((float)XPos,(float)YPos,0.0);
}
// Description:
......@@ -83,11 +123,38 @@ void vtkActor2D::Render (vtkViewport* viewport)
}
void vtkActor2D::PrintSelf(ostream& os, vtkIndent indent)
// Description:
// Returns an actor2D's property2D. Creates a property if one
// doesn't already exist.
vtkProperty2D *vtkActor2D::GetProperty()
{
this->vtkProp2D::PrintSelf(os,indent);
if (this->Property == NULL)
{
this->Property = vtkProperty2D::New();
this->SelfCreatedProperty = 1;
this->Modified();
}
return this->Property;
}
os << indent << "Mapper: " << this->Mapper << "\n";
if (this->Mapper) this->Mapper->PrintSelf(os, indent.GetNextIndent());
unsigned long int vtkActor2D::GetMTime()
{
unsigned long mTime=this->vtkObject::GetMTime();
unsigned long time;
time = this->PositionCoordinate->GetMTime();
mTime = ( time > mTime ? time : mTime );
if ( this->Property != NULL )
{
time = this->Property->GetMTime();
mTime = ( time > mTime ? time : mTime );
}
return mTime;
}
......@@ -38,25 +38,33 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
// .NAME vtkActor2D - a actor that draws data into the viewport overlay plane
// .NAME vtkActor2D
// .SECTION Description
// vtkActor2D is similar to vtkActor, but it is made to be used with
// two dimensional images and annotation. vtkActor2D has a position
// (inherited from vtkProp) but does not use a transformation matrix
// like vtkActor. vtkActor2D has a reference to a vtkMapper2D object
// which does the rendering.
// two dimensional images and annotation. vtkActor2D has a position,
// orientation, and scale, but does not use a transformation matrix
// like vtkActor. vtkActor2D also has a layer property which allows two
// dimensional actors to be rendered on top of each other in a certain
// order. vtkActor2D has a reference to a vtkMapper2D object which does
// the rendering.
// .SECTION See Also
// vtkProp2D vtkMapper2D vtkProperty2D
// vtkProperty2D vtkMapper2D
#ifndef __vtkActor2D_h
#define __vtkActor2D_h
#include "vtkProp2D.h"
#include "vtkReferenceCount.h"
#include "vtkCoordinate.h"
class vtkMapper2D;
class vtkProperty2D;
class VTK_EXPORT vtkActor2D : public vtkProp2D
class VTK_EXPORT vtkActor2D : public vtkReferenceCount
{
public:
vtkActor2D();
~vtkActor2D();
......@@ -64,16 +72,46 @@ public:
void PrintSelf(ostream& os, vtkIndent indent);
const char *GetClassName() {return "vtkActor2D";};
virtual void Render(vtkViewport *viewport);
void Render(vtkViewport *viewport);
// Description:
// Set/Get the vtkMapper2D which defines the data to be drawn.
vtkSetObjectMacro(Mapper, vtkMapper2D);
vtkGetObjectMacro(Mapper, vtkMapper2D);
vtkSetVector2Macro(Scale, float);
vtkGetVectorMacro(Scale, float, 2);
vtkSetMacro(Orientation, float);
vtkGetMacro(Orientation, float);
vtkSetMacro(LayerNumber, int);
vtkGetMacro(LayerNumber, int);
vtkSetMacro(Visibility, int);
vtkGetMacro(Visibility, int);
vtkBooleanMacro(Visibility, int);
vtkProperty2D* GetProperty();
vtkSetObjectMacro(Property, vtkProperty2D);
// Description:
// Get the PositionCoordinate instance of vtkCoordinate
// This is used for for complicated or relative positioning
vtkViewportCoordinateMacro(Position);
void SetDisplayPosition(int,int);
unsigned long int GetMTime();//overload superclasses' implementation
protected:
vtkMapper2D *Mapper;
float Orientation;
float Scale[2];
int LayerNumber;
int Visibility;
int SelfCreatedProperty;
vtkProperty2D *Property;
vtkMapper2D *Mapper;
vtkCoordinate *PositionCoordinate;
};
#endif
......
......@@ -180,20 +180,21 @@ float *vtkCell::GetBounds ()
{
float *x;
int i, j;
static float bounds[6];
this->Bounds[0] = this->Bounds[2] = this->Bounds[4] = VTK_LARGE_FLOAT;
this->Bounds[1] = this->Bounds[3] = this->Bounds[5] = -VTK_LARGE_FLOAT;
bounds[0] = bounds[2] = bounds[4] = VTK_LARGE_FLOAT;
bounds[1] = bounds[3] = bounds[5] = -VTK_LARGE_FLOAT;
for (i=0; i<this->Points.GetNumberOfPoints(); i++)
{
x = this->Points.GetPoint(i);
for (j=0; j<3; j++)
{
if ( x[j] < this->Bounds[2*j] ) this->Bounds[2*j] = x[j];
if ( x[j] > this->Bounds[2*j+1] ) this->Bounds[2*j+1] = x[j];
if ( x[j] < bounds[2*j] ) bounds[2*j] = x[j];
if ( x[j] > bounds[2*j+1] ) bounds[2*j+1] = x[j];
}
}
return this->Bounds;
return bounds;
}
// Description:
......@@ -201,8 +202,8 @@ float *vtkCell::GetBounds ()
// user provided array.
void vtkCell::GetBounds(float bounds[6])
{
this->GetBounds();
for (int i=0; i < 6; i++) bounds[i] = this->Bounds[i];
float *b=this->GetBounds();
for (int i=0; i < 6; i++) bounds[i] = b[i];
}
// Description:
......@@ -213,28 +214,17 @@ float vtkCell::GetLength2 ()
float *bounds;
int i;
this->GetBounds();
bounds = this->GetBounds();
for (i=0; i<3; i++)
{
diff = this->Bounds[2*i+1] - this->Bounds[2*i];
diff = bounds[2*i+1] - bounds[2*i];
l += diff * diff;
}
return l;
}
// Description:
// Return center of the cell in parametric coordinates.
// Note that the parametric center is not always located
// at (0.5,0.5,0.5). The return value is the subId that
// the center is in (if a composite cell). If you want the
// center in x-y-z space, invoke the EvaluateLocation() method.
int vtkCell::GetParametricCenter(float pcoords[3])
{
pcoords[0] = pcoords[1] = pcoords[2] = 0.5;
return 0;
}
void vtkCell::PrintSelf(ostream& os, vtkIndent indent)
{
int numIds=this->PointIds.GetNumberOfIds();
......
......@@ -106,8 +106,8 @@ public:
virtual int GetCellDimension() = 0;
// Description:
// Return the interpolation order of the cell. Usually linear.
virtual int GetInterpolationOrder() {return 1;};
// Return the interpolation order of the cell.
virtual int GetInterpolationOrder() {return 1;}; //usually linear
// Description:
// Get the point coordinates for the cell.
......@@ -243,7 +243,6 @@ public:
void GetBounds(float bounds[6]);
float *GetBounds();
float GetLength2();
virtual int GetParametricCenter(float pcoords[3]);
// Quick intersection of cell bounding box. Returns != 0 for hit.
static char HitBBox(float bounds[6], float origin[3], float dir[3],
......@@ -253,9 +252,6 @@ public:
vtkPoints Points;
vtkIdList PointIds;
protected:
float Bounds[6];
};
#endif
......
......@@ -90,9 +90,7 @@ public:
int InsertNextCell(vtkCell *cell);
int InsertNextCell(int npts, int* pts);
int InsertNextCell(vtkIdList &pts);
// this and next two methods work together
int InsertNextCell(int npts);
int InsertNextCell(int npts); //this and next two methods work together
void InsertCellPoint(int id);
void UpdateCellCount(int npts);
......
......@@ -58,7 +58,6 @@ public:
const char *GetClassName() {return "vtkCellData";};
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Set cell data to null values
void NullCell(int cellId);
};
......
......@@ -114,17 +114,7 @@ void vtkDataObject::PrintSelf(ostream& os, vtkIndent indent)
{
vtkObject::PrintSelf(os,indent);
if ( this->Source )
{
os << indent << "Source: " << this->Source << "\n";
}
else
{
os << indent << "Source: (none)\n";
}
os << indent << "Release Data: " << (this->ReleaseDataFlag ? "On\n" : "Off\n");
os << indent << "Data Released: " << (this->DataReleased ? "True\n" : "False\n");
os << indent << "Global Release Data: "
<< (vtkDataObjectGlobalReleaseDataFlag ? "On\n" : "Off\n");
......
......@@ -40,6 +40,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
// .NAME vtkDataSetAttributes - represent and manipulate attribute data in a dataset
// .SECTION Description
// vtkDataSetAttributes is a class that is used to represent and manipulate
// attribute data (e.g., scalars, vectors, normals, texture coordinates,
// tensors, and field data) Special methods are provided to work with filter
......
......@@ -39,6 +39,8 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
#include "vtkIdList.h"
#include "vtkCell.h"
vtkIdList::vtkIdList(const int sz, const int ext)
{
......
......@@ -101,30 +101,12 @@ void vtkImageCache::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "MemoryLimit: " << this->MemoryLimit << endl;
os << indent << "NumberOfScalarComponents: " <<
this->NumberOfScalarComponents << endl;
if ( this->Source )
{
os << indent << "Source: (" << this->Source << ").\n";
}
else
{
os << indent << "Source: (none).\n";
}
os << indent << "Source: (" << this->Source << ").\n";
os << indent << "ReleaseDataFlag: " << this->ReleaseDataFlag << "\n";
os << indent << "Data Released: " << this->DataReleased << "\n";
os << indent << "ScalarType: "<<vtkImageScalarTypeNameMacro(this->ScalarType)
<< "\n";
if ( this->ImageToStructuredPoints )
{
os << indent << "ImageToStructuredPoints: ("
<< this->ImageToStructuredPoints << ")\n";
}
else
{
os << indent << "ImageToStructuredPoints: (none)\n";
}
os << indent << "ImageToStructuredPoints: ("
<< this->ImageToStructuredPoints << ")\n";
os << indent << "Spacing: (" << this->Spacing[0];
for (idx = 1; idx < 3; ++idx)
......
......@@ -78,7 +78,7 @@ vtkImageSource::~vtkImageSource()
//----------------------------------------------------------------------------
void vtkImageSource::PrintSelf(ostream& os, vtkIndent indent)
{
vtkProcessObject::PrintSelf(os,indent);
vtkObject::PrintSelf(os,indent);
os << indent << "AbortExecute: " << (this->AbortExecute ? "On\n" : "Off\n");
os << indent << "Progress: " << this->Progress << "\n";
......
......@@ -107,46 +107,50 @@ void vtkLine::EvaluateLocation(int& vtkNotUsed(subId), float pcoords[3],
int vtkLine::Intersection (float a1[3], float a2[3], float b1[3], float b2[3],
float& u, float& v)
{
double a21[3], b21[3], b1a1[3];
double sys[2][2], c[2], det;
double *A[2], row1[2], row2[2];
float a21[3], b21[3], b1a1[3];
float sys[2][2], c[2], det;
int i;
// Initialize
//
// Initialize
//
u = v = 0.0;
// Determine line vectors.
//
// Determine line vectors.
//
for (i=0; i<3; i++)
{
a21[i] = a2[i] - a1[i];
b21[i] = b2[i] - b1[i];
b1a1[i] = b1[i] - a1[i];
}
// Compute the system (least squares) matrix.
A[0] = row1;
A[1] = row2;
row1[0] = vtkMath::Dot ( a21, a21 );
row1[1] = -vtkMath::Dot ( a21, b21 );
row2[0] = row1[1];
row2[1] = vtkMath::Dot ( b21, b21 );
// Compute the least squares system constant term.
//
// Compute the system (least squares) matrix.
//
sys[0][0] = vtkMath::Dot ( a21, a21 );
sys[0][1] = -vtkMath::Dot ( a21, b21 );
sys[1][0] = sys[0][1];
sys[1][1] = vtkMath::Dot ( b21, b21 );
//
// Compute the least squares system constant term.
//
c[0] = vtkMath::Dot ( a21, b1a1 );
c[1] = -vtkMath::Dot ( b21, b1a1 );
// Solve the system of equations
if ( vtkMath::SolveLinearSystem(A,c,2) == 0 )
//
// Solve the system of equations
//
if ( (det=vtkMath::Determinant2x2(sys[0],sys[1])) <= VTK_TOL )
{
return ON_LINE;
}
else
{
u = c[0];
v = c[1];
u = vtkMath::Determinant2x2(c,sys[1]) / det;
v = vtkMath::Determinant2x2(sys[0],c) / det;
}
// Check parametric coordinates for intersection.
//
// Check parametric coordinates for intersection.
//
if ( (0.0 <= u) && (u <= 1.0) && (0.0 <= v) && (v <= 1.0) )
{
return INTERSECTION;
......
......@@ -274,7 +274,7 @@ void vtkLookupTable::GetTableValue (int indx, float rgba[4])
void vtkLookupTable::PrintSelf(ostream& os, vtkIndent indent)
{
vtkReferenceCount::PrintSelf(os,indent);
vtkObject::PrintSelf(os,indent);
os << indent << "Build Time: " <<this->BuildTime.GetMTime() << "\n";
os << indent << "Hue Range: (" << this->HueRange[0] << ", "
......@@ -287,6 +287,4 @@ void vtkLookupTable::PrintSelf(ostream& os, vtkIndent indent)
<< this->TableRange[1] << ")\n";
os << indent << "Value Range: (" << this->ValueRange[0] << ", "
<< this->ValueRange[1] << ")\n";
os << indent << "Alpha Range: (" << this->AlphaRange[0] << ", "
<< this->AlphaRange[1] << ")\n";
}
......@@ -648,8 +648,7 @@ void vtkMultiThreader::TerminateThread( int ThreadID )
// Print method for the multithreader
void vtkMultiThreader::PrintSelf(ostream& os, vtkIndent indent)
{
this->vtkObject::PrintSelf(os,indent);
os << indent << "Thread Count: " << this->NumberOfThreads << "\n";
os << indent << "Global Maximum Number Of Threads: " <<
vtkMultiThreaderGlobalMaximumNumberOfThreads << endl;
......
......@@ -38,10 +38,6 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
// .NAME vtkMutexLock - mutual exclusion locking class
// .SECTION Description
// vtkMutexLock allows the locking of variables which are accessed
// through different threads
#ifndef __vtkMutexVariable_h
#define __vtkMutexVariable_h
......
......@@ -80,7 +80,7 @@ vtkPointLocator::vtkPointLocator()
this->Points = NULL;
this->Divisions[0] = this->Divisions[1] = this->Divisions[2] = 50;
this->NumberOfPointsPerBucket = 3;
this->NumberOfPointsPerBucket = 10;
this->HashTable = NULL;
this->NumberOfBuckets = 0;
this->H[0] = this->H[1] = this->H[2] = 0.0;
......@@ -319,6 +319,7 @@ void vtkPointLocator::BuildLocator()
int idx;
vtkIdList *bucket;
int numPts;
int numPtsPerBucket = this->NumberOfPointsPerBucket;
float *x;
typedef vtkIdList *vtkIdListPtr;
......@@ -351,7 +352,7 @@ void vtkPointLocator::BuildLocator()
if ( this->Automatic )
{
level = (float) numPts / this->NumberOfPointsPerBucket;
level = (float) numPts / numPtsPerBucket;
level = ceil( pow((double)level,(double)0.33333333) );
for (i=0; i<3; i++) ndivs[i] = (int) level;
}
......@@ -393,8 +394,7 @@ void vtkPointLocator::BuildLocator()
if ( ! bucket )
{
bucket = vtkIdList::New();
bucket->Allocate(this->NumberOfPointsPerBucket/2,
this->NumberOfPointsPerBucket/3);
bucket->Allocate(numPtsPerBucket/2,numPtsPerBucket/3);
this->HashTable[idx] = bucket;
}
bucket->InsertNextId(i);
......@@ -411,22 +411,22 @@ void vtkPointLocator::GetBucketNeighbors(int ijk[3], int ndivs[3], int level)
{
int i, j, k, min, max, minLevel[3], maxLevel[3];
int nei[3];
//
// Initialize
//
//
// Initialize
//
Buckets->Reset();
//
// If at this bucket, just place into list
//
//
// If at this bucket, just place into list
//
if ( level == 0 )
{
Buckets->InsertNextPoint(ijk);
return;
}
//
// Create permutations of the ijk indices that are at the level
// required. If these are legal buckets, add to list for searching.
//
//
// Create permutations of the ijk indices that are at the level
// required. If these are legal buckets, add to list for searching.