Forum: Poser - OFFICIAL


Subject: Loop-making script

Cage opened this issue on Apr 03, 2010 · 610 posts


markschum posted Mon, 19 April 2010 at 1:13 AM

This was on page 5 of this thread - repeated for convenience.

I found some good explanations on the internet for solving the formula for a parabola if you have 3 points on it.  so if you have (-4,4)(0,1) (3,2) as points you can get the values for y = ax^2 + bx + c  (general formula for a parabola)  values a.b.c  and then calculate
for x = -4 to 3 step 0.5
  y = etc
next x   and create the curve.  (a bit more complex to calculate he exact positions and angles of each link but can be done ) 

to solve you get three equations (one for each point known)  which can be solved by an inverse matrix multiplication
which some kind mathematician did http://stackoverflow.com/questions/717762/how-to-calculate-the-vertex-of-a-parabola-given-three-points

here is the matrix thing expanded :

<pre class="prettyprint">
<span class="pln">denom </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x1 </span><span class="pun">-</span><span class="pln"> x2</span><span class="pun">)(</span><span class="pln">x1 </span><span class="pun">-</span><span class="pln"> x3</span><span class="pun">)(</span><span class="pln">x2 </span><span class="pun">-</span><span class="pln"> x3</span><span class="pun">)</span><span class="pln"><br></br>A </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x3 </span><span class="pun">*</span><span class="pln"> </span><span class="pun">(</span><span class="pln">y2 </span><span class="pun">-</span><span class="pln"> y1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> x2 </span><span class="pun">*</span><span class="pln"> </span><span class="pun">(</span><span class="pln">y1 </span><span class="pun">-</span><span class="pln"> y3</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> x1 </span><span class="pun">*</span><span class="pln"> </span><span class="pun">(</span><span class="pln">y3 </span><span class="pun">-</span><span class="pln"> y2</span><span class="pun">))</span><span class="pln"> </span><span class="pun">/</span><span class="pln"> denom<br></br>B </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x3</span><span class="pun">^</span><span class="lit">2</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="pun">(</span><span class="pln">y1 </span><span class="pun">-</span><span class="pln"> y2</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> x2</span><span class="pun">^</span><span class="lit">2</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="pun">(</span><span class="pln">y3 </span><span class="pun">-</span><span class="pln"> y1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> x1</span><span class="pun">^</span><span class="lit">2</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="pun">(</span><span class="pln">y2 </span><span class="pun">-</span><span class="pln"> y3</span><span class="pun">))</span><span class="pln"> </span><span class="pun">/</span><span class="pln"> denom<br></br>C </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x2 </span><span class="pun">*</span><span class="pln"> x3 </span><span class="pun">*</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x2 </span><span class="pun">-</span><span class="pln"> x3</span><span class="pun">)</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> y1 </span><span class="pun">+</span><span class="pln"> x3 </span><span class="pun">*</span><span class="pln"> x1 </span><span class="pun">*</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x3 </span><span class="pun">-</span><span class="pln"> x1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> y2 </span><span class="pun">+</span><span class="pln"> x1 </span><span class="pun">*</span><span class="pln"> x2 </span><span class="pun">*</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x1 </span><span class="pun">-</span><span class="pln"> x2</span><span class="pun">)</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> y3</span><span class="pun">)</span><span class="pln"> </span><span class="pun">/</span><span class="pln"> denom    once you have the three values you can calculate any point on the curve  for x from x1 to x3 (the start and end positions)    This has point of reference issues and works for the parabola in a plane x,y    in a 3d situation you would find the plane of the endpoints, and rotate it parrallel to an axis.   Then when you calculate the curve and pose the chain, you have a simple rotation back into position.     I hope you can follow that :(     <br></br></span>