TempleOSCD_140715.ISO
This commit is contained in:
1 parent
7ef616a20e
commit
64f679eeb9
1095 files changed
+24814
-221011
No files matched your search
+18
-20
@@ -1,7 +1,7 @@
|
||||
#help_index "Math"
|
||||
public U0 R2P(F64 *_mag=NULL,F64 *_arg=NULL,F64 x,F64 y)
|
||||
{ //Rect to polar
|
||||
//returns angle in range (-ã,ã]
|
||||
{//Rect to polar
|
||||
//Returns angle in range (-ã,ã]
|
||||
if (_arg)
|
||||
*_arg=Arg(x,y);
|
||||
if (_mag)
|
||||
@@ -9,7 +9,7 @@ public U0 R2P(F64 *_mag=NULL,F64 *_arg=NULL,F64 x,F64 y)
|
||||
}
|
||||
|
||||
public U0 P2R(F64 *_x=NULL,F64 *_y=NULL,F64 mag,F64 arg)
|
||||
{ //Polar to Rect
|
||||
{//Polar to Rect
|
||||
if (_x)
|
||||
*_x=mag*Cos(arg);
|
||||
if (_y)
|
||||
@@ -17,7 +17,7 @@ public U0 P2R(F64 *_x=NULL,F64 *_y=NULL,F64 mag,F64 arg)
|
||||
}
|
||||
|
||||
public F64 Wrap(F64 é,F64 base=-ã)
|
||||
{ //returns angle in range [base,base+2*ã)
|
||||
{//Returns angle in range [base,base+2*ã)
|
||||
F64 result=é%(2*ã);
|
||||
if (result>=base+2*ã)
|
||||
result-=2*ã;
|
||||
@@ -26,14 +26,14 @@ public F64 Wrap(F64
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 DistI64(I64 x1,I64 y1,I64 x2,I64 y2)
|
||||
{
|
||||
public I64 DistSqrI64(I64 x1,I64 y1,I64 x2,I64 y2)
|
||||
{//Distance-squared between 2 points.
|
||||
I64 dx=x1-x2,dy=y1-y2;
|
||||
return dx*dx+dy*dy;
|
||||
}
|
||||
|
||||
public F64 ASin(F64 s)
|
||||
{
|
||||
{//Arc Sin (Inverse Sin).
|
||||
F64 c;
|
||||
c=s*s;
|
||||
if (c>=1.0)
|
||||
@@ -43,7 +43,7 @@ public F64 ASin(F64 s)
|
||||
}
|
||||
|
||||
public F64 ACos(F64 c)
|
||||
{
|
||||
{//Arc Cos (Inverse Cos).
|
||||
F64 s;
|
||||
if (!c)
|
||||
return ã/2.0;
|
||||
@@ -55,39 +55,39 @@ public F64 ACos(F64 c)
|
||||
}
|
||||
|
||||
public F64 Sinh(F64 x)
|
||||
{
|
||||
{//Hyperbolic Sine.
|
||||
return 0.5*(Exp(x)-Exp(-x));
|
||||
}
|
||||
|
||||
public F64 Cosh(F64 x)
|
||||
{
|
||||
{//Hyperbolic Cosine.
|
||||
return 0.5*(Exp(x)+Exp(-x));
|
||||
}
|
||||
|
||||
#help_index "Math/Complex"
|
||||
public Complex *CAdd(Complex *n1,Complex *n2,Complex *sum)
|
||||
{
|
||||
{//n1 + n2 -->sum
|
||||
sum->x=n1->x+n2->x;
|
||||
sum->y=n1->y+n2->y;
|
||||
return sum;
|
||||
}
|
||||
|
||||
public Complex *CSub(Complex *n1,Complex *n2,Complex *diff)
|
||||
{
|
||||
{//n1 - n2 -->diff
|
||||
diff->x=n1->x-n2->x;
|
||||
diff->y=n1->y-n2->y;
|
||||
return diff;
|
||||
}
|
||||
|
||||
public Complex *CMul(Complex *n1,Complex *n2,Complex *prod)
|
||||
{
|
||||
{//n1 * n2 -->prod
|
||||
prod->x=n1->x*n2->x-n1->y*n2->y;
|
||||
prod->y=n1->x*n2->y+n1->y*n2->x;
|
||||
return prod;
|
||||
}
|
||||
|
||||
public Complex *CDiv(Complex *n1,Complex *n2,Complex *quot)
|
||||
{
|
||||
{//n1 / n2 -->quot
|
||||
F64 m1,a1,m2,a2;
|
||||
R2P(&m1,&a1,n1->x,n1->y);
|
||||
R2P(&m2,&a2,n2->x,n2->y);
|
||||
@@ -99,28 +99,28 @@ public Complex *CDiv(Complex *n1,Complex *n2,Complex *quot)
|
||||
}
|
||||
|
||||
public Complex *CScale(Complex *dst,F64 s)
|
||||
{
|
||||
{//dst *= s
|
||||
dst->x*=s;
|
||||
dst->y*=s;
|
||||
return dst;
|
||||
}
|
||||
|
||||
public Complex *CCopy(Complex *dst,Complex *src)
|
||||
{
|
||||
{//dst=src
|
||||
dst->x=src->x;
|
||||
dst->y=src->y;
|
||||
return dst;
|
||||
}
|
||||
|
||||
public Complex *CEqu(Complex *dst,F64 x,F64 y)
|
||||
{
|
||||
{//dst=x,y
|
||||
dst->x=x;
|
||||
dst->y=y;
|
||||
return dst;
|
||||
}
|
||||
|
||||
public Complex *CPoly(Complex *dst,Complex *x,Complex *zeros,I64 n)
|
||||
{
|
||||
{//Eval complex polynomial.
|
||||
I64 i;
|
||||
Complex n1,n2;
|
||||
if (n>0) {
|
||||
@@ -134,5 +134,3 @@ public Complex *CPoly(Complex *dst,Complex *x,Complex *zeros,I64 n)
|
||||
CEqu(dst,1.0,0.0);
|
||||
return dst;
|
||||
}
|
||||
|
||||
#help_index ""
|
||||
Reference in new issue
Block a user