📄 ft2-computations.html
字号:
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>The angle pi expressed in <a href="ft2-computations.html#FT_Angle">FT_Angle</a> units.</p>
</td></tr></table><br>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_ANGLE_2PI">FT_ANGLE_2PI</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
#define <b>FT_ANGLE_2PI</b> ( <a href="ft2-computations.html#FT_ANGLE_PI">FT_ANGLE_PI</a> * 2 )
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>The angle 2*pi expressed in <a href="ft2-computations.html#FT_Angle">FT_Angle</a> units.</p>
</td></tr></table><br>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_ANGLE_PI2">FT_ANGLE_PI2</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
#define <b>FT_ANGLE_PI2</b> ( <a href="ft2-computations.html#FT_ANGLE_PI">FT_ANGLE_PI</a> / 2 )
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>The angle pi/2 expressed in <a href="ft2-computations.html#FT_Angle">FT_Angle</a> units.</p>
</td></tr></table><br>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_ANGLE_PI4">FT_ANGLE_PI4</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
#define <b>FT_ANGLE_PI4</b> ( <a href="ft2-computations.html#FT_ANGLE_PI">FT_ANGLE_PI</a> / 4 )
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>The angle pi/4 expressed in <a href="ft2-computations.html#FT_Angle">FT_Angle</a> units.</p>
</td></tr></table><br>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Sin">FT_Sin</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
FT_EXPORT( <a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a> )
<b>FT_Sin</b>( <a href="ft2-computations.html#FT_Angle">FT_Angle</a> angle );
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Return the sinus of a given angle in fixed point format.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>angle</b></td><td>
<p>The input angle.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>The sinus value.</p>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
<p>If you need both the sinus and cosinus for a given angle, use the function <a href="ft2-computations.html#FT_Vector_Unit">FT_Vector_Unit</a>.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Cos">FT_Cos</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
FT_EXPORT( <a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a> )
<b>FT_Cos</b>( <a href="ft2-computations.html#FT_Angle">FT_Angle</a> angle );
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Return the cosinus of a given angle in fixed point format.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>angle</b></td><td>
<p>The input angle.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>The cosinus value.</p>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
<p>If you need both the sinus and cosinus for a given angle, use the function <a href="ft2-computations.html#FT_Vector_Unit">FT_Vector_Unit</a>.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Tan">FT_Tan</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
FT_EXPORT( <a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a> )
<b>FT_Tan</b>( <a href="ft2-computations.html#FT_Angle">FT_Angle</a> angle );
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Return the tangent of a given angle in fixed point format.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>angle</b></td><td>
<p>The input angle.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>The tangent value.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Atan2">FT_Atan2</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
FT_EXPORT( <a href="ft2-computations.html#FT_Angle">FT_Angle</a> )
<b>FT_Atan2</b>( <a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a> x,
<a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a> y );
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Return the arc-tangent corresponding to a given vector (x,y) in the 2d plane.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>x</b></td><td>
<p>The horizontal vector coordinate.</p>
</td></tr>
<tr valign=top><td><b>y</b></td><td>
<p>The vertical vector coordinate.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>The arc-tangent value (i.e. angle).</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Angle_Diff">FT_Angle_Diff</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
FT_EXPORT( <a href="ft2-computations.html#FT_Angle">FT_Angle</a> )
<b>FT_Angle_Diff</b>( <a href="ft2-computations.html#FT_Angle">FT_Angle</a> angle1,
<a href="ft2-computations.html#FT_Angle">FT_Angle</a> angle2 );
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Return the difference between two angles. The result is always constrained to the ]-PI..PI] interval.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>angle1</b></td><td>
<p>First angle.</p>
</td></tr>
<tr valign=top><td><b>angle2</b></td><td>
<p>Second angle.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>Contrainted value of `value2-value1'.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Vector_Unit">FT_Vector_Unit</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
FT_EXPORT( <span class="keyword">void</span> )
<b>FT_Vector_Unit</b>( <a href="ft2-basic_types.html#FT_Vector">FT_Vector</a>* vec,
<a href="ft2-computations.html#FT_Angle">FT_Angle</a> angle );
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Return the unit vector corresponding to a given angle. After the call, the value of `vec.x' will be `sin(angle)', and the value of `vec.y' will be `cos(angle)'.</p>
<p>This function is useful to retrieve both the sinus and cosinus of a given angle quickly.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>output</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>vec</b></td><td>
<p>The address of target vector.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>angle</b></td><td>
<p>The address of angle.</p>
</td></tr>
</table>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Vector_Rotate">FT_Vector_Rotate</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
FT_EXPORT( <span class="keyword">void</span> )
<b>FT_Vector_Rotate</b>( <a href="ft2-basic_types.html#FT_Vector">FT_Vector</a>* vec,
<a href="ft2-computations.html#FT_Angle">FT_Angle</a> angle );
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Rotate a vector by a given angle.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>inout</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>vec</b></td><td>
<p>The address of target vector.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>angle</b></td><td>
<p>The address of angle.</p>
</td></tr>
</table>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Vector_Length">FT_Vector_Length</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
FT_EXPORT( <a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a> )
<b>FT_Vector_Length</b>( <a href="ft2-basic_types.html#FT_Vector">FT_Vector</a>* vec );
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Return the length of a given vector.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>vec</b></td><td>
<p>The address of target vector.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>The vector length, expressed in the same units that the original vector coordinates.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Vector_Polarize">FT_Vector_Polarize</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
FT_EXPORT( <span class="keyword">void</span> )
<b>FT_Vector_Polarize</b>( <a href="ft2-basic_types.html#FT_Vector">FT_Vector</a>* vec,
<a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a> *length,
<a href="ft2-computations.html#FT_Angle">FT_Angle</a> *angle );
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Compute both the length and angle of a given vector.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>vec</b></td><td>
<p>The address of source vector.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>output</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>length</b></td><td>
<p>The vector length.</p>
</td></tr>
<tr valign=top><td><b>angle</b></td><td>
<p>The vector angle.</p>
</td></tr>
</table>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Vector_From_Polar">FT_Vector_From_Polar</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
FT_EXPORT( <span class="keyword">void</span> )
<b>FT_Vector_From_Polar</b>( <a href="ft2-basic_types.html#FT_Vector">FT_Vector</a>* vec,
<a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a> length,
<a href="ft2-computations.html#FT_Angle">FT_Angle</a> angle );
</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Compute vector coordinates from a length and angle.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>output</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>vec</b></td><td>
<p>The address of source vector.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>length</b></td><td>
<p>The vector length.</p>
</td></tr>
<tr valign=top><td><b>angle</b></td><td>
<p>The vector angle.</p>
</td></tr>
</table>
</td></tr></table>
</td></tr></table><hr width="75%">
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -