Created
December 7, 2016 17:41
-
-
Save leonardfactory/a4dff996ee9673c765139c2bba23f7be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Just a snippet, but it should work | |
*/ | |
const { | |
roundedHeight, | |
height, | |
width | |
} = this.props; | |
const heightSq = Math.pow(roundedHeight - height, 2); | |
const widthSq = Math.pow(width / 2, 2); | |
const xSq = Math.pow(x, 2); | |
/** | |
* This will give `y` where 0 = same level as `height`. Maximum | |
* value is `roundedHeight`. | |
*/ | |
let y = Math.round(Math.sqrt(heightSq * (1 - xSq/widthSq))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think that formula is incorrect http://take.ms/169sa