math - How to write a spirial function in python? -
i'm trying write function in python takes 2 arguments (x,y)
, , returns angle in degrees in spiraling direction.
suppose center of spiral @ location (x0,y0)
. given (0,0)
, returns 45
. given other point (0,90)
second intersection top on y axis, angle around 170
. point not touching red line, should return angle of expect direction be. spiral general thing show direction of angles.
does know how write such function?
thanks
that's archimedean spiral curve. page says in polar coordinates formula of curve r = aθ, scalar a
1 i.e. r = θ. polar cartesian conversion is
x = r cos θ, y = r sin θ
hence
x = θ cos θ, y = θ sin θ
varying θ 0 6π give curve you've. when vary parameter θ , x , y values relative origin (0, 0). case, you've translate i.e. move points x , y offset position accordingly. if want bigger version of same curve you've scale (before translation) i.e. multiply both x , y values constant scalar.
Comments
Post a Comment