Skip to content

Commit

Permalink
Merge pull request #6641 from xtassin/patch-1
Browse files Browse the repository at this point in the history
Normalize cross product result for up vector to fix #6640
  • Loading branch information
Hannah authored Oct 23, 2018
2 parents 6757f83 + f40a5c9 commit 3c69b57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Chris Cooper](https://github.com/chris-cooper)
* [Andrew McDowell](https://github.com/madole)
* [Tony Luk](https://github.com/impactblue573)
* [GeoFS](https://www.geo-fs.com)
* [Xavier Tassin](https://github.com/xtassin/)

## [Individual CLA](Documentation/Contributors/CLAs/individual-cla-agi-v1.0.txt)
* [Victor Berchet](https://github.com/vicb)
* [Caleb Morse](https://github.com/cmorse)
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/Transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -808,13 +808,16 @@ define([

var normal = defaultValue(ellipsoid, Ellipsoid.WGS84).geodeticSurfaceNormal(position, normalScratch);
var right = Cartesian3.cross(velocity, normal, rightScratch);

if (Cartesian3.equalsEpsilon(right, Cartesian3.ZERO, CesiumMath.EPSILON6)) {
right = Cartesian3.clone(Cartesian3.UNIT_X, right);
}

var up = Cartesian3.cross(right, velocity, upScratch);
Cartesian3.normalize(up, up);
Cartesian3.cross(velocity, up, right);
Cartesian3.negate(right, right);
Cartesian3.normalize(right, right);

if (!defined(result)) {
result = new Matrix3();
Expand Down

0 comments on commit 3c69b57

Please sign in to comment.