Commit 32bf6e41 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH: Fixed minor bugs.

parent 941979fc
......@@ -52,13 +52,16 @@ class vtkTransform : public vtkObject
void RotateWXYZ ( float angle, float x, float y, float z);
void Scale ( float x, float y, float z);
void Translate ( float x, float y, float z);
void Transpose ();
void Transpose();
void GetTranspose (vtkMatrix4x4& transpose);
void Inverse ();
void GetInverse ( vtkMatrix4x4& inverse);
void Inverse();
void GetInverse(vtkMatrix4x4& inverse);
float *GetOrientation();
void GetPosition (float & x,float & y,float & z);
void GetScale ( float & x, float & y, float & z);
void GetOrientation(float& rx, float& ry, float& rz);
float *GetPosition();
void GetPosition (float& x, float& y, float& z);
float *GetScale();
void GetScale (float& sx, float& sy, float& sz);
void SetMatrix(vtkMatrix4x4& m);
vtkMatrix4x4& GetMatrix();
void GetMatrix (vtkMatrix4x4& m);
......@@ -75,8 +78,8 @@ class vtkTransform : public vtkObject
private:
int PreMultiplyFlag;
int StackSize;
vtkMatrix4x4 ** Stack;
vtkMatrix4x4 ** StackBottom;
vtkMatrix4x4 **Stack;
vtkMatrix4x4 **StackBottom;
float Point[4];
float Orientation[3];
......
......@@ -92,6 +92,7 @@ void vtkContourFilter::Execute()
vtkFloatScalars *newScalars;
vtkCellArray *newVerts, *newLines, *newPolys;
vtkFloatPoints *newPts;
cellScalars.ReferenceCountingOff();
vtkDebugMacro(<< "Executing contour filter");
//
......
......@@ -40,19 +40,6 @@ vtkImplicitModeller::vtkImplicitModeller()
this->CapValue = LARGE_FLOAT;
}
void vtkImplicitModeller::PrintSelf(ostream& os, vtkIndent indent)
{
vtkDataSetToStructuredPointsFilter::PrintSelf(os,indent);
os << indent << "Maximum Distance: " << this->MaximumDistance << "\n";
os << indent << "Sample Dimensions: (" << this->SampleDimensions[0] << ", "
<< this->SampleDimensions[1] << ", "
<< this->SampleDimensions[2] << ")\n";
os << indent << "ModelBounds: \n";
os << indent << " Xmin,Xmax: (" << this->ModelBounds[0] << ", " << this->ModelBounds[1] << ")\n";
os << indent << " Ymin,Ymax: (" << this->ModelBounds[2] << ", " << this->ModelBounds[3] << ")\n";
os << indent << " Zmin,Zmax: (" << this->ModelBounds[4] << ", " << this->ModelBounds[5] << ")\n";
}
// Description:
// Specify the position in space to perform the sampling.
void vtkImplicitModeller::SetModelBounds(float *bounds)
......@@ -310,4 +297,19 @@ void vtkImplicitModeller::Cap(vtkFloatScalars *s)
}
void vtkImplicitModeller::PrintSelf(ostream& os, vtkIndent indent)
{
vtkDataSetToStructuredPointsFilter::PrintSelf(os,indent);
os << indent << "Maximum Distance: " << this->MaximumDistance << "\n";
os << indent << "Sample Dimensions: (" << this->SampleDimensions[0] << ", "
<< this->SampleDimensions[1] << ", "
<< this->SampleDimensions[2] << ")\n";
os << indent << "ModelBounds: \n";
os << indent << " Xmin,Xmax: (" << this->ModelBounds[0] << ", " << this->ModelBounds[1] << ")\n";
os << indent << " Ymin,Ymax: (" << this->ModelBounds[2] << ", " << this->ModelBounds[3] << ")\n";
os << indent << " Zmin,Zmax: (" << this->ModelBounds[4] << ", " << this->ModelBounds[5] << ")\n";
os << indent << "Capping: " << (this->Capping ? "On\n" : "Off\n");
os << indent << "Cap Value: " << this->CapValue << "\n";
}
......@@ -21,7 +21,6 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
//
// eliminate constructor / destructor calls
//
static vtkLine line;
static vtkMath math;
......@@ -346,6 +345,7 @@ int vtkPolyLine::EvaluatePosition(float x[3], float closestPoint[3],
float pc[3], dist2;
int ignoreId, i, return_status, status;
float lineWeights[2];
static vtkLine line;
pcoords[1] = pcoords[2] = 0.0;
......@@ -414,6 +414,7 @@ void vtkPolyLine::Contour(float value, vtkFloatScalars *cellScalars,
{
int i;
vtkFloatScalars lineScalars(2);
static vtkLine line;
for ( i=0; i<this->Points.GetNumberOfPoints()-1; i++)
{
......@@ -435,6 +436,7 @@ void vtkPolyLine::Contour(float value, vtkFloatScalars *cellScalars,
int vtkPolyLine::IntersectWithLine(float p1[3], float p2[3],float tol,float& t,
float x[3], float pcoords[3], int& subId)
{
static vtkLine line;
for (subId=0; subId<this->Points.GetNumberOfPoints()-1; subId++)
{
line.Points.SetPoint(0,this->Points.GetPoint(subId));
......
......@@ -18,7 +18,6 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "CellArr.hh"
#include "Vertex.hh"
static vtkVertex vertex;
static vtkMath math;
// Description:
......@@ -116,6 +115,8 @@ int vtkPolyVertex::IntersectWithLine(float p1[3], float p2[3],
float tol, float& t, float x[3],
float pcoords[3], int& subId)
{
static vtkVertex vertex;
for (subId=0; subId<this->Points.GetNumberOfPoints(); subId++)
{
vertex.Points.SetPoint(0,this->Points.GetPoint(subId));
......
......@@ -365,6 +365,17 @@ void vtkTransform::GetInverse ( vtkMatrix4x4& inverse)
// Description:
// Get the x, y, z orientation angles from transformation matrix.
void vtkTransform::GetOrientation(float& rx, float& ry, float &rz)
{
float *orientation=this->GetOrientation();
rx = orientation[0];
ry = orientation[1];
rz = orientation[2];
}
// Description:
// Get the x, y, z orientation angles from transformation matrix as an array
// of three floating point values.
float *vtkTransform::GetOrientation ()
{
#define AXIS_EPSILON .01
......@@ -484,12 +495,38 @@ void vtkTransform::GetPosition (float & x,float & y,float & z)
z = (**this->Stack).Element[2][3];
}
// Description:
// Return the position from the current transformation matrix as an array
// of three floating point numbers.
float *vtkTransform::GetPosition()
{
static float pos[3];
pos[0] = (**this->Stack).Element[0][3];
pos[1] = (**this->Stack).Element[1][3];
pos[2] = (**this->Stack).Element[2][3];
return pos;
}
// Description:
// Return the x, y, z scale factors of the current transformation matrix.
void vtkTransform::GetScale ( float & x, float & y, float & z)
void vtkTransform::GetScale (float& x, float& y, float& z)
{
float *scale=this->GetScale();
x = scale[0];
y = scale[1];
z = scale[2];
}
// Description:
// Return the scale factors of the current transformation matrix as an
// array of three float numbers.
float *vtkTransform::GetScale()
{
int i;
float scale[3];
static float scale[3];
vtkMatrix4x4 temp;
// copy the matrix into local storage
......@@ -504,9 +541,8 @@ void vtkTransform::GetScale ( float & x, float & y, float & z)
temp.Element[i][1] * temp.Element[i][1] +
temp.Element[i][2] * temp.Element[i][2]);
}
x = scale[0];
y = scale[1];
z = scale[2];
return scale;
}
// Description:
......
......@@ -18,11 +18,6 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "CellArr.hh"
#include "Line.hh"
//
// Static minimizes constructor / destructor calls
//
static vtkTriangle tri;
// Description:
// Deep copy of cell.
vtkTriangleStrip::vtkTriangleStrip(const vtkTriangleStrip& ts)
......@@ -39,6 +34,7 @@ int vtkTriangleStrip::EvaluatePosition(float x[3], float closestPoint[3],
int ignoreId, i, return_status, status;
float tempWeights[3], activeWeights[3];
float closest[3];
static vtkTriangle tri;
pcoords[2] = 0.0;
......@@ -105,6 +101,7 @@ void vtkTriangleStrip::Contour(float value, vtkFloatScalars *cellScalars,
{
int i;
vtkFloatScalars triScalars(3);
static vtkTriangle tri;
for ( i=0; i<this->Points.GetNumberOfPoints()-2; i++)
{
......@@ -158,6 +155,8 @@ int vtkTriangleStrip::IntersectWithLine(float p1[3], float p2[3], float tol,
float& t, float x[3], float pcoords[3],
int& subId)
{
static vtkTriangle tri;
for (subId=0; subId<this->Points.GetNumberOfPoints()-2; subId++)
{
tri.Points.SetPoint(0,this->Points.GetPoint(subId));
......
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