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

Geo rotation #18

Merged
merged 3 commits into from Jun 7, 2016
Merged

Geo rotation #18

merged 3 commits into from Jun 7, 2016

Conversation

chrisuehlinger
Copy link
Contributor

(Note: Now that some of the common structure has been laid out, I've published 4 orthogonal branches. These can be reviewed and merged in any order, whenever you see fit. There might be slight merge conflicts around index.js, but that should be all.)

This branch addresses Issue #13 , d3.geoRotation.

I followed your advice and swapped out equirectangular, which successfully solved the circular dependency. I'll look into a similar solution for getting the references to spherical out of d3.geoCircle.

@mbostock mbostock self-assigned this Jun 7, 2016
@mbostock
Copy link
Member

mbostock commented Jun 7, 2016

Math.asin and d3_asin aren’t exactly the same: the latter is more robust to floating point error when the input value is slightly greater than +1 or slightly less than -1.

var pi = Math.PI,
    halfPi = pi / 2;

function asin(x) {
  return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);
}

@mbostock
Copy link
Member

mbostock commented Jun 7, 2016

I’d also recommend pulling out constants that can be used in multiple places for brevity. At the minimum, in math.js:

export var pi = Math.PI;
export var halfPi = pi / 2;
export var tau = pi * 2;

Probably also:

export var sin = Math.sin;
export var cos = Math.cos;
export var atan2 = Math.atan2;

@mbostock
Copy link
Member

mbostock commented Jun 7, 2016

I’ll do this.

@mbostock mbostock merged commit 4e3fcea into d3:master Jun 7, 2016
@mbostock mbostock mentioned this pull request Jun 7, 2016
@chrisuehlinger chrisuehlinger deleted the geo-rotation branch June 8, 2016 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants