Rsc_curve< K > Class Template Reference

#include <qsc_approximation_fcts.hpp>

List of all members.

Public Member Functions


Detailed Description

template<class K>
class mmx::shape::Rsc_curve< K >

Definition at line 647 of file qsc_approximation_fcts.hpp.


Constructor & Destructor Documentation

Rsc_curve (  )  [inline]

Definition at line 650 of file qsc_approximation_fcts.hpp.

00650 {};

Rsc_curve ( const polynomial< K, with< MonomialTensor > > &  px,
const polynomial< K, with< MonomialTensor > > &  py,
const point< K > &  nn0 = point<K> (),
const point< K > &  nn1 = point<K> (),
const int &  pp = 1 
) [inline]

Definition at line 653 of file qsc_approximation_fcts.hpp.

References POL.

00654     {
00655       u= POL(0,0,0)*POL(0,0,1);
00656       v= POL(0,0,0)*POL(0,0,1);
00657       u+=px;
00658       v+=py;
00659 
00660       n0=nn0;
00661       n1=nn1;
00662       path=pp;
00663     };

Rsc_curve ( const Bezier_curve< K > &  B  )  [inline]

Definition at line 665 of file qsc_approximation_fcts.hpp.

References point< C, N, V >::norm(), POL, and VECT.

00666     {
00667       VECT Va=B[0]-2*B[1]+B[2];
00668       VECT Vb=2*(B[1]-B[0]);
00669       VECT Vc=B[0];
00670 
00671       // POL( coefficient, power, variable)
00672       u= POL(4*Vc[0]*Va[0]-Vb[0]*Vb[0], 2, 0) +
00673         POL(4*Vc[0]*Va[1]-2*Vb[0]*Vb[1]+4*Vc[1]*Va[0],1,0)*POL(1, 1, 1) +
00674         POL(-Vb[1]*Vb[1]+4*Vc[1]*Va[1], 2, 1) ;
00675       
00676       v= POL(4*Va[0],1,0) + POL(4*Va[1],1,1);
00677 
00678       n0= B.normal(0);
00679       n0= n0/n0.norm();
00680       n1= B.normal(1);
00681       n1= n1/n1.norm();
00682 
00683       path= ( B.ccw()==1 ? 1 : -1 );
00684 
00685       //std::cout<<"normal 0 =" <<B.normal(0) << "\n";
00686       //std::cout<<"normal 1 =" <<B.normal(1) << "\n";
00687       //std::cout<<"angle =" << acos( dot(n0,n1)) << "\n";
00688     };


Member Function Documentation

int ccw (  )  const [inline]

Definition at line 728 of file qsc_approximation_fcts.hpp.

Referenced by Piecewise_Qsc_curve< K >::Piecewise_Qsc_curve(), Rsc_curve< K >::sample(), and Rsc_curve< K >::ssample().

00728                         { 
00729    //return (path==1 ? : true : false);
00730    return ( n0[0]*n1[1]- n0[1]*n1[0] <0 ? -1 : 1 );
00731   };

polynomial<K,with<MonomialTensor> > denom (  )  [inline]

Definition at line 854 of file qsc_approximation_fcts.hpp.

00854 { return v; };

point<K> eval ( const point< K > &  n  )  const [inline]

Definition at line 692 of file qsc_approximation_fcts.hpp.

References mmx::shape::dot(), Rsc_curve< K >::sgrad(), and VECT.

Referenced by Rsc_curve< K >::sample().

00693     {
00694       Seq<K> nn;
00695       K h=  u(n[0], n[1])  / v(n[0], n[1]) ;
00696       VECT dh= sgrad( n );
00697 
00698       return ( n*h + dh - n*dot(dh,n) ) ;
00699     };

point<K> nend (  )  [inline]

Definition at line 848 of file qsc_approximation_fcts.hpp.

Referenced by Piecewise_Qsc_curve< K >::Piecewise_Qsc_curve(), and Qsc_curve< K >::Qsc_curve().

00848 {return n1; };

point<K> nmiddle (  )  [inline]

Definition at line 849 of file qsc_approximation_fcts.hpp.

References VECT.

Referenced by Qsc_curve< K >::Qsc_curve().

00849 { VECT m= (n0+n1)*path; return m/m.norm(); };

point<K> nstart (  )  [inline]

Definition at line 847 of file qsc_approximation_fcts.hpp.

Referenced by Piecewise_Qsc_curve< K >::Piecewise_Qsc_curve(), and Qsc_curve< K >::Qsc_curve().

00847 {return n0; };

polynomial<K,with<MonomialTensor> > numer (  )  [inline]

Definition at line 853 of file qsc_approximation_fcts.hpp.

00853 { return u; };

int orientation (  )  [inline]

Definition at line 851 of file qsc_approximation_fcts.hpp.

Referenced by Piecewise_Qsc_curve< K >::Piecewise_Qsc_curve(), and Qsc_curve< K >::Qsc_curve().

00851 {return path; };  

void print ( viewer< axel, default_env > &  axl,
const int &  k = 50 
) [inline]

Definition at line 797 of file qsc_approximation_fcts.hpp.

References Rsc_curve< K >::sample().

00797                                            {
00798 
00799     Seq<VECT> P;
00800     sample(P, k);
00801 
00802   axl<<" <curve type=\"mesh\">\n<vect>\nVECT\n";
00803   axl<< k-1 <<" "
00804      <<2*k-2<<" "
00805      <<k-1<<"\n";
00806   for(int i=1; i!=k;i++) axl<<"2 ";//
00807   axl<<"\n";
00808   for(int i=1; i!=k;i++) axl<<"1 ";//
00809   axl<<"\n";
00810 
00811   for(int i=1; i!=k;i+=1)
00812     axl<< P[i-1].x()<<" "<< P[i-1].y()<< " 0 " <<
00813       P[i].x()<<" "<< P[i].y()<< " 0 \n";
00814  
00815   for(int i=1; i!=k;i++)
00816     axl<< "0.314 0.979 1 1\n";
00817   axl<<" </vect>\n </curve>\n";
00818 
00819   };

void print_supp_graph ( viewer< axel, default_env > &  axl,
const int &  k = 50 
) [inline]

Definition at line 822 of file qsc_approximation_fcts.hpp.

References Rsc_curve< K >::ssample().

00822                                                       {
00823 
00824     Seq<K> P;
00825 
00826     ssample(P, k);
00827     
00828     axl<<" <curve type=\"mesh\">\n<vect>\nVECT\n";
00829     axl<< k-1 <<" "
00830        <<2*k-2<<" "
00831        <<k-1<<"\n";
00832     for(int i=1; i!=k;i++) axl<<"2 ";//
00833     axl<<"\n";
00834     for(int i=1; i!=k;i++) axl<<"1 ";//
00835     axl<<"\n";
00836     
00837     for(int i=3; i<2*k;i+=2)
00838       axl<< P[i-3]<<" "<< P[i-2]<< " 0 " <<
00839         P[i-1]<<" "<< P[ i ]<< " 0 \n";
00840     
00841     for(int i=1; i!=k;i++)
00842       axl<< "0.314 0.979 1 1\n";
00843     axl<<" </vect>\n </curve>\n";
00844   };

void sample ( Seq< point< K > > &  P,
const int &  k = 50 
) const [inline]

Definition at line 734 of file qsc_approximation_fcts.hpp.

References Rsc_curve< K >::ccw(), mmx::shape::dot(), Rsc_curve< K >::eval(), PI, and VECT.

Referenced by Rsc_curve< K >::print().

00735     {
00736       K f0,fi;
00737       f0= acos( n0[0] );
00738       if (sin(n0[1])<0) f0= 2*PI- f0;
00739       //std::cout<<"ccw: "<< ccw() <<"\n";
00740 
00741       if ( path * ccw() > 0 ) 
00742       {
00743         fi =  path * acos( dot(n0,n1)) / K(k-1) ;
00744 //        if ( abs(fi)<0.000001) 
00745 //          fi=  2*PI / K(k-1) ;
00746       }
00747       else
00748       {
00749         fi =  path * (2*PI - acos(dot(n0,n1))) / K(k-1);
00750       }
00751 
00752       P<< eval(n0);
00753       for(int i=2; i!=k; i++ )
00754       {
00755         f0+= fi;
00756         P << eval( VECT(cos(f0), sin(f0)) ) ;
00757       }
00758       P<< eval(n1);
00759 
00760     };

K sdiff ( const point< K > &  n  )  const [inline]

Definition at line 720 of file qsc_approximation_fcts.hpp.

References Rsc_curve< K >::sgrad(), and VECT.

Referenced by Piecewise_Qsc_curve< K >::Piecewise_Qsc_curve(), and Qsc_curve< K >::Qsc_curve().

00721     {
00722       VECT dh= sgrad(n);
00723       
00724       return -dh[0]*n[1] + dh[1]*n[0];;
00725     };

K seval ( const point< K > &  n  )  const [inline]

Definition at line 702 of file qsc_approximation_fcts.hpp.

Referenced by Piecewise_Qsc_curve< K >::Piecewise_Qsc_curve(), Qsc_curve< K >::Qsc_curve(), and Rsc_curve< K >::ssample().

00703     {
00704       return u(n[0], n[1])  / v(n[0], n[1]) ;
00705     };

point<K> sgrad ( const point< K > &  n  )  const [inline]

Definition at line 709 of file qsc_approximation_fcts.hpp.

References mmx::diff(), POL, and VECT.

Referenced by Rsc_curve< K >::eval(), Qsc_curve< K >::Qsc_curve(), and Rsc_curve< K >::sdiff().

00710     {
00711       POL hx, hy ;
00712       hx= (mmx::diff(u,0)* v) - (u * mmx::diff(v,0) );
00713       hy= (mmx::diff(u,1)* v) - (u * mmx::diff(v,1) );
00714       K dn = v( n[0],n[1] ); dn*= dn;
00715 
00716       return VECT( hx( n[0],n[1] ) / dn, hy( n[0],n[1] ) / dn   ); 
00717     };

void ssample ( Seq< K > &  P,
const int &  k = 50 
) const [inline]

Definition at line 763 of file qsc_approximation_fcts.hpp.

References Rsc_curve< K >::ccw(), mmx::shape::dot(), PI, Rsc_curve< K >::seval(), and VECT.

Referenced by Rsc_curve< K >::print_supp_graph().

00764     {
00765       K f0,fi, fs;
00766       f0= acos( n0[0] );
00767       if (sin(n0[1])<0) f0= 2*PI- f0;
00768       //std::cout<<"ccw: "<< ccw() <<"\n";
00769 
00770       if ( path * ccw() > 0 ) 
00771       {
00772         fs= acos( dot(n0,n1));
00773         fi = path * fs / K(k-1) ;
00774 //        if ( abs(fi)<0.000001) 
00775 //          fi=  2*PI / K(k-1) ;
00776       }
00777       else
00778       {
00779         fs= (2*PI - acos(dot(n0,n1)));
00780         fi =  path * fs / K(k-1);
00781       }
00782 
00783       P<< 0.0 ;
00784       P<< seval(n0);
00785       for(int i=2; i!=k; i++ )
00786       {
00787         f0+= fi ;
00788         P<< (i-1)*fi;
00789         P << seval( VECT(cos(f0), sin(f0)) ) ;
00790       }
00791       P<< k*fi ;
00792       P<< seval(n1);
00793 
00794     };

double support_size (  )  [inline]

Definition at line 856 of file qsc_approximation_fcts.hpp.

References mmx::shape::dot().

Referenced by Piecewise_Qsc_curve< K >::Piecewise_Qsc_curve().

00857     {
00858       return acos(dot(n0,n1));
00859     };


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

Generated on 6 Dec 2012 for shape by  doxygen 1.6.1