Go to the documentation of this file.
00001 /***
00002  Some useful functions
00003 ***/
00004 #ifndef _UTIL_H
00005 #define _UTIL_H
00006 #include <stdlib.h>
00007 #include <math.h>
00008 #include <vector>
00009 #include "icVector.h"
00010 #include "nrtypes_nr.h"
00011 typedef int32_t int32;
00012 typedef uint32_t uint32;
00014 struct Location {
00015     int32 x;
00016     int32 y;
00017     Location() { x=0, y=0; }
00018     Location(int32 a, int32 b) { x=a, y=b; }
00019 };
00021 void transform_point3D(float p[3], float rot_mat[16]);
00022 double bilinear_interpolate(double a, double b, double f00, double f01, double f10, double f11);
00023 bool is_repeated_elem(int *a, int b, int num);
00024 inline double fabs (double x){return x>0?x:-x; }
00025 inline double max (double x,double y){return x>y?x:y; }
00026 inline double min (double x,double y){return x>y?y:x; }
00028 int GetIntersection2(double PointA[2], double PointB[2], double PointC[2], double PointD[2], double t[2]);
00029 double * MatrixInver(double A[],int m,int n);
00030 double *MatrixOpp(double A[],int m,int n);
00031 double Surplus(double A[],int m,int n) ;
00032 int solve_ten_cubic(double a, double b, double c, double d, double solutions[4]);
00033 int solve_ten_cubic_3(double a, double b, double c, double d, double solutions[4]);
00034 int solve_ten_cubic_2(double a, double b, double c, double d, double solutions[4]);
00035 int solve_ten_quadratic(double a, double b, double c, double solutions[2]);
00036 int get_sign(double x);
00037 bool SameSide(icVector3 A, icVector3 B, icVector3 C, icVector3 P);
00038 bool PointInTriangle(icVector3 A, icVector3 B, icVector3 C, icVector3 P);
00039 void linbcg(Vec_I_DP &b, Vec_IO_DP &x, Vec_INT *ija_p,Vec_DP *sa_p,const int itol, const DP tol,const int itmax, int &iter, DP &err);
00040 void BubbleSorting(int *a, int size);
00041 void atimes(Vec_I_DP &x, Vec_O_DP &r,Vec_INT *ija_p,Vec_DP *sa_p, const int itrnsp);
00042 void asolve(Vec_I_DP &b, Vec_O_DP &x,Vec_DP *sa_p, const int itrnsp);
00043 void sprsin(Mat_I_DP &a, const DP thresh, Vec_O_DP &sa, Vec_O_INT &ija);
00044 DP  snrm(Vec_I_DP &sx, const int itol);
00045 void  sprsax(Vec_I_DP &sa, Vec_I_INT &ija, Vec_I_DP &x, Vec_O_DP &b);
00046 void  sprstx(Vec_I_DP &sa, Vec_I_INT &ija, Vec_I_DP &x, Vec_O_DP &b);
00047 void Bresenham(int32 x1, int32 y1, int32 x2, int32 y2, vector<Location>& locationVec);
00048 void CalcBresenhamLocs(const Location& startPos, const Location& endPos, vector<Location>& locationVec);
00049 #endif

Author(s): Lintao Zheng, Kai Xu
autogenerated on Thu Jun 6 2019 19:50:56