diff --git a/ETL/ETL/CMakeLists.txt b/ETL/ETL/CMakeLists.txt index 8654c27..643299e 100644 --- a/ETL/ETL/CMakeLists.txt +++ b/ETL/ETL/CMakeLists.txt @@ -13,7 +13,6 @@ set(ETL_HEADERS "${CMAKE_CURRENT_LIST_DIR}/hermite" "${CMAKE_CURRENT_LIST_DIR}/fixed" "${CMAKE_CURRENT_LIST_DIR}/surface" - "${CMAKE_CURRENT_LIST_DIR}/fastangle" "${CMAKE_CURRENT_LIST_DIR}/thread" "${CMAKE_CURRENT_LIST_DIR}/clock" "${CMAKE_CURRENT_LIST_DIR}/stringf" @@ -34,7 +33,6 @@ set(ETL_HEADERS "${CMAKE_CURRENT_LIST_DIR}/_ref_count.h" "${CMAKE_CURRENT_LIST_DIR}/_mutex_win32.h" "${CMAKE_CURRENT_LIST_DIR}/_trivial.h" - "${CMAKE_CURRENT_LIST_DIR}/_fastangle.h" "${CMAKE_CURRENT_LIST_DIR}/_smach.h" "${CMAKE_CURRENT_LIST_DIR}/_rwlock.h" "${CMAKE_CURRENT_LIST_DIR}/_surface.h" @@ -49,7 +47,6 @@ set(ETL_HEADERS "${CMAKE_CURRENT_LIST_DIR}/_clock_base.h" "${CMAKE_CURRENT_LIST_DIR}/_mutex_null.h" "${CMAKE_CURRENT_LIST_DIR}/_clock_win32hpcount.h" - "${CMAKE_CURRENT_LIST_DIR}/_fastangle_tables.h" "${CMAKE_CURRENT_LIST_DIR}/_bspline.h" "${CMAKE_CURRENT_LIST_DIR}/_clock_gettimeofday.h" "${CMAKE_CURRENT_LIST_DIR}/etl_config.h" diff --git a/ETL/ETL/Makefile.am b/ETL/ETL/Makefile.am index ffd24f8..d038f6f 100644 --- a/ETL/ETL/Makefile.am +++ b/ETL/ETL/Makefile.am @@ -19,7 +19,6 @@ etl_HEADERS = \ ref_count \ _ref_count.h \ angle \ - fastangle \ handle \ ipc \ thread \ @@ -40,7 +39,6 @@ etl_HEADERS = \ _clock_system.h \ _clock_gettimeofday.h \ _angle.h \ - _fastangle.h \ _handle.h \ _thread.h \ _mutex_pthreads.h \ @@ -52,7 +50,6 @@ etl_HEADERS = \ _fixed.h \ etl_config.h \ $(top_builddir)/ETL/etl_profile.h \ - _fastangle_tables.h \ bezier \ _bezier.h \ _bezier_angle.h \ diff --git a/ETL/ETL/_fastangle.h b/ETL/ETL/_fastangle.h deleted file mode 100644 index ac4d918..0000000 --- a/ETL/ETL/_fastangle.h +++ /dev/null @@ -1,461 +0,0 @@ -/*! ======================================================================== -** Extended Template and Library -** Fast fastangle Abstraction Class Implementation -** $Id$ -** -** Copyright (c) 2002 Robert B. Quattlebaum Jr. -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** -** === N O T E S =========================================================== -** -** This is an internal header file, included by other ETL headers. -** You should not attempt to use it directly. -** -** ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __ETL__FASTANGLE_H -#define __ETL__FASTANGLE_H - -/* === H E A D E R S ======================================================= */ - -#include -#include - -#include "_fastangle_tables.h" - -/* === M A C R O S ========================================================= */ - -#ifndef PI -# define PI (3.1415926535897932384626433832795029L) -#endif - -#define ETL_FASTANGLE_INIT() - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace etl { - -/*! ======================================================================== -** \class fastangle -** \brief Optimized abstraction of the concept of an angle -** -** A more detailed description needs to be written. -*/ -class fastangle -{ -public: - typedef double value_type; - -protected: - typedef fixed_base unit; - - unit v; //! Stored in rotations - -public: - - /* - ** Arithmetic Operators - */ - - //! fastangle Addition Operator - fastangle - operator+(const fastangle &rhs)const - { - fastangle ret; - ret.v=v+rhs.v; - return ret; - } - - //! fastangle Subtraction Operator - /*! \sa fastangle dist(const fastangle &) */ - fastangle - operator-(const fastangle &rhs)const - { - fastangle ret; - ret.v=v-rhs.v; - return ret; - } - - //! fastangle Scalar Multiplication Operator - /*! This operator will multiply the given - fastangle by the given scalar value. */ - fastangle - operator*(const unit &rhs)const - { - fastangle ret; - ret.v=v*rhs; - return ret; - } - - fastangle - operator/(const unit &rhs)const - { - fastangle ret; - ret.v=v/rhs; - return ret; - } - - const fastangle & - operator+=(const fastangle &rhs) - { - v+=rhs.v; - return *this; - } - - const fastangle & - operator-=(const fastangle &rhs) - { - v-=rhs.v; - return *this; - } - - const fastangle & - operator*=(const unit &rhs) - { - v*=rhs; - return *this; - } - - const fastangle & - operator/=(const unit &rhs) - { - v/=rhs; - return *this; - } - - //! fastangle Negation - fastangle - operator-()const - { - fastangle ret; - ret.v=-v; - return ret; - } - - //! 180 degree rotation operator - /*! Returns the fastangle directly opposite of - the given fastangle, and will yield a result - between 0 and 2PI */ - fastangle - operator~()const - { - fastangle ret; - ret.v=(unit)std::floor(v+0.5f); - return ret; - } - - /*! Returns true if the shortest - fastangle between the left-hand and - right-hand side is clockwise */ - bool - operator<(const fastangle &rhs)const - { return v(const fastangle &rhs)const - { return v>rhs.v; } -// { return dist(rhs).v>(value_type)0.0; } - - /*! Returns true if the shortest - fastangle between the left-hand and - right-hand side is clockwise, - or if the angles are refer to the same - point on the unit circle. */ - bool - operator<=(const fastangle &rhs)const - { return v<=rhs.v; } -// { return dist(rhs).v<=(value_type)0.0; } - - /*! Returns true if the shortest - fastangle between the left-hand and - right-hand side is counter-clockwise, - or if the angles are refer to the same - point on the unit circle. */ - bool - operator>=(const fastangle &rhs)const - { return v>=rhs.v; } -// { return dist(rhs).v>=(value_type)0.0; } - - /*! Returns true if the angles - are refer to the same point - on the unit circle. */ - bool - operator==(const fastangle &rhs)const - { return v==rhs.v; } -// { return dist(rhs).v==(value_type)0.0; } - - /*! Returns false if the angles - are refer to the same point - on the unit circle. */ - bool - operator!=(const fastangle &rhs)const - { return v!=rhs.v; } -// { return dist(rhs).v!=(value_type)0.0; } - - //! fastangle Difference Function - /*! This function will return the - shortest physical distance between - two angles, from -PI/2 to PI/2 - \warning Not yet tested - \sa fastangle operator-(const fastangle &) */ - fastangle - dist(const fastangle &rhs)const - { - fastangle ret; - ret.v=v-rhs.v; - ret.v-=(unit)std::floor(ret.v+0.5f); - return ret; - } - - //! Rotation Modulus - /*! This function will return the - value of the fastangle between 0 and 2PI */ - fastangle - mod()const - { - fastangle ret(*this); - ret.v-=(unit)std::floor(ret.v); - return ret; - } - - static fastangle - zero() - { - fastangle ret; - ret.v=0; - return ret; - } - - bool operator!()const { return v==unit(0); } - - /* - ** Conversion Classes - */ - - class radians; - class degrees; - class rotations; - - /* - ** Trigonometric Classes - */ - - class sin; - class cos; - class tan; - - /* - ** Friend classes - */ - - friend class radians; - friend class degrees; - friend class rotations; - friend class sin; - friend class cos; - friend class tan; - - /* - ** Bleh... - */ - - typedef radians rad; - typedef degrees deg; - typedef rotations rot; - -}; // END of class fastangle - -/*! ======================================================================== -** \class fastangle::radians -** \brief fastangle representation in radians -** -** A more detailed description needs to be written. -*/ -class fastangle::radians : public fastangle -{ -public: - radians(const value_type &x) { v=x/((value_type)PI*2.0f); } - radians(const fastangle &a):fastangle(a) { } - radians mod()const { return fastangle::mod(); } - radians dist(const fastangle &rhs)const { return fastangle::dist(rhs); } - operator value_type()const { return get(); } - value_type get()const { return (value_type)v*(value_type)PI*2.0f; } -}; // END of class fastangle::radians - -/*! ======================================================================== -** \class fastangle::degrees -** \brief fastangle representation in degrees -** -** A more detailed description needs to be written. -*/ -class fastangle::degrees : public fastangle -{ -public: - degrees(const value_type &x) { v=x/360; } - degrees(const fastangle &a):fastangle(a) { } - degrees mod()const { return fastangle::mod(); } - degrees dist(const fastangle &rhs)const { return fastangle::dist(rhs); } - operator value_type()const { return get(); } - value_type get()const { return v*360/*(value_type)(v-::floor(v))*360*/; } -}; // END of class fastangle::degrees - -/*! ======================================================================== -** \class fastangle::rotations -** \brief fastangle representation in rotations -** -** A more detailed description needs to be written. -*/ -class fastangle::rotations : public fastangle -{ -public: - rotations(const value_type &x) { v=x; } - rotations(const fastangle &a):fastangle(a) { } - rotations mod()const { return fastangle::mod(); } - rotations dist(const fastangle &rhs)const { return fastangle::dist(rhs); } - operator value_type()const { return get(); } - value_type get()const { return v; } -}; // END of class fastangle::rotations - -/*! ======================================================================== -** \class fastangle::sin -** \brief fastangle representation as a sine function -** -** A more detailed description needs to be written. -*/ -class fastangle::sin : public fastangle -{ -public: - sin(const value_type &x) { v.data()=_fastangle_asin_table[(int)((x+1)*(value_type)(1<<(ETL_FASTANGLE_LOOKUP_RES-1)))]; } - sin(const fastangle &a):fastangle(a) { } - sin mod()const { return fastangle::mod(); } - sin dist(const fastangle &rhs)const { return fastangle::dist(rhs); } - operator value_type()const { return get(); } - value_type get()const { return (value_type)_fastangle_sin_table[v.data()&( (1<1) - v.data()=(1<<(ETL_FASTANGLE_LOOKUP_RES-2))-_fastangle_atan_table[(int)(((1.0/x)+1)*(value_type)((1<<(ETL_FASTANGLE_LOOKUP_RES-1))-1))]; - else if(x<-1) - v.data()=-(1<<(ETL_FASTANGLE_LOOKUP_RES-1)) + (1<<(ETL_FASTANGLE_LOOKUP_RES-2)) - _fastangle_atan_table[(int)(((1.0/x)+1)*(value_type)((1<<(ETL_FASTANGLE_LOOKUP_RES-1))-1))]; - else - v.data()=_fastangle_atan_table[(int)((x+1)*(value_type)((1<<(ETL_FASTANGLE_LOOKUP_RES-1))-1))]; - } - - tan(const value_type &y,const value_type &x) - { - if(x>=0 && y>=0) // First quadrant - { - if(y>x) - v.data()=(1<<(ETL_FASTANGLE_LOOKUP_RES-2))-_fastangle_atan_table[(int)(((x/y)+1)*(value_type)((1<<(ETL_FASTANGLE_LOOKUP_RES-1))-1))]; - else - v.data()=_fastangle_atan_table[(int)(((y/x)+1)*(value_type)((1<<(ETL_FASTANGLE_LOOKUP_RES-1))-1))]; - } - else if(x>=0 && y<0) // Fourth quadrant - { - if(-y>x) - v.data()=-(1<<(ETL_FASTANGLE_LOOKUP_RES-1)) + (1<<(ETL_FASTANGLE_LOOKUP_RES-2))-_fastangle_atan_table[(int)(((x/y)+1.0)*(value_type)((1<<(ETL_FASTANGLE_LOOKUP_RES-1))-1))]; - else - v.data()=_fastangle_atan_table[(int)(((y/x)+1.0)*(value_type)((1<<(ETL_FASTANGLE_LOOKUP_RES-1))-1))]; - } - else if(x<0 && y>=0) // Second quadrant - { - if(y>-x) - v.data()=(1<<(ETL_FASTANGLE_LOOKUP_RES-2))-_fastangle_atan_table[(int)(((x/y)+1.0)*(value_type)((1<<(ETL_FASTANGLE_LOOKUP_RES-1))-1))]; - else - v.data()=_fastangle_atan_table[(int)(((y/x)+1.0)*(value_type)((1<<(ETL_FASTANGLE_LOOKUP_RES-1))-1))]+(1<<(ETL_FASTANGLE_LOOKUP_RES-1)); - } - else if(x<0 && y<0) // Third Quadrant - { - if(-y>-x) - v.data()=(1<<(ETL_FASTANGLE_LOOKUP_RES-2))-_fastangle_atan_table[(int)(((x/y)+1.0)*(value_type)((1<<(ETL_FASTANGLE_LOOKUP_RES-1))-1))] - (1<<(ETL_FASTANGLE_LOOKUP_RES-1)); - else - v.data()=_fastangle_atan_table[(int)(((y/x)+1.0)*(value_type)((1<<(ETL_FASTANGLE_LOOKUP_RES-1))-1))]-(1<<(ETL_FASTANGLE_LOOKUP_RES-1)); - } - else v.data()=0; - } - tan(const fastangle &a):fastangle(a) { } - tan mod()const { return fastangle::mod(); } - tan dist(const fastangle &rhs)const { return fastangle::dist(rhs); } - operator value_type()const { return get(); } - value_type get()const { return (value_type)_fastangle_tan_table[v.data()&( (1< -struct affine_combo -{ - etl::fastangle operator()(const etl::fastangle &a,const etl::fastangle &b,const float &t)const - { - return b.dist(a)*t+a; - } - - etl::fastangle reverse(const etl::fastangle &x, const etl::fastangle &b, const float &t)const - { - return x.dist(b*t)*((float)1/((float)1-t)); - } -}; - -template <> -struct distance_func : public std::binary_function -{ - etl::fastangle operator()(const etl::fastangle &a,const etl::fastangle &b)const - { - etl::fastangle delta=b.dist(a); - if(delta -*- C++ -*- -/*! ======================================================================== -** Extended Template and Library -** Fast Angle Abstraction Class -** $Id$ -** -** Copyright (c) 2002 Robert B. Quattlebaum Jr. -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** -** === N O T E S =========================================================== -** -** ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __ETL__FASTANGLE__ -#define __ETL__FASTANGLE__ - -/* === H E A D E R S ======================================================= */ - -#include "etl_config.h" - -#include "_fastangle.h" - -/* === E N D =============================================================== */ - -#endif diff --git a/ETL/test/angle.cpp b/ETL/test/angle.cpp index 09e5347..2688c1c 100644 --- a/ETL/test/angle.cpp +++ b/ETL/test/angle.cpp @@ -24,258 +24,17 @@ #include #include -#include #include #include #include /* === M A C R O S ========================================================= */ -ETL_FASTANGLE_INIT(); - using namespace std; using namespace etl; /* === C L A S S E S ======================================================= */ -int fastangle_test(void) -{ - int ret=0; - float largest_error; - - { - angle theta; - fastangle theta2; - float error; - largest_error=0.0f; - - for( - theta=angle::degrees(0),theta2=fastangle::degrees(0); - theta<=angle::degrees(360); - theta+=angle::degrees(10),theta2+=fastangle::degrees(10) - ) - { - error=(float)angle::sin(theta).get() -(float)fastangle::sin(theta2).get(); - /* - fprintf(stderr,"angle: sin(%d)=%f ;\tfastangle: sin(%d)=%f ;\t diff: %f\n", - (int)angle::degrees(theta), - (float)angle::sin(theta), - (int)fastangle::degrees(theta2), - (float)fastangle::sin(theta2), - error - ); - */ - if(error > largest_error) - largest_error=error; - if(error < -largest_error) - largest_error=-error; - - } - } - printf("fastangle: Largest SIN error: (+/-)%f\n",largest_error); - if(largest_error>0.075)ret++; - - { - angle theta; - fastangle theta2; - float error; - largest_error=0.0f; - - for( - theta=angle::degrees(0),theta2=fastangle::degrees(0); - theta<=angle::degrees(360); - theta+=angle::degrees(10),theta2+=fastangle::degrees(10) - ) - { - error=(float)angle::cos(theta).get() -(float)fastangle::cos(theta2).get(); - /* - fprintf(stderr,"angle: cos(%d)=%f ;\tfastangle: cos(%d)=%f ;\t diff: %f\n", - (int)angle::degrees(theta), - (float)angle::cos(theta), - (int)fastangle::degrees(theta2), - (float)fastangle::cos(theta2), - error - ); - */ - if(error > largest_error) - largest_error=error; - if(error < -largest_error) - largest_error=-error; - - } - } - printf("fastangle: Largest COS error: (+/-)%f\n",largest_error); - if(largest_error>0.075)ret++; - - { - double val; - float error; - largest_error=0.0f; - - for( - val=-1.0f; - val<1.0f; - val+=0.01 - ) - { - error=angle::radians(angle::sin(val)).get() -fastangle::radians(fastangle::sin(val)).get(); - /* - fprintf(stderr,"angle: asin(%f)=%frad ;\tfastangle: asin(%f)=%frad ;\t diff: %f\n", - val, - (float)(angle::radians)angle::sin(val), - val, - (float)(fastangle::radians)fastangle::sin(val), - error - ); - */ - if(error > largest_error) - largest_error=error; - if(error < -largest_error) - largest_error=-error; - - } - } - printf("fastangle: Largest ASIN error: (+/-)%frad\n",largest_error); - if(largest_error>0.075)ret++; - - - { - double val; - float error; - largest_error=0.0f; - - for( - val=-1.0f; - val<1.0f; - val+=0.01 - ) - { - error=angle::radians(angle::cos(val)).get() -fastangle::radians(fastangle::cos(val)).get(); - /* - fprintf(stderr,"angle: acos(%f)=%frad ;\tfastangle: acos(%f)=%frad ;\t diff: %f\n", - val, - (float)(angle::radians)angle::cos(val), - val, - (float)(fastangle::radians)fastangle::cos(val), - error - ); - */ - if(error > largest_error) - largest_error=error; - if(error < -largest_error) - largest_error=-error; - - } - } - printf("fastangle: Largest ACOS error: (+/-)%frad\n",largest_error); - if(largest_error>0.075)ret++; - - - { - angle theta; - fastangle theta2; - float error; - largest_error=0.0f; - - for( - theta=angle::degrees(0),theta2=fastangle::degrees(0); - theta largest_error) - largest_error=error; - if(error < -largest_error) - largest_error=-error; - - } - } - printf("fastangle: Largest TAN error: (+/-)%f\n",largest_error); - if(largest_error>0.75)ret++; - - { - double val; - float error; - largest_error=0.0f; - - for( - val=-4.0f; - val<4.0f; - val+=0.1 - ) - { - error=angle::radians(angle::tan(val)).get() -fastangle::radians(fastangle::tan(val)).get(); - /* - fprintf(stderr,"angle: atan(%f)=%frad ;\tfastangle: atan(%f)=%frad ;\t diff: %f\n", - val, - (float)(angle::radians)angle::tan(val), - val, - (float)(fastangle::radians)fastangle::tan(val), - error - ); - */ - if(error > largest_error) - largest_error=error; - if(error < -largest_error) - largest_error=-error; - - } - } - printf("fastangle: Largest ATAN error: (+/-)%frad\n",largest_error); - if(largest_error>0.075)ret++; - - - { - angle theta; - float error; - largest_error=0.0f; - - for( - theta=angle::degrees(-179); - theta largest_error) - largest_error=error; - if(error < -largest_error) - largest_error=-error; - - } - } - printf("fastangle: Largest ATAN2 error: (+/-)%frad\n",largest_error); - if(largest_error>0.075)ret++; - - printf("constant tests: %f==%f\n", - (float)angle::degrees(angle::tan(1.01)).get(), - (float)fastangle::degrees(fastangle::tan(1.01)).get()); - printf("constant tests: %f==%f\n", - (float)angle::degrees(angle::tan(-1.0)).get(), - (float)fastangle::degrees(fastangle::tan(-1.0)).get()); - - return ret; -} - template void angle_cos_speed_test(void) { @@ -357,68 +116,6 @@ void angle_atan2_speed_test(void) } } -int fastangle_speed_test(void) -{ - int ret=0; - float - angle_cos_time, - fastangle_cos_time, - angle_tan_time, - fastangle_tan_time, - angle_atan2_time, - fastangle_atan2_time, - angle_sin_time, - fastangle_sin_time ; - - etl::clock MyTimer; - - MyTimer.reset(); - angle_cos_speed_test(); - angle_cos_time=MyTimer(); - printf("angle: Cosine test: %f seconds\n",angle_cos_time); - - MyTimer.reset(); - angle_cos_speed_test(); - fastangle_cos_time=MyTimer(); - printf("fastangle: Cosine test: %f seconds\n",fastangle_cos_time); - printf("fastangle is %.02f%% faster\n",(angle_cos_time/fastangle_cos_time)*100.0-100.0); - - MyTimer.reset(); - angle_sin_speed_test(); - angle_sin_time=MyTimer(); - printf("angle: Sine test: %f seconds\n",angle_sin_time); - - MyTimer.reset(); - angle_sin_speed_test(); - fastangle_sin_time=MyTimer(); - printf("fastangle: Sine test: %f seconds\n",fastangle_sin_time); - printf("fastangle is %.02f%% faster\n",(angle_sin_time/fastangle_sin_time)*100.0-100.0); - - MyTimer.reset(); - angle_tan_speed_test(); - angle_tan_time=MyTimer(); - printf("angle: Tangent test: %f seconds\n",angle_tan_time); - - MyTimer.reset(); - angle_tan_speed_test(); - fastangle_tan_time=MyTimer(); - printf("fastangle: Tangent test: %f seconds\n",fastangle_tan_time); - printf("fastangle is %.02f%% faster\n",(angle_tan_time/fastangle_tan_time)*100.0-100.0); - - MyTimer.reset(); - angle_atan2_speed_test(); - angle_atan2_time=MyTimer(); - printf("angle: arcTangent2 test: %f seconds\n",angle_atan2_time); - - MyTimer.reset(); - angle_atan2_speed_test(); - fastangle_atan2_time=MyTimer(); - printf("fastangle: arcTangent2 test: %f seconds\n",fastangle_atan2_time); - printf("fastangle is %.02f%% faster\n",(angle_atan2_time/fastangle_atan2_time)*100.0-100.0); - - return ret; -} - int angle_test() { int ret=0; @@ -523,8 +220,6 @@ int main() { int error=0; - error+=fastangle_test(); - error+=fastangle_speed_test(); error+=angle_test(); return error; diff --git a/ETL/test/benchmark.cpp b/ETL/test/benchmark.cpp index 34e6df4..ace6467 100644 --- a/ETL/test/benchmark.cpp +++ b/ETL/test/benchmark.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -34,7 +33,6 @@ /* === M A C R O S ========================================================= */ using namespace etl; -//using namespace std; #define HERMITE_TEST_ITERATIONS (100000) @@ -123,67 +121,6 @@ void angle_atan2_speed_test(void) } } -int fastangle_speed_test(void) -{ - int ret=0; - float - angle_cos_time, - fastangle_cos_time, - angle_tan_time, - fastangle_tan_time, - angle_atan2_time, - fastangle_atan2_time, - angle_sin_time, - fastangle_sin_time ; - - etl::clock MyTimer; - - MyTimer.reset(); - angle_cos_speed_test(); - angle_cos_time=MyTimer(); - printf("angle: Cosine test: %f seconds\n",angle_cos_time); - - MyTimer.reset(); - angle_cos_speed_test(); - fastangle_cos_time=MyTimer(); - printf("fastangle: Cosine test: %f seconds\n",fastangle_cos_time); - printf("fastangle is %.02f%% faster\n",(angle_cos_time/fastangle_cos_time)*100.0-100.0); - - MyTimer.reset(); - angle_sin_speed_test(); - angle_sin_time=MyTimer(); - printf("angle: Sine test: %f seconds\n",angle_sin_time); - - MyTimer.reset(); - angle_sin_speed_test(); - fastangle_sin_time=MyTimer(); - printf("fastangle: Sine test: %f seconds\n",fastangle_sin_time); - printf("fastangle is %.02f%% faster\n",(angle_sin_time/fastangle_sin_time)*100.0-100.0); - - MyTimer.reset(); - angle_tan_speed_test(); - angle_tan_time=MyTimer(); - printf("angle: Tangent test: %f seconds\n",angle_tan_time); - - MyTimer.reset(); - angle_tan_speed_test(); - fastangle_tan_time=MyTimer(); - printf("fastangle: Tangent test: %f seconds\n",fastangle_tan_time); - printf("fastangle is %.02f%% faster\n",(angle_tan_time/fastangle_tan_time)*100.0-100.0); - - MyTimer.reset(); - angle_atan2_speed_test(); - angle_atan2_time=MyTimer(); - printf("angle: arcTangent2 test: %f seconds\n",angle_atan2_time); - - MyTimer.reset(); - angle_atan2_speed_test(); - fastangle_atan2_time=MyTimer(); - printf("fastangle: arcTangent2 test: %f seconds\n",fastangle_atan2_time); - printf("fastangle is %.02f%% faster\n",(angle_atan2_time/fastangle_atan2_time)*100.0-100.0); - - return ret; -} int surface_and_gaussian_blur_test() { @@ -419,45 +356,6 @@ int hermite_angle_test(void) return ret; } -int hermite_fastangle_test(void) -{ - int ret=0,i; - hermite Hermie; - hermite::time_type f; - - etl::clock timer; - fastangle tmp; - double t; - - Hermie.p1()=fastangle::degrees(0); - Hermie.t1()=fastangle::degrees(45); - - Hermie.p2()=fastangle::degrees(-45); - Hermie.t2()=fastangle::degrees(180); - - Hermie.sync(); - - for(f=0.0f,i=0,timer.reset();i:time=%f milliseconds\n",t*1000); - - return ret; -} /* === E N T R Y P O I N T ================================================= */ @@ -465,14 +363,12 @@ int main() { int error=0; - error+=fastangle_speed_test(); error+=surface_and_gaussian_blur_test(); error+=hermite_float_test(); error+=hermite_double_test(); error+=hermite_int_test(); error+=hermite_fixed_test(); error+=hermite_angle_test(); - error+=hermite_fastangle_test(); return error; }