1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
// File gp_GTrsf2d.lxx JCV 08/01/1991
#include <gp_Trsf2d.hxx>
#include <Standard_OutOfRange.hxx>
inline gp_GTrsf2d::gp_GTrsf2d ()
{
shape = gp_Identity;
matrix.SetScale (1.0);
loc.SetCoord (0.0, 0.0);
scale = 1.0;
}
inline gp_GTrsf2d::gp_GTrsf2d (const gp_Trsf2d& T)
{
shape = T.shape;
matrix = T.matrix;
loc = T.loc;
scale = T.scale;
}
inline gp_GTrsf2d::gp_GTrsf2d (const gp_Mat2d& M,
const gp_XY& V) :
matrix(M),
loc(V)
{ shape = gp_Other; scale = 0.0; }
inline void gp_GTrsf2d::SetValue (const Standard_Integer Row,
const Standard_Integer Col,
const Standard_Real Value)
{
Standard_OutOfRange_Raise_if
(Row < 1 || Row > 2 || Col < 1 || Col > 3, " ");
if (Col == 3) loc.SetCoord (Row, Value);
else matrix.SetValue (Row, Col, Value);
shape = gp_Other;
}
inline void gp_GTrsf2d::SetTrsf2d (const gp_Trsf2d& T)
{
shape = T.shape;
matrix = T.matrix;
loc = T.loc;
scale = T.scale;
}
inline void gp_GTrsf2d::SetVectorialPart (const gp_Mat2d& Matrix)
{ matrix = Matrix; shape = gp_Other; scale = 0.0; }
inline Standard_Boolean gp_GTrsf2d::IsNegative () const
{ return matrix.Determinant() < 0.0; }
inline Standard_Boolean gp_GTrsf2d::IsSingular () const
{ return matrix.IsSingular(); }
inline const gp_Mat2d& gp_GTrsf2d::VectorialPart () const
{ return matrix; }
inline Standard_Real gp_GTrsf2d::Value (const Standard_Integer Row,
const Standard_Integer Col) const
{
Standard_OutOfRange_Raise_if
(Row < 1 || Row > 2 || Col < 1 || Col > 3, " ");
if (Col == 3) return loc.Coord (Row);
if (shape == gp_Other) return matrix.Value (Row, Col);
return scale * matrix.Value (Row, Col);
}
inline gp_TrsfForm gp_GTrsf2d::Form () const
{ return shape; }
inline const gp_XY& gp_GTrsf2d::TranslationPart () const
{ return loc; }
inline gp_GTrsf2d gp_GTrsf2d::Inverted () const
{
gp_GTrsf2d T = *this;
T.Invert ();
return T;
}
inline gp_GTrsf2d gp_GTrsf2d::Multiplied (const gp_GTrsf2d& T) const
{
gp_GTrsf2d Tres = *this;
Tres.Multiply (T);
return Tres;
}
inline gp_GTrsf2d gp_GTrsf2d::Powered (const Standard_Integer N) const
{
gp_GTrsf2d T = *this;
T.Power (N);
return T;
}
inline void gp_GTrsf2d::Transforms (gp_XY& Coord) const
{
Coord.Multiply (matrix);
if (!(shape == gp_Other) && !(scale == 1.0)) Coord.Multiply (scale);
Coord.Add(loc);
}
inline gp_XY gp_GTrsf2d::Transformed(const gp_XY& Coord) const
{
gp_XY newCoord = Coord;
Transforms(newCoord);
return newCoord;
}
inline void gp_GTrsf2d::Transforms (Standard_Real& X,
Standard_Real& Y) const
{
gp_XY Doublet (X, Y);
Doublet.Multiply (matrix);
if (!(shape == gp_Other) && !(scale == 1.0)) Doublet.Multiply (scale);
Doublet.Add(loc);
Doublet.Coord (X, Y);
}
|