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

    Plug-In Request: Make Model BSP Compatible.

    Scheduled Pinned Locked Moved Plugins
    26 Posts 6 Posters 7.1k Views 6 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.
    • fredo6F Offline
      fredo6
      last edited by

      Anton,

      Here is a short animation to illustrate the algorithm.

      ConvexifyAnimation.gif

      Also, I understand now the relation with Physics engines. The algorithm uses #intersect_with, so it has to create some geometry. However, it is easy to

      • create the convex solids on a specific layer, so that you can easily associate each original solid to its convex decomposition
      • Transform the convex decomposition in whatever data form suitable to the physics engine to manage collisions and delete the convex solids.

      The algorithm should work on 'pseudo-solids' that is solids where all edges are bordered with 1 or 2 faces (but not more than 2)

      The orientation of normals is important to detect concavity of edges. Here too, it is possible to give some flexibility based on solid topology.

      Fredo

      1 Reply Last reply Reply Quote 0
      • A Offline
        Anton_S
        last edited by

        Very nice animation, Fredo!

        For ziiars purpose, creating geometry is what he needs, but when implementing this to my physics engine, I would avoid creating any geometry and try computing all intersections in a function.
        ` # Get all convex hulls from mesh.

        @param [Sketchup::Group] group

        @return [Array<ArrayGeom::Point3d>] An array of convex hulls.

        Each convex hull represents an array of points.

        def get_convex_hulls(group)
        #...
        end`

        Then, each of these convex hulls (an array of points) could be passed to a function in physics SDK to create convex collisions from them, as Newton Dynamics Physics SDK only asks for an array of points to create a convex hull.

        Although, I'm not asking you to make it the way I requested. What I'll need is the peace of code that subdivides solid into convex hull. Then I could replace the intersect_with function with a custom function to avoid creating any geometry.

        Good to know that it works with 'pseudo solids'. Will be useful.

        Also, you could add 'max concavity angle' parameter to your algorithm to avoid sub-diving if angle between concave edges is greater than the 'max concavity angle'. I.E control generated 'resolution'.

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

          Anton,

          I am afraid my implemnetation is fully based on Sketchup, not just for intersection, but for the topological relationships between edges, faces, etc....
          I can adapt an API that can deliver the output as a hierachical matrix of points for groups and faces, leaving the model intact (either doing an abort_operation, or deleting all intermediary groups created).

          But, if you plan to build it in C++, the best is to write a native version from the algorithm. As I said, it is fairly simple, and since you do not care with the esthetics of the decomposition, it can even be simpler. I can send you the details of algorithm, so that based on your C++ environment to describe the toplogy, you see how to adapt it to integrate with the Physics engine.

          Fredo

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

            By the way, the algorithm happens to work on 'open solids', that is solids where edges are connected to 2 or 1 faces.

            However, I am not sure the result is useful, as it gives potentially open solids too.

            ConvexifyPseudo-solids.gif

            Fredo

            1 Reply Last reply Reply Quote 0
            • A Offline
              Anton_S
              last edited by

              Good! You can PM the code and I'll do my best in implementing it to C++.

              1 Reply Last reply Reply Quote 0
              • ziiarZ Offline
                ziiar
                last edited by

                Hi, this all looks fantastic! Fredo, could you send me the plug-in or are you still working on it?

                Thanks!

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

                  @ziiar: I will publish in a few days. Actually, it needed some time to make the algorithm more robust.

                  Here is the Convexification of a complex model by Pilou. Not a lot of faces (672 faces), but a lot of concave edges (320) and not a true solid (there are some inner faces).

                  It took 20 seconds to compute, 40 seconds to Commit!

                  Here is the model
                  Convexify - Model by Pilou.skp

                  Fredo

                  1 Reply Last reply Reply Quote 0
                  • greenskpG Offline
                    greenskp
                    last edited by

                    I am looking for that. Make a BSP file sometimes is a pain.
                    Anton and Fredo, keep doing a excellent work.

                    +1 for this awesome plugin.

                    1 Reply Last reply Reply Quote 0
                    • F Offline
                      faust07
                      last edited by

                      So, I agree 100%. The implementation in Physics would be a big step. As a plugin to prepare concave models for physics it would be very useful. 👍

                      1 Reply Last reply Reply Quote 0
                      • greenskpG Offline
                        greenskp
                        last edited by

                        Sorry for this question but is there some news? Some progress? I am so excited about this plugin.

                        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