Sign in to follow this  

Facet Data

Recommended Posts

Hi Folks,

I'm proud to introduce a brand new feature already integrated in the BJS core : FacetData

This feature provides some methods to access and to play with mesh facets. Facets are the elementary triangles drawn by WebGL. We call them "facets" here in order to be not confused with the term "faces" : a box has 6 squared planar faces but each face is drawn with 2 facets (triangles).

In bulk, you've got :

mesh.updateFacetData();           // enables the feature or recompute things
mesh.disableFacetData();          // disables it
mesh.isFacetDataEnabled;          // boolean, as it says ...
mesh.facetNb;                     // number of facets
mesh.getFacetPosition(i);         // gives the world position of the i-th facet
mesh.getFacetNormal(i);           // gives the world normal values of the i-th facet
mesh.getClosestFacetAtCoordinates(x,y,z); // gives the index of the closest facet to (x,y,z) in the world

// etc ...

and plenty of other fun tools to play with !

Please have a read at the doc (it should be in the section "Advanced Tutorials" of the doc site as soon as Monday the 23rd of January... if @RaananW accepts my bribes) and at the provided PG examples.

For those who cares, all the facet indexes here are the same than the ones used by the object PickingInfo or the pickable SPS, called there faceId.

So you can easily mix all these different features. Example : to get the normal of the facet from a picked point on a mesh.


Have fun ;)

Share this post

Link to post
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.

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.