Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
VTK
VTK
Commits
592897b0
Commit
592897b0
authored
Mar 03, 1994
by
Ken Martin
Browse files
Added some methods and fixed some minor errors
parent
53406cf8
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/Trans.hh
View file @
592897b0
...
...
@@ -45,6 +45,8 @@ class vlTransform : public vlObject
// the stack is the current transformation matrix.
vlMatrix4x4
**
StackBottom
;
// The bottom of the stack.
float
Vector
[
4
];
// a temp vector used in operations
public:
vlTransform
();
// Constructs a transform. Sets the following defaults:
...
...
@@ -130,6 +132,13 @@ class vlTransform : public vlObject
// Multiplies two 4 x 4 matrices and produces a
// 4 x 4 matrix. The output matrix can be the
// same as either of the two input matrices.
void
VectorMultiply
(
float
in
[
4
],
float
out
[
4
])
{
this
->
Stack
[
0
]
->
VectorMultiply
(
in
,
out
);};
// Multiplies two 4 x 4 matrices and produces a
// 4 x 4 matrix. The output matrix can be the
// same as either of the two input matrices.
vlSetVector4Macro
(
Vector
,
float
);
float
*
GetVector
();
};
#endif
src/Trans.cc
View file @
592897b0
...
...
@@ -191,9 +191,6 @@ void vlTransform::RotateWXYZ ( float angle, float x, float y, float z)
vlMatrix4x4
ctm
;
float
radians
;
float
w
;
float
x
;
float
y
;
float
z
;
float
sum
;
float
quat
[
4
];
float
sin_angle
;
...
...
@@ -214,17 +211,21 @@ void vlTransform::RotateWXYZ ( float angle, float x, float y, float z)
sin_angle
=
sin
(
radians
);
// normalize x, y, z
if
(
sum
=
quat
[
1
]
*
quat
[
1
]
+
quat
[
2
]
*
quat
[
2
]
+
quat
[
3
]
*
quat
[
3
])
{
if
(
sum
=
quat
[
1
]
*
quat
[
1
]
+
quat
[
2
]
*
quat
[
2
]
+
quat
[
3
]
*
quat
[
3
])
{
quat
[
1
]
*=
sin_angle
/
sqrt
(
sum
);
quat
[
2
]
*=
sin_angle
/
sqrt
(
sum
);
quat
[
3
]
*=
sin_angle
/
sqrt
(
sum
);
}
else
{
}
else
{
return
;
}
}
w
=
cos_angle
;
x
=
quat
[
1
];
y
=
quat
[
2
];
z
=
quat
[
3
];
ctm
=
0.0
;
...
...
@@ -538,3 +539,8 @@ void vlTransform::PrintSelf (ostream& os, vlIndent indent)
}
}
float
*
vlTransform
::
GetVector
()
{
this
->
Stack
[
0
]
->
VectorMultiply
(
this
->
Vector
,
this
->
Vector
);
return
this
->
Vector
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment