voronoi_site2d< C, V > Class Template Reference

#include <voronoi_site2d.hpp>

List of all members.

Public Types

Public Member Functions


Detailed Description

template<class C, class V = default_env>
class mmx::shape::voronoi_site2d< C, V >

Definition at line 36 of file voronoi_site2d.hpp.


Member Typedef Documentation

typedef bounding_box<C, typename use<ref_def,double, V >::Ref > BoundingBox

Definition at line 44 of file voronoi_site2d.hpp.

Definition at line 41 of file voronoi_site2d.hpp.


Constructor & Destructor Documentation

voronoi_site2d ( void   )  [inline]

Definition at line 46 of file voronoi_site2d.hpp.

00046 {} ;

voronoi_site2d ( const point< double > &  p,
const int &  k = 2 
) [inline]

Definition at line 141 of file voronoi_site2d.hpp.

References voronoi_site2d< C, V >::lp().

00142 { 
00143   func= this->lp(k , p );
00144   coords= p;
00145 
00146 }

voronoi_site2d ( const point< double > &  p,
double  a,
double  b,
double  c 
) [inline]

Definition at line 120 of file voronoi_site2d.hpp.

References mmx::sqrt().

00121 {
00122   //std::cout<<"seed "<< a<<" "<< b <<" "<< c <<std::endl;
00123 
00124   func= Polynomial(a,2,0)+Polynomial(b+c*c,2,1) + 
00125 
00126     ( c!=0? Polynomial(2*c*std::sqrt(a),1,0)*Polynomial(1,1,1):0) + 
00127     Polynomial(-2*std::sqrt(a)*c*p.x()-2*p.y()*c*c-2*p.y()*b ,1,1) -
00128     (p.x()!=0? Polynomial(2*a*p.x(), 1 , 0): 0) - 
00129     ( c!=0? Polynomial(2*std::sqrt(a)*c*p.y(), 1, 0 ): 0 ) + 
00130     Polynomial( p.y()*p.y()*b+a*p.x()*p.x()+p.y()*p.y()*c*c+
00131                 2*std::sqrt(a)*c*p.y()*p.x(),0,0)  ;
00132 
00133 
00134   std::cout<<"site "<< func <<std::endl;
00135   coords= p; 
00136 
00137 }

voronoi_site2d ( const double &  w,
const point< double > &  p 
) [inline]

Definition at line 150 of file voronoi_site2d.hpp.

00151 { 
00152   func= Polynomial(1,2,0)+Polynomial(1,2,1);
00153 
00154   func += Polynomial(-2*p.x(),1,0) // (coeff,degree,variable)
00155     +  Polynomial(-2*p.y(),1,1)
00156     +  Polynomial(p.x()*p.x()+p.y()*p.y(),0,0)
00157     -  Polynomial( w*w ,0,0);//adding weight 
00158 
00159   coords= p;
00160   std::cout<<"Point: "<< p<<", w: "<< w <<std::endl;
00161 }

voronoi_site2d ( const point< double > &  p,
const char *  s 
) [inline]

Definition at line 103 of file voronoi_site2d.hpp.

References mmx::assign().

00104  { 
00105    // typedef typename use<numeric_def,V>::Rational Coefficients;
00106   polynomial<double, with<Sparse,DegRevLex> >t(s, variables("x y"));
00107   Polynomial e; let::assign(func,t);
00108   // func= Polynomial(s, variables("x y"));
00109 
00110   //std::cout<< func; 
00111   coords= p; 
00112 }

voronoi_site2d ( const point< double > &  p,
const Polynomial f 
) [inline]

Definition at line 165 of file voronoi_site2d.hpp.

00166     {
00167       func  = f;
00168       coords= p; 
00169     }

voronoi_site2d ( const point< double > &  p,
const double &  r 
) [inline]

tri-variate function

Definition at line 173 of file voronoi_site2d.hpp.

00174 {
00175   func= Polynomial(1,2,0)+Polynomial(1,2,1) - Polynomial(1,2,2);
00176   
00177   func += Polynomial(-2*p.x(),1,0) // (coeff,degree,variable)
00178     +  Polynomial(-2*p.y(),1,1)
00179     +  Polynomial(p.x()*p.x()+p.y()*p.y() -r*r ,0,0)
00180     -  Polynomial( 2*r ,1,2);
00181   
00182       coords= p; 
00183 
00184       //BoundingBox bx(0,1,0,1);
00185       //std::cout<<"upp: "<< this->upper_bound(bx) <<std::endl;
00186 
00187 
00188       //std::cout<< func <<"\n";
00189   }

~voronoi_site2d ( void   )  [inline]

Definition at line 55 of file voronoi_site2d.hpp.

00055 {};


Member Function Documentation

point<double> coordinates (  )  const [inline]

Definition at line 59 of file voronoi_site2d.hpp.

00059 { return this->coords ; }

Polynomial distfunc (  )  const [inline]

Definition at line 57 of file voronoi_site2d.hpp.

00057 { return this->func ; }

Polynomial lp ( const int &  n,
const point< double > &  p 
) [inline]

Definition at line 69 of file voronoi_site2d.hpp.

Referenced by voronoi_site2d< C, V >::voronoi_site2d().

00070 {
00071 //  typedef typename SELF::Polynomial Polynomial;
00072 
00073   Polynomial a= Polynomial(1,0,0);
00074 
00075   C c= C(1);
00076   if( p.x()!=0.0)
00077     for(int i=0; i<=n; i++ ) {
00078       a+= Polynomial( c*binomial<C>(n,i),n-i,0);
00079       c*= -p.x(); }
00080   else a+= Polynomial(1,n,0);
00081   c=1.0;
00082   if( p.y()!=0.0)
00083     for(int i=0; i<=n; i++ ) {
00084       a+= Polynomial( c*binomial<double>(n,i),n-i,1);
00085       c*= -p.y(); }
00086   else a+= Polynomial(1,n,1);
00087 
00088   a-=C(1);
00089   return a;
00090 }

Polynomial offset ( const C &  z  )  [inline]

Definition at line 65 of file voronoi_site2d.hpp.

00065 { return (this->func - Polynomial(z,0,0) ); }

double upper_bound ( BoundingBox bx  )  const [inline]

Definition at line 192 of file voronoi_site2d.hpp.

References mmx::assign(), mmx::sparse::eval_at(), mmx::sparse::subs(), Interval< T, r >::upper(), bounding_box< C, V >::xmax(), bounding_box< C, V >::xmin(), bounding_box< C, V >::ymax(), and bounding_box< C, V >::ymin().

00193 {
00194   //double ub;
00195 
00196   //AkritasBound<C> lb;
00197 
00198 
00199     Interval<double> ev(0.3434,0.3434);
00200     Seq< Interval<double> > bb;
00201     bb<< Interval<double>(bx.xmin(), bx.xmax() ) ;    
00202     bb<< Interval<double>(bx.ymin(), bx.ymax() ) ;    
00203     polynomial<Interval<double>,with<Sparse, DegRevLex> > pol(1.4,1,1);
00204     polynomial<double, with<Sparse, DegRevLex> > upol;
00205     let::assign(pol,func);
00206     //std::cout<<"  ev= "<< ev<<"\n";
00207     //std::cout<<"  bb= "<< bb<<"\n";
00208 
00209   if ( func.nbvar()==2 )
00210   {
00211     sparse::eval_at( ev , pol.rep() ,bb );
00212     //tensor::eval( ev , func.rep(),bb , 2 );
00213 
00214 
00215     //std::cout<<"pol= "<< pol<<"\n";
00216 
00217 
00218     return ev.upper();
00219   }
00220   else  // ( func.nbvar()==3 )
00221   {
00222 
00223 
00224 
00225     pol= sparse::subs(pol, 0, bb[0] ) ;
00226     std::cout<<"sub= " << pol <<"\n";
00227     pol= sparse::subs(pol, 1, bb[1] ) ;
00228     std::cout<<"sub= " << pol <<"\n";
00229 
00230     
00231     typedef typename mmx::polynomial<double, with<Sparse, DegRevLex> >::Monomial  mon;
00232 
00233         for ( typename mmx::polynomial<Interval<double>,with<Sparse, DegRevLex> >::const_iterator it =pol.begin();   it != pol.end(); ++it )
00234                   upol+= mon(it->coeff().upper(), it->rep() ) ;
00235 
00236     
00237     std::cout<<"upol=" << upol <<"\n";
00238 
00239     //std::cout<<"upol=" << mon() <<"\n";
00240 
00241     //Cauchy<double> bound;
00242     //solve(f,Sleeve<Approximate>())
00243 
00244     return 1;// bound.upper_bound(upol);
00245   }
00246 }

double x ( void   )  const [inline]

Definition at line 60 of file voronoi_site2d.hpp.

References point< C, N, V >::x().

00060 { return this->coords.x() ; }

double y ( void   )  const [inline]

Definition at line 61 of file voronoi_site2d.hpp.

References point< C, N, V >::y().

00061 { return this->coords.y() ; } 

double z ( void   )  const [inline]

Definition at line 62 of file voronoi_site2d.hpp.

References point< C, N, V >::z().

00062 { return this->coords.z() ; }


The documentation for this class was generated from the following file:

Generated on 6 Dec 2012 for shape by  doxygen 1.6.1