realroot_doc 0.1.1
arc_rep< C > Struct Template Reference

#include <fatarcs.hpp>

List of all members.

Public Types

Public Member Functions

Public Attributes


Detailed Description

template<class C>
struct arc_rep< C >

Definition at line 119 of file fatarcs.hpp.


Member Typedef Documentation

typedef polynomial< coeff_t ,with<Bernstein> > bernstein_t

Definition at line 126 of file fatarcs.hpp.

typedef domain<coeff_t> box_t

Definition at line 125 of file fatarcs.hpp.

typedef C coeff_t

Definition at line 122 of file fatarcs.hpp.

typedef polynomial< coeff_t ,with<MonomialTensor> > monom_t

Definition at line 127 of file fatarcs.hpp.

typedef Seq<coeff_t> seq_t

Definition at line 124 of file fatarcs.hpp.

typedef std::vector<coeff_t> vec_t

Definition at line 123 of file fatarcs.hpp.


Constructor & Destructor Documentation

arc_rep ( ) [inline]

Definition at line 135 of file fatarcs.hpp.

{pts[0]=vec_t(); pts[1]=vec_t(); pts[2]=vec_t();};
arc_rep ( vec_t  p0,
vec_t  p1,
vec_t  p2 
) [inline]

Definition at line 137 of file fatarcs.hpp.

References matrat(), and v_minus().

                                         {
    if(p0.size()!=0 && p1.size()!=0 &&  p2.size()!=0 )
      {if(matrat(v_minus(p1,p0),v_minus(p2,p0))[1]> coeff_t(0)){pts[0]=p2; pts[1]=p1; pts[2]=p0;}
        else{pts[0]=p0; pts[1]=p1; pts[2]=p2;}; }else{pts[0]=p0; pts[1]=p1; pts[2]=p2;}
  };
arc_rep ( vec_t  p[3]) [inline]

Definition at line 143 of file fatarcs.hpp.

References matrat(), mmx::size(), and v_minus().

                      {
    if(p[0].size()!=0 && p[1].size()!=0 &&  p[2].size()!=0 ){
      if(matrat( v_minus(p[1],p[0]),v_minus(p[2],p[0]) )[1]> coeff_t(0)){pts[0]=p[2]; pts[1]=p[1]; pts[2]=p[0];}
      else{pts[0]=p[0]; pts[1]=p[1]; pts[2]=p[2];}; }else{pts[0]=p[0]; pts[1]=p[1]; pts[2]=p[2];} 
  };

Member Function Documentation

seq_t arc_eq ( ) [inline]

Definition at line 173 of file fatarcs.hpp.

References dot(), matrat(), v_minus(), and vec().

Referenced by circ_is(), and arc_rep< C >::offset().

                { 

  
    vec_t cvec=matrat(v_minus(pts[0],pts[1]),v_minus(pts[2],pts[1]));  
     
    coeff_t eh2=cvec[1];
    coeff_t ehx=dot(cvec, vec(pts[2][1]-pts[0][1],(coeff_t)(-1)*pts[0][0]-pts[2][0]));
    coeff_t ehy=dot(cvec, vec(pts[0][0]-pts[2][0],(coeff_t)(-1)*pts[0][1]-pts[2][1]));  
    coeff_t ehc=dot(cvec, vec(pts[0][1]*pts[2][0]-pts[0][0]*pts[2][1],
                                         pts[0][0]*pts[2][0]+pts[0][1]*pts[2][1])); 

    seq_t eh; eh<<eh2<<ehx<<ehy<<ehc;
     
  return(eh);
  }; /*coeff vector of monom rep: eh2*(x^2+y^2)+ehx*x+ehy*y+ehc=0*/
vec_t critpt ( int  var) [inline]

Definition at line 191 of file fatarcs.hpp.

References mmx::eval(), is_unit1(), mmx::rep(), seq2b(), and vec().

Referenced by extpts().

                      { 

  vec_t pt;
   Seq<coeff_t> coeffx,coeffy,wvec; 
   pt=vec(coeff_t(-1),coeff_t(-1));
   coeffx<<pts[0][0]<< midc()[0]*weight()<< pts[2][0];
   coeffy<<pts[0][1]<< midc()[1]*weight()<<pts[2][1]; 
   wvec<<coeff_t(1)<< weight()<<coeff_t(1);  
   coeff_t t, cx,cy,w;

   if (var==0 && (coeffx[2]-coeffx[0])!=0)
     {
       t=(coeffx[0]-coeffx[1])/(coeffx[2]-coeffx[0]);
     }
  else if (var==1 && (coeffy[2]-coeffy[0])!=0)
     {
       t=(coeffy[0]-coeffy[1])/(coeffy[2]-coeffy[0]);
     };

   if(is_unit1(t)){
   tensor::eval(cx,seq2b(coeffx).rep(),t);
   tensor::eval(cy,seq2b(coeffy).rep(),t);
   tensor::eval(w,seq2b(wvec).rep(),t);
   pt=vec( cx/w , cy/w );   
   }
   //  std::cout <<pt<<std::endl;
  return(pt);
  }; /*tang. pt in var*/
vec_t midc ( ) [inline]

Definition at line 157 of file fatarcs.hpp.

References dot(), rotl(), mmx::sign(), mmx::sqrt(), v_div(), v_minus(), v_mul(), and v_plus().

Referenced by box_rep< C >::max_eval().

              {   
    vec_t pp=v_minus(pts[0],pts[2]); pp=rotl(pp);
    vec_t m=v_mul(coeff_t( sign(dot(pp, v_minus(pts[1],pts[2]) ))),pp);
    coeff_t w=weight(); 
  
    vec_t d;
    if( (coeff_t(1)-w*w) > coeff_t(0) && w!=coeff_t(0) ){
      d=v_plus(v_div(v_plus(pts[0],pts[2]),coeff_t(2)),v_div(v_mul(coeff_t(sqrt( coeff_t(1)-w*w )),m),(coeff_t(2)*w))); }
    else {
      d=v_div(v_plus(pts[0],pts[2]),coeff_t(2)); };
    return(d);

  };/*middle control point in bb rep.*/
arc_rep<coeff_t> offset ( coeff_t  r) [inline]

Definition at line 221 of file fatarcs.hpp.

References arc_rep< C >::arc_eq(), is_arc(), is_unit1(), rotl(), Seq< C, R >::size(), solve2(), mmx::sqrt(), v_div(), v_length(), v_minus(), v_mul(), v_plus(), and vec().

Referenced by extpts().

                                   {
   vec_t newp[3];
   Seq<coeff_t> mo, ehrat;
   int i;unsigned j;
   vec_t pp=rotl(v_minus(pts[0],pts[2])); 

    coeff_t l=v_length(pp);
    coeff_t w=weight();

    for( i=0; i<3; i++){newp[i]=vec_t(); };
    arc_rep<coeff_t> ncirc(newp);
    if( l!=coeff_t(0) ){  
      if( w==coeff_t(1)){ for( i=0; i<3; i++){ newp[i]=v_plus(pts[i],v_mul(r/l,pp)); } }//case of a quarter of a circle
      else if (  
               //( coeff_t(1)-w*w )>coeff_t(0) && 
               ( r + l/(coeff_t(2)*sqrt( coeff_t(1)-w*w ) )) > coeff_t(0)  
            &&  v_length( v_minus(pts[1],v_plus(pts[0],pts[2])) )!=coeff_t(0) )
        { 

            newp[0]=v_plus(pts[0],v_mul(coeff_t(2)*r/l,
                                rotl( v_minus(v_minus(v_mul((coeff_t(1)+w),pts[1]),v_mul((w+ coeff_t(0.5)),pts[0])),
                                                v_div(pts[2],coeff_t(2))
                                                )
                                      )
                                  )
                     );

            newp[1]=v_plus(pts[1],
                           v_mul(r/v_length(v_minus(pts[1],v_div(v_plus(pts[0],pts[2]),coeff_t(2)))),
                           v_minus(v_minus(pts[1],v_div(pts[0],coeff_t(2))),v_div(pts[2],coeff_t(2)))
                           )
                     );

            newp[2]=v_minus(pts[2],
                      v_mul(coeff_t(2)*r/l,
                            rotl(v_minus(v_minus(v_mul((coeff_t(1)+w),pts[1]),v_mul((w+(coeff_t)(0.5)),pts[2])),
                                         v_div(pts[0],coeff_t(2))
                                         )
                                 )
                            )
                      );
        };
   
      //std::cout <<"newp0: "<<newp[0]<<" "<<newp[1]<<" "<<newp[2]<<std::endl;
     ncirc=arc_rep<coeff_t>(newp);
     if(is_arc(ncirc)){
     Seq<vec_t> isp;
    ehrat=ncirc.arc_eq();  
    mo=solve2(ehrat[0],ehrat[2],ehrat[3]); 
    for( j=0; j<2; j++){if(is_unit1(mo[j])){isp<<vec(coeff_t(0),mo[j]);};};
    mo=solve2(ehrat[0],ehrat[2],ehrat[0]+ehrat[1]+ehrat[3]);
    for( j=0; j<2; j++){if(is_unit1(mo[j])){isp<<vec(coeff_t(1),mo[j]);};};
    mo=solve2(ehrat[0],ehrat[1],ehrat[3]);
    for( j=0; j<2; j++){if(is_unit1(mo[j])){isp<<vec(mo[j],coeff_t(0));};};
    mo=solve2(ehrat[0],ehrat[1],ehrat[0]+ehrat[2]+ehrat[3]);
    for( j=0; j<2; j++){if(is_unit1(mo[j])){isp<<vec(mo[j],coeff_t(1));};};

    if (isp.size()==0){newp[0]=vec_t(); }else{
    newp[0]=isp[0];
    for( j=1; j<isp.size(); j++)
      {if(v_length(v_minus(isp[j],pts[0]))<v_length(v_minus(newp[0],pts[0]))){newp[0]=isp[j];};};
    };

    if (isp.size()==0){newp[2]=vec_t(); }else{
    newp[2]=isp[0];
    for( j=1; j<isp.size(); j++)
      {if(v_length(v_minus(isp[j],pts[2]))<v_length(v_minus(newp[2],pts[2]))){newp[2]=isp[j];};};
    };
   ncirc=arc_rep<coeff_t>(newp);
   // std::cout <<"newp1: "<<newp[0]<<" "<<newp[1]<<" "<<newp[2]<<std::endl;
   /*if (is_arc(ncirc)){
      if( matrat(v_minus(newp[1],newp[0]),v_minus(newp[2],newp[0]))[1]>coeff_t(0) )
      { vec_t u=newp[0]; newp[0]=newp[2]; newp[2]=u;}};*/
     };
  };
 return( ncirc );
 } /*offset arc computation(with precise endpoints) - OR OUTSIDE!!!*/
coeff_t weight ( ) [inline]

Definition at line 152 of file fatarcs.hpp.

References dot(), v_length(), and v_minus().

Referenced by box_rep< C >::max_eval().

  {return(dot(v_minus(pts[0],pts[1]),v_minus(pts[1],pts[2]))/
          (v_length(v_minus(pts[1],pts[2]))*v_length(v_minus(pts[1],pts[0]))));};

Member Data Documentation

vec_t pts[3]

Definition at line 131 of file fatarcs.hpp.

Referenced by extpts(), is_arc(), is_infatarc(), and box_rep< C >::max_eval().


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