Commit 6ea76b1b authored by Will Schroeder's avatar Will Schroeder
Browse files

ERR: Misc bug fixes.

parent f9cc3f08
......@@ -47,7 +47,7 @@ public:
int FindCell(float x[3], vlCell *cell, float tol2, int& subId, float pc[3])
{return this->DataSet->FindCell(x,cell,tol2,subId,pc);};
void ComputeBounds() {this->DataSet->ComputeBounds();};
void ComputeBounds();
void Update();
protected:
......
......@@ -16,18 +16,17 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Class to transform points
// Warp geometry in direction of vectors
//
#ifndef __vlWarpVector_h
#define __vlWarpVector_h
#include "PtS2PtSF.hh"
#include "Trans.hh"
class vlWarpVector : public vlPointSetToPointSetFilter
{
public:
vlWarpVector() : ScaleFactor(0.0) {};
vlWarpVector() : ScaleFactor(1.0) {};
~vlWarpVector() {};
char *GetClassName() {return "vlWarpVector";};
void PrintSelf(ostream& os, vlIndent indent);
......
......@@ -53,6 +53,12 @@ void vlDataSetToDataSetFilter::Initialize()
}
}
void vlDataSetToDataSetFilter::ComputeBounds()
{
float *bounds = this->DataSet->GetBounds();
for (int i=0; i<6; i++) this->Bounds[i] = bounds[i];
}
void vlDataSetToDataSetFilter::PrintSelf(ostream& os, vlIndent indent)
{
if (this->ShouldIPrint(vlDataSetToDataSetFilter::GetClassName()))
......
......@@ -141,7 +141,7 @@ void vlGeometryFilter::Execute()
for ( i=0; i < numPts; i++)
{
ptId = cell->GetPointId(i);
x = this->GetPoint(ptId);
x = this->Input->GetPoint(ptId);
pts[i] = newPts->InsertNextPoint(x);
this->PointData.CopyData(pd,ptId,pts[i]);
}
......@@ -175,9 +175,8 @@ void vlGeometryFilter::Execute()
//
// Update ourselves
//
newPts->Squeeze();
this->SetPoints(newPts);
this->PointData.Squeeze();
this->Squeeze();
delete [] cellVis;
......
......@@ -55,58 +55,19 @@ void vlTransformFilter::Execute()
//
// Loop over all points, updating position
//
newX[3] = 1.0; // Vector is in homogeneous coordinates
for (ptId=0; ptId < numPts; ptId++)
{
x = inPts->GetPoint(ptId);
for (i=0; i<3; i++) newX[i] = x[i];
trans.VectorMultiply(newX,newX);
for (i=0; i<3; i++) newX[i] /= newX[3]; //normalize
newPts->SetPoint(ptId, newX);
}
trans.MultiplyPoints(inPts,newPts);
//
// Push the matrix on the stack so we can take inverse/transpose. This
// matrix is used to transform vectors/normals.
//
this->Transform->Push();
this->Transform->Inverse();
this->Transform->Transpose();
//
// Loop over all vectors
// Ditto for vectors and normals
//
if ( inVectors )
{
for (ptId=0; ptId < numPts; ptId++)
{
x = inVectors->GetVector(ptId);
for (i=0; i<3; i++) newX[i] = x[i];
trans.VectorMultiply(newX,newX);
for (i=0; i<3; i++) newX[i] /= newX[3]; //normalize
newVectors->SetVector(ptId, newX);
}
trans.MultiplyVectors(inVectors,newVectors);
}
//
// Loop over all normals
//
if ( inNormals )
{
for (ptId=0; ptId < numPts; ptId++)
{
x = inNormals->GetNormal(ptId);
for (i=0; i<3; i++) newX[i] = x[i];
trans.VectorMultiply(newX,newX);
for (i=0; i<3; i++) newX[i] /= newX[3]; //normalize
newNormals->SetNormal(ptId, newX);
}
trans.MultiplyNormals(inNormals,newNormals);
}
// restore transform
this->Transform->Push();
//
// Update ourselves
//
......
Supports Markdown
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