<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/566" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2006-09-30T15:58:20+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/566</id>

		<entry>
		<author><name><![CDATA[Erwin Coumans]]></name></author>
		<updated>2006-09-30T15:58:20+00:00</updated>

		<published>2006-09-30T15:58:20+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1988#p1988</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1988#p1988"/>
		<title type="html"><![CDATA[Volume Integration]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1988#p1988"><![CDATA[
<blockquote class="uncited"><div><blockquote class="uncited"><div>You can adjust the center of mass by using compound shapes: just translate the collision shape. I will make some demo to demonstrate this.<br>Bullet uses a full inertial tensor, but it assumes that the main axis of inertia is aligned along the coordinate axis. In that case you can store the inertia as main diagonal (vector3).<br>The solver uses a 3x3 matrix, the inverse inertia tensor.<br><br>I might add an explicit COM shift routine, but right now the is a workaround by shifting the collision model around the 'center of mass'. It gives the same effect.</div></blockquote>But many classes hold and accept Vector as inertia. It should be converted to Matrix. It should be Matrix from <strong class="text-strong">calculateLocalInertia</strong> and <strong class="text-strong">btCcdConstructionInfo::m_localInertiaTensor</strong> to deep inside the core (among all methods). No?<br>My routine (assumed it should be called inside calculateLocalInertia) want to fill Matrix....</div></blockquote>As long as the rigidbody center of mass is aligned with the inertia frame, you can store the inertia matrix as a vector3. However, aligning this either requires an additional transform (center of mass shift) or applying the reverse-transform to the collision geometry (using a compound).<br><br>If you provide the full local inertia matrix for the model, I can make a utility method that makes the right conversions.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=2">Erwin Coumans</a> — Sat Sep 30, 2006 3:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Jack]]></name></author>
		<updated>2006-09-30T15:34:52+00:00</updated>

		<published>2006-09-30T15:34:52+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1987#p1987</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1987#p1987"/>
		<title type="html"><![CDATA[Volume Integration]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1987#p1987"><![CDATA[
<blockquote class="uncited"><div>You can adjust the center of mass by using compound shapes: just translate the collision shape. I will make some demo to demonstrate this.<br>Bullet uses a full inertial tensor, but it assumes that the main axis of inertia is aligned along the coordinate axis. In that case you can store the inertia as main diagonal (vector3).<br>The solver uses a 3x3 matrix, the inverse inertia tensor.<br><br>I might add an explicit COM shift routine, but right now the is a workaround by shifting the collision model around the 'center of mass'. It gives the same effect.</div></blockquote>But many classes hold and accept Vector as inertia. It should be converted to Matrix. It should be Matrix from <strong class="text-strong">calculateLocalInertia</strong> and <strong class="text-strong">btCcdConstructionInfo::m_localInertiaTensor</strong> to deep inside the core (among all methods). No?<br>My routine (assumed it should be called inside calculateLocalInertia) want to fill Matrix....<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=772">Jack</a> — Sat Sep 30, 2006 3:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Erwin Coumans]]></name></author>
		<updated>2006-09-30T15:07:38+00:00</updated>

		<published>2006-09-30T15:07:38+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1984#p1984</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1984#p1984"/>
		<title type="html"><![CDATA[Volume Integration]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1984#p1984"><![CDATA[
You can adjust the center of mass by using compound shapes: just translate the collision shape. I will make some demo to demonstrate this.<br>Bullet uses a full inertial tensor, but it assumes that the main axis of inertia is aligned along the coordinate axis. In that case you can store the inertia as main diagonal (vector3).<br>The solver uses a 3x3 matrix, the inverse inertia tensor.<br><br>I might add an explicit COM shift routine, but right now the is a workaround by shifting the collision model around the 'center of mass'. It gives the same effect.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=2">Erwin Coumans</a> — Sat Sep 30, 2006 3:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SteveBaker]]></name></author>
		<updated>2006-09-30T13:24:17+00:00</updated>

		<published>2006-09-30T13:24:17+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1982#p1982</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1982#p1982"/>
		<title type="html"><![CDATA[Re: Volume Integration]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1982#p1982"><![CDATA[
<blockquote class="uncited"><div>Maybe I am wrong, but I see you do not find COM (Center Of Mass) in local model coords. You assume that it is always at (0,0,0). Right?</div></blockquote>I believe that's true - it is the problem I've been having with some of my vehicle models which always come out top-heavy and hence roll over too easily.  Being able to adjust the center of mass to be lower to the ground and closer to the front (for most cars for example) would help a lot.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=726">SteveBaker</a> — Sat Sep 30, 2006 1:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Jack]]></name></author>
		<updated>2006-09-30T10:02:31+00:00</updated>

		<published>2006-09-30T10:02:31+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1978#p1978</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1978#p1978"/>
		<title type="html"><![CDATA[Re: Volume Integration]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1978#p1978"><![CDATA[
<blockquote class="uncited"><div><blockquote class="uncited"><div>It would be great to calculate true inertia tensor, center of mass and body volume.</div></blockquote>It would be nice, but for a lot of applications, apploximate inertia tensors work fine, some developers even intentionally modify the inertia to improve stability...<br><br>I'm too busy to add it myself, my short-term focus is on memory management, performance, doing a Fork-lift demo, character control using the convex linear sweep, and integrating FAST concave continuous collision detection.<br><br>It would be great to get this as a contribution, preferably one that combines the inertia tensors for multiple objects so we can use it in the CompoundShape class. Typically there are 2 versions, one that distributes the mass uniform over the entire volume, and another that distributes mass at the outer boundary. As long as it is under the zlib license. Brian Mirtich also provides an implementation. Do you volunteer Jack?</div></blockquote>I have some routines based on Brian Mirtich. They work OK. Ageia also uses full inertia tensor and it looks like they have no stability problems.<br>Probably I could adopt it to Bullet, but first you need to adjust your solver to use Matrix tensor instead of Vector.<br><br>Maybe I am wrong, but I see you do not find COM (Center Of Mass) in local model coords. You assume that it is always at (0,0,0). Right?<br>If so, then you are to adjust solver to apply rotation around COM....<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=772">Jack</a> — Sat Sep 30, 2006 10:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Erwin Coumans]]></name></author>
		<updated>2006-09-29T17:08:57+00:00</updated>

		<published>2006-09-29T17:08:57+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1964#p1964</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1964#p1964"/>
		<title type="html"><![CDATA[Re: Volume Integration]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1964#p1964"><![CDATA[
<blockquote class="uncited"><div>It would be great to calculate true inertia tensor, center of mass and body volume.</div></blockquote>It would be nice, but for a lot of applications, apploximate inertia tensors work fine, some developers even intentionally modify the inertia to improve stability...<br><br>I'm too busy to add it myself, my short-term focus is on memory management, performance, doing a Fork-lift demo, character control using the convex linear sweep, and integrating FAST concave continuous collision detection.<br><br>It would be great to get this as a contribution, preferably one that combines the inertia tensors for multiple objects so we can use it in the CompoundShape class. Typically there are 2 versions, one that distributes the mass uniform over the entire volume, and another that distributes mass at the outer boundary. As long as it is under the zlib license. Brian Mirtich also provides an implementation. Do you volunteer Jack?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=2">Erwin Coumans</a> — Fri Sep 29, 2006 5:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Jack]]></name></author>
		<updated>2006-09-29T15:55:37+00:00</updated>

		<published>2006-09-29T15:55:37+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1963#p1963</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1963#p1963"/>
		<title type="html"><![CDATA[Volume Integration]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1963#p1963"><![CDATA[
It would be great to calculate true inertia tensor, center of mass and body volume.<br>Look here: <a href="http://www.melax.com/volint/" class="postlink">http://www.melax.com/volint/</a><br><br>or<br><br><br>Pseudocode<br>The pseudocode for computing the integrals is quite simple. The polyhedron vertices are passes as the array<br>p[]. The number of triangles is tmax. The array index[] has tmax triples of integers that are indices into<br>the vertex array. The return values are the mass, the center of mass, and the inertia tensor relative to the<br>center of mass.<br>MACRO Subexpressions(w0,w1,w2,f1,f2,f3,g0,g1,g2)<br>{<br>temp0 = w0+w1; f1 = temp0+w2; temp1 = w0*w0; temp2 = temp1+w1*temp0;<br>f2 = temp2+w2*f1; f3 = w0*temp1+w1*temp2+w2*f2;<br>g0 = f2+w0*(f1+w0); g1 = f2+w1*(f1+w1); g2 = f2+w2*(f1+w2);<br>}<br>void Compute (Point p[], int tmax, int index[], Real&amp; mass, Point&amp; cm, Matrix&amp; inertia)<br>{<br>constant Real mult[10] = {1/6,1/24,1/24,1/24,1/60,1/60,1/60,1/120,1/120,1/120};<br>Real intg[10] = {0,0,0,0,0,0,0,0,0,0}; // order: 1, x, y, z, x^2, y^2, z^2, xy, yz, zx<br>for (t = 0; t &lt; tmax; t++)<br>{<br>// get vertices of triangle t<br>i0 = index[3*t]; i1 = index[3*t+1]; i2 = index[3*t+2];<br>x0 = p[i0].x; y0 = p[i0].y; z0 = p[i0].z;<br>x1 = p[i1].x; y1 = p[i1].y; z1 = p[i1].z;<br>x2 = p[i2].x; y2 = p[i2].y; z2 = p[i2].z;<br>// get edges and cross product of edges<br>a1 = x1-x0; b1 = y1-y0; c1 = z1-z0; a2 = x2-x0; b2 = y2-y0; c2 = z2-z0;<br>d0 = b1*c2-b2*c1; d1 = a2*c1-a1*c2; d2 = a1*b2-a2*b1;<br>// compute integral terms<br>Subexpressions(x0,x1,x2,f1x,f2x,f3x,g0x,g1x,g2x);<br>Subexpressions(y0,y1,y2,f1y,f2y,f3y,g0y,g1y,g2y);<br>Subexpressions(z0,z1,z2,f1z,f2z,f3z,g0z,g1z,g2z);<br>// update integrals<br>intg[0] += d0*f1x;<br>intg[1] += d0*f2x; intg[2] += d1*f2y; intg[3] += d2*f2z;<br>intg[4] += d0*f3x; intg[5] += d1*f3y; intg[6] += d2*f3z;<br>intg[7] += d0*(y0*g0x+y1*g1x+y2*g2x);<br>intg[8] += d1*(z0*g0y+z1*g1y+z2*g2y);<br>intg[9] += d2*(x0*g0z+x1*g1z+x2*g2z);<br>}<br>for (i = 0; i &lt; 10; i++)<br>intg<em class="text-italics"> *= mult<em class="text-italics">;<br>mass = intg[0];<br>// center of mass<br>cm.x = intg[1]/mass;<br>cm.y = intg[2]/mass;<br>5<br>cm.z = intg[3]/mass;<br>// inertia tensor relative to center of mass<br>inertia.xx = intg[5]+intg[6]-mass*(cm.y*cm.y+cm.z*cm.z);<br>inertia.yy = intg[4]+intg[6]-mass*(cm.z*cm.z+cm.x*cm.x);<br>inertia.zz = intg[4]+intg[5]-mass*(cm.x*cm.x+cm.y*cm.y);<br>inertia.xy = -(intg[7]-mass*cm.x*cm.y);<br>inertia.yz = -(intg[8]-mass*cm.y*cm.z);<br>inertia.xz = -(intg[9]-mass*cm.z*cm.x);<br>}</em></em><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=772">Jack</a> — Fri Sep 29, 2006 3:55 pm</p><hr />
]]></content>
	</entry>
	</feed>
