@@ -120,94 +120,94 @@ define([
120
120
* @return {localFrameToFixedFrameGenerator~resultat } The function that will computes a
121
121
* 4x4 transformation matrix from a reference frame, with first axis and second axis compliant with the parameters,
122
122
*/
123
- Transforms . localFrameToFixedFrameGenerator = function ( firstAxis , secondAxis ) {
124
- if ( ! vectorProductLocalFrame . hasOwnProperty ( firstAxis ) || ! vectorProductLocalFrame [ firstAxis ] . hasOwnProperty ( secondAxis ) ) {
125
- throw new DeveloperError ( 'firstAxis and secondAxis must be east, north, up, west, south or down.' ) ;
126
- }
127
- var thirdAxis = vectorProductLocalFrame [ firstAxis ] [ secondAxis ] ;
128
-
129
- /**
130
- * Computes a 4x4 transformation matrix from a reference frame
131
- * centered at the provided origin to the provided ellipsoid's fixed reference frame.
132
- * @callback Transforms~LocalFrameToFixedFrame
133
- * @param {Cartesian3 } origin The center point of the local reference frame.
134
- * @param {Ellipsoid } [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation.
135
- * @param {Matrix4 } [result] The object onto which to store the result.
136
- * @returns {Matrix4 } The modified result parameter or a new Matrix4 instance if none was provided.
137
- */
138
- var resultat ;
139
- var hashAxis = firstAxis + secondAxis ;
140
- if ( defined ( localFrameToFixedFrameCache [ hashAxis ] ) ) {
141
- resultat = localFrameToFixedFrameCache [ hashAxis ] ;
142
- } else {
143
- resultat = function ( origin , ellipsoid , result ) {
144
- //>>includeStart('debug', pragmas.debug);
145
- if ( ! defined ( origin ) ) {
146
- throw new DeveloperError ( 'origin is required.' ) ;
147
- }
148
- //>>includeEnd('debug');
149
- if ( ! defined ( result ) ) {
150
- result = new Matrix4 ( ) ;
151
- }
152
- // If x and y are zero, assume origin is at a pole, which is a special case.
153
- if ( CesiumMath . equalsEpsilon ( origin . x , 0.0 , CesiumMath . EPSILON14 ) && CesiumMath . equalsEpsilon ( origin . y , 0.0 , CesiumMath . EPSILON14 ) ) {
154
- var sign = CesiumMath . sign ( origin . z ) ;
155
-
156
- Cartesian3 . unpack ( degeneratePositionLocalFrame [ firstAxis ] , 0 , scratchFirstCartesian ) ;
157
- if ( firstAxis !== 'east' && firstAxis !== 'west' ) {
158
- Cartesian3 . multiplyByScalar ( scratchFirstCartesian , sign , scratchFirstCartesian ) ;
159
- }
160
-
161
- Cartesian3 . unpack ( degeneratePositionLocalFrame [ secondAxis ] , 0 , scratchSecondCartesian ) ;
162
- if ( secondAxis !== 'east' && secondAxis !== 'west' ) {
163
- Cartesian3 . multiplyByScalar ( scratchSecondCartesian , sign , scratchSecondCartesian ) ;
164
- }
165
-
166
- Cartesian3 . unpack ( degeneratePositionLocalFrame [ thirdAxis ] , 0 , scratchThirdCartesian ) ;
167
- if ( thirdAxis !== 'east' && thirdAxis !== 'west' ) {
168
- Cartesian3 . multiplyByScalar ( scratchThirdCartesian , sign , scratchThirdCartesian ) ;
169
- }
170
- } else {
171
- ellipsoid = defaultValue ( ellipsoid , Ellipsoid . WGS84 ) ;
172
- ellipsoid . geodeticSurfaceNormal ( origin , scratchCalculateCartesian . up ) ;
173
-
174
- var up = scratchCalculateCartesian . up ;
175
- var east = scratchCalculateCartesian . east ;
176
- east . x = - origin . y ;
177
- east . y = origin . x ;
178
- east . z = 0.0 ;
179
- Cartesian3 . normalize ( east , scratchCalculateCartesian . east ) ;
180
- Cartesian3 . cross ( up , east , scratchCalculateCartesian . north ) ;
181
-
182
- Cartesian3 . multiplyByScalar ( scratchCalculateCartesian . up , - 1 , scratchCalculateCartesian . down ) ;
183
- Cartesian3 . multiplyByScalar ( scratchCalculateCartesian . east , - 1 , scratchCalculateCartesian . west ) ;
184
- Cartesian3 . multiplyByScalar ( scratchCalculateCartesian . north , - 1 , scratchCalculateCartesian . south ) ;
185
-
186
- scratchFirstCartesian = scratchCalculateCartesian [ firstAxis ] ;
187
- scratchSecondCartesian = scratchCalculateCartesian [ secondAxis ] ;
188
- scratchThirdCartesian = scratchCalculateCartesian [ thirdAxis ] ;
189
- }
190
- result [ 0 ] = scratchFirstCartesian . x ;
191
- result [ 1 ] = scratchFirstCartesian . y ;
192
- result [ 2 ] = scratchFirstCartesian . z ;
193
- result [ 3 ] = 0.0 ;
194
- result [ 4 ] = scratchSecondCartesian . x ;
195
- result [ 5 ] = scratchSecondCartesian . y ;
196
- result [ 6 ] = scratchSecondCartesian . z ;
197
- result [ 7 ] = 0.0 ;
198
- result [ 8 ] = scratchThirdCartesian . x ;
199
- result [ 9 ] = scratchThirdCartesian . y ;
200
- result [ 10 ] = scratchThirdCartesian . z ;
201
- result [ 11 ] = 0.0 ;
202
- result [ 12 ] = origin . x ;
203
- result [ 13 ] = origin . y ;
204
- result [ 14 ] = origin . z ;
205
- result [ 15 ] = 1.0 ;
206
- return result ;
207
- } ;
208
- localFrameToFixedFrameCache [ hashAxis ] = resultat ;
209
- }
210
- return resultat ;
123
+ Transforms . localFrameToFixedFrameGenerator = function ( firstAxis , secondAxis ) {
124
+ if ( ! vectorProductLocalFrame . hasOwnProperty ( firstAxis ) || ! vectorProductLocalFrame [ firstAxis ] . hasOwnProperty ( secondAxis ) ) {
125
+ throw new DeveloperError ( 'firstAxis and secondAxis must be east, north, up, west, south or down.' ) ;
126
+ }
127
+ var thirdAxis = vectorProductLocalFrame [ firstAxis ] [ secondAxis ] ;
128
+
129
+ /**
130
+ * Computes a 4x4 transformation matrix from a reference frame
131
+ * centered at the provided origin to the provided ellipsoid's fixed reference frame.
132
+ * @callback Transforms~LocalFrameToFixedFrame
133
+ * @param {Cartesian3 } origin The center point of the local reference frame.
134
+ * @param {Ellipsoid } [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation.
135
+ * @param {Matrix4 } [result] The object onto which to store the result.
136
+ * @returns {Matrix4 } The modified result parameter or a new Matrix4 instance if none was provided.
137
+ */
138
+ var resultat ;
139
+ var hashAxis = firstAxis + secondAxis ;
140
+ if ( defined ( localFrameToFixedFrameCache [ hashAxis ] ) ) {
141
+ resultat = localFrameToFixedFrameCache [ hashAxis ] ;
142
+ } else {
143
+ resultat = function ( origin , ellipsoid , result ) {
144
+ //>>includeStart('debug', pragmas.debug);
145
+ if ( ! defined ( origin ) ) {
146
+ throw new DeveloperError ( 'origin is required.' ) ;
147
+ }
148
+ //>>includeEnd('debug');
149
+ if ( ! defined ( result ) ) {
150
+ result = new Matrix4 ( ) ;
151
+ }
152
+ // If x and y are zero, assume origin is at a pole, which is a special case.
153
+ if ( CesiumMath . equalsEpsilon ( origin . x , 0.0 , CesiumMath . EPSILON14 ) && CesiumMath . equalsEpsilon ( origin . y , 0.0 , CesiumMath . EPSILON14 ) ) {
154
+ var sign = CesiumMath . sign ( origin . z ) ;
155
+
156
+ Cartesian3 . unpack ( degeneratePositionLocalFrame [ firstAxis ] , 0 , scratchFirstCartesian ) ;
157
+ if ( firstAxis !== 'east' && firstAxis !== 'west' ) {
158
+ Cartesian3 . multiplyByScalar ( scratchFirstCartesian , sign , scratchFirstCartesian ) ;
159
+ }
160
+
161
+ Cartesian3 . unpack ( degeneratePositionLocalFrame [ secondAxis ] , 0 , scratchSecondCartesian ) ;
162
+ if ( secondAxis !== 'east' && secondAxis !== 'west' ) {
163
+ Cartesian3 . multiplyByScalar ( scratchSecondCartesian , sign , scratchSecondCartesian ) ;
164
+ }
165
+
166
+ Cartesian3 . unpack ( degeneratePositionLocalFrame [ thirdAxis ] , 0 , scratchThirdCartesian ) ;
167
+ if ( thirdAxis !== 'east' && thirdAxis !== 'west' ) {
168
+ Cartesian3 . multiplyByScalar ( scratchThirdCartesian , sign , scratchThirdCartesian ) ;
169
+ }
170
+ } else {
171
+ ellipsoid = defaultValue ( ellipsoid , Ellipsoid . WGS84 ) ;
172
+ ellipsoid . geodeticSurfaceNormal ( origin , scratchCalculateCartesian . up ) ;
173
+
174
+ var up = scratchCalculateCartesian . up ;
175
+ var east = scratchCalculateCartesian . east ;
176
+ east . x = - origin . y ;
177
+ east . y = origin . x ;
178
+ east . z = 0.0 ;
179
+ Cartesian3 . normalize ( east , scratchCalculateCartesian . east ) ;
180
+ Cartesian3 . cross ( up , east , scratchCalculateCartesian . north ) ;
181
+
182
+ Cartesian3 . multiplyByScalar ( scratchCalculateCartesian . up , - 1 , scratchCalculateCartesian . down ) ;
183
+ Cartesian3 . multiplyByScalar ( scratchCalculateCartesian . east , - 1 , scratchCalculateCartesian . west ) ;
184
+ Cartesian3 . multiplyByScalar ( scratchCalculateCartesian . north , - 1 , scratchCalculateCartesian . south ) ;
185
+
186
+ scratchFirstCartesian = scratchCalculateCartesian [ firstAxis ] ;
187
+ scratchSecondCartesian = scratchCalculateCartesian [ secondAxis ] ;
188
+ scratchThirdCartesian = scratchCalculateCartesian [ thirdAxis ] ;
189
+ }
190
+ result [ 0 ] = scratchFirstCartesian . x ;
191
+ result [ 1 ] = scratchFirstCartesian . y ;
192
+ result [ 2 ] = scratchFirstCartesian . z ;
193
+ result [ 3 ] = 0.0 ;
194
+ result [ 4 ] = scratchSecondCartesian . x ;
195
+ result [ 5 ] = scratchSecondCartesian . y ;
196
+ result [ 6 ] = scratchSecondCartesian . z ;
197
+ result [ 7 ] = 0.0 ;
198
+ result [ 8 ] = scratchThirdCartesian . x ;
199
+ result [ 9 ] = scratchThirdCartesian . y ;
200
+ result [ 10 ] = scratchThirdCartesian . z ;
201
+ result [ 11 ] = 0.0 ;
202
+ result [ 12 ] = origin . x ;
203
+ result [ 13 ] = origin . y ;
204
+ result [ 14 ] = origin . z ;
205
+ result [ 15 ] = 1.0 ;
206
+ return result ;
207
+ } ;
208
+ localFrameToFixedFrameCache [ hashAxis ] = resultat ;
209
+ }
210
+ return resultat ;
211
211
} ;
212
212
213
213
/**
0 commit comments