Commit e0b7ab94 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH: Got tensors working

parent d0c80012
......@@ -40,11 +40,11 @@ public:
char *GetDataType() {return "float";};
int GetNumberOfTensors();
void Squeeze() {this->T.Squeeze();};
vtkTensor &GetTensor(int i);
vtkTensor *GetTensor(int i);
void GetTensor(int i,vtkTensor &t) {this->vtkTensors::GetTensor(i,t);};
void SetTensor(int i, vtkTensor &t);
void InsertTensor(int i, vtkTensor &t);
int InsertNextTensor(vtkTensor &t);
void SetTensor(int i, vtkTensor *t);
void InsertTensor(int i, vtkTensor *t);
int InsertNextTensor(vtkTensor *t);
// miscellaneous
float *GetPtr(const int id);
......@@ -103,30 +103,30 @@ inline int vtkFloatTensors::GetNumberOfTensors()
return (this->T.GetMaxId()+1)/(this->Dimension*this->Dimension);
}
inline void vtkFloatTensors::SetTensor(int id, vtkTensor &t)
inline void vtkFloatTensors::SetTensor(int id, vtkTensor *t)
{
id *= this->Dimension*this->Dimension;
for (int j=0; j < this->Dimension; j++)
for (int i=0; i < this->Dimension; i++)
this->T[id+i+t.GetDimension()*j] = t.GetComponent(i,j);
this->T[id+i+t->GetDimension()*j] = t->GetComponent(i,j);
}
inline void vtkFloatTensors::InsertTensor(int id, vtkTensor &t)
inline void vtkFloatTensors::InsertTensor(int id, vtkTensor *t)
{
id *= this->Dimension*this->Dimension;
for (int j=0; j < this->Dimension; j++)
for (int i=0; i < this->Dimension; i++)
this->T.InsertValue(id+i+t.GetDimension()*j,t.GetComponent(i,j));
this->T.InsertValue(id+i+t->GetDimension()*j,t->GetComponent(i,j));
}
inline int vtkFloatTensors::InsertNextTensor(vtkTensor &t)
inline int vtkFloatTensors::InsertNextTensor(vtkTensor *t)
{
int id = this->GetNumberOfTensors() + 1;
for (int j=0; j < this->Dimension; j++)
for (int i=0; i < this->Dimension; i++)
this->T.InsertNextValue(t.GetComponent(i,j));
this->T.InsertNextValue(t->GetComponent(i,j));
return id;
}
......
......@@ -52,7 +52,7 @@ public:
// Description:
// Return a float tensor t[dim*dim] for a particular point id.
virtual vtkTensor &GetTensor(int id) = 0;
virtual vtkTensor *GetTensor(int id) = 0;
// Description:
// Copy float tensor into user provided tensor
......@@ -61,12 +61,12 @@ public:
// Description:
// Insert tensor into object. No range checking performed (fast!).
virtual void SetTensor(int id, vtkTensor& t) = 0;
virtual void SetTensor(int id, vtkTensor *t) = 0;
// Description:
// Insert tensor into object. Range checking performed and
// memory allocated as necessary.
virtual void InsertTensor(int id, vtkTensor &t) = 0;
virtual void InsertTensor(int id, vtkTensor *t) = 0;
void InsertTensor(int id, float t11, float t12, float t13,
float t21, float t22, float t23,
float t31, float t32, float t33);
......@@ -74,7 +74,7 @@ public:
// Description:
// Insert tensor into next available slot. Returns point
// id of slot.
virtual int InsertNextTensor(vtkTensor &t) = 0;
virtual int InsertNextTensor(vtkTensor *t) = 0;
int InsertNextTensor(float t11, float t12, float t13,
float t21, float t22, float t23,
float t31, float t32, float t33);
......
......@@ -22,6 +22,10 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
// be used as the direction along which to warp the geometry. If normals are
// present but you would like to use the Normals instance variable, set the
// UseNormals boolean to true.
// If XYPlane boolean is set true, then the z-value is considered to be
// a scalar value (still scaled by scale factor) and the displacement is
// along the z-axis. If scalars are also present, these are copied through
// and can be used to color the surface.
#ifndef __vtkWarpScalar_h
#define __vtkWarpScalar_h
......@@ -54,17 +58,27 @@ public:
vtkSetVector3Macro(Normal,float);
vtkGetVectorMacro(Normal,float,3);
// Description:
// Turn on/off flag specifying that input data is x-y plane. If x-y plane,
// then the z value is used to warp the surface in the z-axis direction
// (times the scale factor) and scalars are used to color the surface.
vtkSetMacro(XYPlane,int);
vtkGetMacro(XYPlane,int);
vtkBooleanMacro(XYPlane,int);
protected:
void Execute();
float ScaleFactor;
int UseNormal;
float Normal[3];
int XYPlane;
//BTX
float *(vtkWarpScalar::*PointNormal)(int id, vtkNormals *normals);
float *DataNormal(int id, vtkNormals *normals=NULL);
float *InstanceNormal(int id, vtkNormals *normals=NULL);
float *ZNormal(int id, vtkNormals *normals=NULL);
//ETX
};
......
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