Jump to content

A GUI Extrusion Tool


JohnK
 Share

Recommended Posts

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.

 

post-14282-0-51981500-1442575134.jpg

 

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

post-14282-0-62646900-1442576832.jpg      post-14282-0-42700300-1442576833.jpg

 

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 :-

  1. how to get the correct data from the rotate parameter for the rotationFunction,
  2. how to separate the x and y scale so that they were independent by changing scaleInPlace  using
BABYLON.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 when

var 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.

 

 

Link to comment
Share on other sites

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 curves

Tilt  - rotation of normal about x axis

Twist - rotation of normal about y axis

Move x - displacement of normal along x axis

Move y - displacement of normal along y axis

and 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!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...