00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00031
#ifndef __vtkGeneralTransform_h
00032
#define __vtkGeneralTransform_h
00033
00034
#include "vtkAbstractTransform.h"
00035
00036
#include "vtkMatrix4x4.h"
00037
00038 class VTK_COMMON_EXPORT vtkGeneralTransform :
public vtkAbstractTransform
00039 {
00040
public:
00041
static vtkGeneralTransform *
New();
00042
00043 vtkTypeRevisionMacro(vtkGeneralTransform,
vtkAbstractTransform);
00044
void PrintSelf(ostream& os,
vtkIndent indent);
00045
00049 void Identity() { this->Concatenation->Identity(); this->
Modified(); };
00050
00054 void Inverse() { this->Concatenation->Inverse(); this->
Modified(); };
00055
00057
00059 void Translate(
double x,
double y,
double z) {
00060 this->Concatenation->Translate(x,y,z); };
00061 void Translate(
const double x[3]) { this->Translate(x[0], x[1], x[2]); };
00062 void Translate(
const float x[3]) { this->Translate(x[0], x[1], x[2]); };
00064
00066
00070 void RotateWXYZ(
double angle,
double x,
double y,
double z) {
00071 this->Concatenation->Rotate(angle,x,y,z); };
00072 void RotateWXYZ(
double angle,
const double axis[3]) {
00073 this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00074 void RotateWXYZ(
double angle,
const float axis[3]) {
00075 this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00077
00079
00082 void RotateX(
double angle) { this->RotateWXYZ(angle, 1, 0, 0); };
00083 void RotateY(
double angle) { this->RotateWXYZ(angle, 0, 1, 0); };
00084 void RotateZ(
double angle) { this->RotateWXYZ(angle, 0, 0, 1); };
00086
00088
00091 void Scale(
double x,
double y,
double z) {
00092 this->Concatenation->Scale(x,y,z); };
00093 void Scale(
const double s[3]) { this->Scale(s[0], s[1], s[2]); };
00094 void Scale(
const float s[3]) { this->Scale(s[0], s[1], s[2]); };
00096
00098
00100 void Concatenate(
vtkMatrix4x4 *matrix) {
00101 this->Concatenate(*matrix->
Element); };
00102 void Concatenate(
const double elements[16]) {
00103 this->Concatenation->Concatenate(elements); };
00105
00111
void Concatenate(
vtkAbstractTransform *transform);
00112
00114
00119 void PreMultiply() {
00120
if (this->Concatenation->GetPreMultiplyFlag()) {
return; }
00121 this->Concatenation->SetPreMultiplyFlag(1); this->
Modified(); };
00123
00125
00130 void PostMultiply() {
00131
if (!this->Concatenation->GetPreMultiplyFlag()) {
return; }
00132 this->Concatenation->SetPreMultiplyFlag(0); this->
Modified(); };
00134
00136
00138 int GetNumberOfConcatenatedTransforms() {
00139
return this->Concatenation->GetNumberOfTransforms() +
00140 (this->Input == NULL ? 0 : 1); };
00142
00144
00149 vtkAbstractTransform *GetConcatenatedTransform(
int i) {
00150
if (this->Input == NULL) {
00151
return this->Concatenation->GetTransform(i); }
00152
else if (i < this->Concatenation->GetNumberOfPreTransforms()) {
00153
return this->Concatenation->GetTransform(i); }
00154
else if (i > this->Concatenation->GetNumberOfPreTransforms()) {
00155
return this->Concatenation->GetTransform(i-1); }
00156
else if (this->GetInverseFlag()) {
00157
return this->Input->GetInverse(); }
00158
else {
00159
return this->Input; } };
00161
00163
00169
void SetInput(
vtkAbstractTransform *input);
00170 vtkAbstractTransform *GetInput() {
return this->Input; };
00172
00174
00178 int GetInverseFlag() {
00179
return this->Concatenation->GetInverseFlag(); };
00181
00183
00184 void Push() {
if (this->Stack == NULL) {
00185 this->Stack =
vtkTransformConcatenationStack::New(); }
00186 this->Stack->Push(&this->Concatenation);
00187 this->
Modified(); };
00189
00191
00193 void Pop() {
if (this->Stack == NULL) {
return; }
00194 this->Stack->Pop(&this->Concatenation);
00195 this->
Modified(); };
00197
00199
00201
void InternalTransformPoint(
const float in[3],
float out[3]);
00202
void InternalTransformPoint(
const double in[3],
double out[3]);
00204
00206
00208
void InternalTransformDerivative(
const float in[3],
float out[3],
00209
float derivative[3][3]);
00210
void InternalTransformDerivative(
const double in[3],
double out[3],
00211
double derivative[3][3]);
00213
00220
int CircuitCheck(
vtkAbstractTransform *transform);
00221
00223
vtkAbstractTransform *
MakeTransform();
00224
00226
unsigned long GetMTime();
00227
00228
protected:
00229 vtkGeneralTransform();
00230 ~vtkGeneralTransform();
00231
00232
void InternalDeepCopy(
vtkAbstractTransform *t);
00233
void InternalUpdate();
00234
00235 vtkAbstractTransform *Input;
00236 vtkTransformConcatenation *Concatenation;
00237 vtkTransformConcatenationStack *Stack;
00238
private:
00239 vtkGeneralTransform(
const vtkGeneralTransform&);
00240
void operator=(
const vtkGeneralTransform&);
00241 };
00242
00243
00244
#endif
00245
00246
00247
00248
00249