diff options
Diffstat (limited to 'svtools/source/dialogs/mcvmath.cxx')
-rw-r--r-- | svtools/source/dialogs/mcvmath.cxx | 159 |
1 files changed, 0 insertions, 159 deletions
diff --git a/svtools/source/dialogs/mcvmath.cxx b/svtools/source/dialogs/mcvmath.cxx index 5d5ad14c82c2..f34737b8a4f0 100644 --- a/svtools/source/dialogs/mcvmath.cxx +++ b/svtools/source/dialogs/mcvmath.cxx @@ -71,23 +71,6 @@ Fix ImpMultBig2( const Fix& a, const Fix& b ) /************************************************************************** |* -|* ImpMultBig2() -|* -|* Beschreibung Multiplikation fuer FixPoint-Berechnungen -|* -**************************************************************************/ - -// first parameter should be the bigger one - -FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb ) -{ - Fix rr = ImpMultBig2(ra.r,rb.r)-ImpMultBig2(ra.i,rb.i); - Fix ii = ImpMultBig2(ra.r,rb.i)+ImpMultBig2(ra.i,rb.r); - return FixCpx( rr,ii ); -} - -/************************************************************************** -|* |* ImpSqrt() |* |* Beschreibung Wurzelfunktion fuer FixPoint-Berechnungen @@ -146,146 +129,4 @@ FixCpx ImpExPI( sal_uInt16 nPhi ) return aIter; } -/************************************************************************** -|* -|* ImpATanx2() -|* -|* Beschreibung ATANX2-Funktion fuer FixPoint-Berechnungen -|* -**************************************************************************/ - -// use for x*x+y*y==1 only - -static sal_uInt16 ImpATanx2( const Fix& rX, const Fix& rY ) -{ - sal_uInt16 phi0 = 0; // result angel higher part - sal_uInt16 phi = 0; // dito lower part - long x = rX.x; - long y = rY.x; - long z; - const char Sft=14-FIX_POST; - short i; - FixCpx aTry; - FixCpx aInc; - FixCpx aIter(1L); - sal_Bool Small = sal_False; - - if ( (x==0) && (y==0) ) - return 0; - - if ( y < 0) - { - // reduce 3. to 1. quadrant (0..90 Degree) - phi0 += 180L * 65536L / 360L; - // turn 180 degree - y *= -1; - x *= -1; - } - - if ( x < 0) - { - // 2. to 1. q. - phi0 += 90L * 65536L / 360L; - // turn 90 degree clockwise - z = y; - y = -x; - x = z; - } - - for ( i = 13; i >= 0; i-- ) - { - aInc.r.x = CosTab[i]>>Sft; // e**(i(phi1+phi2)) = - aInc.i.x = SinTab[i]>>Sft; // e**(i*phi1)) * e**(i*phi2)) - aTry = aIter*aInc; - - if ( Small ) - { - // is try ok - if ( aTry.r.x >= x ) - { - aIter = aTry; - phi += (1<<i); - } - } - else - { - // is try ok - if ( aTry.i.x <= y ) - { - aIter = aTry; - phi += (1<<i); - - if ( i > 11 ) - Small=sal_True; - } - } - } - - return phi0+phi; -} - -/************************************************************************** -|* -|* ImpATan2() -|* -|* Beschreibung ATAN-Funktion fuer FixPoint-Berechnungen -|* -**************************************************************************/ - -sal_uInt16 ImpATan2( const short x, const short y ) -{ - Fix rRad = ImpSqrt(sal_uLong(long(x)*x+long(y)*y)); - - if ( !rRad.x ) - return 0; - Fix fx = x; - fx.DivBig( rRad ); // Normiere auf Einheitskreis - Fix fy = y; - fy.DivBig( rRad ); - - return ImpATanx2( fx, fy ); -} - -/************************************************************************** -|* -|* ImpCartToPolar() -|* -|* Beschreibung Koordinaaten-Wandlung -|* -**************************************************************************/ - -void ImpCartToPolar( const short x, const short y, Fix& rRad, sal_uInt16& rPhi ) -{ - rRad = Fix( ImpSqrt( sal_uLong( long(x)*x+long(y)*y ) ) ); - - if ( !rRad.x ) - rPhi=0; - else - { - // Normiere auf Einheitskreis - Fix fx = x; - fx.DivBig(rRad); - Fix fy = y; - fy.DivBig(rRad); - rPhi = ImpATanx2(fx, fy); - } -} - -/************************************************************************** -|* -|* ImpPolarToCart() -|* -|* Beschreibung Koordinaaten-Wandlung -|* -**************************************************************************/ - -void ImpPolarToCart( const Fix& rR, const sal_uInt16 Phi, short& rX, short& rY ) -{ - FixCpx fc = ImpExPI( Phi ); // calculate sin() & cos() - fc.GetReal().MultBig( rR ); - rX = sal::static_int_cast< short >(long( fc.GetReal() )); - fc.GetImag().MultBig( rR ); - rY = sal::static_int_cast< short >(long( fc.GetImag() )); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |