sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] Superellipse 1.2

    Scheduled Pinned Locked Moved Plugins
    26 Posts 13 Posters 19.9k Views 13 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      Regular Polygon
      last edited by Regular Polygon

      Hi everyone,

      First of all, let me say that this forum has been a helpful resource. I have often found answers for my own plugin development problems already addressed here. It is also interesting to follow the continuing evolution of new SketchUp plugins posted here.

      I wrote a few plugins over the years that are just languishing on my hard drive. My plan is to write them up on a blog, and then announce them on your forum.

      This first plugin draws a superellipse. It is pretty simple, but as far as I know it hasn't been done before. A superellipse is a shape that is in between an ellipse and a rectangle, (or a circle and a square, if both axes are equal). For example, here is a cube with superellipse shaped windows.

      superellipse 1.PNG

      A parameter, n, controls the degree of "squareness." As n gets larger, the curve looks more and more like a rectangle with rounded corners.

      superellipse 2.PNG

      ` # CHANGELOG

      1.1 - June 23, 2010

      * Implements new scale to describe squareness.

      1.2 - July 7, 2010

      * Remembers last dialog box values between sessions.`

      The Superellipse plugin is at: regularpolygon.org/plugins/superellipse.php.

      Thanks.

      My SketchUp Plugins

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        👍

        Welcome to SCF! 😄 Excellent first post.

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • Chris FullmerC Offline
          Chris Fullmer
          last edited by

          Wow, yeah thats great! Welcome, thanks for the plugin,

          Chris

          Lately you've been tan, suspicious for the winter.
          All my Plugins I've written

          1 Reply Last reply Reply Quote 0
          • pilouP Offline
            pilou
            last edited by

            Cool! 👍

            Next Will be Super Cycloïd? ☀

            http://www.wiley.com/legacy/compbooks/stephens/cycloid.gif

            Frenchy Pilou
            Is beautiful that please without concept!
            My Little site :)

            1 Reply Last reply Reply Quote 0
            • R Offline
              Regular Polygon
              last edited by

              @unknownuser said:

              Next Will be Super Cycloïd? ☀

              Yeah, that sounds like a plugin I would work on. They tend to have that sort of mathematical flavor.

              My SketchUp Plugins

              1 Reply Last reply Reply Quote 0
              • S Offline
                SU Reviewer
                last edited by

                Welcome! Another great and simple plugin.

                It works really well, though I have a note on the Exponent value. There is no known scale for the exponent input that I could tell. As of now its pretty much a shot in the dark as to how square the superellipse will come out. Perhaps having a scale of 1-100 (100 being a perfect square) the plugin would be more manageable?

                Good job! 👍

                Living Einstein's dream through SketchUp.
                "Imagination is a preview of life's coming attractions" - Albert Einstein

                Joe Simhon ~ SketchUp Plugin Reviews

                1 Reply Last reply Reply Quote 0
                • R Offline
                  remus
                  last edited by

                  Why replace one arbitrary scale with another? they'll both serve the same purpose, and as long as the user understands 'big n = more square' you cant go too far wrong.

                  http://remusrendering.wordpress.com/

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    Regular Polygon
                    last edited by

                    @su reviewer said:

                    As of now its pretty much a shot in the dark as to how square the superellipse will come out. Perhaps having a scale of 1-100 (100 being a perfect square) the plugin would be more manageable?

                    Otherwise great plugin!

                    Thanks for your review!

                    I can see your point. It is not real intuitive to me either how square the superellipse will be for a given exponent value.

                    We could replace the exponent with a scale that runs from 1-100. If 1 represents a completely round shape, then we would associate it with an ellipse. At the other end, 100 represents a completely square shape, so we associate it with a rectangle. But it is not so obvious to me what the numbers in the middle represent. Which superellispe should correspond to a scale factor of say 50?

                    My SketchUp Plugins

                    1 Reply Last reply Reply Quote 0
                    • boofredlayB Offline
                      boofredlay
                      last edited by

                      Oh man, I could have used this about 4 days ago. This is one of those quick scripts I imagine using quite often.

                      Thank you very much. ❗

                      http://www.coroflot.com/boofredlay

                      1 Reply Last reply Reply Quote 0
                      • B Offline
                        Ben Ritter
                        last edited by

                        Thank you Regular Polygon.

                        1 Reply Last reply Reply Quote 0
                        • thomthomT Offline
                          thomthom
                          last edited by

                          Is "Regular Polygon" a reference to Flat Land?

                          Thomas Thomassen — SketchUp Monkey & Coding addict
                          List of my plugins and link to the CookieWare fund

                          1 Reply Last reply Reply Quote 0
                          • Dave RD Offline
                            Dave R
                            last edited by

                            Thank you for this plugin. It is very nice.

                            I think the exponent makes sense. After all, it's a logical input considering the formula you're solving. Length and width are a and b so why not define n? I would prefer that to some arbitrary 1-100 scale.

                            http://upload.wikimedia.org/math/1/7/1/171490937fc13b93677c00b8c80ffb76.png

                            Etaoin Shrdlu

                            %

                            (THERE'S NO PLACE LIKE)

                            G28 X0.0 Y0.0 Z0.0

                            M30

                            %

                            1 Reply Last reply Reply Quote 0
                            • brookefoxB Offline
                              brookefox
                              last edited by

                              @dave r said:

                              I think the exponent makes sense. After all, it's a logical input considering the formula you're solving. Length and width are a and b so why not define n? I would prefer that to some arbitrary 1-100 scale.

                              http://upload.wikimedia.org/math/1/7/1/171490937fc13b93677c00b8c80ffb76.png

                              Silly me thought you figured that formula out for yourself, Dave.

                              Since I have no sense at this point where the exponent variable will take me, though I guess that comes with practice, the 1-100 option has some appeal. I should hold my tongue until I practice, but I won't.

                              Thanks for the contribution, rp, and for adding the loci to the ellipse.

                              ~ Brooke

                              1 Reply Last reply Reply Quote 0
                              • R Offline
                                remus
                                last edited by

                                A quick question about using values of n<1 if i may: how do you handle it, because surely you'll end up trying to take roots of negative numbers which'll give you imaginary numbers, unless you just take the imaginary part and use that?

                                http://remusrendering.wordpress.com/

                                1 Reply Last reply Reply Quote 0
                                • R Offline
                                  Regular Polygon
                                  last edited by

                                  @remus said:

                                  A quick question about using values of n<1 if i may: how do you handle it, because surely you'll end up trying to take roots of negative numbers.

                                  Here is the code that computes the coordinates.

                                  
                                  def sgn(num)
                                    return  0  if num.zero?
                                    return +1  if ( num > 0 )
                                    return -1
                                  end
                                  
                                  
                                  # Compute the points for the vertices of the superellipse
                                  def points
                                    e = 2.0 / @exp
                                    pts = []
                                    delta = 2 * Math;;PI / @edges
                                    for i in 0...@edges do
                                      phi = i * delta
                                      x = @a * sgn(Math.cos(phi)) * Math.cos(phi).abs**e
                                      y = @b * sgn(Math.sin(phi)) * Math.sin(phi).abs**e
                                      pts.push([x, y, 0])
                                    end
                                    pts.push(pts[0])  # close the loop
                                    pts
                                  end
                                  
                                  

                                  The only trick is to take the absolute value before you raise a number to a fractional power. After that, multiply it by +1 or -1, depending on the sign the original number had.

                                  My SketchUp Plugins

                                  1 Reply Last reply Reply Quote 0
                                  • R Offline
                                    remus
                                    last edited by

                                    That makes sense, cheers.

                                    http://remusrendering.wordpress.com/

                                    1 Reply Last reply Reply Quote 0
                                    • R Offline
                                      Regular Polygon
                                      last edited by

                                      @thomthom said:

                                      Is "Regular Polygon" a reference to Flat Land?

                                      No, not really.

                                      "Regular Polygon" is kind of a play on words. It could mean an ordinary, everyday, run-of-the-mill polygon (i.e. the basic element of 3D graphics). But, in the mathematical sense, it means a symmetrical polygon whose angles and edges are all equal.

                                      My SketchUp Plugins

                                      1 Reply Last reply Reply Quote 0
                                      • R Offline
                                        Regular Polygon
                                        last edited by

                                        I have just released a new version 1.1 of the Superellipse plugin. This version allows you to specify the "squareness" of a superellipse using a scale. The exact association between the scale and the squareness is spelled out in gory detail in the post on my blog. But a picture is probably worth a 1000 words.

                                        scale 8.PNG

                                        Basically, 0 corresponds to an ellipse, 100 corresponds to a rectangle, and a scale factor of 50 corresponds to a superellipse that stretches 50% of the way in between. I think this makes assigning a squareness value fairly intuitive.

                                        You can run both versions (1.0 and 1.1) at the same time to compare them. To download the plugin, or read more about it, please visit my blog at http://regularpolygon.blogspot.com/

                                        Thanks.

                                        My SketchUp Plugins

                                        1 Reply Last reply Reply Quote 0
                                        • olisheaO Offline
                                          olishea
                                          last edited by

                                          thanks for sharing 👍

                                          oli

                                          1 Reply Last reply Reply Quote 0
                                          • simon le bonS Offline
                                            simon le bon
                                            last edited by

                                            thanks for sharing 👍
                                            we will see, but it would prove itself often useful in time
                                            ++simon

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement