• Login
sketchucation logo sketchucation
  • Login
πŸ”Œ Quick Selection | Try Didier Bur's reworked classic extension that supercharges selections in SketchUp Download

[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.
  • B Offline
    boofredlay
    last edited by 19 Jun 2010, 01:39

    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 19 Jun 2010, 02:05

      Thank you Regular Polygon.

      1 Reply Last reply Reply Quote 0
      • T Offline
        thomthom
        last edited by 19 Jun 2010, 08:55

        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
        • D Offline
          Dave R
          last edited by 19 Jun 2010, 10:15

          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
          • B Offline
            brookefox
            last edited by 19 Jun 2010, 16:46

            @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 19 Jun 2010, 18:08

              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 19 Jun 2010, 21:56

                @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 19 Jun 2010, 22:08

                  That makes sense, cheers.

                  http://remusrendering.wordpress.com/

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    Regular Polygon
                    last edited by 20 Jun 2010, 07:01

                    @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 23 Jun 2010, 20:52

                      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
                      • O Offline
                        olishea
                        last edited by 24 Jun 2010, 10:06

                        thanks for sharing πŸ‘

                        oli

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          simon le bon
                          last edited by 24 Jun 2010, 10:20

                          thanks for sharing πŸ‘
                          we will see, but it would prove itself often useful in time
                          ++simon

                          1 Reply Last reply Reply Quote 0
                          • R Offline
                            Regular Polygon
                            last edited by 25 Jun 2010, 01:12

                            Hey, thanks everyone for the big welcome, and your show of support, for this first -- albeit simple -- plugin.

                            My SketchUp Plugins

                            1 Reply Last reply Reply Quote 0
                            • P Offline
                              pyroluna
                              last edited by 25 Jun 2010, 09:39

                              Really nice... but it reminds me... I used to use POV-Ray some years ago, in which it was possible to create a 3d-superellipsoid.
                              Could you make that??? πŸ˜„ would be so awesome, I used to use it a lot!
                              Perhaps in SU it would need a variable for level of detail, though...

                              @unknownuser said:

                              The superellipsoid object creates a shape known as a superquadric ellipsoid object. It is an extension of the quadric ellipsoid. It can be used to create boxes and cylinders with round edges and other interesting shapes. Mathematically it is given by the equation:
                              formula.jpg
                              The values of e and n, called the east-west and north-south exponent, determine the shape of the superquadric ellipsoid. Both have to be greater than zero. The sphere is given by e = 1 and n = 1.

                              The syntax of the superquadric ellipsoid is:

                              SUPERELLIPSOID:
                              superellipsoid
                              {
                              <Value_E, Value_N>
                              [OBJECT_MODIFIERS...]
                              }

                              The 2-D vector specifies the e and n values in the equation above. The object sits at the origin and occupies a space about the size of a box{<-1,-1,-1>,<1,1,1>}.

                              Two useful objects are the rounded box and the rounded cylinder. These are declared in the following way.

                              #declare Rounded_Box = superellipsoid { <Round, Round> }
                              #declare Rounded_Cylinder = superellipsoid { <1, Round> }

                              The roundedness value Round determines the roundedness of the edges and has to be greater than zero and smaller than one. The smaller you choose the values, the smaller and sharper the edges will get.

                              Very small values of e and n might cause problems with the root solver (the Sturmian root solver cannot be used).

                              1 Reply Last reply Reply Quote 0
                              • R Offline
                                Regular Polygon
                                last edited by 25 Jun 2010, 20:28

                                @unknownuser said:

                                Really nice... but it reminds me... I used to use POV-Ray some years ago, in which it was possible to create a 3d-superellipsoid.
                                Could you make that??? πŸ˜„ would be so awesome, I used to use it a lot!
                                Perhaps in SU it would need a variable for level of detail, though...

                                Thanks, glad you like it. Funny you should ask because, in fact, I do have a superellipsoid plugin. It lets the user enter the number of lines of latitude and longitude to control the level of detail.

                                It was interesting to see how POV-Ray is dealing with the exponents in the formula. They let the user specify a Roundedness value, whereas I came up with a Squareness value. I'll have to try out both approaches to see which I like better.

                                Anyway, I should get the superellipsoid plugin polished up, and posted on my blog , sometime next week. Stay tuned!

                                My SketchUp Plugins

                                1 Reply Last reply Reply Quote 0
                                • S Offline
                                  SU Reviewer
                                  last edited by 30 Jun 2010, 21:08

                                  Looking good! Definitely works better, will update the review. πŸ‘

                                  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
                                    Regular Polygon
                                    last edited by 1 Jul 2010, 23:05

                                    @su reviewer said:

                                    Looking good! Definitely works better, will update the review. πŸ‘

                                    That is +1 vote for the new squareness scale in version 1.1 . I think it improved the plugin, thanks for the suggestion.

                                    My SketchUp Plugins

                                    1 Reply Last reply Reply Quote 0
                                    • R Offline
                                      Regular Polygon
                                      last edited by 7 Jul 2010, 20:01

                                      Update to version 1.2

                                      Previous versions started off each session with arbitrary default values in the dialog box for the Superellipse parameters. This version remembers your last dialog box values between sessions.

                                      My SketchUp Plugins

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

                                      Advertisement