File: |
Math.lib |
Version: |
1.0 |
Author: |
Marcus Johansson |
Details
Constants
Sub routines
Some extra math functions.
Name |
Description | |
M_PI# |
PI. |
|
M_D2R# |
For conversion from degrees to radians. |
|
M_R2D# |
For conversion from radians to degrees. |
Conversion between number formats |
|||
Name |
Parameters |
Brief description |
|
function |
dec |
Convert from decimal to binary. |
|
function |
bin$ |
Convert from binary to decimal. |
|
function |
dec |
Convert from decimal to hexadecimal. |
|
function |
hex$ |
Convert from hexadecimal to decimal. |
|
Distances and angles |
|||
Name |
Parameters |
Brief description |
|
function |
x1, y1, x2, y2 |
Returns distance between two integer points. |
|
function |
x1#, y1#, x2#, y2# |
Returns distance between two floating point points. |
|
function |
x1, y1, x2, y2 |
Returns the inverted distance between two integer points. |
|
function |
x1#, y1#, x2#, y2# |
Returns the inverted distance between two floating point points. |
|
function |
src_x, src_y, dst_x, dst_y |
Angle from one integer point to another. |
|
function |
src_x#, src_y#, dst_x#, dst_y# |
Angle from one floating point point to another. |
|
2D vectors |
|||
Name |
Parameters |
Brief description |
|
procedure |
&u#[], &v#[] |
Add a vector 'v' to 'u'. |
|
procedure |
&u#[], &v#[] |
Subtract vector 'v' from 'u'. |
|
procedure |
&u#[], s# |
Multipy vector 'u' with scalar 's'. |
|
procedure |
&u#[] |
Normalize 'u'. |
|
procedure |
&u#[], a# |
Rotate 'u' by 'a' degrees/radians. |
|
procedure |
&u#[], &v#[] |
Project vector 'u' on 'v'. |
|
procedure |
&u#[], &v#[] |
Reflect 'u' in 'v'. |
|
function |
&u#[], &v#[] |
Get vector 'u + v'. |
|
function |
&u#[], &v#[] |
Get vector 'u - v'. |
|
function |
&u#[], s# |
Get vector 'u*s'. |
|
function |
&u#[] |
Get normalized vector 'u'. |
|
function |
&u#[], a# |
Get 'u' rotated 'a' degrees/radians. |
|
function |
&u#[], &v#[] |
Get vector 'u' projected on 'v'. |
|
function |
&u#[], &v#[] |
Get vector 'u' reflected in 'v'. |
|
function |
&u#[] |
Get size of 'u'. |
|
function |
&u#[], &v#[] |
Get vector dot product 'u*v'. |
|
function |
&u#[], &v#[] |
Get determinant 'u x v'. |
|
function |
&u#[] |
Get angle of vector 'u'. |
|
function |
&u#[], &v#[] |
Get angle between vector 'u' and 'v'. |
|
function |
&u#[], &v#[] |
Return true if 'u' and 'v' are equal. |
|
function |
&u#[], &v#[] |
Return true if 'u' and 'v' are parallel. |
function DecToBin$ ( dec )Convert from decimal to binary.
Return value [ Back ] |
function BinToDec ( bin$ )Convert from binary to decimal.
Return value [ Back ] |
function DecToHex$ ( dec )Convert from decimal to hexadecimal.
Return value [ Back ] |
function HexToDec ( hex$ )Convert from hexadecimal to decimal.
Return value [ Back ] |
function Distance# ( x1, y1, x2, y2 )Returns distance between two integer points.
Return value [ Back ] |
function DistanceF# ( x1#, y1#, x2#, y2# )Returns distance between two floating point points.
Return value [ Back ] |
function InvDistance# ( x1, y1, x2, y2 )Returns the inverted distance between two integer points.
Return value [ Back ] |
function InvDistanceF# ( x1#, y1#, x2#, y2# )Returns the inverted distance between two floating point points.
Return value [ Back ] |
function AngleTo# ( src_x, src_y, dst_x, dst_y )Angle from one integer point to another.
Return value [ Back ] |
function AngleToF# ( src_x#, src_y#, dst_x#, dst_y# )Angle from one floating point point to another.
Return value [ Back ] |
procedure V_Add ( &u#[], &v#[] )Add a vector 'v' to 'u'.
[ Back ] |
procedure V_Sub ( &u#[], &v#[] )Subtract vector 'v' from 'u'.
[ Back ] |
procedure V_Scale ( &u#[], s# )Multipy vector 'u' with scalar 's'.
[ Back ] |
procedure V_Normalize ( &u#[] )Normalize 'u'.
[ Back ] |
procedure V_Rotate ( &u#[], a# )Rotate 'u' by 'a' degrees/radians.
[ Back ] |
procedure V_Project ( &u#[], &v#[] )Project vector 'u' on 'v'.
[ Back ] |
procedure V_Reflect ( &u#[], &v#[] )Reflect 'u' in 'v'.
[ Back ] |
function V_AddGet#[] ( &u#[], &v#[] )Get vector 'u + v'.
Return value [ Back ] |
function V_SubGet#[] ( &u#[], &v#[] )Get vector 'u - v'.
Return value [ Back ] |
function V_ScaleGet#[] ( &u#[], s# )Get vector 'u*s'.
Return value [ Back ] |
function V_NormalizeGet#[] ( &u#[] )Get normalized vector 'u'.
Return value [ Back ] |
function V_RotateGet#[] ( &u#[], a# )Get 'u' rotated 'a' degrees/radians.
Return value [ Back ] |
function V_ProjectGet#[] ( &u#[], &v#[] )Get vector 'u' projected on 'v'.
Return value [ Back ] |
function V_ReflectGet#[] ( &u#[], &v#[] )Get vector 'u' reflected in 'v'.
Return value [ Back ] |
function V_Size# ( &u#[] )Get size of 'u'.
Return value [ Back ] |
function V_Dot# ( &u#[], &v#[] )Get vector dot product 'u*v'.
Return value [ Back ] |
function V_Cross# ( &u#[], &v#[] )Get determinant 'u x v'.
Return value [ Back ] |
function V_Angle# ( &u#[] )Get angle of vector 'u'.
Return value [ Back ] |
function V_AngleBetween# ( &u#[], &v#[] )Get angle between vector 'u' and 'v'.
Return value [ Back ] |
function V_Equal ( &u#[], &v#[] )Return true if 'u' and 'v' are equal.
Return value [ Back ] |
function V_Parallel ( &u#[], &v#[] )Return true if 'u' and 'v' are parallel.
Return value [ Back ] |
Generated with NLDoc 20140626.