#include <fatarcs.hpp>
Definition at line 119 of file fatarcs.hpp.
typedef polynomial< coeff_t ,with<Bernstein> > bernstein_t |
Definition at line 126 of file fatarcs.hpp.
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.
Definition at line 124 of file fatarcs.hpp.
Definition at line 123 of file fatarcs.hpp.
arc_rep | ( | ) | [inline] |
Definition at line 135 of file fatarcs.hpp.
References arc_rep< C >::pts.
Definition at line 137 of file fatarcs.hpp.
References matrat(), arc_rep< C >::pts, and v_minus().
Definition at line 143 of file fatarcs.hpp.
References matrat(), arc_rep< C >::pts, mmx::size(), and v_minus().
seq_t arc_eq | ( | ) | [inline] |
Definition at line 173 of file fatarcs.hpp.
References dot(), matrat(), arc_rep< C >::pts, v_minus(), and vec().
Referenced by circ_is(), and arc_rep< C >::offset().
00173 { 00174 00175 00176 vec_t cvec=matrat(v_minus(pts[0],pts[1]),v_minus(pts[2],pts[1])); 00177 00178 coeff_t eh2=cvec[1]; 00179 coeff_t ehx=dot(cvec, vec(pts[2][1]-pts[0][1],(coeff_t)(-1)*pts[0][0]-pts[2][0])); 00180 coeff_t ehy=dot(cvec, vec(pts[0][0]-pts[2][0],(coeff_t)(-1)*pts[0][1]-pts[2][1])); 00181 coeff_t ehc=dot(cvec, vec(pts[0][1]*pts[2][0]-pts[0][0]*pts[2][1], 00182 pts[0][0]*pts[2][0]+pts[0][1]*pts[2][1])); 00183 00184 seq_t eh; eh<<eh2<<ehx<<ehy<<ehc; 00185 00186 return(eh); 00187 }; /*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::brnops::eval(), is_unit1(), arc_rep< C >::midc(), arc_rep< C >::pts, mmx::rep(), seq2b(), vec(), and arc_rep< C >::weight().
Referenced by extpts().
00191 { 00192 00193 vec_t pt; 00194 Seq<coeff_t> coeffx,coeffy,wvec; 00195 pt=vec(coeff_t(-1),coeff_t(-1)); 00196 coeffx<<pts[0][0]<< midc()[0]*weight()<< pts[2][0]; 00197 coeffy<<pts[0][1]<< midc()[1]*weight()<<pts[2][1]; 00198 wvec<<coeff_t(1)<< weight()<<coeff_t(1); 00199 coeff_t t, cx,cy,w; 00200 00201 if (var==0 && (coeffx[2]-coeffx[0])!=0) 00202 { 00203 t=(coeffx[0]-coeffx[1])/(coeffx[2]-coeffx[0]); 00204 } 00205 else if (var==1 && (coeffy[2]-coeffy[0])!=0) 00206 { 00207 t=(coeffy[0]-coeffy[1])/(coeffy[2]-coeffy[0]); 00208 }; 00209 00210 if(is_unit1(t)){ 00211 tensor::eval(cx,seq2b(coeffx).rep(),t); 00212 tensor::eval(cy,seq2b(coeffy).rep(),t); 00213 tensor::eval(w,seq2b(wvec).rep(),t); 00214 pt=vec( cx/w , cy/w ); 00215 } 00216 // std::cout <<pt<<std::endl; 00217 return(pt); 00218 }; /*tang. pt in var*/
vec_t midc | ( | ) | [inline] |
Definition at line 157 of file fatarcs.hpp.
References dot(), arc_rep< C >::pts, rotl(), mmx::sign(), mmx::sqrt(), v_div(), v_minus(), v_mul(), v_plus(), and arc_rep< C >::weight().
Referenced by arc_rep< C >::critpt(), and box_rep< C >::max_eval().
00157 { 00158 vec_t pp=v_minus(pts[0],pts[2]); pp=rotl(pp); 00159 vec_t m=v_mul(coeff_t( sign(dot(pp, v_minus(pts[1],pts[2]) ))),pp); 00160 coeff_t w=weight(); 00161 00162 vec_t d; 00163 if( (coeff_t(1)-w*w) > coeff_t(0) && w!=coeff_t(0) ){ 00164 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))); } 00165 else { 00166 d=v_div(v_plus(pts[0],pts[2]),coeff_t(2)); }; 00167 return(d); 00168 00169 };/*middle control point in bb rep.*/
Definition at line 221 of file fatarcs.hpp.
References arc_rep< C >::arc_eq(), is_arc(), is_unit1(), arc_rep< C >::pts, rotl(), Seq< C, R >::size(), solve2(), mmx::sqrt(), v_div(), v_length(), v_minus(), v_mul(), v_plus(), vec(), and arc_rep< C >::weight().
Referenced by extpts().
00221 { 00222 vec_t newp[3]; 00223 Seq<coeff_t> mo, ehrat; 00224 int i;unsigned j; 00225 vec_t pp=rotl(v_minus(pts[0],pts[2])); 00226 00227 coeff_t l=v_length(pp); 00228 coeff_t w=weight(); 00229 00230 for( i=0; i<3; i++){newp[i]=vec_t(); }; 00231 arc_rep<coeff_t> ncirc(newp); 00232 if( l!=coeff_t(0) ){ 00233 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 00234 else if ( 00235 //( coeff_t(1)-w*w )>coeff_t(0) && 00236 ( r + l/(coeff_t(2)*sqrt( coeff_t(1)-w*w ) )) > coeff_t(0) 00237 && v_length( v_minus(pts[1],v_plus(pts[0],pts[2])) )!=coeff_t(0) ) 00238 { 00239 00240 newp[0]=v_plus(pts[0],v_mul(coeff_t(2)*r/l, 00241 rotl( v_minus(v_minus(v_mul((coeff_t(1)+w),pts[1]),v_mul((w+ coeff_t(0.5)),pts[0])), 00242 v_div(pts[2],coeff_t(2)) 00243 ) 00244 ) 00245 ) 00246 ); 00247 00248 newp[1]=v_plus(pts[1], 00249 v_mul(r/v_length(v_minus(pts[1],v_div(v_plus(pts[0],pts[2]),coeff_t(2)))), 00250 v_minus(v_minus(pts[1],v_div(pts[0],coeff_t(2))),v_div(pts[2],coeff_t(2))) 00251 ) 00252 ); 00253 00254 newp[2]=v_minus(pts[2], 00255 v_mul(coeff_t(2)*r/l, 00256 rotl(v_minus(v_minus(v_mul((coeff_t(1)+w),pts[1]),v_mul((w+(coeff_t)(0.5)),pts[2])), 00257 v_div(pts[0],coeff_t(2)) 00258 ) 00259 ) 00260 ) 00261 ); 00262 }; 00263 00264 //std::cout <<"newp0: "<<newp[0]<<" "<<newp[1]<<" "<<newp[2]<<std::endl; 00265 ncirc=arc_rep<coeff_t>(newp); 00266 if(is_arc(ncirc)){ 00267 Seq<vec_t> isp; 00268 ehrat=ncirc.arc_eq(); 00269 mo=solve2(ehrat[0],ehrat[2],ehrat[3]); 00270 for( j=0; j<2; j++){if(is_unit1(mo[j])){isp<<vec(coeff_t(0),mo[j]);};}; 00271 mo=solve2(ehrat[0],ehrat[2],ehrat[0]+ehrat[1]+ehrat[3]); 00272 for( j=0; j<2; j++){if(is_unit1(mo[j])){isp<<vec(coeff_t(1),mo[j]);};}; 00273 mo=solve2(ehrat[0],ehrat[1],ehrat[3]); 00274 for( j=0; j<2; j++){if(is_unit1(mo[j])){isp<<vec(mo[j],coeff_t(0));};}; 00275 mo=solve2(ehrat[0],ehrat[1],ehrat[0]+ehrat[2]+ehrat[3]); 00276 for( j=0; j<2; j++){if(is_unit1(mo[j])){isp<<vec(mo[j],coeff_t(1));};}; 00277 00278 if (isp.size()==0){newp[0]=vec_t(); }else{ 00279 newp[0]=isp[0]; 00280 for( j=1; j<isp.size(); j++) 00281 {if(v_length(v_minus(isp[j],pts[0]))<v_length(v_minus(newp[0],pts[0]))){newp[0]=isp[j];};}; 00282 }; 00283 00284 if (isp.size()==0){newp[2]=vec_t(); }else{ 00285 newp[2]=isp[0]; 00286 for( j=1; j<isp.size(); j++) 00287 {if(v_length(v_minus(isp[j],pts[2]))<v_length(v_minus(newp[2],pts[2]))){newp[2]=isp[j];};}; 00288 }; 00289 ncirc=arc_rep<coeff_t>(newp); 00290 // std::cout <<"newp1: "<<newp[0]<<" "<<newp[1]<<" "<<newp[2]<<std::endl; 00291 /*if (is_arc(ncirc)){ 00292 if( matrat(v_minus(newp[1],newp[0]),v_minus(newp[2],newp[0]))[1]>coeff_t(0) ) 00293 { vec_t u=newp[0]; newp[0]=newp[2]; newp[2]=u;}};*/ 00294 }; 00295 }; 00296 return( ncirc ); 00297 } /*offset arc computation(with precise endpoints) - OR OUTSIDE!!!*/
coeff_t weight | ( | ) | [inline] |
Definition at line 152 of file fatarcs.hpp.
References dot(), arc_rep< C >::pts, v_length(), and v_minus().
Referenced by arc_rep< C >::critpt(), box_rep< C >::max_eval(), arc_rep< C >::midc(), and arc_rep< C >::offset().
Definition at line 131 of file fatarcs.hpp.
Referenced by arc_rep< C >::arc_eq(), arc_rep< C >::arc_rep(), arc_rep< C >::critpt(), extpts(), is_arc(), is_infatarc(), box_rep< C >::max_eval(), arc_rep< C >::midc(), arc_rep< C >::offset(), and arc_rep< C >::weight().