proj home

Files   Classes   Functions   Hierarchy  

bernstein.cpp

Go to the documentation of this file.
00001 #include <cmath>
00002 using namespace std;
00003 
00004 #include <bernstein.h>
00005 #include <mathlib.h>
00006 
00007 
00008 
00009 
00010 void bernsteinPoly::construct
00011 ( 
00012   uintc n_, 
00013   uintc i_
00014 )
00015 {
00016   n = n_;
00017   i = i_;
00018   construct();
00019 }
00020 
00021 bernsteinPoly::bernsteinPoly
00022 ( 
00023   uintc n_, 
00024   uintc i_
00025 )
00026   : n(n_), i(i_)
00027 {
00028   construct();
00029 }
00030 
00031 void bernsteinPoly::construct()
00032 {
00033   mathcombination(coeff,n,i);
00034 }
00035 
00036 void bernsteinPoly::eval
00037 (
00038   double & res,
00039   doublec t
00040 ) const
00041 {
00042   doublec a1(1.0-t);
00043   res = coeff * pow(t,(double)i) * pow(a1,(double)(n-i));
00044 }
00045 
00046 
00047 void bernsteinPolyProd::construct()
00048 {
00049   b0.construct();
00050   b1.construct();
00051 }
00052 
00053 void bernsteinPolyProd::eval
00054 (
00055   double & res, 
00056   doublec u, 
00057   doublec v
00058 ) const
00059 {
00060   res = b0.eval(u)*b1.eval(v);
00061 }
00062 
00063 bernsteinPolyProd::bernsteinPolyProd
00064 ( 
00065   uintc n0_, 
00066   uintc i0_,
00067   uintc n1_, 
00068   uintc i1_
00069 )
00070   : b0(n0_,i0_), b1(n1_,i1_)
00071 {
00072   construct();
00073 }
00074 
00075 
00076 
00077 
00078 

Generated on Fri Mar 4 00:49:28 2011 for Chelton Evans Source by  doxygen 1.5.8