Jump to content

volume of mesh from vertices?


georage
 Share

Recommended Posts

Has anyone figured out how to determine the volume of a mesh?

I have a parent and child mesh in this playground, but can't figure out how to determine the volume from the vertices of the combined mesh so went with this ugly kludge, but I don't even know how to make the playground output console messages.

I notice in testing that the parent mesh does have vertices saved, but I am not sure how to access them. (looks like _boundingInfo -> boundingbox -> vectors ??? )

http://www.babylonjs-playground.com/#1YODXL#4

I am attaching a jpg showing the object array returned in my testing ... can anyone tell me how to access the values? (and also how to make playgrounds show console.log messages?)

THANKS!

 

 

Capture.JPG

Link to comment
Share on other sites

Hello 

i think @Wingnut will tell you more about it

Just shortly if you see underscore and name _name these are Protected members of a Class (or in Javascipt offen called an Object, same thing, maybe, you have to do you own research on this topic)
you don't have to access them, i would recommend as learning experience avoiding to access them, and find out through reading of tutorials, whats the actual function call that you need

to simpfy things, people wrote books about it:

console.log(box1)
box1 is a "Class" with many members
_boundingInfo is a protected member

you want to access one of them you have to go in though a dot

box1.boundingInfo()

i made a quick playground you can see, hopefully, what i do.

http://www.babylonjs-playground.com/#1YODXL#5


https://github.com/BabylonJS/Babylon.js/blob/9019f5d151943212e9602c1a6ed5b13800ed6ab2/src/Debug/babylon.debugLayer.js

Link to comment
Share on other sites

Showing console.log messages is done in the same way as you would do it normally in your browser of choice by opening the console from developer menu. Note that the PG adds new messages to the bottom of existing PG messages so clear the console before clicking on run.

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