Panda3D
animChannel.cxx
1 // Filename: animChannel.cxx
2 // Created by: drose (11May00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 #include "animChannel.h"
17 
18 #include "compose_matrix.h"
19 
20 // Tell GCC that we'll take care of the instantiation explicitly here.
21 #ifdef __GNUC__
22 #pragma implementation
23 #endif
24 
25 ////////////////////////////////////////////////////////////////////
26 // Function: ACMatrixSwitchType::output_value
27 // Access: Public, Static
28 // Description: Outputs a very brief description of a matrix.
29 ////////////////////////////////////////////////////////////////////
31 output_value(ostream &out, const ACMatrixSwitchType::ValueType &value) {
32  LVecBase3 scale, shear, hpr, translate;
33  if (decompose_matrix(value, scale, shear, hpr, translate)) {
34  if (!scale.almost_equal(LVecBase3(1.0f, 1.0f, 1.0f))) {
35  if (IS_NEARLY_EQUAL(scale[0], scale[1]) &&
36  IS_NEARLY_EQUAL(scale[1], scale[2])) {
37  out << " scale " << scale[0];
38  } else {
39  out << " scale " << scale;
40  }
41  }
42  if (!shear.almost_equal(LVecBase3(0.0f, 0.0f, 0.0f))) {
43  out << " shear " << shear;
44  }
45 
46  if (!hpr.almost_equal(LVecBase3(0.0f, 0.0f, 0.0f))) {
47  out << " hpr " << hpr;
48  }
49 
50  if (!translate.almost_equal(LVecBase3(0.0f, 0.0f, 0.0f))) {
51  out << " trans " << translate;
52  }
53 
54  } else {
55  out << " mat " << value;
56  }
57 }
58 
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
static void output_value(ostream &out, const ValueType &value)
Outputs a very brief description of a matrix.
Definition: animChannel.cxx:31
bool almost_equal(const LVecBase3f &other, float threshold) const
Returns true if two vectors are memberwise equal within a specified tolerance.
Definition: lvecBase3.h:1280
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:451