15 #include "eggTransform.h" 25 _is_transform_2d(true),
37 _is_transform_2d(copy._is_transform_2d),
38 _components(copy._components),
39 _transform(copy._transform)
50 _is_transform_2d = copy._is_transform_2d;
51 _components = copy._components;
52 _transform = copy._transform;
73 _components.push_back(Component(CT_translate2d));
74 _components.back()._vec2 =
new LVecBase2d(translate);
87 _is_transform_2d =
false;
88 _components.push_back(Component(CT_translate3d));
89 _components.back()._vec3 =
new LVecBase3d(translate);
103 _components.push_back(Component(CT_rotate2d, angle));
117 _is_transform_2d =
false;
118 _components.push_back(Component(CT_rotx, angle));
132 _is_transform_2d =
false;
133 _components.push_back(Component(CT_roty, angle));
147 _is_transform_2d =
false;
148 _components.push_back(Component(CT_rotz, angle));
162 _is_transform_2d =
false;
164 _components.push_back(Component(CT_rotate3d, angle));
165 _components.back()._vec3 =
new LVecBase3d(normaxis);
179 _is_transform_2d =
false;
192 _is_transform_2d =
false;
193 _components.push_back(Component(CT_scale2d));
194 _components.back()._vec2 =
new LVecBase2d(scale);
207 _is_transform_2d =
false;
208 _components.push_back(Component(CT_scale3d));
209 _components.back()._vec3 =
new LVecBase3d(scale);
221 _components.push_back(Component(CT_uniform_scale, scale));
233 write(ostream &out,
int indent_level,
const string &label)
const {
234 indent(out, indent_level) << label <<
" {\n";
237 for (
int i = 0; i < num_components; i++) {
240 indent(out, indent_level + 2)
245 indent(out, indent_level + 2)
250 indent(out, indent_level + 2)
255 indent(out, indent_level + 2)
260 indent(out, indent_level + 2)
265 indent(out, indent_level + 2)
270 indent(out, indent_level + 2)
276 indent(out, indent_level + 2)
281 indent(out, indent_level + 2)
285 case CT_uniform_scale:
286 indent(out, indent_level + 2)
291 indent(out, indent_level + 2) <<
"<Matrix3> {\n";
293 indent(out, indent_level + 2) <<
"}\n";
297 indent(out, indent_level + 2) <<
"<Matrix4> {\n";
299 indent(out, indent_level + 2) <<
"}\n";
308 indent(out, indent_level) <<
"}\n";
318 internal_clear_transform() {
319 _is_transform_2d =
true;
331 internal_add_matrix(
const LMatrix3d &mat) {
332 _components.push_back(Component(CT_matrix3));
333 _components.back()._mat3 =
new LMatrix3d(mat);
334 LMatrix4d mat4(mat(0, 0), mat(0, 1), 0.0, mat(0, 2),
335 mat(1, 0), mat(1, 1), 0.0, mat(1, 2),
337 mat(2, 0), mat(2, 1), 0.0, mat(2, 2));
348 internal_add_matrix(
const LMatrix4d &mat) {
349 _is_transform_2d =
false;
350 _components.push_back(Component(CT_matrix4));
351 _components.back()._mat4 =
new LMatrix4d(mat);
364 transform_changed() {
LVector3d get_axis() const
This, along with get_angle(), returns the rotation represented by the quaternion as an angle about an...
double get_angle() const
This, along with get_axis(), returns the rotation represented by the quaternion as an angle about an ...
This is a 4-by-4 transform matrix.
static LMatrix4d rotate_mat(double angle, const LVecBase3d &axis, CoordinateSystem cs=CS_default)
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vect...
This is a two-component vector offset.
This is the base class for all two-component vectors and points.
This is the base quaternion class.
static LMatrix4d scale_mat(const LVecBase3d &scale)
Returns a matrix that applies the indicated scale in each of the three axes.
static LMatrix4d translate_mat(const LVecBase3d &trans)
Returns a matrix that applies the indicated translation.
This is a 3-by-3 transform matrix.
static const LMatrix4d & ident_mat()
Returns an identity matrix.
static LMatrix4d rotate_mat_normaxis(double angle, const LVecBase3d &axis, CoordinateSystem cs=CS_default)
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vect...
This is the base class for all three-component vectors and points.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...