4 #define SMALL C(10e-20)
6 #define SIZE poly.size()
25 std::vector<C>
vec (
const C c1,
const C c2) {
26 std::vector<C> a(2,
C(0));
32 std::vector<C>
rotl(std::vector<C> p){
33 std::vector<C> v; v=
vec(
C(-1)*p[1],p[0]);
return(v);
37 C dot(std::vector<C> p ,std::vector<C> q){
39 for(
unsigned i=0; i<p.size(); i++){
46 std::vector<C>
v_plus(std::vector<C> p ,std::vector<C> q){
47 std::vector<C> v(p.size(),
C(0));
48 assert( p.size()==q.size() );
49 for(
unsigned i=0; i<p.size(); i++){
56 std::vector<C>
v_minus(std::vector<C> p ,std::vector<C> q){
57 std::vector<C> v(p.size(),
C(0));
58 assert( p.size()==q.size() );
59 for(
unsigned i=0; i<p.size(); i++){
66 std::vector<C>
v_div(std::vector<C> p ,
C q){
68 std::vector<C> v(p.size(),
C(0));
69 for(
unsigned i=0; i<p.size(); i++){
71 return(v);}
else{
return std::vector<C>();}
75 std::vector<C>
v_mul(
C q, std::vector<C> p){
76 std::vector<C> v(p.size(),
C(0));
77 for(
unsigned i=0; i<p.size(); i++){
89 std::vector<C>
matrat(std::vector<C> v1,std::vector<C> v2){
90 std::vector<C> mm; mm=
vec(v1[0]*v2[0]+v1[1]*v2[1],v1[0]*v2[1]-v2[0]*v1[1]);
95 std::vector<C>
crossrat(std::vector<C> v1,std::vector<C> v2,std::vector<C> v3,std::vector<C> v4){
105 if(p==
C(0)){
return true;}
111 if(p==
C(0)){
return true;}
128 else{
if(
sign(b*b-
C(4)*a*c) >= 0){
129 root1=(
C(-1)*b+
sqrt(b*b-
C(4)*a*c))/(
C(2)*a);
130 root2=(
C(-1)*b-
sqrt(b*b-
C(4)*a*c))/(
C(2)*a);
131 r[0]=root1;r[1]=root2;}
139 if(p<
C(0) || p>
C(1) ){
return false;}
158 if((n-p)<p){ p=n-p;};
160 for(
int i=1;i<=p;i++){ n1=n1*n2/i; n2--;};
172 for(
int i=0; i<n-deg; i++){
mul(tj,t); };
184 for(
int i=1; i<n; i++){
mul(
poly, t); };
192 int n=coeffseq.
size()-1;
195 for(
int i=0; i<=n; i++ ){
196 pi=
bbasis(coeffseq[i],n,i);
209 for(
int i=0; i<n; i++ ){
210 res +=
REP[i]/
C(i+1) ;}
221 for (
unsigned i = 1; i <
SIZE; i++ ){
236 for (
unsigned i = 1; i <
SIZE; i++ ){
252 if( max*max < min*min){ max =
C(-1)*
min; };
267 Seq<C> cval; cval<<c00<<c10<<c01<<c11;
281 std::vector<C> movec;
283 if (ep2.size()==0 ){movec=ep1;}
289 endptsx<<ep2[0]<<ep1[0];
290 endptsy<<ep2[1]<<ep1[1];
306 C u=
C(15)*I-
C(0.75)*(c0+c1);
307 sols=
solve2(c0+c1-
C(2)*u,
C(2)*(u-c0),c0);
311 {t=sols[0]; movec=
vec(ep1[0]*t+ep2[0]*(
C(1)-t),ep1[1]*t+ep2[1]*(
C(1)-t));}
313 {t=sols[1]; movec=
vec(ep1[0]*t+ep2[0]*(
C(1)-t),ep1[1]*t+ep2[1]*(
C(1)-t));}
314 else{movec=std::vector<C>();}
324 std::vector<C> endp[2], mpts[3];
327 for(
int i=0; i<3; i++){mpts[i]=std::vector<C>();};
330 mpts[0]=
approx(box.
poly, list[0], list[1], MTH);
331 mpts[1]=
approx(box.
poly, list[2], list[3], MTH);
333 if( mpts[0].
size()!=0 && mpts[1].
size()!=0 ){
335 std::vector<C> mid, rvec, v;
341 bval[0]=rvec[1]*
C(-1)*mid[0]/rvec[0]+mid[1];
342 bval[1]=rvec[1]*(
C(1)-mid[0])/rvec[0]+mid[1];}
else{ bval[0]=
C(-1); bval[1]=
C(-1);}
345 bval[2]=rvec[0]*
C(-1)*mid[1]/rvec[1]+mid[0];
346 bval[3]=rvec[0]*(
C(1)-mid[1])/rvec[1]+mid[0];}
else{ bval[2]=
C(-1); bval[3]=
C(-1);}
348 if(
is_unit1(bval[0]) && s<2){endp[s]=
vec(
C(0),bval[0]); s++;};
349 if(
is_unit1(bval[1]) && s<2){endp[s]=
vec(
C(1),bval[1]); s++;};
350 if(
is_unit1(bval[2]) && s<2){endp[s]=
vec(bval[2],
C(0)); s++;};
351 if(
is_unit1(bval[3]) && s<2){endp[s]=
vec(bval[3],
C(1)); s++;};
354 if(s==2){ mpts[1]=
approx(box.
poly, endp[0], endp[1], MTH);}
377 Aeh=(
C(-1)*eh2[1])/(eh2[2]);
378 Ceh=(
C(-1)*eh2[3])/(eh2[2]);
379 sx[0]=(
C(-1)*eh1[2]*Ceh-eh1[3])/(eh1[2]*Aeh+eh1[1]);
381 ispts[0]=
vec(sx[0],Aeh*sx[0]+Ceh);
382 ispts[1]=
vec(sx[0],Aeh*sx[0]+Ceh);
389 Aeh=(eh2[1]-eh1[1])/(eh1[2]-eh2[2]);
390 Ceh=(eh2[3]-eh1[3])/(eh1[2]-eh2[2]);}
396 Aeh=(
C(-1)*eh2[1])/(eh2[2]);
397 Ceh=(
C(-1)*eh2[3])/(eh2[2]);};
401 sx=
solve2(
C(1)+Aeh*Aeh,
C(2)*Aeh*Ceh+eh1[1]+eh1[2]*Aeh, Ceh*Ceh+eh1[2]*Ceh+eh1[3]);
403 ispts[0]=
vec(sx[0],Aeh*sx[0]+Ceh);
404 ispts[1]=
vec(sx[1],Aeh*sx[1]+Ceh);
408 else{ ispts[0]=
vec(
C(-1),
C(-1));
409 ispts[1]=
vec(
C(-1),
C(-1));
416 if( c.
pts[0].size()!=0 && c.
pts[1].size()!=0 && c.
pts[2].size()!=0 ){
return true;}
425 {
return true;}
else{
return false;}
468 for(
unsigned i=0; i<cpts.
size(); i++){
if(
is_infatarc(cpts[i],c1m,c1p) &&
479 if(ispts.size()==0) {
483 C minx=ispts[0][0], maxx=ispts[0][0], miny=ispts[0][1], maxy=ispts[0][1];
484 for(
unsigned i=0; i<ispts.size(); i++){
485 if(k==0){ minx=ispts[i][0]; maxx=ispts[i][0]; miny=ispts[i][1]; maxy=ispts[i][1]; k++;};
486 if(ispts[i][0]>maxx){maxx=ispts[i][0];};
487 if(ispts[i][0]<minx){minx=ispts[i][0];};
488 if(ispts[i][1]>maxy){maxy=ispts[i][1];};
489 if(ispts[i][1]<miny){miny=ispts[i][1];};
493 if((maxx-minx)>
C(0) && (maxy-miny)>
C(0))
Seq< std::vector< C > > extpts(arc_rep< C > mc1, C r1, arc_rep< C > mc2, C r2)
Definition: fatarcs_fcts.hpp:432
std::vector< C > v_mul(C q, std::vector< C > p)
Definition: fatarcs_fcts.hpp:75
Sequence of terms with reference counter.
Definition: Seq.hpp:28
arc_rep< coeff_t > offset(coeff_t r)
Definition: fatarcs.hpp:221
bool is_unit2(std::vector< C > p)
Definition: fatarcs_fcts.hpp:145
T pow(const T &a, int i)
Definition: binomials.hpp:12
C pint(polynomial< C, with< MonomialTensor > > poly)
Definition: fatarcs_fcts.hpp:204
vec_t pts[3]
Definition: fatarcs.hpp:131
const C & b
Definition: Interval_glue.hpp:25
std::vector< C > approx(polynomial< C, with< Bernstein > > poly, std::vector< C > ep1, std::vector< C > ep2, int MTH)
Definition: fatarcs_fcts.hpp:276
C abs_max_coeff(polynomial< C, with< Bernstein > > poly)
Definition: fatarcs_fcts.hpp:248
const Interval & I
Definition: Interval_glue.hpp:49
polynomial< C,with< Bernstein > > bbasis(C co, int n, int deg)
Definition: fatarcs_fcts.hpp:168
bool is_zero(C p)
Definition: fatarcs_fcts.hpp:104
Result eval(const Polynomial &polynomial, const Parameters ¶meters)
Multivariate Polynomial Evaluation.
Definition: polynomial_fcts.hpp:135
bool is_infatarc(std::vector< C > p, arc_rep< C > c1, arc_rep< C > c2)
Definition: fatarcs_fcts.hpp:422
std::vector< C > rotl(std::vector< C > p)
Definition: fatarcs_fcts.hpp:32
#define REP
Definition: fatarcs_fcts.hpp:5
Definition: fatarcs.hpp:307
Definition: fatarcs.hpp:23
bool is_arc(arc_rep< C > c)
Definition: fatarcs_fcts.hpp:415
void mul(Interval< C, r > &a, const C &x)
Definition: Interval_fcts.hpp:259
void assign(monomials< C > &monoms, const bernstein< C > &controls)
Definition: tensor_bernstein_fcts.hpp:267
Seq< C > corner_values(polynomial< C, with< Bernstein > > p)
Definition: fatarcs_fcts.hpp:260
C min_coeff(polynomial< C, with< Bernstein > > poly)
Definition: fatarcs_fcts.hpp:217
void eval(Result &result, const bernstein< Coeff > &controls, const Parameters ¶meters)
Definition: tensor_bernstein_fcts.hpp:195
std::vector< C > v_div(std::vector< C > p, C q)
Definition: fatarcs_fcts.hpp:66
size_type size() const
Definition: Seq.hpp:166
box_t box
Definition: fatarcs.hpp:318
Interval< T, r > min(const Interval< T, r > &a, const Interval< T, r > &b)
Definition: Interval_fcts.hpp:130
seqint_t I
Definition: fatarcs.hpp:31
seq_t arc_eq()
Definition: fatarcs.hpp:173
bool is_small(C p)
Definition: fatarcs_fcts.hpp:110
Seq< C > delta()
Definition: fatarcs.hpp:76
vec_t critpt(int var)
Definition: fatarcs.hpp:191
Seq< C > solve2(C a, C b, C c)
Definition: fatarcs_fcts.hpp:124
Definition: polynomial.hpp:37
#define SIZE
Definition: fatarcs_fcts.hpp:6
ZZ size(const ZZ &z)
Definition: GMPXX.hpp:67
std::vector< C > crossrat(std::vector< C > v1, std::vector< C > v2, std::vector< C > v3, std::vector< C > v4)
Definition: fatarcs_fcts.hpp:95
T median(const Interval< T, r > &x)
Definition: Interval_fcts.hpp:91
scalar< T > sqrt(const scalar< T > &b)
Definition: scalar.hpp:501
domain< C > minmax_box(Seq< std::vector< C > > ispts, domain< C > box)
Definition: fatarcs_fcts.hpp:476
bool is_unit1(C p)
Definition: fatarcs_fcts.hpp:138
std::vector< C > vec(const C c1, const C c2)
Definition: fatarcs_fcts.hpp:25
C dot(std::vector< C > p, std::vector< C > q)
Definition: fatarcs_fcts.hpp:37
Generic class for intervals.
Definition: Interval.hpp:44
const C & c
Definition: Interval_glue.hpp:45
Definition: fatarcs.hpp:119
double C
Definition: solver_mv_fatarcs.cpp:16
std::vector< C > matrat(std::vector< C > v1, std::vector< C > v2)
Definition: fatarcs_fcts.hpp:89
int sign(const QQ &a)
Definition: GMP.hpp:60
bernstein_t poly
Definition: fatarcs.hpp:319
C max_coeff(polynomial< C, with< Bernstein > > poly)
Definition: fatarcs_fcts.hpp:232
std::vector< C > v_plus(std::vector< C > p, std::vector< C > q)
Definition: fatarcs_fcts.hpp:46
C v_length(std::vector< C > p)
Definition: fatarcs_fcts.hpp:84
void circ_is(std::vector< C > *ispts, arc_rep< C > c1, arc_rep< C > c2)
Definition: fatarcs_fcts.hpp:369
Interval< T, r > max(const Interval< T, r > &a, const Interval< T, r > &b)
Definition: Interval_fcts.hpp:135
void add(dynamic_exp< E > &r, const dynamic_exp< E > &A, const dynamic_exp< E > &B)
Definition: dynamicexp.hpp:295
Definition: polynomial.hpp:40
polynomial< C,with< Bernstein > > seq2b(Seq< C > coeffseq)
Definition: fatarcs_fcts.hpp:190
std::vector< C > v_minus(std::vector< C > p, std::vector< C > q)
Definition: fatarcs_fcts.hpp:56
T binomial(int n, int p)
Definition: binomials.hpp:52
#define assert(expr, msg)
Definition: shared_object.hpp:57