MCPcopy
hub / github.com/CesiumGS/cesium / normalize

Method normalize

packages/engine/Source/Core/Cartesian2.js:357–375  ·  view source on GitHub ↗

* Computes the normalized form of the supplied Cartesian. * * @param {Cartesian2} cartesian The Cartesian to be normalized. * @param {Cartesian2} result The object onto which to store the result. * @returns {Cartesian2} The modified result parameter.

(cartesian, result)

Source from the content-addressed store, hash-verified

355 * @returns {Cartesian2} The modified result parameter.
356 */
357 static normalize(cartesian, result) {
358 //>>includeStart('debug', pragmas.debug);
359 Check.typeOf.object("cartesian", cartesian);
360 Check.typeOf.object("result", result);
361 //>>includeEnd('debug');
362
363 const magnitude = Cartesian2.magnitude(cartesian);
364
365 result.x = cartesian.x / magnitude;
366 result.y = cartesian.y / magnitude;
367
368 //>>includeStart('debug', pragmas.debug);
369 if (isNaN(result.x) || isNaN(result.y)) {
370 throw new DeveloperError("normalized result is not a number");
371 }
372 //>>includeEnd('debug');
373
374 return result;
375 }
376
377 /**
378 * Computes the dot (scalar) product of two Cartesians.

Callers 15

setCameraFunction · 0.45
setSunAndMoonDirectionsFunction · 0.45
UniformState.jsFile · 0.45
I3SGeometry.jsFile · 0.45
MetadataPicking.jsFile · 0.45
normalizeFunction · 0.45
MetadataEntity.jsFile · 0.45
handleZoomFunction · 0.45
translate2DFunction · 0.45
twist2DFunction · 0.45

Calls 2

objectMethod · 0.80
magnitudeMethod · 0.45

Tested by

no test coverage detected