Jump to content

ribbon mesh... first attempt


jerome
 Share

Recommended Posts

http://www.babylonjs-playground.com/#2E9DTS#9

 

Here is a very simple but useful, I hope, mesh type : ribbon

A ribbon is defined by two pathes or curves. It is the surface between these two pathes.

A path in an array of vertices sequentially along this path.

 

For now, there is no control, but you need at least two vertices on each path (so in each array) to create a ribbon.

If a path has more vertices than the other, the ribbon is created on the shorter path only. Supernumery vertices are ignored.

 

This mesh type is very basic but could be very useful as you can set any curve points in parameters.

 

5 simple examples :

- a flat ribbon with 2 pathes of 3 vertices each

- a cubic ribbon (with ribbons, you can reproduce many basic shapes, even agregate ribbons if needed)

- a sinusoidal ribbon along x-axis

- a tubular ribbon, a bit more complex than a simple cylinder

- a conic ribbon

 

As gently proposed by JCPalmer, here is the function signature :

 

var pathA = [vertA1, vertA2, vertA3, ...];

var pathB = [vertB1, vertB2, vertB3, ...];

var mesh = new BABYLON.Mesh("ribbon", scene);

 

createRibbon(mesh, pathA, pathB);

 

 

first day playing with BJS and some code already running... :-D

Damn, I like this framework !!!

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