7 |
|
|
8 |
namespace gr2lib.core.coretypes.implementation |
namespace gr2lib.core.coretypes.implementation |
9 |
{ |
{ |
10 |
|
/// <summary> |
11 |
|
/// Transform class |
12 |
|
/// </summary> |
13 |
public class Transform : ITransform |
public class Transform : ITransform |
14 |
{ |
{ |
15 |
|
/// <summary> |
16 |
|
/// default constructor |
17 |
|
/// </summary> |
18 |
public Transform() |
public Transform() |
19 |
{ |
{ |
20 |
this.Initialize(); |
this.Initialize(); |
26 |
{ |
{ |
27 |
this.MakeIdentity(); |
this.MakeIdentity(); |
28 |
} |
} |
29 |
|
/// <summary> |
30 |
|
/// Gets string representation |
31 |
|
/// </summary> |
32 |
|
/// <returns></returns> |
33 |
public override string ToString() |
public override string ToString() |
34 |
{ |
{ |
35 |
StringBuilder builder = new StringBuilder(); |
StringBuilder builder = new StringBuilder(); |
72 |
} |
} |
73 |
|
|
74 |
#region ITransform Members |
#region ITransform Members |
75 |
|
/// <summary> |
76 |
|
/// ToMatrix44 |
77 |
|
/// </summary> |
78 |
|
/// <returns></returns> |
79 |
public Matrix44 ToMatrix44() |
public Matrix44 ToMatrix44() |
80 |
{ |
{ |
81 |
Matrix33 rotator = this.Rotation.Inverse().ToMatrix33(); |
Matrix33 rotator = this.Rotation.Inverse().ToMatrix33(); |
84 |
result.pos = this.Origin.P4; |
result.pos = this.Origin.P4; |
85 |
return result; |
return result; |
86 |
} |
} |
87 |
|
/// <summary> |
88 |
|
/// ToMatrix44EA |
89 |
|
/// </summary> |
90 |
|
/// <returns></returns> |
91 |
public Matrix44 ToMatrix44EA() |
public Matrix44 ToMatrix44EA() |
92 |
{ |
{ |
93 |
Matrix33 rotator = this.Rotation.Inverse().ToMatrix33EA(); |
Matrix33 rotator = this.Rotation.Inverse().ToMatrix33EA(); |
96 |
result.pos = this.Origin.P4; |
result.pos = this.Origin.P4; |
97 |
return result; |
return result; |
98 |
} |
} |
99 |
|
/// <summary> |
100 |
|
/// MakeIdentity |
101 |
|
/// </summary> |
102 |
public void MakeIdentity() |
public void MakeIdentity() |
103 |
{ |
{ |
104 |
this.Dimensions = 7; |
this.Dimensions = 7; |
107 |
this.Scale = Matrix33.CopyMatrix(Matrix33.Identity); |
this.Scale = Matrix33.CopyMatrix(Matrix33.Identity); |
108 |
this.Matrix = Matrix44.CopyMatrix(Matrix44.Identity); |
this.Matrix = Matrix44.CopyMatrix(Matrix44.Identity); |
109 |
} |
} |
110 |
|
/// <summary> |
111 |
|
/// MakeIdentity |
112 |
|
/// </summary> |
113 |
|
/// <param name="t">the transform to return</param> |
114 |
public void MakeIdentity(out Transform t) |
public void MakeIdentity(out Transform t) |
115 |
{ |
{ |
116 |
t = new Transform(); |
t = new Transform(); |
126 |
private Quaternion _Rotation; |
private Quaternion _Rotation; |
127 |
private Matrix33 _Scale; |
private Matrix33 _Scale; |
128 |
private Matrix44 _Matrix; |
private Matrix44 _Matrix; |
129 |
|
/// <summary> |
130 |
|
/// Dimensions |
131 |
|
/// </summary> |
132 |
public Int32 Dimensions { get { return _Dimensions; } set { _Dimensions = value; } } |
public Int32 Dimensions { get { return _Dimensions; } set { _Dimensions = value; } } |
133 |
|
/// <summary> |
134 |
|
/// Origin |
135 |
|
/// </summary> |
136 |
public Vector3 Origin { get { return _Origin; } set { _Origin = value; } } |
public Vector3 Origin { get { return _Origin; } set { _Origin = value; } } |
137 |
|
/// <summary> |
138 |
|
/// Rotation |
139 |
|
/// </summary> |
140 |
public Quaternion Rotation { get { return _Rotation; } set { _Rotation = value; } } |
public Quaternion Rotation { get { return _Rotation; } set { _Rotation = value; } } |
141 |
|
/// <summary> |
142 |
|
/// Scale |
143 |
|
/// </summary> |
144 |
public Matrix33 Scale { get { return _Scale; } set { _Scale = value; } } |
public Matrix33 Scale { get { return _Scale; } set { _Scale = value; } } |
145 |
|
/// <summary> |
146 |
|
/// Matrix |
147 |
|
/// </summary> |
148 |
public Matrix44 Matrix { get { return _Matrix; } set { _Matrix = value; } } |
public Matrix44 Matrix { get { return _Matrix; } set { _Matrix = value; } } |
149 |
#endregion |
#endregion |
150 |
} |
} |