How to calculate Mass of a Polygon?
7 posts • Page 1 of 1
How to calculate Mass of a Polygon?
I know that the Mass of a box or circle can be calculated with area * density, but that doesn't seem to work with polygons. So, does anyone know how I could calculate the mass of a polygon? OR is the Mass directly readable some how?
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: How to calculate Mass of a Polygon?
But that is area*density even with polygons...I tested here and it works.
-
carl00s01 - Posts: 24
- Joined: Fri Nov 26, 2010 7:03 pm
- Location: Brazil
Re: How to calculate Mass of a Polygon?
Thanks for your reply, carl00s01, but it does not work for my gold ring polygons in my recent scene http://www.algodoo.com/algobox/details.php?id=150626. If you load my scene and zoom in so that you can select just one gold ring, you will see that they all have a mass of exactly 100 grams (except for thief number 8, who has been stealing one gram per gold ring). Now, if you multiply the density of one gold ring by it's area, the result is approximately 9.8 grams (not 100 grams)! So, maybe area times density works for a closed polygon, but not for one with holes in it like my gold rings!
The way that I calculate it in my scene is, I reverse-calculated one ring, and found that I could divide the density by a particular constant (you can see my calculation in the onSpawn event). But I was hoping that it could be calculated without fudging it.
The way that I calculate it in my scene is, I reverse-calculated one ring, and found that I could divide the density by a particular constant (you can see my calculation in the onSpawn event). But I was hoping that it could be calculated without fudging it.
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: How to calculate Mass of a Polygon?
I saw your scene and it indeed gives the wrong mass. I tried to recreate that ring with all those codes and it gave me the right mass when I printed it in a scene.my variable. I don't know what you've done to make this bug appear, but it mass for any geometry is area*density...
-
carl00s01 - Posts: 24
- Joined: Fri Nov 26, 2010 7:03 pm
- Location: Brazil
Re: How to calculate Mass of a Polygon?
Hmmmmm..... very strange. I wish I knew what I did too!
Thanks again,
Xray
Thanks again,
Xray
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: How to calculate Mass of a Polygon?
I can't reproduce bug with area calculation... I have correct area for polygons.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: How to calculate Mass of a Polygon?
I noticed that all of the gold rings in my scene have the wrong area value. If I select a gold ring and then resize it and put it back to the original size, then the area is correct! So, I assume that the problem originally occurred when I copy and pasted those gold rings. Something that I did caused the incorrect area calculation, which was off by a factor of 10!
I won't worry about it any longer. Thanks for your help!
I won't worry about it any longer. Thanks for your help!
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
7 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests