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

    Ruby challenge 2 ?

    Scheduled Pinned Locked Moved Developers' Forum
    18 Posts 8 Posters 2.3k Views 8 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.
    • M Offline
      Matt666
      last edited by

      Hi all !
      I really HOPE that no one can do this with native ruby codes πŸ˜„ πŸ˜„ !!

      I start this challenge because I don't know how to do that... In fact, I have a little idea πŸ˜†
      This challenge is to do a script that returns a list of 4 points which represent mounting space of the face.
      Exemples :Sans titre 1.jpg
      SU file is attached.

      Is it instersting? Is it an idea worthy of a challenge? I would like to have your opinions !

      Thank you !


      Ch12.skp

      Frenglish at its best !
      My scripts

      1 Reply Last reply Reply Quote 0
      • fredo6F Offline
        fredo6
        last edited by

        The problem of the best-fitting bounding box is well known.
        In 2D, it is not too complex to find a solution, though the algorithm is hungry.
        In 3D, the algorithm is very hungry and complex in the general case of any shape

        But it's worth the challenge, as there are some approximate solutions too.

        Fredo

        1 Reply Last reply Reply Quote 0
        • N Offline
          NewOne
          last edited by

          @matt666 said:

          Hi all !
          I really HOPE that no one can do this with native ruby codes πŸ˜„ πŸ˜„ !!

          I start this challenge because I don't know how to do that... In fact, I have a little idea πŸ˜†
          This challenge is to do a script that returns a list of 4 points which represent mounting space of the face.
          Exemples :[attachment=1:1f1b2ici]<!-- ia1 -->Sans titre 1.jpg<!-- ia1 -->[/attachment:1f1b2ici]
          SU file is attached.

          Is it instersting? Is it an idea worthy of a challenge? I would like to have your opinions !

          Thank you !

          Check "Rotate a texture" topic... i put there something that fits what you want. Just the ideea... maybe will come the script, but for now I'm working to something else. Perhaps somebody else will try a script based on that.

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

            I know anything of the ruby scripting 😳
            but seems to me that when you select a volume there is a blue bounding box around the volume done by SU πŸ˜’
            Just take it the 8 vertices and you have your list πŸ’š (or 4 for a surface in 2D)
            I don't know if that is cheating πŸ˜„

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

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

              Frenchy, i believe the challenge is to find the best fitting bounding box, rather than any bounding box.

              http://remusrendering.wordpress.com/

              1 Reply Last reply Reply Quote 0
              • N Offline
                NewOne
                last edited by

                @unknownuser said:

                I know anything of the ruby scripting 😳
                but seems to me that when you select a volume there is a blue bounding box around the volume done by SU πŸ˜’
                Just take it the 8 vertices and you have your list πŸ’š (or 4 for a surface in 2D)
                I don't know if that is cheating πŸ˜„

                The BoundingBox is related to global axes! so if your face is oblique, the boundingbox means the projection on the axes. That's not helpfull because doesn't represent the real size of the face.

                1 Reply Last reply Reply Quote 0
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  Since the test seems to involve only the single face... first copy the face into a group. Make a transformation of that round a given vertex/axis so that it's 'flat' (the face's plane z=1). Find the copied face's longest edge, find the rotation of that edge, transform rotate the group around the start of that edge so that its now at 0 rotation around the z axis. Find the bounding box of the 'flat'/rotated copy. Make a rectangle using the four corners of the bbox. Erase the rest of the group's contents and transform the bbox rectangle backwards onto the original face and you then have that face's minimum bounding box...

                  .

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    Matt666
                    last edited by

                    Hi TIG !!
                    Wow, great idea... I will try to do what you say ! Thank you !

                    Frenglish at its best !
                    My scripts

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      Matt666
                      last edited by

                      😲 😲 😲
                      Wow !! You're the man, Fredo !!
                      Thank you so much !

                      Frenglish at its best !
                      My scripts

                      1 Reply Last reply Reply Quote 0
                      • fredo6F Offline
                        fredo6
                        last edited by

                        Matt,

                        Here is a rather brute force version functioning for a single face, when selected. It works in 3D.
                        BFBBox.jpg

                        The command is in the menu Plugins "Best Bounding Box for a single face" (there is no icon).
                        You can extract the algorithm (3 methods) from the code to do what you have in mind. On my side, I may use it to develop a Face Scaling macro that use the Best-fitting bounding rectangle instead of the default box aligned on axes.

                        The bounding box (actually always a rectangle) is created as a Group.

                        Fred


                        bbface.rb

                        1 Reply Last reply Reply Quote 0
                        • free agentF Offline
                          free agent
                          last edited by

                          this would be good for making proxy objects (when vray decides to implement proxies 😠 )

                          http:i167.photobucket.comalbumsu143FreeAgent84bug.gif

                          1 Reply Last reply Reply Quote 0
                          • M Offline
                            Matt666
                            last edited by

                            What is a proxy object ?

                            Frenglish at its best !
                            My scripts

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

                              Its like a dummy piece of geometry that you place instead of something else. In the case of render engines, its usually used so your scene can be kept low poly, but when you export to the render engine, it will load up a high poly component in place of the low poly proxy.

                              Very useful for trees and the like.

                              http://remusrendering.wordpress.com/

                              1 Reply Last reply Reply Quote 0
                              • M Offline
                                Matt666
                                last edited by

                                Ok, thank you Remus !

                                Frenglish at its best !
                                My scripts

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

                                  No worries, its nice to be able to contribute to the ruby forum for once πŸ˜›

                                  http://remusrendering.wordpress.com/

                                  1 Reply Last reply Reply Quote 0
                                  • M Offline
                                    minguinhirigue
                                    last edited by

                                    Did anyone was able to do the same for groups or any volume ?

                                    1 Reply Last reply Reply Quote 0
                                    • TIGT Offline
                                      TIG Moderator
                                      last edited by

                                      The "untransformed bounds" is now a new group property accessible in the v7 API...

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • M Offline
                                        minguinhirigue
                                        last edited by

                                        WHOA, So I have to give a try to the free versionof SU7, but, I think my computer will begin to say ARRGHH... (quite old... 😳)

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

                                        Advertisement