I would like to create a function that would move one point in along a circle around another, but lack the math know how.
here's what I have cobbled together from examples elsewhere and a little help, hopefully at least my intentions are clear (the inc=increment would let me fiddle with how fast p2 travels)
function orbit(p1, p2, inc)
distance = sqrt((p1.x-p2.x)(p1.x-p2.x) + (p1.y-p2.y)(p1.y-p2.y))
ang= atan2(p2.y, p2.x) - atan2(p1.y, p2.x)
p2.x=(p1.x + distance cos(ang+inc))
p2.y=(p1.y + distance sin(ang+inc))
orbit(point1, point2, .01)
line(point1.x, point1.y, point2.x, point2.y, 7)
Hey @xyxzzy I hope this is what you're looking for; your description sounded similar but my math is a lot simpler so I'm not really sure.
I did something to accomplish this here: https://www.lexaloffle.com/bbs/?tid=29405
Since that uses some magic numbers (it was my first time trying to really figure out some of this trig stuff instead of faking it), here's a better demo:
'O' (z) changes the 'mode'
If this was different what you're wanting to do, let me know.
[Please log in to post a comment]