<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>macouno.com &#187; Math</title>
	<atom:link href="http://www.macouno.com/category/miscellaneous/math/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.macouno.com</link>
	<description>The shenanigans of Dolf J. Veenvliet</description>
	<lastBuildDate>Tue, 07 Sep 2010 12:15:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Normal smooth method</title>
		<link>http://www.macouno.com/2010/03/17/normal-smooth-method/</link>
		<comments>http://www.macouno.com/2010/03/17/normal-smooth-method/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 20:33:56 +0000</pubDate>
		<dc:creator>Dolf Veenvliet</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Blender]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.macouno.com/?p=507</guid>
		<description><![CDATA[On this post I&#8217;ll try to explain how the method for the Normal Smooth script works.

Concept
The idea is to reposition verticles so your mesh ends up nice and smooth. Of course there is already a function in Blender that does it, but that doesn&#8217;t take the actual &#8220;surface&#8221; of the mesh into account. So say [...]]]></description>
			<content:encoded><![CDATA[<p>On this post I&#8217;ll try to explain how the method for the Normal Smooth script works.</p>
<hr />
<h3>Concept</h3>
<p>The idea is to reposition verticles so your mesh ends up nice and smooth. Of course there is already a function in Blender that does it, but that doesn&#8217;t take the actual &#8220;surface&#8221; of the mesh into account. So say you have a part of a perfect sphere selected, and you run the current internal function, it would flatten that selection, or even make it concave (hollow). That&#8217;s what we don&#8217;t want. In stead if you try to smooth a perfect sphere, it should not change anything. You can&#8217;t get smoother than a sphere!</p>
<p>See below here&#8230; that&#8217;s not nicely smoothed!<br />
<a href="http://www.macouno.com/wp-content/uploads/2010/03/wrongsmooth.jpg"><img class="alignnone size-full wp-image-509" title="wrongsmooth" src="http://www.macouno.com/wp-content/uploads/2010/03/wrongsmooth.jpg" alt="" width="410" height="275" /></a></p>
<hr />
<h3>Smoothing the normal way</h3>
<p>I&#8217;ll explain the concept in 2D. Lets say we want to smooth the position of vertex <strong>A </strong>and it&#8217;s connected to vertex <strong>B</strong> and <strong>C</strong>. Then we get the vertex normals for <strong>B</strong> and <strong>C</strong>. We then rotate those normal vectors 90 degrees towards <strong>A</strong> and make them half the length of the distance between that specific vert (<strong>B</strong> or <strong>C</strong>) and <strong>A</strong>. Once we have those, we find the points at the ends of those two vectors and place vert <strong>A</strong> at the midpoint between them.</p>
<p>But let me explain with a picture, which should help.</p>
<p><a href="http://www.macouno.com/wp-content/uploads/2010/03/diagram.png"><img class="alignnone size-full wp-image-508" title="diagram" src="http://www.macouno.com/wp-content/uploads/2010/03/diagram.png" alt="" width="640" height="300" /></a></p>
<hr />
<h3>That&#8217;s just the basics</h3>
<p>Of course there is a lot more that you can do with a script. Like looking further along the surface and using more normals. Also in 3d at times you have quads and you need to figure out what you want to do with the vert at the far end of the quad. Having non manifold meshes can be tricky too.</p>
<p>At least I hope this explains the idea a bit, and as ideas go&#8230;. it&#8217;s not too bad</p>
<p>Dolf</p>
]]></content:encoded>
			<wfw:commentRss>http://www.macouno.com/2010/03/17/normal-smooth-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mechanics math</title>
		<link>http://www.macouno.com/2010/03/17/mechanics-math/</link>
		<comments>http://www.macouno.com/2010/03/17/mechanics-math/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 20:24:02 +0000</pubDate>
		<dc:creator>Dolf Veenvliet</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://www.macouno.com/?p=488</guid>
		<description><![CDATA[Here so I don&#8217;t have to search the internet to look for this stuff.
I&#8217;m working on some physics things for my swarm AI&#8230; tricky since I haven&#8217;t done any of this for ehm&#8230; 15 years or so.

Second law of Newton
F = m * a
a = F/m
m = F/a
F is force in newtons
m is mass in kilograms
a is acceleration [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Here so I don&#8217;t have to search the internet to look for this stuff.</strong></p>
<p>I&#8217;m working on some physics things for my swarm AI&#8230; tricky since I haven&#8217;t done any of this for ehm&#8230; 15 years or so.</p>
<hr />
<h3>Second law of Newton</h3>
<p><strong>F = m * a<br />
a = F/m<br />
m = F/a</strong></p>
<p><strong>F</strong> is force in newtons<br />
<strong>m</strong> is mass in kilograms<br />
<strong>a</strong> is acceleration in meters per second</p>
]]></content:encoded>
			<wfw:commentRss>http://www.macouno.com/2010/03/17/mechanics-math/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding mesh angles</title>
		<link>http://www.macouno.com/2010/03/17/finding-mesh-angles/</link>
		<comments>http://www.macouno.com/2010/03/17/finding-mesh-angles/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 19:26:13 +0000</pubDate>
		<dc:creator>Dolf Veenvliet</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Blender]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.macouno.com/?p=410</guid>
		<description><![CDATA[Here I&#8217;ll try to explain a method for finding out the angle of a mesh at a specific point/edge in python.
This method can for instance be used to create effects like with the ma baker or ma self scripts;

Finding the angle between two faces in Blender
Now this isn&#8217;t really complicated.
Lets say you retrieve two faces from [...]]]></description>
			<content:encoded><![CDATA[<p>Here I&#8217;ll try to explain a method for finding out the angle of a mesh at a specific point/edge in python.</p>
<p>This method can for instance be used to create effects like with the ma baker or ma self scripts;</p>
<hr />
<h2>Finding the angle between two faces in Blender</h2>
<p>Now this isn&#8217;t really complicated.</p>
<p>Lets say you retrieve two faces from Blender&#8217;s python API that are connected by an edge.</p>
<p>Lets call them <strong>face1</strong> and <strong>face2</strong> and <strong>face1.no</strong> retrieves the face normal of <strong>face1</strong>.</p>
<p><a href="http://www.macouno.com/wp-content/uploads/2010/03/anglebetweenfaces.gif"><img class="alignnone size-full wp-image-411" title="anglebetweenfaces" src="http://www.macouno.com/wp-content/uploads/2010/03/anglebetweenfaces.gif" alt="" width="300" height="200" /></a></p>
<p>Then we can simply do the following to find the angle:</p>
<div class="code"><pre class="python"><ol><li class="li1"><div class="de1">myAngle = <span class="kw6">Mathutils</span>.<span class="kw8">AngleBetweenVecs</span><span class="br0">&#40;</span>face1.<span class="me1">no</span>, face2.<span class="me1">no</span><span class="br0">&#41;</span></div></li></ol></pre></div><p><a href="javascript: void(0);" class="showpre">Display clean python code for copying</a></p><pre class="python">myAngle = Mathutils.AngleBetweenVecs(face1.no, face2.no)</pre>
<p>The result though is only an angle between 0 and 90 degrees, to find out if that is positive or negative continue reading below.</p>
<hr />
<h2>Finding out whether the angle between two faces is convex or concave</h2>
<p>A lot of the time you also want to know whether the angle is concave or convex (positive or negative).</p>
<p>To get that we get the vector from the midpoint of <strong>face1</strong> to the midpoint of <strong>face2</strong>.</p>
<p>The midpoint of a face is retrieved by getting <strong>face1.cent</strong>.</p>
<p>Then we get the dot product of the face normal of <strong>face1</strong> and the vector we just retrieved.</p>
<p><a href="http://www.macouno.com/wp-content/uploads/2010/03/dotbetweenfaces.gif"><img class="alignnone size-full wp-image-412" title="dotbetweenfaces" src="http://www.macouno.com/wp-content/uploads/2010/03/dotbetweenfaces.gif" alt="" width="500" height="200" /></a></p>
<p>In python that could be:</p>
<div class="code"><pre class="python"><ol><li class="li1"><div class="de1">dotProduct = <span class="kw6">Mathutils</span>.<span class="kw8">DotVecs</span><span class="br0">&#40;</span>face1.<span class="me1">no</span>, <span class="br0">&#40;</span>face2.<span class="me1">cent</span> - face1.<span class="me1">cent</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div></li></ol></pre></div><p><a href="javascript: void(0);" class="showpre">Display clean python code for copying</a></p><pre class="python">dotProduct = Mathutils.DotVecs(face1.no, (face2.cent - face1.cent))</pre>
<p>The resulting dot product will be either positive or negative depending on whether the angle is concave or convex.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.macouno.com/2010/03/17/finding-mesh-angles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Angle math</title>
		<link>http://www.macouno.com/2010/03/17/angle-math/</link>
		<comments>http://www.macouno.com/2010/03/17/angle-math/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 13:00:21 +0000</pubDate>
		<dc:creator>Dolf Veenvliet</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.macouno.com/?p=316</guid>
		<description><![CDATA[This is just here so I don&#8217;t forget ;)
(small characters here refer to angles, capitals to lengths of sides)

An oblique triangle
A triangle without a 90 degree angle

Python equivalents of the above math are for instance (untested):
A = math.sin(a) / (math.sin(b)/B)
B = math.sin(b) / (math.sin(c)/C)
C = math.sin(c) / (math.sin(a)/A)

A right angle triangle
A triangle with a single [...]]]></description>
			<content:encoded><![CDATA[<p>This is just here so I don&#8217;t forget ;)</p>
<p>(small characters here refer to angles, capitals to lengths of sides)</p>
<hr />
<h3>An oblique triangle</h3>
<p>A triangle without a 90 degree angle</p>
<p><a href="http://www.macouno.com/wp-content/uploads/2010/03/math_oblique.gif"><img class="alignnone size-full wp-image-319" title="math_oblique" src="http://www.macouno.com/wp-content/uploads/2010/03/math_oblique.gif" alt="" width="500" height="180" /></a></p>
<p>Python equivalents of the above math are for instance (untested):</p>
<p>A = math.sin(a) / (math.sin(b)/B)</p>
<p>B = math.sin(b) / (math.sin(c)/C)</p>
<p>C = math.sin(c) / (math.sin(a)/A)</p>
<hr />
<h3>A right angle triangle</h3>
<p>A triangle with a single 90 degree angle (a in this case)</p>
<p><a href="http://www.macouno.com/wp-content/uploads/2010/03/math_right.gif"><img class="alignnone size-full wp-image-320" title="math_right" src="http://www.macouno.com/wp-content/uploads/2010/03/math_right.gif" alt="" width="500" height="211" /></a></p>
<p>Python equivalents of the above math are for instance:</p>
<p>c = math.asin(C/A)</p>
<p>c = math.acos(A/C)</p>
<p>c = math.atan(C/B)</p>
<p>A = math.sqrt(B*B+C*C)</p>
<p><strong>Remember soscastoa!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.macouno.com/2010/03/17/angle-math/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
