Commit ee1ce0fe authored by Ken Martin's avatar Ken Martin

renderings next double changes

parent dd3c1fe2
......@@ -73,25 +73,25 @@ public:
// Description:
// Get the selection point in screen (pixel) coordinates. The third
// value is related to z-buffer depth. (Normally should be =0.)
vtkGetVectorMacro(SelectionPoint,float,3);
vtkGetVectorMacro(SelectionPoint,double,3);
// Description:
// Return position in global coordinates of pick point.
vtkGetVectorMacro(PickPosition,float,3);
vtkGetVectorMacro(PickPosition,double,3);
// Description:
// Perform pick operation with selection point provided. Normally the
// first two values for the selection point are x-y pixel coordinate, and
// the third value is =0. Return non-zero if something was successfully
// picked.
virtual int Pick(float selectionX, float selectionY, float selectionZ,
virtual int Pick(double selectionX, double selectionY, double selectionZ,
vtkRenderer *renderer) = 0;
// Description: Perform pick operation with selection point
// provided. Normally the first two values for the selection point
// are x-y pixel coordinate, and the third value is =0. Return
// non-zero if something was successfully picked.
int Pick(float selectionPt[3], vtkRenderer *ren)
int Pick(double selectionPt[3], vtkRenderer *ren)
{return this->Pick(selectionPt[0],selectionPt[1],selectionPt[2],ren);};
// Description:
......@@ -125,8 +125,8 @@ protected:
virtual void Initialize();
vtkRenderer *Renderer; //pick occurred in this renderer's viewport
float SelectionPoint[3]; //selection point in window (pixel) coordinates
float PickPosition[3]; //selection point in world coordinates
double SelectionPoint[3]; //selection point in window (pixel) coordinates
double PickPosition[3]; //selection point in world coordinates
// use the following to control picking from a list
int PickFromList;
......
......@@ -19,7 +19,7 @@
#include "vtkDataSet.h"
vtkCxxRevisionMacro(vtkAbstractVolumeMapper, "1.2");
vtkCxxRevisionMacro(vtkAbstractVolumeMapper, "1.3");
// Construct a vtkAbstractVolumeMapper
vtkAbstractVolumeMapper::vtkAbstractVolumeMapper()
......@@ -56,7 +56,15 @@ float *vtkAbstractVolumeMapper::GetBounds()
else
{
this->Update();
this->GetDataSetInput()->GetBounds(this->Bounds);
// TODO: clean up when mapper API switched to double
double *dbounds = this->GetDataSetInput()->GetBounds();
this->Bounds[0] = (float)dbounds[0];
this->Bounds[1] = (float)dbounds[1];
this->Bounds[2] = (float)dbounds[2];
this->Bounds[3] = (float)dbounds[3];
this->Bounds[4] = (float)dbounds[4];
this->Bounds[5] = (float)dbounds[5];
//this->GetDataSetInput()->GetBounds(this->Bounds);
return this->Bounds;
}
}
......
......@@ -23,7 +23,7 @@
#include "vtkViewport.h"
#include "vtkWindow.h"
vtkCxxRevisionMacro(vtkAxisActor2D, "1.36");
vtkCxxRevisionMacro(vtkAxisActor2D, "1.37");
vtkStandardNewMacro(vtkAxisActor2D);
vtkCxxSetObjectMacro(vtkAxisActor2D,LabelTextProperty,vtkTextProperty);
......@@ -275,7 +275,8 @@ void vtkAxisActor2D::BuildAxis(vtkViewport *viewport)
int i, *x, viewportSizeHasChanged, positionsHaveChanged;
vtkIdType ptIds[2];
float p1[3], p2[3], offset;
float interval, deltaX, deltaY, xTick[3];
float interval, deltaX, deltaY;
double xTick[3];
float theta, val;
int *size, stringSize[2];
char string[512];
......@@ -767,7 +768,7 @@ void vtkAxisActor2D::ComputeRange(float inRange[2],
// Position text with respect to a point (xTick) where the angle of the line
// from the point to the center of the text is given by theta. The offset
// is the spacing between ticks and labels.
void vtkAxisActor2D::SetOffsetPosition(float xTick[3], float theta,
void vtkAxisActor2D::SetOffsetPosition(double xTick[3], float theta,
int stringWidth, int stringHeight,
int offset, vtkActor2D *actor)
{
......
......@@ -288,7 +288,7 @@ protected:
virtual void BuildAxis(vtkViewport *viewport);
static float ComputeStringOffset(float width, float height, float theta);
static void SetOffsetPosition(float xTick[3], float theta, int stringHeight,
static void SetOffsetPosition(double xTick[3], float theta, int stringHeight,
int stringWidth, int offset, vtkActor2D *actor);
virtual void UpdateAdjustedRange();
......
......@@ -20,7 +20,7 @@
#include "vtkObjectFactory.h"
#include "vtkVolumeMapper.h"
vtkCxxRevisionMacro(vtkCellPicker, "1.34");
vtkCxxRevisionMacro(vtkCellPicker, "1.35");
vtkStandardNewMacro(vtkCellPicker);
vtkCellPicker::vtkCellPicker()
......@@ -39,14 +39,14 @@ vtkCellPicker::~vtkCellPicker()
this->Cell->Delete();
}
float vtkCellPicker::IntersectWithLine(float p1[3], float p2[3], float tol,
double vtkCellPicker::IntersectWithLine(double p1[3], double p2[3], double tol,
vtkAssemblyPath *path,
vtkProp3D *prop3D,
vtkAbstractMapper3D *m)
{
vtkIdType numCells, cellId, minCellId;
int i, minSubId, subId;
float x[3], tMin, t, pcoords[3], minXYZ[3], minPcoords[3];
double x[3], tMin, t, pcoords[3], minXYZ[3], minPcoords[3];
vtkDataSet *input;
vtkMapper *mapper;
vtkVolumeMapper *volumeMapper;
......@@ -62,7 +62,7 @@ float vtkCellPicker::IntersectWithLine(float p1[3], float p2[3], float tol,
}
else
{
return VTK_LARGE_FLOAT;
return VTK_DOUBLE_MAX;
}
if ( (numCells = input->GetNumberOfCells()) < 1 )
......@@ -81,8 +81,8 @@ float vtkCellPicker::IntersectWithLine(float p1[3], float p2[3], float tol,
minCellId = -1;
minSubId = -1;
pcoords[0] = pcoords[1] = pcoords[2] = 0;
float pDistMin=VTK_LARGE_FLOAT, pDist;
for (tMin=VTK_LARGE_FLOAT,cellId=0; cellId<numCells; cellId++)
double pDistMin=VTK_DOUBLE_MAX, pDist;
for (tMin=VTK_DOUBLE_MAX,cellId=0; cellId<numCells; cellId++)
{
input->GetCell(cellId, this->Cell);
......
......@@ -47,7 +47,7 @@ public:
// Description:
// Get the parametric coordinates of the picked cell. Only valid if
// pick was made.
vtkGetVectorMacro(PCoords, float,3);
vtkGetVectorMacro(PCoords, double,3);
protected:
vtkCellPicker();
......@@ -55,9 +55,9 @@ protected:
vtkIdType CellId; // picked cell
int SubId; // picked cell subId
float PCoords[3]; // picked cell parametric coordinates
double PCoords[3]; // picked cell parametric coordinates
virtual float IntersectWithLine(float p1[3], float p2[3], float tol,
virtual double IntersectWithLine(double p1[3], double p2[3], double tol,
vtkAssemblyPath *path, vtkProp3D *p,
vtkAbstractMapper3D *m);
void Initialize();
......
......@@ -21,7 +21,7 @@
#include <math.h>
vtkCxxRevisionMacro(vtkEncodedGradientEstimator, "1.33");
vtkCxxRevisionMacro(vtkEncodedGradientEstimator, "1.34");
vtkCxxSetObjectMacro(vtkEncodedGradientEstimator, Input, vtkImageData );
......@@ -171,7 +171,7 @@ unsigned char *vtkEncodedGradientEstimator::GetGradientMagnitudes()
void vtkEncodedGradientEstimator::Update( )
{
int scalarInputSize[3];
float scalarInputAspect[3];
double scalarInputAspect[3];
double startSeconds, endSeconds;
double startCPUSeconds, endCPUSeconds;
......@@ -235,7 +235,11 @@ void vtkEncodedGradientEstimator::Update( )
// Copy info that multi threaded function will need into temp variables
memcpy( this->InputSize, scalarInputSize, 3 * sizeof(int) );
memcpy( this->InputAspect, scalarInputAspect, 3 * sizeof(float) );
// TODO cleanup when double changes are further along
this->InputAspect[0] = static_cast<float>(scalarInputAspect[0]);
this->InputAspect[1] = static_cast<float>(scalarInputAspect[1]);
this->InputAspect[2] = static_cast<float>(scalarInputAspect[2]);
// memcpy( this->InputAspect, scalarInputAspect, 3 * sizeof(float) );
if ( this->CylinderClip &&
(this->InputSize[0] == this->InputSize[1]) )
......
......@@ -34,7 +34,7 @@
#include "vtkTransform.h"
#include "vtkUnsignedCharArray.h"
vtkCxxRevisionMacro(vtkIVExporter, "1.52");
vtkCxxRevisionMacro(vtkIVExporter, "1.53");
vtkStandardNewMacro(vtkIVExporter);
vtkIVExporter::vtkIVExporter()
......@@ -255,7 +255,7 @@ void vtkIVExporter::WriteAnActor(vtkActor *anActor, FILE *fp)
float tempf2;
vtkPolyDataMapper *pm;
vtkUnsignedCharArray *colors;
float *p;
double *p;
unsigned char *c;
vtkTransform *trans;
......@@ -607,7 +607,7 @@ void vtkIVExporter::WritePointData(vtkPoints *points, vtkDataArray *normals,
vtkDataArray *tcoords,
vtkUnsignedCharArray *colors, FILE *fp)
{
float *p;
double *p;
int i;
unsigned char *c;
......
......@@ -18,7 +18,7 @@
#include "vtkRenderer.h"
#include "vtkImageData.h"
vtkCxxRevisionMacro(vtkImageActor, "1.14");
vtkCxxRevisionMacro(vtkImageActor, "1.15");
//----------------------------------------------------------------------------
// Needed when we don't use the vtkStandardNewMacro.
......@@ -166,8 +166,8 @@ float *vtkImageActor::GetBounds()
return this->Bounds;
}
this->Input->UpdateInformation();
float *spacing = this->Input->GetSpacing();
float *origin = this->Input->GetOrigin();
double *spacing = this->Input->GetSpacing();
double *origin = this->Input->GetOrigin();
// if the display extent has not been set, then compute one
int *wExtent = this->Input->GetWholeExtent();
......
......@@ -32,7 +32,7 @@
#include "vtkRenderer.h"
#include "vtkTextProperty.h"
vtkCxxRevisionMacro(vtkInteractorStyle, "1.90");
vtkCxxRevisionMacro(vtkInteractorStyle, "1.91");
vtkStandardNewMacro(vtkInteractorStyle);
//----------------------------------------------------------------------------
......@@ -303,7 +303,10 @@ void vtkInteractorStyle::HighlightProp3D(vtkProp3D *prop3D)
this->CurrentRenderer->AddActor(this->OutlineActor);
this->PickedRenderer = this->CurrentRenderer;
}
this->Outline->SetBounds(prop3D->GetBounds());
// TODO: cleanup when prop is changed to double
float *bnds = prop3D->GetBounds();
this->Outline->SetBounds(bnds[0], bnds[1], bnds[2],
bnds[3], bnds[4], bnds[5]);
}
}
......
......@@ -35,7 +35,7 @@
#include "vtkTransform.h"
#include "vtkWorldPointPicker.h"
vtkCxxRevisionMacro(vtkInteractorStyleUnicam, "1.30");
vtkCxxRevisionMacro(vtkInteractorStyleUnicam, "1.31");
vtkStandardNewMacro(vtkInteractorStyleUnicam);
// define 'TheTime()' function-- returns time in elapsed seconds
......@@ -154,8 +154,12 @@ void vtkInteractorStyleUnicam::OnLeftButtonDown()
//
this->FindPokedRenderer(x, y);
this->InteractionPicker->Pick(x, y, 0.0, this->CurrentRenderer);
this->InteractionPicker->GetPickPosition(this->DownPt);
// TODO: cleanup double
double * ddp = this->InteractionPicker->GetPickPosition();
this->DownPt[0] = (float)ddp[0];
this->DownPt[1] = (float)ddp[1];
this->DownPt[2] = (float)ddp[2];
// if someone has already clicked to make a dot and they're not clicking
// on it now, OR if the user is clicking on the perimeter of the screen,
// then we want to go into rotation mode.
......
......@@ -22,7 +22,7 @@
#include "vtkTextMapper.h"
#include "vtkTextProperty.h"
vtkCxxRevisionMacro(vtkLabeledDataMapper, "1.36");
vtkCxxRevisionMacro(vtkLabeledDataMapper, "1.37");
vtkStandardNewMacro(vtkLabeledDataMapper);
vtkCxxSetObjectMacro(vtkLabeledDataMapper,Input, vtkDataSet);
......@@ -101,7 +101,7 @@ void vtkLabeledDataMapper::RenderOverlay(vtkViewport *viewport,
vtkActor2D *actor)
{
int i;
float x[3];
double x[3];
vtkDataSet *input=this->GetInput();
if ( ! input )
......@@ -124,9 +124,8 @@ void vtkLabeledDataMapper::RenderOpaqueGeometry(vtkViewport *viewport,
{
int i, j, numComp = 0, pointIdLabels, activeComp = 0;
char string[1024], format[1024];
float val, x[3];
double val, x[3];
vtkDataArray *data;
// float *tuple=NULL;
vtkDataSet *input=this->GetInput();
vtkPointData *pd=input->GetPointData();
......
......@@ -17,7 +17,7 @@
#include "vtkLookupTable.h"
#include "vtkDataSet.h"
vtkCxxRevisionMacro(vtkMapper, "1.104");
vtkCxxRevisionMacro(vtkMapper, "1.105");
// Initialize static member that controls global immediate mode rendering
static int vtkMapperGlobalImmediateModeRendering = 0;
......@@ -82,7 +82,14 @@ float *vtkMapper::GetBounds()
else
{
this->Update();
this->GetInput()->GetBounds(this->Bounds);
// TODO: cleanup
double *dbounds = this->GetInput()->GetBounds();
this->Bounds[0] = (float)dbounds[0];
this->Bounds[1] = (float)dbounds[1];
this->Bounds[2] = (float)dbounds[2];
this->Bounds[3] = (float)dbounds[3];
this->Bounds[4] = (float)dbounds[4];
this->Bounds[5] = (float)dbounds[5];
return this->Bounds;
}
}
......
......@@ -30,7 +30,7 @@
#include "vtkRendererCollection.h"
#include "vtkTransform.h"
vtkCxxRevisionMacro(vtkOBJExporter, "1.50");
vtkCxxRevisionMacro(vtkOBJExporter, "1.51");
vtkStandardNewMacro(vtkOBJExporter);
vtkOBJExporter::vtkOBJExporter()
......@@ -129,7 +129,8 @@ void vtkOBJExporter::WriteAnActor(vtkActor *anActor, FILE *fpObj, FILE *fpMtl,
vtkDataArray *tcoords = NULL;
int i, i1, i2, idNext;
vtkProperty *prop;
float *tempf, *p;
float *tempf;
double *p;
vtkCellArray *cells;
vtkTransform *trans = vtkTransform::New();
vtkIdType npts = 0;
......
......@@ -36,7 +36,7 @@
#include "vtkTriangleStrip.h"
#include "vtkVersion.h"
vtkCxxRevisionMacro(vtkOOGLExporter, "1.21");
vtkCxxRevisionMacro(vtkOOGLExporter, "1.22");
vtkStandardNewMacro(vtkOOGLExporter);
vtkOOGLExporter::vtkOOGLExporter()
......@@ -486,7 +486,7 @@ void vtkOOGLExporter::WriteAnActor(vtkActor *anActor, FILE *fp, int count)
fprintf(fp, "%s", indent);
for (i=0;i<npts;i++)
{
float *pt = points->GetPoint(indx[i]);
double *pt = points->GetPoint(indx[i]);
fprintf(fp, "%s%f %f %f ", indent, pt[0], pt[1], pt[2]);
}
fprintf(fp, "\n");
......@@ -532,7 +532,7 @@ void vtkOOGLExporter::WriteAnActor(vtkActor *anActor, FILE *fp, int count)
{
for (i = 0; i < points->GetNumberOfPoints(); i++)
{
float *pt = points->GetPoint(i);
double *pt = points->GetPoint(i);
c = (unsigned char *)colors->GetPointer(4*i);
fprintf (fp,"%s%g %g %g %g %g %g %g\n", indent,
......@@ -544,7 +544,7 @@ void vtkOOGLExporter::WriteAnActor(vtkActor *anActor, FILE *fp, int count)
{
for (i = 0; i < points->GetNumberOfPoints(); i++)
{
float *pt = points->GetPoint(i);
double *pt = points->GetPoint(i);
fprintf (fp,"%s%g %g %g\n", indent, pt[0], pt[1], pt[2]);
}
}
......
......@@ -30,7 +30,7 @@
#endif
#ifndef VTK_IMPLEMENT_MESA_CXX
vtkCxxRevisionMacro(vtkOpenGLImageActor, "1.21");
vtkCxxRevisionMacro(vtkOpenGLImageActor, "1.22");
vtkStandardNewMacro(vtkOpenGLImageActor);
#endif
......@@ -111,8 +111,8 @@ unsigned char *vtkOpenGLImageActor::MakeDataSuitable(int &xsize, int &ysize,
ydim = 2;
}
float *spacing = this->Input->GetSpacing();
float *origin = this->Input->GetOrigin();
double *spacing = this->Input->GetSpacing();
double *origin = this->Input->GetOrigin();
// compute the world coordinates
this->Coords[0] = this->DisplayExtent[0]*spacing[0] + origin[0];
......
This diff is collapsed.
......@@ -38,7 +38,7 @@
#include <math.h>
#ifndef VTK_IMPLEMENT_MESA_CXX
vtkCxxRevisionMacro(vtkOpenGLPolyDataMapper2D, "1.47");
vtkCxxRevisionMacro(vtkOpenGLPolyDataMapper2D, "1.48");
vtkStandardNewMacro(vtkOpenGLPolyDataMapper2D);
#endif
......@@ -259,7 +259,7 @@ void vtkOpenGLPolyDataMapper2D::RenderOverlay(vtkViewport* viewport,
}
glColor4ubv(rgba);
}
glVertex2fv(p->GetPoint(pts[j]));
glVertex2dv(p->GetPoint(pts[j]));
}
glEnd();
}
......@@ -311,7 +311,7 @@ void vtkOpenGLPolyDataMapper2D::RenderOverlay(vtkViewport* viewport,
}
glColor4ubv(rgba);
}
glVertex2fv(p->GetPoint(pts[j]));
glVertex2dv(p->GetPoint(pts[j]));
}
glEnd();
}
......@@ -337,7 +337,7 @@ void vtkOpenGLPolyDataMapper2D::RenderOverlay(vtkViewport* viewport,
}
glColor4ubv(rgba);
}
glVertex2fv(p->GetPoint(pts[j]));
glVertex2dv(p->GetPoint(pts[j]));
}
}
glEnd();
......
......@@ -26,7 +26,7 @@
#include "vtkViewport.h"
#include "vtkWindow.h"
vtkCxxRevisionMacro(vtkParallelCoordinatesActor, "1.30");
vtkCxxRevisionMacro(vtkParallelCoordinatesActor, "1.31");
vtkStandardNewMacro(vtkParallelCoordinatesActor);
vtkCxxSetObjectMacro(vtkParallelCoordinatesActor,Input,vtkDataObject);
......@@ -302,7 +302,7 @@ int vtkParallelCoordinatesActor::PlaceAxes(vtkViewport *viewport, int *vtkNotUse
vtkIdType i, j, id;
vtkDataObject *input = this->GetInput();
vtkFieldData *field = input->GetFieldData();
float v;
double v;
this->Initialize();
......@@ -345,12 +345,12 @@ int vtkParallelCoordinatesActor::PlaceAxes(vtkViewport *viewport, int *vtkNotUse
// We need to loop over the field to determine the range of
// each independent variable.
this->Mins = new float [this->N];
this->Maxs = new float [this->N];
this->Mins = new double [this->N];
this->Maxs = new double [this->N];
for (i=0; i<this->N; i++)
{
this->Mins[i] = VTK_LARGE_FLOAT;
this->Maxs[i] = -VTK_LARGE_FLOAT;
this->Mins[i] = VTK_DOUBLE_MAX;
this->Maxs[i] = -VTK_DOUBLE_MAX;
}
if ( this->IndependentVariables == VTK_IV_COLUMN )
......@@ -426,9 +426,11 @@ int vtkParallelCoordinatesActor::PlaceAxes(vtkViewport *viewport, int *vtkNotUse
this->YMax = p2[1];
for (i=0; i<this->N; i++)
{
this->Xs[i] = (int) (p1[0] + (float)i/((float)this->N) * (p2[0]-p1[0]));
this->Axes[i]->GetPositionCoordinate()->SetValue(this->Xs[i], this->YMin);
this->Axes[i]->GetPosition2Coordinate()->SetValue(this->Xs[i], this->YMax);
this->Xs[i] = (int) (p1[0] + (double)i/((double)this->N) * (p2[0]-p1[0]));
this->Axes[i]->GetPositionCoordinate()->SetValue((double)this->Xs[i],
this->YMin);
this->Axes[i]->GetPosition2Coordinate()->SetValue((double)this->Xs[i],
this->YMax);
}
// Now generate the lines to plot
......@@ -439,7 +441,7 @@ int vtkParallelCoordinatesActor::PlaceAxes(vtkViewport *viewport, int *vtkNotUse
this->PlotData->SetPoints(pts);
this->PlotData->SetLines(lines);
float x[3]; x[2] = 0.0;
double x[3]; x[2] = 0.0;
if ( this->IndependentVariables == VTK_IV_COLUMN )
{
lines->Allocate(lines->EstimateSize(numRows,numColumns));
......
......@@ -145,8 +145,8 @@ private:
int IndependentVariables; // Use column or row
vtkIdType N; // The number of independent variables
float *Mins; // Minimum data value along this row/column
float *Maxs; // Maximum data value along this row/column
double *Mins; // Minimum data value along this row/column
double *Maxs; // Maximum data value along this row/column
int *Xs; // Axes x-values (in viewport coordinates)
int YMin; // Axes y-min-value (in viewport coordinates)
int YMax; // Axes y-max-value (in viewport coordinates)
......
......@@ -35,7 +35,7 @@
#include "vtkVolumeMapper.h"
#include "vtkBox.h"
vtkCxxRevisionMacro(vtkPicker, "1.80");
vtkCxxRevisionMacro(vtkPicker, "1.81");
vtkStandardNewMacro(vtkPicker);
// Construct object with initial tolerance of 1/40th of window. There are no
......@@ -50,7 +50,7 @@ vtkPicker::vtkPicker()
this->Mapper = NULL;
this->DataSet = NULL;
this->GlobalTMin = VTK_LARGE_FLOAT;
this->GlobalTMin = VTK_DOUBLE_MAX;
this->Actors = vtkActorCollection::New();
this->Prop3Ds = vtkProp3DCollection::New();
this->PickedPositions = vtkPoints::New();
......@@ -68,7 +68,7 @@ vtkPicker::~vtkPicker()
// Update state when prop3D is picked.
void vtkPicker::MarkPicked(vtkAssemblyPath *path, vtkProp3D *prop3D,
vtkAbstractMapper3D *m,
float tMin, float mapperPos[3])
double tMin, double mapperPos[3])
{
int i;
vtkMapper *mapper;
......@@ -108,29 +108,29 @@ void vtkPicker::MarkPicked(vtkAssemblyPath *path, vtkProp3D *prop3D,
// Perform pick operation with selection point provided. Normally the
// first two values for the selection point are x-y pixel coordinate, and
// the third value is =0. Return non-zero if something was successfully picked.
int vtkPicker::Pick(float selectionX, float selectionY, float selectionZ,
int vtkPicker::Pick(double selectionX, double selectionY, double selectionZ,
vtkRenderer *renderer)
{
int i;
vtkProp *prop;
vtkCamera *camera;
vtkAbstractMapper3D *mapper = NULL;
float p1World[4], p2World[4], p1Mapper[4], p2Mapper[4];
double p1World[4], p2World[4], p1Mapper[4], p2Mapper[4];
int picked=0;
int *winSize;
float x, y, t;
double x, y, t;
float *viewport;
float cameraPos[4], cameraFP[4];
double cameraPos[4], cameraFP[4];
float *displayCoords, *worldCoords;
double *clipRange;
float ray[3], rayLength;
double ray[3], rayLength;
int pickable;
int LODId;
float windowLowerLeft[4], windowUpperRight[4];
float bounds[6], tol;
float tF, tB;
float hitPosition[3];
float cameraDOP[3];
double windowLowerLeft[4], windowUpperRight[4];
double bounds[6], tol;
double tF, tB;
double hitPosition[3];
double cameraDOP[3];
// Initialize picking process
this->Initialize();
......@@ -152,10 +152,10 @@ int vtkPicker::Pick(float selectionX, float selectionY, float selectionZ,
// coordinates. We need a depth value for z-buffer.
//
camera = renderer->GetActiveCamera();
camera->GetPosition((float *)cameraPos); cameraPos[3] = 1.0;
camera->GetFocalPoint((float *)cameraFP); cameraFP[3] = 1.0;
camera->GetPosition((double *)cameraPos); cameraPos[3] = 1.0;
camera->GetFocalPoint((double *)cameraFP); cameraFP[3] = 1.0;
renderer->SetWorldPoint(cameraFP);
renderer->SetWorldPoint(cameraFP[0],cameraFP[1],cameraFP[2],cameraFP[3]);
renderer->WorldToDisplay();
displayCoords = renderer->GetDisplayPoint();
selectionZ = displayCoords[2];
......@@ -343,16 +343,22 @@ int vtkPicker::Pick(float selectionX, float selectionY, float selectionZ,
// Get the bounding box of the modeller. Note that the tolerance is
// added to the bounding box to make sure things on the edge of the
// bounding box are picked correctly.
mapper->GetBounds(bounds);
float *fbounds = mapper->GetBounds();
bounds[0] = fbounds[0];
bounds[1] = fbounds[1];
bounds[2] = fbounds[2];
bounds[3] = fbounds[3];
bounds[4] = fbounds[4];
bounds[5] = fbounds[5];
bounds[0] -= tol; bounds[1] += tol;
bounds[2] -= tol; bounds[3] += tol;
bounds[4] -= tol; bounds[5] += tol;
if ( vtkBox::IntersectBox(bounds, (float *)p1Mapper, ray, hitPosition, t) )
if ( vtkBox::IntersectBox(bounds, (double *)p1Mapper, ray, hitPosition, t) )
{
t = this->IntersectWithLine((float *)p1Mapper,
(float *)p2Mapper, tol, path,
t = this->IntersectWithLine((double *)p1Mapper,
(double *)p2Mapper, tol, path,
(vtkProp3D *)propCandidate, mapper);
if ( t < VTK_LARGE_FLOAT )
if ( t < VTK_DOUBLE_MAX )
{
picked = 1;
this->Prop3Ds->AddItem((vtkProp3D *)prop);
......@@ -380,18 +386,21 @@ int vtkPicker::Pick(float selectionX, float selectionY, float selectionZ,
}
// Intersect data with specified ray.
float vtkPicker::IntersectWithLine(float p1[3], float p2[3],
float vtkNotUsed(tol),
double vtkPicker::IntersectWithLine(double p1[3], double p2[3],
double vtkNotUsed(tol),
vtkAssemblyPath *path,
vtkProp3D *prop3D,
vtkAbstractMapper3D *mapper)
{
int i;
float *center, t, ray[3], rayFactor;
double center[3], t, ray[3], rayFactor;
// Get the data from the modeler
//
center = mapper->GetCenter();
// TODO: cleanup when GetCeneter return double
center[0] = mapper->GetCenter()[0];
center[1] = mapper->GetCenter()[1];
center[2] = mapper->GetCenter()[2];
for (i=0; i<3; i++)
{
......@@ -428,7 +437,7 @@ void vtkPicker::Initialize()
this->MapperPosition[2] = 0.0;
this->Mapper = NULL;
this->GlobalTMin = VTK_LARGE_FLOAT;
this->GlobalTMin = VTK_DOUBLE_MAX;
}
......
......@@ -55,13 +55,13 @@ public:
// Specify tolerance for performing pick operation. Tolerance is specified
// as fraction of rendering window size. (Rendering window size is measured
// across diagonal.)
vtkSetMacro(Tolerance,float);
vtkGetMacro(Tolerance,float);
vtkSetMacro(Tolerance,double);
vtkGetMacro(Tolerance,double);
// Description:
// Return position in mapper (i.e., non-transformed) coordinates of
// pick point.
vtkGetVectorMacro(MapperPosition,float,3);
vtkGetVectorMacro(MapperPosition,double,3);
// Description:
// Return mapper that was picked (if any).
......@@ -94,14 +94,14 @@ public:
// first two values for the selection point are x-y pixel coordinate, and
// the third value is =0. Return non-zero if something was successfully
// picked.
virtual int Pick(float selectionX, float selectionY, float selectionZ,
virtual int Pick(double selectionX, double selectionY, double selectionZ,
vtkRenderer *renderer);
// Description:
// Perform pick operation with selection point provided. Normally the first
// two values for the selection point are x-y pixel coordinate, and the
// third value is =0. Return non-zero if something was successfully picked.
int Pick(float selectionPt[3], vtkRenderer *ren)
int Pick(double selectionPt[3], vtkRenderer *ren)
{return this->Pick(selectionPt[0], selectionPt[1], selectionPt[2], ren);};
protected:
......@@ -109,19 +109,19 @@ protected:
~vtkPicker();
void MarkPicked(vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m,