Jump to content

Find all facets (vertex) in surface


Recommended Posts

Frist- Hi evryone, i'm newbie on Babylon Js.

Second - i'm lookin for similar args , with no goal. - - sorry if alredy exist one


I'm looking for method to select all surface facets (basically I select the entire surface)

My idea is:

R1: "Facets with two vertices equal are contiguous" ( evaluate a set of coordinates)

R2: "Valuate the same oriented  'Normal' facets "

  Evaluate true of R1 && R2,  made well done job?

 Thanks 4 help

Link to comment
Share on other sites

Hi @Luca, welcome to the forum.  I don't understand the question, but perhaps over-my-head.  Hopefully, others (smarter people) will reply.


That is one of my favorite "basic plotting" playground demos.  Much can be learned there... about how BJS mesh store their shape information (on a vertexData-class object).  The blue number boxes are helpers... temporary.  They number the vertices for you.  Those numbers... are the numbers used in indices data.  Every three numbers in the indices array... are three vertex numbers... connected together to form a triangular face/facet.  Try to add the "boxify" function to whatever mesh you are experimenting-with.  It will help you learn how to find the correct vertices/indices that make-up a face/facet.

You can use GET and SET methods found on Mesh Class objects... to retrieve/install shape data of mesh... such as mesh.getVerticesData(somekind).

Another thread has some more information. 

Be patient with yourself.  It takes a little time to learn how to gather and test the vertexData.positions array.  It all starts with mesh.getVerticesData like those seen in THIS playground demo.  

A playground search for getVerticesData returns over 1000 hits, so you have many examples of people manipulating mesh shapes.  Make adjustments to ANY playground demo you wish, and hit RUN over and over, and SAVE as often as you wish.  You cannot damage anything in the playground.  It is a wonderful place to learn/experiment.  But it is wise to bookmark the URL's of your playground saves, sometimes.

It also might be wise to TRY to better explain what you wish to do (add another post here, or edit the one above).  It sounds like you need to START... with gathering the vertex positions on all 3 corners of a triangular face/facet.  Start with small mesh, so you have less troubles with big indices arrays and vertex positions arrays.  A plane or ground is a nice mesh to do tests-with.

I hope this helps.  Good luck.  Experiment, experiment, experiment.  :) Others may comment soon.  Again, welcome!

Link to comment
Share on other sites

Is this what you are asking?

Some objects are made from planar surfaces, for example a box has 6 planar surfaces whereas a solid cylinder has 2 planar surfaces. We call these planer surfaces faces. When creating a mesh any face of the mesh will be made from several triangular facets. In order to select a face it is necessary to select all the facets of that face.

How do you check that two or more facets belong to the same face?

Yes you will need to check for shared vertices but unless the mesh is a flat shaded mesh the normals for the vertices may not be the mathematical normal for the facet and so your method may not work.

Have a read of this


Link to comment
Share on other sites

Thanks @Wingnut & @JohnK for your answers and welcome .

@Wingnut , I'm sorry if you did not understand I try to explain better.

      I starting study with your example to understand vertices and facets,.....  i create :  http://www.babylonjs-playground.com/#1PTNXE#35

     1 red  mesh is result of CSG union-intersect, etc... pratically.... any figure 

     2 green box's showing all vertices of all facetes . You can see it in red, adding , scene.forceWireframe =true; in code.

 @JohnK , exact,  My goal is identify  "planar surfaces" now i raffine it.

     3 Under the green box you can find little green line ,  results of .convertToFlatShadedMesh();  

           I need to calculate a normal's of facets (3 vertices result ), not of single vertice like  

     4 Rear the green box you find a red line result of example (http://www.babylonjs-playground.com/#VKBJN#6), but at now result of all vertices (labelled on box's ) of all facetes of specific Vertex.

Link to comment
Share on other sites

Ciao. Provo imparare italiano. Ogni settimana vado a una classe ma so solamente un po. Perche vuoi trovare il superfici piano, qual è il tuo obiettivo dopo li trovate?

Hi. I am trying to learn Italian. Every week I go to a class, but I know only a little. Why do you want to find the plane surfaces, what is your goal after you find them?

Link to comment
Share on other sites

Complimenti per il tuo Italiano.(sorry 4 my eng)

    My Frist goal is , pick on "planar surfaces" (all area),  assign on it attribute like "DOOR" or "CLOTH" , maybe i solved by solution for normals -->  http://www.babylonjs-playground.com/#1XCJJO

    My Second Goal is optimize it .... Remove were is possible facetes extra / redundant, es. 3 facets(9 vertices ) in square surface are too many.

    I hope it is useful to someone else .... olso, my third objective is practicing with English writing.

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.

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.


  • Recently Browsing   0 members

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