973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | #include <Vrml_MatrixTransform.ixx> |
15 | #include <gp_Pnt.hxx> |
16 | #include <gp_Dir.hxx> |
17 | #include <gp_Ax3.hxx> |
18 | #include <Precision.hxx> |
19 | |
b311480e |
20 | Vrml_MatrixTransform::Vrml_MatrixTransform() |
7fd59977 |
21 | { |
22 | // SetValues(me : in out; |
23 | // a11, a12, a13, a14, |
24 | // a21, a22, a23, a24, |
25 | // a31, a32, a33, a34 : Real; |
26 | // Tolang, TolDist : Real) |
27 | |
28 | gp_Trsf T; |
29 | T.SetValues ( 1, 0, 0, 0, |
30 | 0, 1, 0, 0, |
7a8c6a36 |
31 | 0, 0, 1, 0); |
7fd59977 |
32 | T.SetScaleFactor(1); |
33 | |
34 | myMatrix = T; |
35 | } |
36 | |
37 | Vrml_MatrixTransform::Vrml_MatrixTransform(const gp_Trsf& aMatrix) |
38 | { |
39 | myMatrix = aMatrix; |
40 | } |
41 | |
42 | void Vrml_MatrixTransform::SetMatrix(const gp_Trsf& aMatrix) |
43 | { |
44 | myMatrix = aMatrix; |
45 | } |
46 | |
47 | gp_Trsf Vrml_MatrixTransform::Matrix() const |
48 | { |
49 | return myMatrix; |
50 | } |
51 | |
52 | Standard_OStream& Vrml_MatrixTransform::Print(Standard_OStream& anOStream) const |
53 | { |
54 | Standard_Integer i,j; |
55 | anOStream << "MatrixTransform {" << endl; |
56 | |
57 | if ( Abs(myMatrix.Value(1,1) - 1) > 0.0000001 || Abs(myMatrix.Value(2,1) - 0) > 0.0000001 || Abs(myMatrix.Value(3,1) - 0) > 0.0000001 || |
58 | Abs(myMatrix.Value(1,2) - 0) > 0.0000001 || Abs(myMatrix.Value(2,2) - 1) > 0.0000001 || Abs(myMatrix.Value(3,2) - 0) > 0.0000001 || |
59 | Abs(myMatrix.Value(1,3) - 0) > 0.0000001 || Abs(myMatrix.Value(2,3) - 0) > 0.0000001 || Abs(myMatrix.Value(3,3) - 1) > 0.0000001 || |
60 | Abs(myMatrix.Value(1,4) - 0) > 0.0000001 || Abs(myMatrix.Value(2,4) - 0) > 0.0000001 || Abs(myMatrix.Value(3,4) - 0) > 0.0000001 ) |
61 | { |
62 | anOStream << " matrix" << '\t'; |
63 | |
64 | for ( j = 1; j <=4; j++ ) |
65 | { |
66 | for ( i = 1; i <=3; i++ ) |
67 | { |
68 | // Value (me; Row, Col : Integer) returns Real |
69 | anOStream << myMatrix.Value(i,j) << ' '; |
70 | } |
71 | if (j!=4) |
72 | { |
73 | anOStream << '0' << endl; |
74 | anOStream << "\t\t"; |
75 | } |
76 | else |
77 | { |
78 | anOStream << myMatrix.ScaleFactor() << endl; |
79 | } |
80 | } |
81 | } |
82 | anOStream << '}' << endl; |
83 | return anOStream; |
84 | } |