JohnK Posted September 18, 2015 Share Posted September 18, 2015 As part of my cubees project (see Babylon Projects thread) I am developing a gui tool for producing extrusions and hoped somebody somewhere might like to see an example I produced with it. The seat, leg and back were all produced with this extrusion tool. (You will find a limited description of how this was done from menu --> help They elements were then all put together in this playground http://www.babylonjs-playground.com/#1XBSL1#2. It still a bit rough and ready, more work needs to be done on using measurements particularly in the cross section. As an alternative the lathe tool could have been used to produce legs like these Anyone interested can find all the code at https://github.com/Cubees/Cubees.github.io Note for Jerome - sorry I tried to use to build the extrusion mesh from your ExtrudeShapeCustom. While I worked out :-how to get the correct data from the rotate parameter for the rotationFunction, how to separate the x and y scale so that they were independent by changing scaleInPlace usingBABYLON.Vector3.prototype.scaleInPlace = function (scale) { if(typeof scale === 'number') { this.x *= scale; this.y *= scale; this.z *= scale; } else { this.x *= scale.x; this.y *= scale.y; this.z *= scale.z; } return this; };So then whenvar V=new BABYLON.Vector3(1, 1, 1); //and var scaleVec = new BABYLON.Vector3(2, 3, 4);V.scaleInPlace(5); //results in (5, 5, 5) and V.scaleInPlace(scaleVec); //results in (2, 3, 4)I could not successfully work out how to obtain the path from the tilt, twist, move x and move y parameters. In the end I went for constructing the extrusion using a ribbon. jerome, iiceman and Jaskar 3 Quote Link to comment Share on other sites More sharing options...
jerome Posted September 18, 2015 Share Posted September 18, 2015 not sure I understand what you couldn't achieve very nice tool however Quote Link to comment Share on other sites More sharing options...
JohnK Posted September 18, 2015 Author Share Posted September 18, 2015 Let the length of the extrusion be Z. Initially the cross section is at the origin in the xy plane. Let C be the point in the cross section that coincides with the origin. Let U be the cross sections normal through C, this will initially be in the z direction. As the extrusion is made the cross section moves along the length of the extrusion. When it is at a point distance z (0<=z<=Z) I read the following values from the parameter curvesTilt - rotation of normal about x axisTwist - rotation of normal about y axisMove x - displacement of normal along x axisMove y - displacement of normal along y axisand the displacement of C is always in the direction of the changing normal. From these I needed to find the path ie, the third parameter of your ExtrudeShapeCustom function. I found this too difficult and found it much easier using existing BJS transformation functions and apply them to the points around the edge of the cross section rather than the normal. Now having written that perhaps I was trying to think in 3D rather than just applying the the transformations directly to the normal. Mmmm perhaps it was that easy! Quote Link to comment Share on other sites More sharing options...
MidnightCow Posted September 19, 2015 Share Posted September 19, 2015 Nice Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.