#include <solver_implicit.hpp>
Definition at line 49 of file solver_implicit.hpp.
typedef bounding_box<C,Ref> BoundingBox |
Definition at line 54 of file solver_implicit.hpp.
Definition at line 55 of file solver_implicit.hpp.
Definition at line 53 of file solver_implicit.hpp.
Definition at line 52 of file solver_implicit.hpp.
typedef C Scalar |
Definition at line 51 of file solver_implicit.hpp.
static void common_edge_point | ( | Seq< Point * > & | lp, | |
const MultivariateDenseBernstein & | p, | |||
const BoxFace & | E, | |||
const BoundingBox & | bx1, | |||
const BoundingBox & | bx2 | |||
) | [inline, static] |
Definition at line 293 of file solver_implicit.hpp.
References approx(), box_face< C, V >::cvar(), mmx::tensor::face(), box_face< C, V >::lower(), mmx::shape::lower(), mmx::max(), box_face< C, V >::new_point(), box_face< C, V >::side(), mmx::solve(), mmx::ssi::up(), box_face< C, V >::upper(), and mmx::shape::upper().
00297 { 00298 MultivariateDenseBernstein f; 00299 00300 tensor::face(f,p,E.cvar(0),E.side(0)); 00301 00302 polynomial<double, with<Bernstein> > dw(1,f.size()-1), up(1,f.size()-1); 00303 for(unsigned i=0; i<f.size();i++) { 00304 up[i]= upper(f[i]); 00305 dw[i]= lower(f[i]); 00306 //up[i]=dw[i]=f[i]; 00307 } 00308 00309 double 00310 U_b = std::max( E.lower(bx1), E.lower(bx2) ) , 00311 V_b = std::min( E.upper(bx1), E.upper(bx2) ) ; 00312 00313 Seq<double> sol; 00314 00315 solver< double, Sleeve<Approximate> >::solve(sol,dw,up,U_b,V_b); 00316 00317 sol.sort();// sort from smaller to bigger 00318 00319 Approximate approx; 00320 for(unsigned i=0;i<sol.size(); i++) 00321 { 00322 lp<< E.new_point(bx1,sol[i]); 00323 } 00324 }
static void edge_point | ( | Seq< Point * > & | lp, | |
const MultivariateDenseBernstein & | p, | |||
const BoxFace & | E, | |||
const BoundingBox & | bx | |||
) | [inline, static] |
Definition at line 94 of file solver_implicit.hpp.
References approx(), box_face< C, V >::cvar(), mmx::tensor::face(), box_face< C, V >::lower(), mmx::shape::lower(), box_face< C, V >::m_s, box_face< C, V >::m_v, box_face< C, V >::new_point(), box_face< C, V >::side(), mmx::solve(), mmx::ssi::up(), box_face< C, V >::upper(), and mmx::shape::upper().
Referenced by bcell2d_algebraic_curve< C, V >::bcell2d_algebraic_curve(), cell3d_algebraic_surface< C, V >::edge_point(), and bcell3d_algebraic_surface< C, V >::edge_point().
00097 { 00098 00099 MultivariateDenseBernstein f; 00100 00101 tensor::face(f,p,E.cvar(0),E.side(0)); 00102 00103 polynomial<double, with<Bernstein> > dw(1,f.size()-1), up(1,f.size()-1); 00104 for(unsigned i=0; i<f.size();i++) { 00105 up[i]= upper(f[i]); 00106 dw[i]= lower(f[i]); 00107 } 00108 00109 double 00110 U_b = E.lower(bx), 00111 V_b = E.upper(bx); 00112 00113 Seq<double> sol; 00114 solver< double, Sleeve<Approximate> >::solve(sol,dw,up,U_b,V_b); 00115 00116 // std::cout<<"****U= "<<U<<std::endl; 00117 // std::cout<<"****V= "<<V<<std::endl; 00118 // std::cout<<"***dw= "<<dw<<std::endl; 00119 // std::cout<<"***up= "<<up<<std::endl; 00120 // if(sol.size()>1) std::cout<<"******Sols : "<<sol<<" "<<sol[1]-sol[0]<<std::endl; 00121 00122 Approximate approx; 00123 std::vector<double> pt(3); 00124 for(unsigned i=0;i<sol.size(); i++) 00125 if (i==0 || sol[i]-sol[i-1]> approx.eps){ 00126 if(true) {//E.is_valid(bx, sol[i], approx.eps)) { 00127 lp<< E.new_point(bx,sol[i]); 00128 } else { 00129 std::cout<<"Not valid: ["<<(*E.new_point(bx,sol[i])) <<"] " 00130 <<bx<<" " 00131 <<E.m_v[0]<< " "<< E.m_s[0] <<" " 00132 <<E.m_v[1]<< " "<< E.m_s[1] << " " 00133 <<std::endl; 00134 lp<< E.new_point(bx,sol[i]); 00135 } 00136 } 00137 }
static int edge_sign_var | ( | const MultivariateDenseBernstein & | p, | |
const BoxFace & | E | |||
) | [inline, static] |
Definition at line 140 of file solver_implicit.hpp.
References box_face< C, V >::cvar(), mmx::tensor::face(), box_face< C, V >::side(), and mmx::sign_variation().
Referenced by cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().
00141 { 00142 MultivariateDenseBernstein f; 00143 tensor::face(f,p,E.cvar(0),E.side(0)); 00144 return sign_variation(f.begin(), f.end()); 00145 00146 }
static void extremal | ( | Seq< Point * > & | sol, | |
const Polynomial & | pol, | |||
const BoundingBox & | b | |||
) | [inline, static] |
Definition at line 210 of file solver_implicit.hpp.
References mmx::assign(), mmx::diff(), solver_implicit< C, V >::new_point(), Polynomial, bounding_box< C, V >::xmax(), bounding_box< C, V >::xmin(), bounding_box< C, V >::ymax(), and bounding_box< C, V >::ymin().
Referenced by bcell2d_algebraic_curve< C, V >::bcell2d_algebraic_curve(), cell2d_algebraic_curve< C, V >::cell2d_algebraic_curve(), and mmx::shape::extremal().
00211 { 00212 00213 typedef polynomial< double, with<Bernstein> > MultivariateDenseBernstein; 00214 00215 // typedef Polynomial MultivariateDenseBernstein; 00216 00217 00218 typedef polynomial< GMP::rational, with<Bernstein> > MultivariateDenseBernsteinQ; 00219 00220 Seq<mmx::GMP::rational> bx; 00221 bx<<as<mmx::GMP::rational>(b.xmin()); 00222 bx<<as<mmx::GMP::rational>(b.xmax()); 00223 bx<<as<mmx::GMP::rational>(b.ymin()); 00224 bx<<as<mmx::GMP::rational>(b.ymax()); 00225 00226 00227 //tensor::bernstein<mmx::GMP::rational> P(pol.rep(),bx); 00228 //typename Polynomial::Scalar mx = as<typename Polynomial::Scalar>(array::max_abs(P)); 00229 //Polynomial Pol=pol/mx, dxpol = diff(Pol,0), dypol = diff(Pol,1); 00230 00231 Polynomial dxpol = diff(pol,0), dypol = diff(pol,1); 00232 tensor::bernstein<mmx::GMP::rational> 00233 dxP(dxpol.rep(),bx),dyP(dypol.rep(),bx); 00234 00235 MultivariateDenseBernstein dxp,dyp; 00236 let::assign(dxp.rep(), dxP); 00237 let::assign(dyp.rep(), dyP); 00238 00239 Seq<MultivariateDenseBernstein> sys; 00240 // Seq<MultivariateDenseBernsteinQ> sys; 00241 sys<<dxp<<dyp; 00242 00243 solver<double, ProjRd<SBD_RDRDL> > slv; 00244 00245 std::vector<double> res; 00246 slv.solve_bernstein(res,sys); 00247 00248 double x_sc= (b.xmax()-b.xmin()), y_sc= (b.ymax()-b.ymin()); 00249 for(unsigned i=0;i<res.size();i+=2) { 00250 sol << new_point(b.xmin()+res[i]*x_sc, b.ymin()+res[i+1]*y_sc, 0.0); 00251 } 00252 }
static void face_point | ( | Seq< Point * > & | sol, | |
const Seq< MultivariateDenseBernstein > & | eqs, | |||
const BoxFace & | F, | |||
const BoundingBox & | bx | |||
) | [inline, static] |
Definition at line 149 of file solver_implicit.hpp.
References approx(), mmx::assign(), box_face< C, V >::cvar(), mmx::tensor::face(), box_face< C, V >::is_valid(), box_face< C, V >::new_point(), Polynomial, Seq< C, R >::rep(), box_face< C, V >::side(), and Seq< C, R >::size().
Referenced by bcell3d_algebraic_curve< C, V >::bcell3d_algebraic_curve(), and bcell3d_algebraic_curve< C, V >::subdivide().
00152 { 00153 00154 typedef polynomial< double, with<Bernstein> > Polynomial; 00155 00156 Polynomial f, p; 00157 Seq<Polynomial> sys; 00158 for(unsigned i=0;i< eqs.size(); i++) { 00159 let::assign(p.rep(), eqs[i].rep()); 00160 tensor::face(f.rep(), p.rep(), F.cvar(0), F.side(0)); 00161 sys<<f; 00162 } 00163 00164 solver<double, ProjRd<SBD_RDRDL> > slv; 00165 std::vector<double> res; 00166 slv.solve_bernstein(res,sys); 00167 Approximate approx; 00168 00169 for(int i=0;i<(int)res.size()-1;i+=2) { 00170 00171 // if (res[i]<approx.eps) res[i]=0; 00172 // else if (res[i]>1-approx.eps) res[i]=1; 00173 00174 // if (res[i+1]<approx.eps) res[i+1]=0; 00175 // else if (res[i+1]>1-approx.eps) res[i+1]=1; 00176 00177 Point * p = F.new_point(bx, res[i], res[i+1]); 00178 if (F.is_valid(*p, bx)) sol<< p; 00179 // else delete p; 00180 } 00181 }
static void intersection | ( | Seq< Point * > & | sol, | |
const Polynomial & | f1, | |||
const Polynomial & | f2, | |||
const BoundingBox & | bx | |||
) | [inline, static] |
Definition at line 184 of file solver_implicit.hpp.
References mmx::assign(), solver_implicit< C, V >::new_point(), bounding_box< C, V >::xmax(), bounding_box< C, V >::xmin(), bounding_box< C, V >::ymax(), and bounding_box< C, V >::ymin().
00186 { 00187 00188 typedef polynomial< double, with<Bernstein> > MultivariateDenseBernstein; 00189 MultivariateDenseBernstein p1, p2; 00190 00191 00192 let::assign(p1.rep(), f1.rep() ); 00193 let::assign(p2.rep(), f2.rep() ); 00194 00195 Seq<MultivariateDenseBernstein> sys; 00196 sys<<p1<<p2; 00197 00198 solver<double, ProjRd<SBD_RDRDL> > slv; 00199 std::vector<double> res; 00200 slv.solve_bernstein(res,sys); 00201 00202 double x_sc= (bx.xmax()-bx.xmin()), y_sc= (bx.ymax()-bx.ymin()); 00203 for(unsigned i=0;i<res.size();i+=2) 00204 { 00205 sol << new_point(bx.xmin()+res[i]*x_sc, bx.ymin()+res[i+1]*y_sc, 0.0); 00206 } 00207 }
static Point* new_point | ( | double | a, | |
double | b, | |||
double | c | |||
) | [inline, static] |
Definition at line 86 of file solver_implicit.hpp.
Referenced by solver_implicit< C, V >::extremal(), solver_implicit< C, V >::intersection(), and solver_implicit< C, V >::singular().
00086 { 00087 return new Point(a,b,c); 00088 }
static void singular | ( | Seq< Point * > & | sol, | |
const Polynomial & | pol, | |||
const BoundingBox & | b | |||
) | [inline, static] |
Definition at line 255 of file solver_implicit.hpp.
References mmx::assign(), mmx::diff(), solver_implicit< C, V >::new_point(), Polynomial, bounding_box< C, V >::xmax(), bounding_box< C, V >::xmin(), bounding_box< C, V >::ymax(), and bounding_box< C, V >::ymin().
00256 { 00257 00258 typedef polynomial< double, with<Bernstein> > MultivariateDenseBernstein; 00259 typedef polynomial< GMP::rational, with<Bernstein> > MultivariateDenseBernsteinQ; 00260 00261 Seq<mmx::GMP::rational> bx; 00262 bx<<as<mmx::GMP::rational>(b.xmin()); 00263 bx<<as<mmx::GMP::rational>(b.xmax()); 00264 bx<<as<mmx::GMP::rational>(b.ymin()); 00265 bx<<as<mmx::GMP::rational>(b.ymax()); 00266 00267 Polynomial dxpol = diff(pol,0), dypol = diff(pol,1); 00268 tensor::bernstein<mmx::GMP::rational> 00269 P(pol.rep(),bx), dxP(dxpol.rep(),bx),dyP(dypol.rep(),bx); 00270 00271 MultivariateDenseBernstein p,dxp,dyp; 00272 let::assign(p.rep() , P); 00273 let::assign(dxp.rep(), dxP); 00274 let::assign(dyp.rep(), dyP); 00275 00276 Seq<MultivariateDenseBernstein> sys; 00277 sys<<p<<dxp<<dyp; 00278 00279 solver<double, ProjRd<SBD_RDRDL> > slv; 00280 // solver<ring<double,Bernstein>, ProjRd<SBD_RDRDL> >::eps=1e-10; 00281 00282 std::vector<double> res; 00283 slv.solve_bernstein(res,sys); 00284 00285 double x_sc= (b.xmax()-b.xmin()), y_sc= (b.ymax()-b.ymin()); 00286 for(unsigned i=0;i<res.size();i+=2) { 00287 sol << new_point(b.xmin()+res[i]*x_sc, b.ymin()+res[i+1]*y_sc, 0.0); 00288 } 00289 }
Definition at line 62 of file solver_implicit.hpp.
Definition at line 84 of file solver_implicit.hpp.
Referenced by bcell3d_algebraic_curve< C, V >::bcell3d_algebraic_curve(), bcell3d< C, V >::intersections(), and bcell3d_algebraic_curve< C, V >::subdivide().
box_face< C, typename use< ref_def, double, V >::Ref > east_back_edge [inline, static] |
Definition at line 67 of file solver_implicit.hpp.
Referenced by cell3d_algebraic_surface< C, V >::edge_point(), bcell3d_algebraic_surface< C, V >::edge_point(), cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().
Definition at line 60 of file solver_implicit.hpp.
Referenced by bcell2d_algebraic_curve< C, V >::bcell2d_algebraic_curve().
Definition at line 82 of file solver_implicit.hpp.
Referenced by bcell3d_algebraic_curve< C, V >::bcell3d_algebraic_curve(), bcell3d< C, V >::intersections(), and bcell3d_algebraic_curve< C, V >::subdivide().
box_face< C, typename use< ref_def, double, V >::Ref > east_front_edge [inline, static] |
Definition at line 72 of file solver_implicit.hpp.
Referenced by cell3d_algebraic_surface< C, V >::edge_point(), bcell3d_algebraic_surface< C, V >::edge_point(), cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().
box_face< C, typename use< ref_def, double, V >::Ref > front_edge [inline, static] |
Definition at line 61 of file solver_implicit.hpp.
box_face< C, typename use< ref_def, double, V >::Ref > front_face [inline, static] |
Definition at line 83 of file solver_implicit.hpp.
Referenced by bcell3d_algebraic_curve< C, V >::bcell3d_algebraic_curve(), bcell3d< C, V >::intersections(), and bcell3d_algebraic_curve< C, V >::subdivide().
box_face< C, typename use< ref_def, double, V >::Ref > north_back_edge [inline, static] |
Definition at line 64 of file solver_implicit.hpp.
Referenced by cell3d_algebraic_surface< C, V >::edge_point(), bcell3d_algebraic_surface< C, V >::edge_point(), cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().
box_face< C, typename use< ref_def, double, V >::Ref > north_east_edge [inline, static] |
Definition at line 76 of file solver_implicit.hpp.
Referenced by cell3d_algebraic_surface< C, V >::edge_point(), bcell3d_algebraic_surface< C, V >::edge_point(), cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().
box_face< C, typename use< ref_def, double, V >::Ref > north_edge [inline, static] |
Definition at line 57 of file solver_implicit.hpp.
Referenced by bcell2d_algebraic_curve< C, V >::bcell2d_algebraic_curve().
box_face< C, typename use< ref_def, double, V >::Ref > north_face [inline, static] |
Definition at line 79 of file solver_implicit.hpp.
Referenced by bcell3d_algebraic_curve< C, V >::bcell3d_algebraic_curve(), bcell3d< C, V >::intersections(), and bcell3d_algebraic_curve< C, V >::subdivide().
box_face< C, typename use< ref_def, double, V >::Ref > north_front_edge [inline, static] |
Definition at line 69 of file solver_implicit.hpp.
Referenced by cell3d_algebraic_surface< C, V >::edge_point(), bcell3d_algebraic_surface< C, V >::edge_point(), cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().
box_face< C, typename use< ref_def, double, V >::Ref > north_west_edge [inline, static] |
Definition at line 74 of file solver_implicit.hpp.
Referenced by cell3d_algebraic_surface< C, V >::edge_point(), bcell3d_algebraic_surface< C, V >::edge_point(), cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().
box_face< C, typename use< ref_def, double, V >::Ref > south_back_edge [inline, static] |
Definition at line 65 of file solver_implicit.hpp.
Referenced by cell3d_algebraic_surface< C, V >::edge_point(), bcell3d_algebraic_surface< C, V >::edge_point(), cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().
box_face< C, typename use< ref_def, double, V >::Ref > south_east_edge [inline, static] |
Definition at line 77 of file solver_implicit.hpp.
Referenced by cell3d_algebraic_surface< C, V >::edge_point(), bcell3d_algebraic_surface< C, V >::edge_point(), cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().
box_face< C, typename use< ref_def, double, V >::Ref > south_edge [inline, static] |
Definition at line 58 of file solver_implicit.hpp.
Referenced by bcell2d_algebraic_curve< C, V >::bcell2d_algebraic_curve().
box_face< C, typename use< ref_def, double, V >::Ref > south_face [inline, static] |
Definition at line 80 of file solver_implicit.hpp.
Referenced by bcell3d_algebraic_curve< C, V >::bcell3d_algebraic_curve(), bcell3d< C, V >::intersections(), and bcell3d_algebraic_curve< C, V >::subdivide().
box_face< C, typename use< ref_def, double, V >::Ref > south_front_edge [inline, static] |
Definition at line 70 of file solver_implicit.hpp.
Referenced by cell3d_algebraic_surface< C, V >::edge_point(), bcell3d_algebraic_surface< C, V >::edge_point(), cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().
box_face< C, typename use< ref_def, double, V >::Ref > south_west_edge [inline, static] |
Definition at line 75 of file solver_implicit.hpp.
Referenced by cell3d_algebraic_surface< C, V >::edge_point(), bcell3d_algebraic_surface< C, V >::edge_point(), cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().
box_face< C, typename use< ref_def, double, V >::Ref > west_back_edge [inline, static] |
Definition at line 66 of file solver_implicit.hpp.
Referenced by cell3d_algebraic_surface< C, V >::edge_point(), bcell3d_algebraic_surface< C, V >::edge_point(), cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().
Definition at line 59 of file solver_implicit.hpp.
Referenced by bcell2d_algebraic_curve< C, V >::bcell2d_algebraic_curve().
Definition at line 81 of file solver_implicit.hpp.
Referenced by bcell3d_algebraic_curve< C, V >::bcell3d_algebraic_curve(), bcell3d< C, V >::intersections(), and bcell3d_algebraic_curve< C, V >::subdivide().
box_face< C, typename use< ref_def, double, V >::Ref > west_front_edge [inline, static] |
Definition at line 71 of file solver_implicit.hpp.
Referenced by cell3d_algebraic_surface< C, V >::edge_point(), bcell3d_algebraic_surface< C, V >::edge_point(), cell3d_algebraic_surface< C, V >::is_regular(), and bcell3d_algebraic_surface< C, V >::is_regular().