Last active
December 17, 2015 05:39
-
-
Save ikekou/5559127 to your computer and use it in GitHub Desktop.
[Math][JavaScript][CoffeeScript]2次ベジェ曲線の中間点の座標を求める
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
#2次ベジェの中間点の座標を求める | |
#a1はアンカーポイント1 | |
#c1はアンカーポイント1から出るコントロールポイント | |
#c2はアンカーポイント2から出るコントロールポイント | |
#a2はアンカーポイント2 | |
#tは分割する割合、0~1の範囲 | |
getQuadraticBezierPoint:(a1x,a1y,cx,cy,a2x,a2y,t)-> | |
tp = 1 - t | |
x = t*t*a2x + 2*t*tp*cx + tp*tp*a1x | |
y = t*t*a2y + 2*t*tp*cy + tp*tp*a1y | |
return [x,y] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment