From 9b4562281dd75d79cfa90a0c72dc9c77ea174b9f Mon Sep 17 00:00:00 2001 From: Anne Gropler Date: Thu, 1 Aug 2024 09:59:32 +0200 Subject: [PATCH] use scratch variable for time parameter --- packages/engine/Source/DataSources/CallbackProperty.js | 4 +++- .../Source/DataSources/CheckerboardMaterialProperty.js | 4 +++- packages/engine/Source/DataSources/ColorMaterialProperty.js | 4 +++- .../engine/Source/DataSources/CompositeMaterialProperty.js | 4 +++- .../engine/Source/DataSources/CompositePositionProperty.js | 4 +++- packages/engine/Source/DataSources/CompositeProperty.js | 6 ++++-- .../engine/Source/DataSources/ConstantPositionProperty.js | 4 +++- packages/engine/Source/DataSources/GridMaterialProperty.js | 4 +++- packages/engine/Source/DataSources/ImageMaterialProperty.js | 4 +++- packages/engine/Source/DataSources/MaterialProperty.js | 6 ++++-- .../engine/Source/DataSources/NodeTransformationProperty.js | 4 +++- .../Source/DataSources/PolylineArrowMaterialProperty.js | 4 +++- .../Source/DataSources/PolylineDashMaterialProperty.js | 4 +++- .../Source/DataSources/PolylineGlowMaterialProperty.js | 4 +++- .../Source/DataSources/PolylineOutlineMaterialProperty.js | 4 +++- packages/engine/Source/DataSources/PositionProperty.js | 2 +- packages/engine/Source/DataSources/PositionPropertyArray.js | 4 +++- packages/engine/Source/DataSources/PropertyArray.js | 4 +++- packages/engine/Source/DataSources/PropertyBag.js | 4 +++- packages/engine/Source/DataSources/ReferenceProperty.js | 4 +++- .../engine/Source/DataSources/SampledPositionProperty.js | 4 +++- packages/engine/Source/DataSources/SampledProperty.js | 4 +++- .../engine/Source/DataSources/ScaledPositionProperty.js | 4 +++- .../engine/Source/DataSources/StripeMaterialProperty.js | 4 +++- packages/engine/Source/DataSources/TerrainOffsetProperty.js | 4 +++- .../DataSources/TimeIntervalCollectionPositionProperty.js | 4 +++- .../Source/DataSources/TimeIntervalCollectionProperty.js | 4 +++- .../Source/DataSources/VelocityOrientationProperty.js | 3 ++- .../engine/Source/DataSources/VelocityVectorProperty.js | 3 ++- 29 files changed, 85 insertions(+), 31 deletions(-) diff --git a/packages/engine/Source/DataSources/CallbackProperty.js b/packages/engine/Source/DataSources/CallbackProperty.js index d7c0c829b8a2..3611241ed407 100644 --- a/packages/engine/Source/DataSources/CallbackProperty.js +++ b/packages/engine/Source/DataSources/CallbackProperty.js @@ -47,6 +47,8 @@ Object.defineProperties(CallbackProperty.prototype, { }, }); +const timeScratch = new JulianDate(); + /** * Gets the value of the property. * @@ -56,7 +58,7 @@ Object.defineProperties(CallbackProperty.prototype, { */ CallbackProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } return this._callback(time, result); }; diff --git a/packages/engine/Source/DataSources/CheckerboardMaterialProperty.js b/packages/engine/Source/DataSources/CheckerboardMaterialProperty.js index 83ff33ea6a77..4dfc5c297e18 100644 --- a/packages/engine/Source/DataSources/CheckerboardMaterialProperty.js +++ b/packages/engine/Source/DataSources/CheckerboardMaterialProperty.js @@ -106,6 +106,8 @@ CheckerboardMaterialProperty.prototype.getType = function (time) { return "Checkerboard"; }; +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -115,7 +117,7 @@ CheckerboardMaterialProperty.prototype.getType = function (time) { */ CheckerboardMaterialProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } if (!defined(result)) { result = {}; diff --git a/packages/engine/Source/DataSources/ColorMaterialProperty.js b/packages/engine/Source/DataSources/ColorMaterialProperty.js index bd7a7005c464..26928fad14c4 100644 --- a/packages/engine/Source/DataSources/ColorMaterialProperty.js +++ b/packages/engine/Source/DataSources/ColorMaterialProperty.js @@ -70,6 +70,8 @@ ColorMaterialProperty.prototype.getType = function (time) { return "Color"; }; +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -79,7 +81,7 @@ ColorMaterialProperty.prototype.getType = function (time) { */ ColorMaterialProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } if (!defined(result)) { result = {}; diff --git a/packages/engine/Source/DataSources/CompositeMaterialProperty.js b/packages/engine/Source/DataSources/CompositeMaterialProperty.js index 71b2e84b29ea..303d90c90c46 100644 --- a/packages/engine/Source/DataSources/CompositeMaterialProperty.js +++ b/packages/engine/Source/DataSources/CompositeMaterialProperty.js @@ -83,6 +83,8 @@ CompositeMaterialProperty.prototype.getType = function (time) { return undefined; }; +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -92,7 +94,7 @@ CompositeMaterialProperty.prototype.getType = function (time) { */ CompositeMaterialProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } const innerProperty = this._composite._intervals.findDataForIntervalContainingDate( diff --git a/packages/engine/Source/DataSources/CompositePositionProperty.js b/packages/engine/Source/DataSources/CompositePositionProperty.js index 24744b533b9d..202b6fe43026 100644 --- a/packages/engine/Source/DataSources/CompositePositionProperty.js +++ b/packages/engine/Source/DataSources/CompositePositionProperty.js @@ -83,6 +83,8 @@ Object.defineProperties(CompositePositionProperty.prototype, { }, }); +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time in the fixed frame. * @@ -92,7 +94,7 @@ Object.defineProperties(CompositePositionProperty.prototype, { */ CompositePositionProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result); }; diff --git a/packages/engine/Source/DataSources/CompositeProperty.js b/packages/engine/Source/DataSources/CompositeProperty.js index ee23394d3cc7..4af69c9f0eed 100644 --- a/packages/engine/Source/DataSources/CompositeProperty.js +++ b/packages/engine/Source/DataSources/CompositeProperty.js @@ -1,7 +1,7 @@ -import { JulianDate } from "@cesium/engine"; import defined from "../Core/defined.js"; import Event from "../Core/Event.js"; import EventHelper from "../Core/EventHelper.js"; +import JulianDate from "../Core/JulianDate.js"; import TimeIntervalCollection from "../Core/TimeIntervalCollection.js"; import Property from "./Property.js"; @@ -103,6 +103,8 @@ Object.defineProperties(CompositeProperty.prototype, { }, }); +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -112,7 +114,7 @@ Object.defineProperties(CompositeProperty.prototype, { */ CompositeProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } const innerProperty = this._intervals.findDataForIntervalContainingDate(time); diff --git a/packages/engine/Source/DataSources/ConstantPositionProperty.js b/packages/engine/Source/DataSources/ConstantPositionProperty.js index 8cf47910999e..b2a436383bf5 100644 --- a/packages/engine/Source/DataSources/ConstantPositionProperty.js +++ b/packages/engine/Source/DataSources/ConstantPositionProperty.js @@ -66,6 +66,8 @@ Object.defineProperties(ConstantPositionProperty.prototype, { }, }); +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time in the fixed frame. * @@ -75,7 +77,7 @@ Object.defineProperties(ConstantPositionProperty.prototype, { */ ConstantPositionProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result); }; diff --git a/packages/engine/Source/DataSources/GridMaterialProperty.js b/packages/engine/Source/DataSources/GridMaterialProperty.js index b3c33791f145..77ea417ec67c 100644 --- a/packages/engine/Source/DataSources/GridMaterialProperty.js +++ b/packages/engine/Source/DataSources/GridMaterialProperty.js @@ -135,6 +135,8 @@ GridMaterialProperty.prototype.getType = function (time) { return "Grid"; }; +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -144,7 +146,7 @@ GridMaterialProperty.prototype.getType = function (time) { */ GridMaterialProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } if (!defined(result)) { result = {}; diff --git a/packages/engine/Source/DataSources/ImageMaterialProperty.js b/packages/engine/Source/DataSources/ImageMaterialProperty.js index 5d7b249fb5fb..97f00224bc02 100644 --- a/packages/engine/Source/DataSources/ImageMaterialProperty.js +++ b/packages/engine/Source/DataSources/ImageMaterialProperty.js @@ -115,6 +115,8 @@ ImageMaterialProperty.prototype.getType = function (time) { return "Image"; }; +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -124,7 +126,7 @@ ImageMaterialProperty.prototype.getType = function (time) { */ ImageMaterialProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } if (!defined(result)) { diff --git a/packages/engine/Source/DataSources/MaterialProperty.js b/packages/engine/Source/DataSources/MaterialProperty.js index 0dc7058b8896..0c2ec6f866a5 100644 --- a/packages/engine/Source/DataSources/MaterialProperty.js +++ b/packages/engine/Source/DataSources/MaterialProperty.js @@ -63,7 +63,7 @@ MaterialProperty.prototype.getType = DeveloperError.throwInstantiationError; * Gets the value of the property at the provided time. * @function * - * @param {JulianDate} time The time for which to retrieve the value. + * @param {JulianDate} [time=JulianDate.now()] The time for which to retrieve the value. If omitted, the current system time is used. * @param {object} [result] The object to store the value into, if omitted, a new instance is created and returned. * @returns {object} The modified result parameter or a new instance if the result parameter was not supplied. */ @@ -79,13 +79,15 @@ MaterialProperty.prototype.getValue = DeveloperError.throwInstantiationError; */ MaterialProperty.prototype.equals = DeveloperError.throwInstantiationError; +const timeScratch = new JulianDate(); + /** * @private */ MaterialProperty.getValue = function (time, materialProperty, material) { let type; if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } if (defined(materialProperty)) { diff --git a/packages/engine/Source/DataSources/NodeTransformationProperty.js b/packages/engine/Source/DataSources/NodeTransformationProperty.js index cc75e3cb0167..b71017dc363a 100644 --- a/packages/engine/Source/DataSources/NodeTransformationProperty.js +++ b/packages/engine/Source/DataSources/NodeTransformationProperty.js @@ -93,6 +93,8 @@ Object.defineProperties(NodeTransformationProperty.prototype, { scale: createPropertyDescriptor("scale"), }); +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -102,7 +104,7 @@ Object.defineProperties(NodeTransformationProperty.prototype, { */ NodeTransformationProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } if (!defined(result)) { result = new TranslationRotationScale(); diff --git a/packages/engine/Source/DataSources/PolylineArrowMaterialProperty.js b/packages/engine/Source/DataSources/PolylineArrowMaterialProperty.js index 49071af1c517..0550b9f46992 100644 --- a/packages/engine/Source/DataSources/PolylineArrowMaterialProperty.js +++ b/packages/engine/Source/DataSources/PolylineArrowMaterialProperty.js @@ -68,6 +68,8 @@ PolylineArrowMaterialProperty.prototype.getType = function (time) { return "PolylineArrow"; }; +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -77,7 +79,7 @@ PolylineArrowMaterialProperty.prototype.getType = function (time) { */ PolylineArrowMaterialProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } if (!defined(result)) { result = {}; diff --git a/packages/engine/Source/DataSources/PolylineDashMaterialProperty.js b/packages/engine/Source/DataSources/PolylineDashMaterialProperty.js index f41afbb744dc..3335017ba128 100644 --- a/packages/engine/Source/DataSources/PolylineDashMaterialProperty.js +++ b/packages/engine/Source/DataSources/PolylineDashMaterialProperty.js @@ -111,6 +111,8 @@ PolylineDashMaterialProperty.prototype.getType = function (time) { return "PolylineDash"; }; +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -120,7 +122,7 @@ PolylineDashMaterialProperty.prototype.getType = function (time) { */ PolylineDashMaterialProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } if (!defined(result)) { result = {}; diff --git a/packages/engine/Source/DataSources/PolylineGlowMaterialProperty.js b/packages/engine/Source/DataSources/PolylineGlowMaterialProperty.js index 4a88682a74c7..50b5c2db007a 100644 --- a/packages/engine/Source/DataSources/PolylineGlowMaterialProperty.js +++ b/packages/engine/Source/DataSources/PolylineGlowMaterialProperty.js @@ -96,6 +96,8 @@ PolylineGlowMaterialProperty.prototype.getType = function (time) { return "PolylineGlow"; }; +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -105,7 +107,7 @@ PolylineGlowMaterialProperty.prototype.getType = function (time) { */ PolylineGlowMaterialProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } if (!defined(result)) { result = {}; diff --git a/packages/engine/Source/DataSources/PolylineOutlineMaterialProperty.js b/packages/engine/Source/DataSources/PolylineOutlineMaterialProperty.js index bd61624b6a01..bb13942d3736 100644 --- a/packages/engine/Source/DataSources/PolylineOutlineMaterialProperty.js +++ b/packages/engine/Source/DataSources/PolylineOutlineMaterialProperty.js @@ -103,6 +103,8 @@ PolylineOutlineMaterialProperty.prototype.getType = function (time) { return "PolylineOutline"; }; +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -112,7 +114,7 @@ PolylineOutlineMaterialProperty.prototype.getType = function (time) { */ PolylineOutlineMaterialProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } if (!defined(result)) { result = {}; diff --git a/packages/engine/Source/DataSources/PositionProperty.js b/packages/engine/Source/DataSources/PositionProperty.js index 5f6b8fa6699f..66a9c384b67a 100644 --- a/packages/engine/Source/DataSources/PositionProperty.js +++ b/packages/engine/Source/DataSources/PositionProperty.js @@ -61,7 +61,7 @@ Object.defineProperties(PositionProperty.prototype, { * Gets the value of the property at the provided time in the fixed frame. * @function * - * @param {JulianDate} time The time for which to retrieve the value. + * @param {JulianDate} [time=JulianDate.now()] The time for which to retrieve the value. If omitted, the current system time is used. * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned. * @returns {Cartesian3 | undefined} The modified result parameter or a new instance if the result parameter was not supplied. */ diff --git a/packages/engine/Source/DataSources/PositionPropertyArray.js b/packages/engine/Source/DataSources/PositionPropertyArray.js index 89b50f4076ad..fc8c3f4e54b5 100644 --- a/packages/engine/Source/DataSources/PositionPropertyArray.js +++ b/packages/engine/Source/DataSources/PositionPropertyArray.js @@ -77,6 +77,8 @@ Object.defineProperties(PositionPropertyArray.prototype, { }, }); +const timeScratch = new JulianDate(); + /** * Gets the value of the property. * @@ -86,7 +88,7 @@ Object.defineProperties(PositionPropertyArray.prototype, { */ PositionPropertyArray.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result); }; diff --git a/packages/engine/Source/DataSources/PropertyArray.js b/packages/engine/Source/DataSources/PropertyArray.js index 8524a703e952..b0a1322d865c 100644 --- a/packages/engine/Source/DataSources/PropertyArray.js +++ b/packages/engine/Source/DataSources/PropertyArray.js @@ -60,6 +60,8 @@ Object.defineProperties(PropertyArray.prototype, { }, }); +const timeScratch = new JulianDate(); + /** * Gets the value of the property. * @@ -69,7 +71,7 @@ Object.defineProperties(PropertyArray.prototype, { */ PropertyArray.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } const value = this._value; diff --git a/packages/engine/Source/DataSources/PropertyBag.js b/packages/engine/Source/DataSources/PropertyBag.js index 2dc54cddf311..f98a3305aab8 100644 --- a/packages/engine/Source/DataSources/PropertyBag.js +++ b/packages/engine/Source/DataSources/PropertyBag.js @@ -158,6 +158,8 @@ PropertyBag.prototype.removeProperty = function (propertyName) { this._definitionChanged.raiseEvent(this); }; +const timeScratch = new JulianDate(); + /** * Gets the value of this property. Each contained property will be evaluated at the given time, and the overall * result will be an object, mapping property names to those values. @@ -169,7 +171,7 @@ PropertyBag.prototype.removeProperty = function (propertyName) { */ PropertyBag.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } if (!defined(result)) { diff --git a/packages/engine/Source/DataSources/ReferenceProperty.js b/packages/engine/Source/DataSources/ReferenceProperty.js index 796daf56066e..175c3e41705f 100644 --- a/packages/engine/Source/DataSources/ReferenceProperty.js +++ b/packages/engine/Source/DataSources/ReferenceProperty.js @@ -255,6 +255,8 @@ ReferenceProperty.fromString = function (targetCollection, referenceString) { return new ReferenceProperty(targetCollection, identifier, values); }; +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -265,7 +267,7 @@ ReferenceProperty.fromString = function (targetCollection, referenceString) { ReferenceProperty.prototype.getValue = function (time, result) { const target = resolve(this); if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } return defined(target) ? target.getValue(time, result) : undefined; }; diff --git a/packages/engine/Source/DataSources/SampledPositionProperty.js b/packages/engine/Source/DataSources/SampledPositionProperty.js index 7fa4e35b2538..fb72ce8aae8f 100644 --- a/packages/engine/Source/DataSources/SampledPositionProperty.js +++ b/packages/engine/Source/DataSources/SampledPositionProperty.js @@ -179,6 +179,8 @@ Object.defineProperties(SampledPositionProperty.prototype, { }, }); +const timeScratch = new JulianDate(); + /** * Gets the position at the provided time. * @@ -188,7 +190,7 @@ Object.defineProperties(SampledPositionProperty.prototype, { */ SampledPositionProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result); }; diff --git a/packages/engine/Source/DataSources/SampledProperty.js b/packages/engine/Source/DataSources/SampledProperty.js index b5a99d1dd322..2c015283c4f9 100644 --- a/packages/engine/Source/DataSources/SampledProperty.js +++ b/packages/engine/Source/DataSources/SampledProperty.js @@ -359,6 +359,8 @@ Object.defineProperties(SampledProperty.prototype, { }, }); +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -368,7 +370,7 @@ Object.defineProperties(SampledProperty.prototype, { */ SampledProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } const times = this._times; diff --git a/packages/engine/Source/DataSources/ScaledPositionProperty.js b/packages/engine/Source/DataSources/ScaledPositionProperty.js index 12d2c446bd24..ec89e9386674 100644 --- a/packages/engine/Source/DataSources/ScaledPositionProperty.js +++ b/packages/engine/Source/DataSources/ScaledPositionProperty.js @@ -38,9 +38,11 @@ Object.defineProperties(ScaledPositionProperty.prototype, { }, }); +const timeScratch = new JulianDate(); + ScaledPositionProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result); }; diff --git a/packages/engine/Source/DataSources/StripeMaterialProperty.js b/packages/engine/Source/DataSources/StripeMaterialProperty.js index 7c0520516944..8fb83fe4f720 100644 --- a/packages/engine/Source/DataSources/StripeMaterialProperty.js +++ b/packages/engine/Source/DataSources/StripeMaterialProperty.js @@ -136,6 +136,8 @@ StripeMaterialProperty.prototype.getType = function (time) { return "Stripe"; }; +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -145,7 +147,7 @@ StripeMaterialProperty.prototype.getType = function (time) { */ StripeMaterialProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } if (!defined(result)) { result = {}; diff --git a/packages/engine/Source/DataSources/TerrainOffsetProperty.js b/packages/engine/Source/DataSources/TerrainOffsetProperty.js index 71cc74fb44df..329d1b136a2f 100644 --- a/packages/engine/Source/DataSources/TerrainOffsetProperty.js +++ b/packages/engine/Source/DataSources/TerrainOffsetProperty.js @@ -147,6 +147,8 @@ TerrainOffsetProperty.prototype._updateClamping = function () { ); }; +const timeScratch = new JulianDate(); + /** * Gets the height relative to the terrain based on the positions. * @@ -156,7 +158,7 @@ TerrainOffsetProperty.prototype._updateClamping = function () { */ TerrainOffsetProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } const heightReference = Property.getValueOrDefault( diff --git a/packages/engine/Source/DataSources/TimeIntervalCollectionPositionProperty.js b/packages/engine/Source/DataSources/TimeIntervalCollectionPositionProperty.js index bde198aa5a99..7813010f98c4 100644 --- a/packages/engine/Source/DataSources/TimeIntervalCollectionPositionProperty.js +++ b/packages/engine/Source/DataSources/TimeIntervalCollectionPositionProperty.js @@ -79,6 +79,8 @@ Object.defineProperties(TimeIntervalCollectionPositionProperty.prototype, { }, }); +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time in the fixed frame. * @@ -91,7 +93,7 @@ TimeIntervalCollectionPositionProperty.prototype.getValue = function ( result ) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result); }; diff --git a/packages/engine/Source/DataSources/TimeIntervalCollectionProperty.js b/packages/engine/Source/DataSources/TimeIntervalCollectionProperty.js index ed9fb92ccd42..f6325bc8a148 100644 --- a/packages/engine/Source/DataSources/TimeIntervalCollectionProperty.js +++ b/packages/engine/Source/DataSources/TimeIntervalCollectionProperty.js @@ -91,6 +91,8 @@ Object.defineProperties(TimeIntervalCollectionProperty.prototype, { }, }); +const timeScratch = new JulianDate(); + /** * Gets the value of the property at the provided time. * @@ -100,7 +102,7 @@ Object.defineProperties(TimeIntervalCollectionProperty.prototype, { */ TimeIntervalCollectionProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } const value = this._intervals.findDataForIntervalContainingDate(time); diff --git a/packages/engine/Source/DataSources/VelocityOrientationProperty.js b/packages/engine/Source/DataSources/VelocityOrientationProperty.js index ae13603e1151..a4ab53537a23 100644 --- a/packages/engine/Source/DataSources/VelocityOrientationProperty.js +++ b/packages/engine/Source/DataSources/VelocityOrientationProperty.js @@ -105,6 +105,7 @@ Object.defineProperties(VelocityOrientationProperty.prototype, { const positionScratch = new Cartesian3(); const velocityScratch = new Cartesian3(); const rotationScratch = new Matrix3(); +const timeScratch = new JulianDate(); /** * Gets the value of the property at the provided time. @@ -115,7 +116,7 @@ const rotationScratch = new Matrix3(); */ VelocityOrientationProperty.prototype.getValue = function (time, result) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeScratch); } const velocity = this._velocityVectorProperty._getValue( time, diff --git a/packages/engine/Source/DataSources/VelocityVectorProperty.js b/packages/engine/Source/DataSources/VelocityVectorProperty.js index e774cf4b8e24..3d0b9d900c83 100644 --- a/packages/engine/Source/DataSources/VelocityVectorProperty.js +++ b/packages/engine/Source/DataSources/VelocityVectorProperty.js @@ -118,6 +118,7 @@ Object.defineProperties(VelocityVectorProperty.prototype, { const position1Scratch = new Cartesian3(); const position2Scratch = new Cartesian3(); const timeScratch = new JulianDate(); +const timeNowScratch = new JulianDate(); const step = 1.0 / 60.0; /** @@ -140,7 +141,7 @@ VelocityVectorProperty.prototype._getValue = function ( positionResult ) { if (!defined(time)) { - time = JulianDate.now(); + time = JulianDate.now(timeNowScratch); } if (!defined(velocityResult)) {