Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute sun and moon positions #677

Merged
merged 23 commits into from
Apr 27, 2013
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Beta Releases
});
* `CzmlCartographic` has been removed and all cartographic values are converted to Cartesian internally during CZML processing. This improves performance and fixes interpolation of cartographic source data. The Cartographic representation can still be retrieved if needed.
* Removed `ComplexConicSensorVolume`, which was not documented and did not work on most platforms. It will be brought back in a future release. This does not affect CZML, which uses a custom sensor to approximate a complex conic.
* Replaced `computeSunPosition` with `Simon1994PlanetaryPosition`, which has functions to calculate the position of the sun and the moon more accurately.
* Added wide polylines that work with and without ANGLE.
* Polylines now use materials to describe their surface appearance. See the [Fabric](https://github.com/AnalyticalGraphicsInc/cesium/wiki/Fabric) wiki page for more details on how to create materials.
* Added new `PolylineOutline`, `PolylineArrow`, and `Fade` materials.
Expand Down
13 changes: 13 additions & 0 deletions Source/Core/Cartesian3.js
Original file line number Diff line number Diff line change
Expand Up @@ -926,5 +926,18 @@ define([
return Cartesian3.cross(this, right, result);
};

/**
* Produces a Cartesian3 representing this instance which results from rotating
* the original axes used to represent this instance by the provided Quaternion rotation.
* @memberof Cartesian3
*
* @param {Quaternion}
* @return {Cartesian3} The result of the rotation
*
*/
Cartesian3.prototype.rotate = function(quaternion, result) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to remove this, too, since it called the other one.

return Cartesian3.rotate(this, quaternion, result);
};

return Cartesian3;
});
14 changes: 13 additions & 1 deletion Source/Core/Math.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ define([
};

/**
* Alters the value of input x such that <code>-CesiumMath.PI</code> <= x <= <code>CesiumMath.PI</code>
* Produces an angle in the range 0 <= angle <= 2Pi which is equivalent to the provided angle.
* @param {Number} angle in radians
* @return {Number} The angle in the range ()<code>-CesiumMath.PI</code>, <code>CesiumMath.PI</code>).
*/
Expand All @@ -417,6 +417,18 @@ define([
return x > pi ? pi : x;
};

/**
* Produces an angle in the range -Pi <= angle <= Pi which is equivalent to the provided angle.
* @param {Number} angle in radians
* @return {Number} The angle in the range (0 , <code>CesiumMath.TWO_PI</code>).
*/
CesiumMath.zeroToTwoPi = function(x) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saying it "alters" the value of input x is a bit misleading. It's ok to just copy the doc right out of Components. The comment in the code in Components about the second modulus is useful as well (even if it's mispelled modules).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied the doc from the existing negativePiToPi function right above this one. I'll change the doc for both.

var value = x % CesiumMath.TWO_PI;
// We do a second modules here if we add 2Pi to ensure that we don't have any numerical issues with very
// small negative values.
return (value < 0.0) ? (value + CesiumMath.TWO_PI) % CesiumMath.TWO_PI : value;
};

/**
* DOC_TBA
*/
Expand Down
Loading