Menu

#248 Roulette-drawing Magic tool

v0.9.32
closed
nobody
None
7
2024-01-20
2024-01-05
No

A (set of) magic tool(s) for drawing centered trochoids (a form of roulette curves) -- i.e.. epitrochoids & epicycloids (aka hypercycloids), hypotrochoids & hypocycloids. Basically, ways to draw art similar to that produced by a Spirograph.

Given a fixed circle with radius R, and another circle rolling around that circle with radius r (if negative, on the inside), with a point at d distance from center of the interior circle, looping through angles θ, the position of the points (lines) to plot (relative to the fixed circle's center) are calculated as:

x = ((R - r) * cos(θ)) + d * cos(((R - r) / r) * θ)
y = ((R - r) * sin(θ)) - d * sin(((R - r) / r) * θ)

θ must go through the range 0 to 2π * (least_common_multiple(r, R) / R) (see https://en.wikipedia.org/wiki/Least_common_multiple) to generate a complete shape. Depending on the relation between R, r, and d, different trochoids will be generated.

Thoughts on how to get all this working in Tux Paint's interface (limits of the Magic tool API):
* click to set the center of the fixed circle
* drag horizontally to set the radius of the fixed circle (R); drag vertically to change the distance of the plot point (d) (see behavior of "Waves" and "Wavelets")
* a click-and-release (without dragging) should draw a satisfying shape (see behavior of "3D Glasses", "Flower", and "Tornado")
* size option could be used to set the radius of the rolling circle (r); it would need to be relative to the radius of the fixed circle (R)
* separate tools for positive r vs negative r values -- e.g., epitrochoid ("flower petals") vs hypotrochoid ("star")
* if size option is unavailable (--nomagicsizes), perhaps provide additional tool variations with some useful r values (R * 1.5, R, R * 0.5)

Discussion

  • William Kendrick

    • status: open --> closed
     
  • William Kendrick

    Done!

     
  • Pere Pujal i Carabantes

    Bill, just played a little with them, I don't understand those maths, just speaking from what I see in the screen, so sorry if I am making noise, but looks as the titles and definitions are inversed, and that the xor fixed circles too(inside/outside), see the attached drawing

     
    • William Kendrick

      Nope, it doesn't look like I swapped them :D

      See https://en.wikipedia.org/wiki/Centered_trochoid

      • "epi" - a prefix occurring in loanwords from Greek, where it meant “upon,” “on,” “over,” “near,” “at,” “before,” “after”. (So in this tool, that's the circle that follows your mouse. Note that the mouse-following is not meaningful, just a fun and helpful way to remind which circle is 'fixed' and which is the one that rolls.)
      • "hypo" - A prefix that means “beneath“ or “below,” as in hypodermic, below the skin.
        (Thanks, Google)
       
  • William Kendrick

    • status: closed --> open
     
  • William Kendrick

    • status: open --> closed
     
  • William Kendrick

    Ok fixed I think :)

     
  • Pere Pujal i Carabantes

    Yes, only rests review the icons to match the tools, and the hypo, when both circles equals, it doesn't draw anything, maybe don't allow equal circles and jump from low size to upper one directly.
    Sorry for the noise :)

     
  • Pere Pujal i Carabantes

    Found another problem, Tux Paint freezes when trying to draw a BIG trochoid,no matter epi or hypo.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.