JSCAD User Group
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    V2 Feedback : script hangs

    Scheduled Pinned Locked Moved Development Discussions
    8 Posts 2 Posters 1.6k Views 1 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.
    • gilboonetG Offline
      gilboonet
      last edited by

      Hello, I just updated to last V2 version (alpha 6) and my converted script that worked well with previous update now hangs (keep running after 10 minutes).
      Capture d’écran de 2020-09-11 10-48-28.png
      The script is here : https://github.com/gilboonet/gilboonet.github.io/blob/master/demos/gigi.js

      1 Reply Last reply Reply Quote 0
      • gilboonetG Offline
        gilboonet
        last edited by

        With my first example which uses the extrudeWobble() from BezierSimpleExtrude.jscad example, it works, it is with a polyhedron that is more complex that it hangs, I will try to reduce it.
        (working example rendered with alpha 6)
        Capture d’écran de 2020-09-11 12-13-12.png

        1 Reply Last reply Reply Quote 0
        • gilboonetG Offline
          gilboonet
          last edited by

          It seems to be an intersect problem, I try to get the intersection between my volume ( a polyhedron) and a cuboid and it hangs. Are there rules for CSG boolean operations ?
          Capture d’écran de 2020-09-11 13-53-21.png

          1 Reply Last reply Reply Quote 0
          • gilboonetG Offline
            gilboonet
            last edited by gilboonet

            I have it, the polyhedron that I exported from Wings3d to .jscad had quads, hopefully there's an option to export tris and it works with such polyhedron. About polyhedra with polygons instead of triangles, I now use a little code to do the conversion when reading a .obj file on my vanilla js unfolder, but didn't try it with jscad. I will try it with this example.
            Capture d’écran de 2020-09-11 14-51-07.png

            z3devZ 1 Reply Last reply Reply Quote 0
            • gilboonetG Offline
              gilboonet
              last edited by

              I did the version with the little code that modify a polyhedron polygons if needed (first it checks the winding using measureArea() as I just read on a recent issue on github, then it turns it to triangles) . And it's nice to be able to have 3d and 2d rendered together.
              Capture d’écran de 2020-09-11 18-21-24.png

              z3devZ 1 Reply Last reply Reply Quote 0
              • z3devZ Offline
                z3dev @gilboonet
                last edited by

                @gilboonet very nice!

                it seems that the issues were about the winding of the 2D geometries, and correcting geometries to wind CCW about the Z axis. is that correct? Any bugs that we need to look at?

                1 Reply Last reply Reply Quote 0
                • z3devZ Offline
                  z3dev @gilboonet
                  last edited by

                  @gilboonet can you provide an example of the quad polygons? we may be able to fix this when converting from OBJ files.

                  gilboonetG 1 Reply Last reply Reply Quote 0
                  • gilboonetG Offline
                    gilboonet @z3dev
                    last edited by gilboonet

                    @z3dev You're right, the problem was about winding and by correcting it for MeasureArea() < 0 and triangulating was enough to make it work. I updated my source here : https://github.com/gilboonet/gilboonet.github.io/blob/master/demos/gigi.js It contains a volume exported from Wings3d, with Cube1_default() that contains data with quads and table() with this :

                    function table() {
                    	
                    	var a = Cube1_default();
                    	
                    	var tmp = [];
                    	for(var i = 0; i < a.polygons.length; i++){
                    		if (measureArea(a.polygons[i]) < 0){
                    			a.polygons[i] = a.polygons[i].reverse();
                    		}
                    		for(var j = 1; j< a.polygons[i].length-1; j++){
                    			tmp.push([a.polygons[i][0], a.polygons[i][j], a.polygons[i][j+1]]);
                    		}
                    	}
                    	
                    	return scale([8,8,8], polyhedron({points:a.points, faces:tmp}));
                    	
                    }
                    
                    

                    There is certainly a way to write this code a more modern way with map() to speed it up.

                    1 Reply Last reply Reply Quote 0

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    • First post
                      Last post
                    Powered by NodeBB | Contributors