Jump to content

Tube and Extrusion Cap


jerome
 Share

Recommended Posts

Hi people,

 

As it was asked by some people, I could implement a cap option in Tube and Extruded mesh types.

This would add another parameter in functions already quite rich in parameters ... Just a matter of practice.

 

Since BJS 2.1 is not yet released as stable (BTW is there a planned date ?), I could set this parameter before "scene" in the parameter order, because there are yet other general (for all mesh types) and optional parameters after "scene" : upgradable, orientation, instance.

 

This new parameter could have different values :

0 = no cap

1 = cap at axis starting point (top)

2 = cap at axis endinf point (bottom)

3 = both

 

I would do this because I realize it's quite difficult for a user to cap a parametric mesh with strange shapes after it is initially computed.

Moreover it would need a lot of maths if the mesh should be then animated or morphed.

 

Any thoughts ?

Link to comment
Share on other sites

WARNING

 

For tube mesh users only :

As BJS 2.1 is not released the tube creation method is not fixed.

 

It has just changed :

var tube = BABYLON.Mesh.CreateTube(name, path, radius, tessellation, radiusFunction, cap, scene);

There is now an extra parameter cap just before the scene parameter in the call signature.

 

cap allowed values :

0 = no cap

1 = cap on start

2 = cap on end

3 = both

Link to comment
Share on other sites

PR for extrusion cap

 

WARNING

 

For extruded shape users only :

As BJS 2.1 is not released the extrusion method is not fixed.

 

It has just changed :

var ex = BABYLON.Mesh.ExtrudeShape(name, shape, path, scale, rotation, cap, scene);var cstm = BABYLON.Mesh.ExtrudeShapeCustom(name, shape, path, scaleFunction, rotateFunction, ribbonCloseArray, ribbonClosePath, cap scene);

There is now an extra parameter cap just before the scene parameter in the call signature.

 

cap allowed values :

0 = no cap

1 = cap on start

2 = cap on end

3 = both

 

As the shape to be extruded is parametric and so unpredictable, its barycenter is taken in account to set the cap center.

Link to comment
Share on other sites

  • 5 months later...
  • 1 month later...

I observed in the behavior of capping extrusions that it is doing something like tessellating each (subsequent)vertex pair of the profile with a centerpoint of the extrusion. This will give a nice result for some profiles, but not all. I am sure it has been considered that the created cap could be drawn with "overhanging" parts if the tessellated triangle overlaps the line from another vertex pair. Is there a way to get around this? I am happy to create some playground code to show this, but I am sure, if I have explained well, that you'd already be familiar with the problem.

Link to comment
Share on other sites

  • 5 months later...

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