Commit b6617c31 authored by Ken Martin's avatar Ken Martin

some double fixes

parent eb025f36
......@@ -19,7 +19,7 @@
#include "vtkPropCollection.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkActor2D, "1.36");
vtkCxxRevisionMacro(vtkActor2D, "1.37");
vtkStandardNewMacro(vtkActor2D);
vtkCxxSetObjectMacro(vtkActor2D,Property, vtkProperty2D);
......@@ -195,30 +195,30 @@ void vtkActor2D::SetDisplayPosition(int XPos, int YPos)
this->PositionCoordinate->SetValue((float)XPos,(float)YPos,0.0);
}
void vtkActor2D::SetWidth(float w)
void vtkActor2D::SetWidth(double w)
{
float *pos;
double *pos;
pos = this->Position2Coordinate->GetValue();
this->Position2Coordinate->SetCoordinateSystemToNormalizedViewport();
this->Position2Coordinate->SetValue(w,pos[1]);
}
void vtkActor2D::SetHeight(float w)
void vtkActor2D::SetHeight(double w)
{
float *pos;
double *pos;
pos = this->Position2Coordinate->GetValue();
this->Position2Coordinate->SetCoordinateSystemToNormalizedViewport();
this->Position2Coordinate->SetValue(pos[0],w);
}
float vtkActor2D::GetWidth()
double vtkActor2D::GetWidth()
{
return this->Position2Coordinate->GetValue()[0];
}
float vtkActor2D::GetHeight()
double vtkActor2D::GetHeight()
{
return this->Position2Coordinate->GetValue()[1];
}
......
......@@ -90,10 +90,10 @@ public:
// Set/Get the height and width of the Actor2D. The value is expressed
// as a fraction of the viewport. This really is just another way of
// setting the Position2 instance variable.
void SetWidth(float w);
float GetWidth();
void SetHeight(float h);
float GetHeight();
void SetWidth(double w);
double GetWidth();
void SetHeight(double h);
double GetHeight();
// Description:
// Return this objects MTime.
......
This diff is collapsed.
......@@ -89,13 +89,9 @@ public:
// Description:
// Set/get the value of this coordinate. This can be thought of as
// the position of this coordinate in its coordinate system.
vtkSetVector3Macro(Value,float);
vtkGetVector3Macro(Value,float);
void SetValue(float a, float b) { this->SetValue(a,b,0.0);}
void SetValue(double a, double b) {
this->SetValue((float)a,(float)b); }
void SetValue(double *a) {
this->SetValue((float)a[0],(float)a[1],(float)a[2]); }
vtkSetVector3Macro(Value,double);
vtkGetVector3Macro(Value,double);
void SetValue(double a, double b) { this->SetValue(a,b,0.0);}
// Description:
// If this coordinate is relative to another coordinate,
......@@ -113,20 +109,20 @@ public:
// Description:
// Return the computed value in a specified coordinate system.
float *GetComputedWorldValue(vtkViewport *);
double *GetComputedWorldValue(vtkViewport *);
int *GetComputedViewportValue(vtkViewport *);
int *GetComputedDisplayValue(vtkViewport *);
int *GetComputedLocalDisplayValue(vtkViewport *);
float *GetComputedFloatViewportValue(vtkViewport *);
float *GetComputedFloatDisplayValue(vtkViewport *);
double *GetComputedDoubleViewportValue(vtkViewport *);
double *GetComputedDoubleDisplayValue(vtkViewport *);
// Description:
// GetComputedValue() will return either World, Viewport or
// Display based on what has been set as the coordinate system.
// This is good for objects like vtkLineSource, where the
// user might want to use them as World or Viewport coordinates
float *GetComputedValue(vtkViewport *);
double *GetComputedValue(vtkViewport *);
// Description:
// GetComputedUserDefinedValue() is to be used only when
......@@ -134,25 +130,25 @@ public:
// must subclass vtkCoordinate and override this function,
// when set as the TransformCoordinate in 2D-Mappers, the user
// can customize display of 2D polygons
virtual float *GetComputedUserDefinedValue(vtkViewport *)
virtual double *GetComputedUserDefinedValue(vtkViewport *)
{ return this->Value; }
protected:
vtkCoordinate();
~vtkCoordinate();
float Value[3];
double Value[3];
int CoordinateSystem;
vtkCoordinate *ReferenceCoordinate;
vtkViewport *Viewport;
float ComputedWorldValue[3];
double ComputedWorldValue[3];
int ComputedDisplayValue[2];
int ComputedViewportValue[2];
int Computing;
float ComputedFloatDisplayValue[2];
float ComputedFloatViewportValue[2];
float ComputedUserDefinedValue[3];
double ComputedDoubleDisplayValue[2];
double ComputedDoubleViewportValue[2];
double ComputedUserDefinedValue[3];
private:
vtkCoordinate(const vtkCoordinate&); // Not implemented.
......
......@@ -25,6 +25,7 @@
#include "vtkLargeInteger.h"
#include "vtkLine.h"
#include "vtkLongArray.h"
#include "vtkMath.h"
#include "vtkObjectFactory.h"
#include "vtkPixel.h"
#include "vtkPointData.h"
......@@ -37,7 +38,7 @@
#include "vtkVertex.h"
#include "vtkVoxel.h"
vtkCxxRevisionMacro(vtkImageData, "1.146");
vtkCxxRevisionMacro(vtkImageData, "1.147");
vtkStandardNewMacro(vtkImageData);
//----------------------------------------------------------------------------
......@@ -499,27 +500,35 @@ void vtkImageData::GetCellBounds(vtkIdType cellId, double bounds[6])
}
bounds[0] = bounds[2] = bounds[4] = VTK_DOUBLE_MAX;
bounds[1] = bounds[3] = bounds[5] = -VTK_DOUBLE_MAX;
// Extract point coordinates
for (loc[2]=kMin; loc[2]<=kMax; loc[2]++)
{
x[2] = origin[2] + (loc[2]+this->Extent[4]) * spacing[2];
bounds[4] = (x[2] < bounds[4] ? x[2] : bounds[4]);
bounds[5] = (x[2] > bounds[5] ? x[2] : bounds[5]);
}
for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
// carefully compute the bounds
if (kMax >= kMin && jMax >= jMin && iMax >= iMin)
{
x[1] = origin[1] + (loc[1]+this->Extent[2]) * spacing[1];
bounds[2] = (x[1] < bounds[2] ? x[1] : bounds[2]);
bounds[3] = (x[1] > bounds[3] ? x[1] : bounds[3]);
bounds[0] = bounds[2] = bounds[4] = VTK_DOUBLE_MAX;
bounds[1] = bounds[3] = bounds[5] = -VTK_DOUBLE_MAX;
// Extract point coordinates
for (loc[2]=kMin; loc[2]<=kMax; loc[2]++)
{
x[2] = origin[2] + (loc[2]+this->Extent[4]) * spacing[2];
bounds[4] = (x[2] < bounds[4] ? x[2] : bounds[4]);
bounds[5] = (x[2] > bounds[5] ? x[2] : bounds[5]);
}
for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
{
x[1] = origin[1] + (loc[1]+this->Extent[2]) * spacing[1];
bounds[2] = (x[1] < bounds[2] ? x[1] : bounds[2]);
bounds[3] = (x[1] > bounds[3] ? x[1] : bounds[3]);
}
for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
{
x[0] = origin[0] + (loc[0]+this->Extent[0]) * spacing[0];
bounds[0] = (x[0] < bounds[0] ? x[0] : bounds[0]);
bounds[1] = (x[0] > bounds[1] ? x[0] : bounds[1]);
}
}
for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
else
{
x[0] = origin[0] + (loc[0]+this->Extent[0]) * spacing[0];
bounds[0] = (x[0] < bounds[0] ? x[0] : bounds[0]);
bounds[1] = (x[0] > bounds[1] ? x[0] : bounds[1]);
vtkMath::UninitializeBounds(bounds);
}
}
......@@ -819,8 +828,7 @@ void vtkImageData::ComputeBounds()
this->Extent[2] > this->Extent[3] ||
this->Extent[4] > this->Extent[5] )
{
this->Bounds[0] = this->Bounds[2] = this->Bounds[4] = VTK_DOUBLE_MAX;
this->Bounds[1] = this->Bounds[3] = this->Bounds[5] = -VTK_DOUBLE_MAX;
vtkMath::UninitializeBounds(this->Bounds);
return;
}
this->Bounds[0] = origin[0] + (this->Extent[0] * spacing[0]);
......
......@@ -31,7 +31,7 @@
#include "vtkTriangleStrip.h"
#include "vtkVertex.h"
vtkCxxRevisionMacro(vtkPolyData, "1.156");
vtkCxxRevisionMacro(vtkPolyData, "1.157");
vtkStandardNewMacro(vtkPolyData);
//----------------------------------------------------------------------------
......@@ -502,38 +502,31 @@ void vtkPolyData::GetCellBounds(vtkIdType cellId, double bounds[6])
return;
}
bounds[0] = bounds[2] = bounds[4] = VTK_DOUBLE_MAX;
bounds[1] = bounds[3] = bounds[5] = -VTK_DOUBLE_MAX;
for (i=0; i < numPts; i++)
// carefully compute the bounds
if (numPts)
{
this->Points->GetPoint( pts[i], x );
if (x[0] < bounds[0])
{
bounds[0] = x[0];
}
if (x[0] > bounds[1])
this->Points->GetPoint( pts[0], x );
bounds[0] = x[0];
bounds[2] = x[1];
bounds[4] = x[2];
bounds[1] = x[0];
bounds[3] = x[1];
bounds[5] = x[2];
for (i=1; i < numPts; i++)
{
bounds[1] = x[0];
}
if (x[1] < bounds[2])
{
bounds[2] = x[1];
}
if (x[1] > bounds[3])
{
bounds[3] = x[1];
}
if (x[2] < bounds[4])
{
bounds[4] = x[2];
}
if (x[2] > bounds[5])
{
bounds[5] = x[2];
this->Points->GetPoint( pts[i], x );
bounds[0] = (x[0] < bounds[0] ? x[0] : bounds[0]);
bounds[1] = (x[0] > bounds[1] ? x[0] : bounds[1]);
bounds[2] = (x[1] < bounds[2] ? x[1] : bounds[2]);
bounds[3] = (x[1] > bounds[3] ? x[1] : bounds[3]);
bounds[4] = (x[2] < bounds[4] ? x[2] : bounds[4]);
bounds[5] = (x[2] > bounds[5] ? x[2] : bounds[5]);
}
}
else
{
vtkMath::UninitializeBounds(bounds);
}
}
......@@ -555,9 +548,6 @@ void vtkPolyData::ComputeBounds()
vtkIdType npts = 0;
double x[3];
this->Bounds[0] = this->Bounds[2] = this->Bounds[4] = VTK_DOUBLE_MAX;
this->Bounds[1] = this->Bounds[3] = this->Bounds[5] = -VTK_DOUBLE_MAX;
vtkCellArray *cella[4];
cella[0] = this->GetVerts();
......@@ -565,6 +555,11 @@ void vtkPolyData::ComputeBounds()
cella[2] = this->GetPolys();
cella[3] = this->GetStrips();
// carefully compute the bounds
int doneOne = 0;
this->Bounds[0] = this->Bounds[2] = this->Bounds[4] = VTK_DOUBLE_MAX;
this->Bounds[1] = this->Bounds[3] = this->Bounds[5] = -VTK_DOUBLE_MAX;
// Iterate over cells's points
for (t = 0; t < 4; t++)
{
......@@ -573,35 +568,20 @@ void vtkPolyData::ComputeBounds()
for (i = 0; i < npts; i++)
{
this->Points->GetPoint( pts[i], x );
if (x[0] < this->Bounds[0])
{
this->Bounds[0] = x[0];
}
if (x[0] > this->Bounds[1])
{
this->Bounds[1] = x[0];
}
if (x[1] < this->Bounds[2])
{
this->Bounds[2] = x[1];
}
if (x[1] > this->Bounds[3])
{
this->Bounds[3] = x[1];
}
if (x[2] < this->Bounds[4])
{
this->Bounds[4] = x[2];
}
if (x[2] > this->Bounds[5])
{
this->Bounds[5] = x[2];
}
this->Bounds[0] = (x[0] < this->Bounds[0] ? x[0] : this->Bounds[0]);
this->Bounds[1] = (x[0] > this->Bounds[1] ? x[0] : this->Bounds[1]);
this->Bounds[2] = (x[1] < this->Bounds[2] ? x[1] : this->Bounds[2]);
this->Bounds[3] = (x[1] > this->Bounds[3] ? x[1] : this->Bounds[3]);
this->Bounds[4] = (x[2] < this->Bounds[4] ? x[2] : this->Bounds[4]);
this->Bounds[5] = (x[2] > this->Bounds[5] ? x[2] : this->Bounds[5]);
doneOne = 1;
}
}
}
if (!doneOne)
{
vtkMath::UninitializeBounds(this->Bounds);
}
this->ComputeTime.Modified();
}
}
......
......@@ -19,6 +19,7 @@
#include "vtkDoubleArray.h"
#include "vtkGenericCell.h"
#include "vtkLine.h"
#include "vtkMath.h"
#include "vtkObjectFactory.h"
#include "vtkPixel.h"
#include "vtkPointData.h"
......@@ -27,7 +28,7 @@
#include "vtkVertex.h"
#include "vtkVoxel.h"
vtkCxxRevisionMacro(vtkRectilinearGrid, "1.61");
vtkCxxRevisionMacro(vtkRectilinearGrid, "1.62");
vtkStandardNewMacro(vtkRectilinearGrid);
vtkCxxSetObjectMacro(vtkRectilinearGrid,XCoordinates,vtkDataArray);
......@@ -324,8 +325,6 @@ void vtkRectilinearGrid::GetCellBounds(vtkIdType cellId, double bounds[6])
double x[3];
iMin = iMax = jMin = jMax = kMin = kMax = 0;
bounds[0] = bounds[2] = bounds[4] = VTK_DOUBLE_MAX;
bounds[1] = bounds[3] = bounds[5] = -VTK_DOUBLE_MAX;
switch (this->DataDescription)
{
......@@ -381,24 +380,35 @@ void vtkRectilinearGrid::GetCellBounds(vtkIdType cellId, double bounds[6])
break;
}
// Extract point coordinates
for (loc[2]=kMin; loc[2]<=kMax; loc[2]++)
// carefully compute the bounds
if (kMax >= kMin && jMax >= jMin && iMax >= iMin)
{
x[2] = this->ZCoordinates->GetComponent(loc[2], 0);
bounds[4] = (x[2] < bounds[4] ? x[2] : bounds[4]);
bounds[5] = (x[2] > bounds[5] ? x[2] : bounds[5]);
}
for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
{
x[1] = this->YCoordinates->GetComponent(loc[1], 0);
bounds[2] = (x[1] < bounds[2] ? x[1] : bounds[2]);
bounds[3] = (x[1] > bounds[3] ? x[1] : bounds[3]);
bounds[0] = bounds[2] = bounds[4] = VTK_DOUBLE_MAX;
bounds[1] = bounds[3] = bounds[5] = -VTK_DOUBLE_MAX;
// Extract point coordinates
for (loc[2]=kMin; loc[2]<=kMax; loc[2]++)
{
x[2] = this->ZCoordinates->GetComponent(loc[2], 0);
bounds[4] = (x[2] < bounds[4] ? x[2] : bounds[4]);
bounds[5] = (x[2] > bounds[5] ? x[2] : bounds[5]);
}
for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
{
x[1] = this->YCoordinates->GetComponent(loc[1], 0);
bounds[2] = (x[1] < bounds[2] ? x[1] : bounds[2]);
bounds[3] = (x[1] > bounds[3] ? x[1] : bounds[3]);
}
for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
{
x[0] = this->XCoordinates->GetComponent(loc[0], 0);
bounds[0] = (x[0] < bounds[0] ? x[0] : bounds[0]);
bounds[1] = (x[0] > bounds[1] ? x[0] : bounds[1]);
}
}
for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
else
{
x[0] = this->XCoordinates->GetComponent(loc[0], 0);
bounds[0] = (x[0] < bounds[0] ? x[0] : bounds[0]);
bounds[1] = (x[0] > bounds[1] ? x[0] : bounds[1]);
vtkMath::UninitializeBounds(bounds);
}
}
......@@ -674,8 +684,7 @@ void vtkRectilinearGrid::ComputeBounds()
if (this->XCoordinates == NULL || this->YCoordinates == NULL ||
this->ZCoordinates == NULL)
{
this->Bounds[0] = this->Bounds[2] = this->Bounds[4] = VTK_DOUBLE_MAX;
this->Bounds[1] = this->Bounds[3] = this->Bounds[5] = -VTK_DOUBLE_MAX;
vtkMath::UninitializeBounds(this->Bounds);
return;
}
......@@ -683,8 +692,7 @@ void vtkRectilinearGrid::ComputeBounds()
this->YCoordinates->GetNumberOfTuples() == 0 ||
this->ZCoordinates->GetNumberOfTuples() == 0 )
{
this->Bounds[0] = this->Bounds[2] = this->Bounds[4] = VTK_DOUBLE_MAX;
this->Bounds[1] = this->Bounds[3] = this->Bounds[5] = -VTK_DOUBLE_MAX;
vtkMath::UninitializeBounds(this->Bounds);
return;
}
......
......@@ -507,12 +507,12 @@ virtual vtkCoordinate *Get##name##Coordinate () \
vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " #name "Coordinate address " << this->name##Coordinate ); \
return this->name##Coordinate; \
} \
virtual void Set##name(float x[3]) {this->Set##name(x[0],x[1],x[2]);}; \
virtual void Set##name(float x, float y, float z) \
virtual void Set##name(double x[3]) {this->Set##name(x[0],x[1],x[2]);}; \
virtual void Set##name(double x, double y, double z) \
{ \
this->name##Coordinate->SetValue(x,y,z); \
} \
virtual float *Get##name() \
virtual double *Get##name() \
{ \
return this->name##Coordinate->GetValue(); \
}
......@@ -523,12 +523,12 @@ virtual vtkCoordinate *Get##name##Coordinate () \
vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " #name "Coordinate address " << this->name##Coordinate ); \
return this->name##Coordinate; \
} \
virtual void Set##name(float x[2]) {this->Set##name(x[0],x[1]);}; \
virtual void Set##name(float x, float y) \
virtual void Set##name(double x[2]) {this->Set##name(x[0],x[1]);}; \
virtual void Set##name(double x, double y) \
{ \
this->name##Coordinate->SetValue(x,y); \
} \
virtual float *Get##name() \
virtual double *Get##name() \
{ \
return this->name##Coordinate->GetValue(); \
}
......
......@@ -20,13 +20,14 @@
#include "vtkGenericCell.h"
#include "vtkHexahedron.h"
#include "vtkLine.h"
#include "vtkMath.h"
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkStructuredVisibilityConstraint.h"
#include "vtkQuad.h"
#include "vtkVertex.h"
vtkCxxRevisionMacro(vtkStructuredGrid, "1.98");
vtkCxxRevisionMacro(vtkStructuredGrid, "1.99");
vtkStandardNewMacro(vtkStructuredGrid);
vtkCxxSetObjectMacro(vtkStructuredGrid,
......@@ -421,16 +422,15 @@ void vtkStructuredGrid::GetCellBounds(vtkIdType cellId, double bounds[6])
int offset2 = 0;
double x[3];
bounds[0] = bounds[2] = bounds[4] = VTK_DOUBLE_MAX;
bounds[1] = bounds[3] = bounds[5] = -VTK_DOUBLE_MAX;
// Make sure data is defined
if ( ! this->Points )
{
vtkErrorMacro (<<"No data");
return;
}
vtkMath::UninitializeBounds(bounds);
// Update dimensions
this->GetDimensions();
......
......@@ -24,6 +24,7 @@
#include "vtkImageData.h"
#include "vtkLargeInteger.h"
#include "vtkLine.h"
#include "vtkMath.h"
#include "vtkObjectFactory.h"
#include "vtkPixel.h"
#include "vtkPointData.h"
......@@ -32,7 +33,7 @@
#include "vtkVertex.h"
#include "vtkVoxel.h"
vtkCxxRevisionMacro(vtkUniformGrid, "1.1");
vtkCxxRevisionMacro(vtkUniformGrid, "1.2");
vtkStandardNewMacro(vtkUniformGrid);
vtkCxxSetObjectMacro(vtkUniformGrid,
......@@ -424,27 +425,35 @@ void vtkUniformGrid::GetCellBounds(vtkIdType cellId, double bounds[6])
}
bounds[0] = bounds[2] = bounds[4] = VTK_DOUBLE_MAX;
bounds[1] = bounds[3] = bounds[5] = -VTK_DOUBLE_MAX;
// Extract point coordinates
for (loc[2]=kMin; loc[2]<=kMax; loc[2]++)
{
x[2] = origin[2] + (loc[2]+this->Extent[4]) * spacing[2];
bounds[4] = (x[2] < bounds[4] ? x[2] : bounds[4]);
bounds[5] = (x[2] > bounds[5] ? x[2] : bounds[5]);
}
for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
// carefully compute the bounds
if (kMax >= kMin && jMax >= jMin && iMax >= iMin)
{
x[1] = origin[1] + (loc[1]+this->Extent[2]) * spacing[1];
bounds[2] = (x[1] < bounds[2] ? x[1] : bounds[2]);
bounds[3] = (x[1] > bounds[3] ? x[1] : bounds[3]);
bounds[0] = bounds[2] = bounds[4] = VTK_DOUBLE_MAX;
bounds[1] = bounds[3] = bounds[5] = -VTK_DOUBLE_MAX;
// Extract point coordinates
for (loc[2]=kMin; loc[2]<=kMax; loc[2]++)
{
x[2] = origin[2] + (loc[2]+this->Extent[4]) * spacing[2];
bounds[4] = (x[2] < bounds[4] ? x[2] : bounds[4]);
bounds[5] = (x[2] > bounds[5] ? x[2] : bounds[5]);
}
for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
{
x[1] = origin[1] + (loc[1]+this->Extent[2]) * spacing[1];
bounds[2] = (x[1] < bounds[2] ? x[1] : bounds[2]);
bounds[3] = (x[1] > bounds[3] ? x[1] : bounds[3]);
}
for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
{
x[0] = origin[0] + (loc[0]+this->Extent[0]) * spacing[0];
bounds[0] = (x[0] < bounds[0] ? x[0] : bounds[0]);
bounds[1] = (x[0] > bounds[1] ? x[0] : bounds[1]);
}
}
for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
else
{
x[0] = origin[0] + (loc[0]+this->Extent[0]) * spacing[0];
bounds[0] = (x[0] < bounds[0] ? x[0] : bounds[0]);
bounds[1] = (x[0] > bounds[1] ? x[0] : bounds[1]);
vtkMath::UninitializeBounds(bounds);
}
}
......@@ -771,8 +780,7 @@ void vtkUniformGrid::ComputeBounds()
this->Extent[2] > this->Extent[3] ||
this->Extent[4] > this->Extent[5] )
{
this->Bounds[0] = this->Bounds[2] = this->Bounds[4] = VTK_DOUBLE_MAX;
this->Bounds[1] = this->Bounds[3] = this->Bounds[5] = -VTK_DOUBLE_MAX;
vtkMath::UninitializeBounds(this->Bounds);
return;
}
this->Bounds[0] = origin[0] + (this->Extent[0] * spacing[0]);
......
......@@ -44,7 +44,7 @@
#include "vtkVoxel.h"
#include "vtkWedge.h"
vtkCxxRevisionMacro(vtkUnstructuredGrid, "1.115");
vtkCxxRevisionMacro(vtkUnstructuredGrid, "1.116");
vtkStandardNewMacro(vtkUnstructuredGrid);
vtkUnstructuredGrid::vtkUnstructuredGrid ()
......@@ -373,20 +373,32 @@ void vtkUnstructuredGrid::GetCellBounds(vtkIdType cellId, double bounds[6])
loc = this->Locations->GetValue(cellId);
this->Connectivity->GetCell(loc,numPts,pts);
bounds[0] = bounds[2] = bounds[4] = VTK_DOUBLE_MAX;
bounds[1] = bounds[3] = bounds[5] = -VTK_DOUBLE_MAX;
for (i=0; i < numPts; i++)
// carefully compute the bounds
if (numPts)
{
this->Points->GetPoint( pts[0], x );
bounds[0] = x[0];
bounds[2] = x[1];
bounds[4] = x[2];
bounds[1] = x[0];
bounds[3] = x[1];
bounds[5] = x[2];
for (i=1; i < numPts; i++)
{
this->Points->GetPoint( pts[i], x );
bounds[0] = (x[0] < bounds[0] ? x[0] : bounds[0]);
bounds[1] = (x[0] > bounds[1] ? x[0] : bounds[1]);
bounds[2] = (x[1] < bounds[2] ? x[1] : bounds[2]);
bounds[3] = (x[1] > bounds[3] ? x[1] : bounds[3]);
bounds[4] = (x[2] < bounds[4] ? x[2] : bounds[4]);
bounds[5] = (x[2] > bounds[5] ? x[2] : bounds[5]);
}
}
else
{
this->Points->GetPoint( pts[i], x );
bounds[0] = (x[0] < bounds[0] ? x[0] : bounds[0]);
bounds[1] = (x[0] > bounds[1] ? x[0] : bounds[1]);
bounds[2] = (x[1] < bounds[2] ? x[1] : bounds[2]);
bounds[3] = (x[1] > bounds[3] ? x[1] : bounds[3]);
bounds[4] = (x[2] < bounds[4] ? x[2] : bounds[4]);
bounds[5] = (x[2] > bounds[5] ? x[2] : bounds[5]);
vtkMath::UninitializeBounds(bounds);
}
}
int vtkUnstructuredGrid::GetMaxCellSize()
......
......@@ -20,7 +20,7 @@
#include "vtkPropCollection.h"
#include "vtkWindow.h"
vtkCxxRevisionMacro(vtkViewport, "1.55");
vtkCxxRevisionMacro(vtkViewport, "1.56");
// Create a vtkViewport with a black background, a white ambient light,
// two-sided lighting turned on, a viewport of (0,0,1,1), and backface culling
......@@ -158,7 +158,7 @@ void vtkViewport::DisplayToView()
{
if ( this->VTKWindow )
{
float vx,vy,vz;
double vx,vy,vz;
int sizex,sizey;
int *size;
......@@ -182,7 +182,7 @@ void vtkViewport::ViewToDisplay()
{
if ( this->VTKWindow )
{
float dx,dy;