<?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/9757" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2014-02-12T07:20:00+00:00</updated>

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

		<entry>
		<author><name><![CDATA[guernika]]></name></author>
		<updated>2014-02-12T07:20:00+00:00</updated>

		<published>2014-02-12T07:20:00+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32941#p32941</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32941#p32941"/>
		<title type="html"><![CDATA[softbody internal functions]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32941#p32941"><![CDATA[
Dear all,<br><br>I'm trying to understand what is the output of the functions ProjectOrigin and BaryCoord, contained in the file btSoftbodyInternals.h.<br>Any suggestion will be appreciated.<br>Thanks in advance,<br>Francesco<br><br><div class="codebox"><p>Code: </p><pre><code>static inline btVector3BaryCoord(const btVector3&amp; a,  const btVector3&amp; b,  const btVector3&amp; c,  const btVector3&amp; p){const btScalarw[]={btCross(a-p,b-p).length(),btCross(b-p,c-p).length(),btCross(c-p,a-p).length()};const btScalarisum=1/(w[0]+w[1]+w[2]);return(btVector3(w[1]*isum,w[2]*isum,w[0]*isum));}static inline voidProjectOrigin(const btVector3&amp; a,  const btVector3&amp; b,  btVector3&amp; prj,  btScalar&amp; sqd){const btVector3d=b-a;const btScalarm2=d.length2();if(m2&gt;SIMD_EPSILON){const btScalart=Clamp&lt;btScalar&gt;(-btDot(a,d)/m2,0,1);const btVector3p=a+d*t;const btScalarl2=p.length2();if(l2&lt;sqd){prj=p;sqd=l2;}}}static inline voidProjectOrigin(const btVector3&amp; a,  const btVector3&amp; b,  const btVector3&amp; c,  btVector3&amp; prj,  btScalar&amp; sqd){const btVector3&amp;q=btCross(b-a,c-a);const btScalarm2=q.length2();if(m2&gt;SIMD_EPSILON){const btVector3n=q/btSqrt(m2);const btScalark=btDot(a,n);const btScalark2=k*k;if(k2&lt;sqd){const btVector3p=n*k;if((btDot(btCross(a-p,b-p),q)&gt;0)&amp;&amp;(btDot(btCross(b-p,c-p),q)&gt;0)&amp;&amp;(btDot(btCross(c-p,a-p),q)&gt;0)){prj=p;sqd=k2;}else{ProjectOrigin(a,b,prj,sqd);ProjectOrigin(b,c,prj,sqd);ProjectOrigin(c,a,prj,sqd);}}}}</code></pre></div><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=6632">guernika</a> — Wed Feb 12, 2014 7:20 am</p><hr />
]]></content>
	</entry>
	</feed>
