1 /* -*- mode:C++ ; compile-command: "g++ -I.. -g -c plot.cc" -*- */ 2 #ifndef _GIAC_PLOT_H 3 #define _GIAC_PLOT_H 4 /* 5 * Copyright (C) 2000,2014 B. Parisse, Institut Fourier, 38402 St Martin d'Heres 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #ifdef HAVE_CONFIG_H 21 #include "config.h" 22 #endif 23 #include "first.h" 24 #include <stdexcept> 25 #include <cmath> 26 #include <cstdlib> 27 #include <iostream> 28 #include "gen.h" 29 #include "plot3d.h" 30 #include <stdio.h> 31 // #include <stdiostream.h> 32 33 #ifdef HAVE_LIBFLTK 34 #include <FL/Enumerations.H> 35 #else 36 #ifndef GIAC_HAS_STO_38 37 enum Fl_Color { // standard colors 38 FL_BLACK = 0, 39 FL_RED = 1, 40 FL_GREEN = 2, 41 FL_YELLOW = 3, 42 FL_BLUE = 4, 43 FL_MAGENTA = 5, 44 FL_CYAN = 6, 45 FL_WHITE = 7, 46 FL_INACTIVE_COLOR = 8, 47 FL_SELECTION_COLOR = 15, 48 49 FL_FREE_COLOR = 16, 50 FL_NUM_FREE_COLOR = 16, 51 52 FL_GRAY_RAMP = 32, 53 54 // boxtypes limit themselves to these colors so whole ramp is not allocated: 55 FL_GRAY0 = 32, // 'A' 56 FL_DARK3 = 39, // 'H' 57 FL_DARK2 = 45, // 'N' 58 FL_DARK1 = 47, // 'P' 59 FL_GRAY = 49, // 'R' default color 60 FL_LIGHT1 = 50, // 'S' 61 FL_LIGHT2 = 52, // 'U' 62 FL_LIGHT3 = 54, // 'W' 63 64 FL_COLOR_CUBE = 56 65 }; 66 #else // GIAC_HAS_STO_38 67 //#ifndef LP64 68 typedef ptrdiff_t Int; 69 //#else typedef signed long Int; #endif 70 //#include "Colors.h" 71 #include "../../src/Colors.h" 72 enum Fl_Color { 73 FL_BLACK = ColorBlack, 74 FL_WHITE = ColorWhite, 75 FL_RED = ColorRed, // grey1 76 FL_YELLOW = ColorYellow, // grey1 77 FL_CYAN = ColorCyan, // grey2 78 FL_BLUE = ColorBlue, // grey2 79 FL_GREEN = ColorGreen, 80 FL_MAGENTA = ColorMagenta, 81 FL_TRANSPARENT = ColorTransparent, // transparent 82 FL_DARK1 = ColorDarkGrey, 83 FL_GRAY = ColorGrey, 84 FL_LIGHT1 = ColorWhite, 85 86 }; 87 88 #endif // GIAC_HAS_STO_38 89 #endif // FLTK 90 91 #ifndef NO_NAMESPACE_GIAC 92 namespace giac { 93 #endif // ndef NO_NAMESPACE_GIAC 94 95 // File "Out.txt" for gnuwince 96 #ifdef GNUWINCE 97 extern std::ofstream * outptr; 98 #endif 99 extern int LEGENDE_SIZE; 100 extern int COORD_SIZE; 101 extern int PARAM_STEP; 102 extern int gnuplot_pixels_per_eval; 103 extern double gnuplot_xmin,gnuplot_xmax,gnuplot_ymin,gnuplot_ymax,gnuplot_zmin,gnuplot_zmax,gnuplot_tmin,gnuplot_tmax,gnuplot_tstep,global_window_xmin,global_window_xmax,global_window_ymin,global_window_ymax,x_tick,y_tick; // ranges 104 extern double class_minimum,class_size; // histogram 105 extern bool autoscale; 106 extern bool has_gnuplot; 107 108 std::string print_DOUBLE_(double d,unsigned ndigits); 109 gen makecomplex(const gen & a,const gen &b); 110 111 void local_sto_double(double value,const identificateur & i,GIAC_CONTEXT); 112 void local_sto_double_increment(double value,const identificateur & i,GIAC_CONTEXT); 113 vecteur quote_eval(const vecteur & v,const vecteur & quoted,GIAC_CONTEXT); 114 115 // if v is the vector argument of pnt, get_style returns attributs and 116 // set legende to the legende to be displayed 117 vecteur get_style(const vecteur & v,std::string & legende); 118 // for a point nothing, segment/line/vect->1st point 119 // circle/sphere->diam 120 gen get_point(const gen & g,int n,GIAC_CONTEXT); 121 gen readvar(const gen & g); 122 void read_tmintmaxtstep(vecteur & vargs,gen & t,int vstart,double &tmin,double & tmax,double &tstep,bool & tminmax_defined,bool & tstep_defined,GIAC_CONTEXT); 123 int read_attributs(const vecteur & v,vecteur & attributs,GIAC_CONTEXT); 124 void read_option(const vecteur & v,double xmin,double xmax,double ymin,double ymax,double zmin,double zmax,vecteur & attributs, int & nstep,int & jstep,int & kstep,GIAC_CONTEXT); 125 gen curve_surface_apply(const gen & elem,const gen & b,gen (* func) (const gen &, const gen &,const context *),GIAC_CONTEXT); 126 gen apply3d(const gen & e1, const gen & e2,const context * contextptr, gen (* f) (const gen &, const gen &,const context *) ); 127 128 gen _point3d(const gen & args,GIAC_CONTEXT); 129 gen _point2d(const gen & args,GIAC_CONTEXT); 130 gen mkrand2d3d(int dim,int nargs,gen (* f)(const gen &,const context *),GIAC_CONTEXT); 131 gen droite_by_equation(const vecteur & v,bool est_plan,GIAC_CONTEXT); 132 // given 2 points e and f return equation of line e,f as coeffs a,b,c 133 bool point2abc(const gen & e,const gen & f,gen & a,gen & b,gen & c,GIAC_CONTEXT); 134 gen abs_norm(const gen & g,GIAC_CONTEXT); 135 gen abs_norm2(const gen & g,GIAC_CONTEXT); 136 gen dotvecteur(const gen & a,const gen & b,GIAC_CONTEXT); 137 bool check3dpoint(const gen & g); 138 vecteur remove_not_in_segment(const gen & a,const gen & b,int subtype,const vecteur & v,GIAC_CONTEXT); 139 vecteur interpolygone(const vecteur & p,const gen & bb,GIAC_CONTEXT); 140 vecteur interdroitecercle(const gen & a,const gen &b,GIAC_CONTEXT); 141 vecteur inter2cercles_or_spheres(const gen & centre_a,const gen & rayon_a2,const gen & centre_b,const gen & rayon_b2,bool a2d,GIAC_CONTEXT); 142 vecteur curveintercircle(const gen & curve,const gen &circle,bool iscircle,GIAC_CONTEXT); 143 144 bool set_turtle_state(const vecteur & v,GIAC_CONTEXT); 145 gen turtle2gen(const logo_turtle & turtle); 146 vecteur turtlevect2vecteur(const std::vector<logo_turtle> & v); 147 std::vector<logo_turtle> vecteur2turtlevect(const vecteur & v); 148 logo_turtle vecteur2turtle(const vecteur & v); 149 gen _avance(const gen & g,GIAC_CONTEXT); 150 gen _recule(const gen & g,GIAC_CONTEXT); 151 gen _position(const gen & g,GIAC_CONTEXT); 152 gen _cap(const gen & g,GIAC_CONTEXT); 153 gen _tourne_droite(const gen & g,GIAC_CONTEXT); 154 gen _tourne_gauche(const gen & g,GIAC_CONTEXT); 155 gen _leve_crayon(const gen & g,GIAC_CONTEXT); 156 gen _baisse_crayon(const gen & g,GIAC_CONTEXT); 157 gen _ecris(const gen & g,GIAC_CONTEXT); 158 gen _signe(const gen & g,GIAC_CONTEXT); 159 gen _saute(const gen & g,GIAC_CONTEXT); 160 gen _pas_de_cote(const gen & g,GIAC_CONTEXT); 161 gen _cache_tortue(const gen & g,GIAC_CONTEXT); 162 gen _montre_tortue(const gen & g,GIAC_CONTEXT); 163 gen _debut_enregistrement(const gen & g0,GIAC_CONTEXT); 164 gen _fin_enregistrement(const gen & g0,GIAC_CONTEXT); 165 gen _repete(const gen & g,GIAC_CONTEXT); 166 gen _crayon(const gen & g,GIAC_CONTEXT); 167 gen _efface(const gen & g,GIAC_CONTEXT); 168 gen _vers(const gen & g,GIAC_CONTEXT); 169 gen _rond(const gen & g,GIAC_CONTEXT); 170 gen _disque(const gen & g,GIAC_CONTEXT); 171 gen _disque_centre(const gen & g,GIAC_CONTEXT); 172 gen _polygone_rempli(const gen & g,GIAC_CONTEXT); 173 gen _rectangle_plein(const gen & g,GIAC_CONTEXT); 174 gen _triangle_plein(const gen & g,GIAC_CONTEXT); 175 gen _dessine_tortue(const gen & g,GIAC_CONTEXT); 176 177 gen _arc(const gen & args,GIAC_CONTEXT); 178 typedef gen (* propriete)(const gen & g,GIAC_CONTEXT); 179 gen _est(const gen & args,const propriete & f,GIAC_CONTEXT); 180 181 vecteur plotpreprocess(const gen & args,GIAC_CONTEXT); 182 vecteur gen2vecteur(const gen & arg); 183 bool chk_double_interval(const gen & g,double & inf,double & sup,GIAC_CONTEXT); 184 bool readrange(const gen & g,double defaultxmin,double defaultxmax,gen & x, double & xmin, double & xmax,GIAC_CONTEXT); 185 void ck_parameter_x(GIAC_CONTEXT); 186 void ck_parameter_y(GIAC_CONTEXT); 187 void ck_parameter_z(GIAC_CONTEXT); 188 void ck_parameter_t(GIAC_CONTEXT); 189 void ck_parameter_u(GIAC_CONTEXT); 190 void ck_parameter_v(GIAC_CONTEXT); 191 void ck_parameter(const gen & ,GIAC_CONTEXT); 192 193 void autoname_plus_plus(std::string & autoname); 194 int erase3d(); 195 gen _erase3d(const gen & args,GIAC_CONTEXT); 196 int erase_pos(GIAC_CONTEXT); 197 int erase_pos(int current,GIAC_CONTEXT); 198 bool is_segment(const gen & e); 199 bool is_pnt_or_pixon(const gen & g); 200 gen remove_at_pnt(const gen & e); 201 gen remove_sto(const gen & e); 202 vecteur selection2vecteur(const std::vector<int> & selected,GIAC_CONTEXT); 203 vecteur selection2vecteureval(const std::vector<int> & selected,GIAC_CONTEXT); 204 // find best int in selected (and modify selected) 205 // p is the pointed mouse point, eps the precision 206 // try_perp=-1 if no try of perp line, =an history_position otherwise 207 bool find_best(std::vector<int> & selected,const gen & p,double eps,int try_perp_history_pos,int & pnt_pos,int & history_position,gen & res,GIAC_CONTEXT); 208 int findfirstcercle(const vecteur & v); 209 int findfirstpoint(const vecteur & v); 210 211 extern bool fastcurveprint; 212 void rewrite_with_t_real(gen & eq,const gen & t,GIAC_CONTEXT); 213 extern const int _GROUP__VECT_subtype[]; 214 void streamcopy(FILE * source,FILE * target); 215 #if !defined VISUALC && !defined __MINGW_H 216 int set_nonblock_flag (int desc, int value); 217 int set_cloexec_flag (int desc, int value); 218 #endif 219 // runs gnuplot if necessary, returns the FD of the pipe to write to gnuplot 220 #ifdef WITH_GNUPLOT 221 // extern int plot_instructionsh,plot_instructionsw; 222 extern std::string PICTautoname; 223 void PICTautoname_plus_plus(); 224 extern std::string gnuplot_name; // name of the program gnuplot 225 extern std::string gnuplot_filename; // name of files where we save plots 226 extern int gnuplot_fileno; // current index in save plot files 227 int run_gnuplot(int & r); 228 void gnuplot_wait(int handle,FILE * gnuplot_out_readstream,int ngwait=0); 229 FILE * open_gnuplot(bool & clrplot,FILE * & gnuplot_out_readstream,int & r); 230 // Plot a function or a set of functions 231 void reset_gnuplot_hidden3d(FILE * stream); 232 extern bool gnuplot_do_splot; 233 std::string gnuplot_traduit(const gen & g); 234 void win9x_gnuplot(FILE * stream); 235 extern int gnuplot_wait_times; 236 void kill_gnuplot(); 237 extern bool gnuplot_hidden3d,gnuplot_pm3d; 238 void gnuplot_set_hidden3d(bool hidden); 239 void gnuplot_set_pm3d(bool b); 240 /* following obsolete declaration that will be remove in the future 241 when all fork/child etc. will be removed */ 242 extern vecteur plot_instructions; 243 #endif 244 int gnuplot_show_pnt(const symbolic & e,GIAC_CONTEXT); 245 246 gen rationalparam2equation(const gen & at_orig,const gen & t_orig,const gen &x,const gen & y,GIAC_CONTEXT); 247 248 // return parametrization for a parametric curve and translate 249 // ellipsis/hyperbola to a rational parametrization 250 // m will contain the complex depending on gen_t 251 bool find_curve_parametrization(const gen & geo_obj,gen & m,const gen & gen_t,double T,gen & tmin,gen & tmax,bool tminmax_defined,GIAC_CONTEXT); 252 // test if a point f is on a parametric curve e 253 // compute t if true 254 bool on(const gen & e_orig,const gen & f,gen & t,GIAC_CONTEXT); 255 256 gen plotfunc(const gen & f,const gen & vars,const vecteur & attributs,bool clrplot,double function_xmin,double function_xmax,double function_ymin,double function_ymax,double function_zmin, double function_zmax,int nstep,int jstep,bool showeq,GIAC_CONTEXT); 257 // return a vector of values with simple decimal representation 258 // between xmin/xmax or including xmin/xmax (if bounds is true) 259 vecteur ticks(double xmin,double xmax,bool bounds); 260 gen plotcontour(const gen & f0,bool contour,GIAC_CONTEXT); 261 gen plot_array(const std::vector< std::vector< double> > & fij,int imax,int jmax,double xmin,double xmax,double dx,double ymin,double ymax,double dy,const vecteur & lz,const vecteur & attributs,bool contour,GIAC_CONTEXT); 262 bool latex_replot(FILE * stream,const std::string & s); 263 bool png_replot(int i); 264 bool png_replot(const std::string & s); 265 bool terminal_replot(const char * terminal,int i,const char * file_extension); 266 bool terminal_replot(const char * terminal,const std::string & s); 267 gen approx_area(const gen & f,const gen & x,const gen & a,const gen &b,int n,int method,GIAC_CONTEXT); 268 gen _aire(const gen & args,GIAC_CONTEXT); 269 gen _perimetre(const gen & args,GIAC_CONTEXT); 270 gen funcplotfunc(const gen & args,bool densityplot,const context * contextptr); 271 gen _plotfunc(const gen &,GIAC_CONTEXT); 272 gen _funcplot(const gen & args,const context * contextptr); 273 gen _plotdensity(const gen & args,const context * contextptr); 274 extern const unary_function_ptr * const at_innertln; 275 extern const unary_function_ptr * const at_plotfunc; 276 extern const unary_function_ptr * const at_funcplot; 277 // gen _plot(const gen &); 278 extern const unary_function_ptr * const at_plot; 279 gen remove_at_pnt(const gen & e); 280 281 gen _erase(const gen & args,GIAC_CONTEXT); 282 extern const unary_function_ptr * const at_erase; 283 284 extern int pixon_size; 285 vecteur merge_pixon(const vecteur & v); 286 gen _pixon(const gen & args,GIAC_CONTEXT); 287 extern const unary_function_ptr * const at_pixon; 288 void pixon_print(const gen &g,std::string & S,GIAC_CONTEXT); 289 290 gen _pixoff(const gen & args,GIAC_CONTEXT); 291 extern const unary_function_ptr * const at_pixoff; 292 293 gen _droite(const gen & args,GIAC_CONTEXT); 294 extern const unary_function_ptr * const at_droite; 295 gen _slope(const gen & args,GIAC_CONTEXT); 296 297 gen _demi_droite(const gen & args,GIAC_CONTEXT); 298 extern const unary_function_ptr * const at_demi_droite; 299 300 gen _segment(const gen & args,GIAC_CONTEXT); 301 extern const unary_function_ptr * const at_segment; 302 303 extern const unary_function_ptr * const at_inter_unique; 304 extern const unary_function_ptr * const at_polygone_ouvert; 305 306 // segment x->y with attributs c 307 gen symb_segment(const gen & x,const gen & y,const vecteur & ,int ,GIAC_CONTEXT); 308 // point x color c name nom 309 gen symb_pnt_name(const gen & x,const gen & c,const gen & nom,GIAC_CONTEXT); 310 // point x and color c 311 gen symb_pnt(const gen & x,const gen & c,GIAC_CONTEXT); 312 gen pnt_attrib(const gen & point,const vecteur & attributs,GIAC_CONTEXT); 313 // point x with default color FL_BLACK 314 gen symb_pnt(const gen & x,GIAC_CONTEXT); 315 gen _pnt(const gen & args,GIAC_CONTEXT); 316 extern const unary_function_ptr * const at_pnt; 317 extern const unary_function_ptr * const at_animation; 318 gen _animation(const gen & args,GIAC_CONTEXT); 319 int animations(const gen & g); // number of animations inside g 320 gen get_animation_pnt(const gen & g,int pos); 321 322 gen _point(const gen & args,GIAC_CONTEXT); 323 extern const unary_function_ptr * const at_point; 324 325 gen _affixe(const gen & args,GIAC_CONTEXT); 326 extern const unary_function_ptr * const at_affixe; 327 328 gen _abscisse(const gen & args,GIAC_CONTEXT); 329 extern const unary_function_ptr * const at_abscisse; 330 331 gen _ordonnee(const gen & args,GIAC_CONTEXT); 332 extern const unary_function_ptr * const at_ordonnee; 333 334 gen _cote(const gen & args,GIAC_CONTEXT); 335 extern const unary_function_ptr * const at_cote; 336 extern const unary_function_ptr * const at_coordonnees; 337 gen _coordonnees(const gen & args,GIAC_CONTEXT); 338 gen _coordonnees_polaires(const gen & args,GIAC_CONTEXT); 339 gen _coordonnees_rectangulaires(const gen & args,GIAC_CONTEXT); 340 gen _point_polaire(const gen & args,GIAC_CONTEXT); 341 342 gen _cercle(const gen & args,GIAC_CONTEXT); 343 extern const unary_function_ptr * const at_cercle; 344 bool centre_rayon(const gen & cercle,gen & centre,gen & rayon,bool absrayon, GIAC_CONTEXT); 345 gen _centre(const gen & args,GIAC_CONTEXT); 346 extern const unary_function_ptr * const at_centre; 347 gen _rayon(const gen & args,GIAC_CONTEXT); 348 extern const unary_function_ptr * const at_rayon; 349 350 gen _milieu(const gen & args,GIAC_CONTEXT); 351 extern const unary_function_ptr * const at_milieu; 352 353 gen _mediatrice(const gen & args,GIAC_CONTEXT); 354 extern const unary_function_ptr * const at_mediatrice; 355 356 gen bissectrice(const gen & args,bool interieur,GIAC_CONTEXT); 357 gen _bissectrice(const gen & args,GIAC_CONTEXT); 358 extern const unary_function_ptr * const at_bissectrice; 359 360 gen _exbissectrice(const gen & args,GIAC_CONTEXT); 361 extern const unary_function_ptr * const at_exbissectrice; 362 363 gen _mediane(const gen & args,GIAC_CONTEXT); 364 extern const unary_function_ptr * const at_mediane; 365 366 gen _circonscrit(const gen & args,GIAC_CONTEXT); 367 extern const unary_function_ptr * const at_circonscrit; 368 gen _orthocentre(const gen & arg_orig,GIAC_CONTEXT); 369 370 gen _inscrit(const gen & args,GIAC_CONTEXT); 371 extern const unary_function_ptr * const at_inscrit; 372 373 gen _exinscrit(const gen & args,GIAC_CONTEXT); 374 extern const unary_function_ptr * const at_exinscrit; 375 376 gen _isobarycentre(const gen & args,GIAC_CONTEXT); 377 extern const unary_function_ptr * const at_isobarycentre; 378 gen _barycentre(const gen & args,GIAC_CONTEXT); 379 380 // if suppl is true return in 3-d an object of dim'=3-dim, else dim'=dim 381 gen perpendiculaire(const gen & args,bool suppl,GIAC_CONTEXT); 382 gen _perpendiculaire(const gen & args,GIAC_CONTEXT); 383 gen _orthogonal(const gen & args,GIAC_CONTEXT); 384 extern const unary_function_ptr * const at_perpendiculaire; 385 gen _mediatrice(const gen & args,GIAC_CONTEXT); 386 387 gen _parallele(const gen & args,GIAC_CONTEXT); 388 extern const unary_function_ptr * const at_parallele; 389 390 gen distance2pp(const gen & ee,const gen & ff,GIAC_CONTEXT); 391 gen distance2(const gen & f1,const gen & f2,GIAC_CONTEXT); 392 gen _longueur2(const gen & args,GIAC_CONTEXT); 393 extern const unary_function_ptr * const at_longueur2; 394 395 gen longueur(const gen & f1,const gen & f2,GIAC_CONTEXT); 396 gen _longueur(const gen & args,GIAC_CONTEXT); 397 extern const unary_function_ptr * const at_longueur; 398 399 gen angle(const gen & f1,const gen & f2,GIAC_CONTEXT); 400 gen _angle(const gen & args,GIAC_CONTEXT); 401 extern const unary_function_ptr * const at_angle; 402 403 gen scalar_product(const gen & a,const gen & b,GIAC_CONTEXT); 404 // return t such that tb+(1-t)a ? ta+(1-t)b is the projection of c on [a,b] 405 gen projection(const gen & a,const gen & b,const gen & c,GIAC_CONTEXT); 406 // projection of p on a parametric curve 407 // e=symb_cercle or line, returns t 408 gen projection(const gen & e,const gen & p,GIAC_CONTEXT); 409 gen parameter2point(const vecteur & v,GIAC_CONTEXT); 410 gen cercle2curve(const gen & f,GIAC_CONTEXT); 411 gen line2curve(const gen & f); 412 413 std::vector<int> nearest_point(const vecteur & v,const gen & p,double eps,GIAC_CONTEXT); 414 415 vecteur inter(const gen & a,const gen & b,GIAC_CONTEXT); 416 417 gen _click(const gen & args,GIAC_CONTEXT); 418 extern const unary_function_ptr * const at_click; 419 class unary_function_eval; 420 #ifdef RTOS_THREADX 421 extern const alias_unary_function_eval __click; 422 #else 423 extern unary_function_eval __click; 424 #endif 425 426 gen _element(const gen & args,GIAC_CONTEXT); 427 extern const unary_function_ptr * const at_element; 428 429 gen _as_function_of(const gen & args,GIAC_CONTEXT); 430 extern const unary_function_ptr * const at_as_function_of; 431 432 gen _lieu(const gen & args,GIAC_CONTEXT); 433 extern const unary_function_ptr * const at_lieu; 434 435 gen _head(const gen & args,GIAC_CONTEXT); 436 extern const unary_function_ptr * const at_head; 437 438 gen _tail(const gen & args,GIAC_CONTEXT); 439 extern const unary_function_ptr * const at_tail; 440 441 gen _sommets(const gen & args,GIAC_CONTEXT); 442 gen _sommets_abca(const gen & args,GIAC_CONTEXT); 443 extern const unary_function_ptr * const at_sommets; 444 445 gen _symetrie(const gen & args,GIAC_CONTEXT); 446 extern const unary_function_ptr * const at_symetrie; 447 448 gen _rotation(const gen & args,GIAC_CONTEXT); 449 extern const unary_function_ptr * const at_rotation; 450 451 gen _projection(const gen & args,GIAC_CONTEXT); 452 extern const unary_function_ptr * const at_projection; 453 454 gen _homothetie(const gen & args,GIAC_CONTEXT); 455 extern const unary_function_ptr * const at_homothetie; 456 gen _est_coplanaire(const gen & args,GIAC_CONTEXT); 457 458 extern const unary_function_ptr * const at_est_dans; 459 gen _est_aligne(const gen & args,GIAC_CONTEXT); 460 extern const unary_function_ptr * const at_est_aligne; 461 462 gen _est_cocyclique(const gen & args,GIAC_CONTEXT); 463 extern const unary_function_ptr * const at_est_cocyclique; 464 465 gen _est_parallele(const gen & args,GIAC_CONTEXT); 466 extern const unary_function_ptr * const at_est_parallele; 467 468 gen _est_perpendiculaire(const gen & args,GIAC_CONTEXT); 469 extern const unary_function_ptr * const at_est_perpendiculaire; 470 471 gen _est_element(const gen & args,GIAC_CONTEXT); 472 extern const unary_function_ptr * const at_est_element; 473 474 gen _inversion(const gen & args,GIAC_CONTEXT); 475 extern const unary_function_ptr * const at_inversion; 476 477 gen _similitude(const gen & args,GIAC_CONTEXT); 478 extern const unary_function_ptr * const at_similitude; 479 480 gen translation(const gen & a,const gen & bb,GIAC_CONTEXT); 481 gen _translation(const gen & args,GIAC_CONTEXT); 482 extern const unary_function_ptr * const at_translation; 483 484 gen _curve(const gen & args,GIAC_CONTEXT); 485 extern const unary_function_ptr * const at_curve; 486 // curve arguments: 0 complex parametric equation, 1 variable (e.g. t), 2 tmin, 3 tmax, 487 // 4 optional != 0 automatically show a legende based on arg 0 and 1 488 // 5 optional cartesian equation in x and y, 6 optional parametric rational equation 489 490 gen plotparam(const gen & f,const gen & vars,const vecteur & attributs,bool densityplot,double function_xmin,double function_xmax,double function_ymin,double function_ymax,double function_tmin, double function_tmax,double function_tstep,const gen & equation,const gen & parameq,const context * contextptr); 491 gen _plotparam(const gen & args,GIAC_CONTEXT); 492 gen _paramplot(const gen & args,const context * contextptr); 493 extern const unary_function_ptr * const at_plotparam; 494 extern const unary_function_ptr * const at_paramplot; 495 gen paramplotparam(const gen & args,bool clrplot,const context * contextptr); 496 gen _plot(const gen & g,const context * contextptr); 497 498 gen _plotpolar(const gen & args,GIAC_CONTEXT); 499 extern const unary_function_ptr * const at_plotpolar; 500 extern const unary_function_ptr * const at_polarplot; 501 502 gen _parameq(const gen & args,GIAC_CONTEXT); 503 extern const unary_function_ptr * const at_parameq; 504 505 gen _equation(const gen & args,GIAC_CONTEXT); 506 extern const unary_function_ptr * const at_equation; 507 gen equation_homogene(const gen & eq,GIAC_CONTEXT); 508 509 gen _tangent(const gen & args,GIAC_CONTEXT); 510 extern const unary_function_ptr * const at_tangent; 511 512 gen _ellipse(const gen & args,GIAC_CONTEXT); 513 extern const unary_function_ptr * const at_ellipse; 514 515 gen _hyperbole(const gen & args,GIAC_CONTEXT); 516 extern const unary_function_ptr * const at_hyperbole; 517 518 gen _parabole(const gen & args,GIAC_CONTEXT); 519 extern const unary_function_ptr * const at_parabole; 520 gen _conique(const gen & args,GIAC_CONTEXT); 521 522 gen _legende(const gen & args,GIAC_CONTEXT); 523 extern const unary_function_ptr * const at_legende; 524 gen _distanceat(const gen & args,GIAC_CONTEXT); 525 gen _distanceatraw(const gen & args,GIAC_CONTEXT); 526 gen _areaatraw(const gen & args,GIAC_CONTEXT); 527 gen _areaat(const gen & args,GIAC_CONTEXT); 528 gen _slopeatraw(const gen & args,GIAC_CONTEXT); 529 gen _slopeat(const gen & args,GIAC_CONTEXT); 530 gen _perimeterat(const gen & args,GIAC_CONTEXT); 531 gen _perimeteratraw(const gen & args,GIAC_CONTEXT); 532 gen _extract_measure(const gen & valeur,GIAC_CONTEXT); 533 gen _angleat(const gen & args,GIAC_CONTEXT); 534 gen _angleatraw(const gen & args,GIAC_CONTEXT); 535 extern const unary_function_ptr * const at_distanceat; 536 extern const unary_function_ptr * const at_distanceatraw; 537 extern const unary_function_ptr * const at_angleat; 538 extern const unary_function_ptr * const at_angleatraw; 539 extern const unary_function_ptr * const at_areaatraw; 540 extern const unary_function_ptr * const at_areaat; 541 extern const unary_function_ptr * const at_perimeteratraw; 542 extern const unary_function_ptr * const at_perimeterat; 543 extern const unary_function_ptr * const at_slopeatraw; 544 extern const unary_function_ptr * const at_slopeat; 545 extern const unary_function_ptr * const at_extract_measure; 546 547 gen _couleur(const gen & args,GIAC_CONTEXT); 548 extern const unary_function_ptr * const at_couleur; 549 extern const unary_function_ptr * const at_display ; 550 551 gen _parameter(const gen & args,GIAC_CONTEXT); 552 extern const unary_function_ptr * const at_parameter; 553 554 gen _hauteur(const gen & args,GIAC_CONTEXT); 555 extern const unary_function_ptr * const at_hauteur; 556 557 gen _triangle(const gen & args,GIAC_CONTEXT); 558 extern const unary_function_ptr * const at_triangle; 559 560 gen _triangle_rectangle(const gen & args,GIAC_CONTEXT); 561 extern const unary_function_ptr * const at_triangle_rectangle; 562 563 gen _triangle_isocele(const gen & args,GIAC_CONTEXT); 564 extern const unary_function_ptr * const at_triangle_isocele; 565 566 gen _triangle_equilateral(const gen & args,GIAC_CONTEXT); 567 extern const unary_function_ptr * const at_triangle_equilateral; 568 569 gen _parallelogramme(const gen & args,GIAC_CONTEXT); 570 extern const unary_function_ptr * const at_parallelogramme; 571 572 extern const unary_function_ptr * const at_isopolygone; 573 gen _isopolygone(const gen & args,GIAC_CONTEXT); 574 gen _carre(const gen & args,GIAC_CONTEXT); 575 extern const unary_function_ptr * const at_carre; 576 gen _hexagone(const gen & args,GIAC_CONTEXT); 577 578 gen _quadrilatere(const gen & args,GIAC_CONTEXT); 579 extern const unary_function_ptr * const at_quadrilatere; 580 581 gen _rectangle(const gen & args,GIAC_CONTEXT); 582 extern const unary_function_ptr * const at_rectangle; 583 584 gen _losange(const gen & args,GIAC_CONTEXT); 585 extern const unary_function_ptr * const at_losange; 586 587 gen _polygone(const gen & args,GIAC_CONTEXT); 588 gen _polygone_ouvert(const gen & args,GIAC_CONTEXT); 589 extern const unary_function_ptr * const at_polygone; 590 gen _bissectrice(const gen & args,GIAC_CONTEXT); 591 gen _exbissectrice(const gen & args,GIAC_CONTEXT); 592 593 gen plotfield(const gen & xp,const gen & yp,const gen & x,const gen & y,double xmin,double xmax,double xstep,double ymin,double ymax,double ystep,double scaling,vecteur & attributs,bool normalize,const context * contextptr); 594 gen _plotfield(const gen & args,GIAC_CONTEXT); 595 extern const unary_function_ptr * const at_plotfield; 596 extern const unary_function_ptr * const at_fieldplot; 597 598 gen _interactive_plotode(const gen & args,GIAC_CONTEXT); 599 extern const unary_function_ptr * const at_interactive_plotode; 600 extern const unary_function_ptr * const at_interactive_odeplot; 601 602 gen _plotode(const gen & args,GIAC_CONTEXT); 603 extern const unary_function_ptr * const at_plotode; 604 extern const unary_function_ptr * const at_odeplot; 605 606 #ifndef NSPIRE 607 std::ostream & archive(std::ostream & os,const gen & e,GIAC_CONTEXT); 608 gen unarchive(std::istream & is,GIAC_CONTEXT); 609 gen archive_session(bool save_history,std::ostream & os,GIAC_CONTEXT); 610 gen archive_session(bool save_history,const std::string & s,GIAC_CONTEXT); 611 std::string archive_session(bool save_history,GIAC_CONTEXT); 612 gen unarchive_session(std::istream & is,int level, const gen & replace,GIAC_CONTEXT); 613 gen unarchive_session(const std::string & s,int level, const gen & replace,GIAC_CONTEXT); 614 gen unarchive_session_string(const std::string & s,int level, const gen & replace,GIAC_CONTEXT); 615 616 gen _archive(bool save_history,const gen & args,GIAC_CONTEXT); 617 extern const unary_function_ptr * const at_archive; 618 619 gen _unarchive(const gen & args,GIAC_CONTEXT); 620 extern const unary_function_ptr * const at_unarchive; 621 #endif // NSPIRE 622 623 bool geo_setup(const vecteur & w,GIAC_CONTEXT); 624 gen xyztrange(double xmin,double xmax,double ymin,double ymax,double zmin,double zmax,double tmin,double tmax,double wxmin,double wxmax,double wymin, double wymax, int axes,double class_minimum,double class_size,bool gnuplot_hidden3d,bool gnuplot_pm3d); 625 gen _xyztrange(const gen & args,GIAC_CONTEXT); 626 extern const unary_function_ptr * const at_xyztrange; 627 #ifndef RTOS_THREADX 628 extern unary_function_eval __xyztrange; 629 #endif 630 631 gen _switch_axes(const gen & args,GIAC_CONTEXT); 632 extern const unary_function_ptr * const at_switch_axes; 633 634 int find_plotseq_args(const gen & args,gen & expr,gen & x,double & x0d,double & xmin,double & xmax,int & niter,vecteur & attributs,GIAC_CONTEXT,bool & print); 635 gen plotseq(const gen& f,const gen&x,double x0,double xmin,double xmax,int niter,const vecteur & attributs,const context * contextptr,bool print); 636 gen _plotseq(const gen & args,GIAC_CONTEXT); 637 extern const unary_function_ptr * const at_plotseq; 638 extern const unary_function_ptr * const at_seqplot; 639 640 gen plotimplicit(const gen& f_orig,const gen&x,const gen & y,double xmin,double xmax,double ymin,double ymax,int nxstep,int nystep,double eps,const vecteur & attributs,bool unfactored,const context * contextptr,int ckgeo2d); 641 gen _plotimplicit(const gen & args,GIAC_CONTEXT); 642 extern const unary_function_ptr * const at_plotimplicit; 643 extern const unary_function_ptr * const at_implicitplot; 644 645 gen _plotcontour(const gen & args,GIAC_CONTEXT); 646 extern const unary_function_ptr * const at_plotcontour; 647 extern const unary_function_ptr * const at_contourplot; 648 gen _plotinequation(const gen & f0,GIAC_CONTEXT); 649 gen _inter_droite(const gen & args,GIAC_CONTEXT); 650 void papier_lignes(vecteur & res,double xmin,double xmax,double ymin,double ymax,double angle,double deltax,double deltay,double pente,const vecteur & attributs,GIAC_CONTEXT); 651 gen _dot_paper(const gen & args,GIAC_CONTEXT); 652 gen _grid_paper(const gen & args,GIAC_CONTEXT); 653 gen _triangle_paper(const gen & args,GIAC_CONTEXT); 654 gen _line_paper(const gen & args,GIAC_CONTEXT); 655 656 gen _bitmap(const gen & args,GIAC_CONTEXT); 657 extern const unary_function_ptr * const at_bitmap; 658 659 gen _Pictsize(const gen & args,GIAC_CONTEXT); 660 extern const unary_function_ptr * const at_Pictsize; 661 662 gen _plot_style(const gen & args,GIAC_CONTEXT); 663 extern const unary_function_ptr * const at_plot_style ; 664 665 gen _DrawInv(const gen & args,GIAC_CONTEXT); 666 extern const unary_function_ptr * const at_DrawInv ; 667 668 gen _Graph(const gen & g,GIAC_CONTEXT); 669 gen _DrwCtour(const gen & g,GIAC_CONTEXT); 670 extern const unary_function_ptr * const at_Graph; 671 extern const unary_function_ptr * const at_DrawFunc; 672 extern const unary_function_ptr * const at_DrawParm; 673 extern const unary_function_ptr * const at_DrawPol; 674 extern const unary_function_ptr * const at_DrwCtour; 675 extern const unary_function_ptr * const at_arc; 676 677 int est_isocele(const gen & a,const gen & b,const gen & c,GIAC_CONTEXT); 678 gen _est_isocele(const gen & args,GIAC_CONTEXT); 679 extern const unary_function_ptr * const at_est_isocele; 680 681 bool est_equilateral(const gen & a,const gen & b,const gen & c,GIAC_CONTEXT); 682 gen _est_equilateral(const gen & args,GIAC_CONTEXT); 683 extern const unary_function_ptr * const at_est_equilateral; 684 685 bool est_carre(const gen & a,const gen & b,const gen & c,const gen & d,GIAC_CONTEXT); 686 gen _est_carre(const gen & args,GIAC_CONTEXT); 687 extern const unary_function_ptr * const at_est_carre; 688 689 int est_losange(const gen & a,const gen & b,const gen & c,const gen & d,GIAC_CONTEXT); 690 gen _est_losange(const gen & args,GIAC_CONTEXT); 691 extern const unary_function_ptr * const at_est_losange; 692 693 int est_parallelogramme(const gen & a,const gen & b,const gen & c,const gen & d,GIAC_CONTEXT); 694 gen _est_parallelogramme(const gen & args,GIAC_CONTEXT); 695 extern const unary_function_ptr * const at_est_parallelogramme; 696 697 int est_rect(const gen & a,const gen & b,const gen & c,const gen & d,GIAC_CONTEXT); 698 gen _est_rectangle(const gen & args,GIAC_CONTEXT); 699 extern const unary_function_ptr * const at_est_rectangle; 700 701 gen _est_harmonique(const gen & args,GIAC_CONTEXT); 702 extern const unary_function_ptr * const at_est_harmonique; 703 704 gen _div_harmonique(const gen & args,GIAC_CONTEXT); 705 extern const unary_function_ptr * const at_div_harmonique; 706 707 gen _point_div(const gen & args,GIAC_CONTEXT); 708 extern const unary_function_ptr * const at_point_div; 709 710 gen _birapport(const gen & args,GIAC_CONTEXT); 711 extern const unary_function_ptr * const at_birapport; 712 713 gen _est_harmonique(const gen & args,GIAC_CONTEXT); 714 extern const unary_function_ptr * const at_est_harmonique; 715 716 gen _div_harmonique(const gen & args,GIAC_CONTEXT); 717 extern const unary_function_ptr * const at_div_harmonique; 718 719 gen _conj_harmonique(const gen & args,GIAC_CONTEXT); 720 extern const unary_function_ptr * const at_conj_harmonique; 721 722 gen _conj_harmoniques(const gen & args,GIAC_CONTEXT); 723 extern const unary_function_ptr * const at_conj_harmoniques; 724 725 gen _point_div(const gen & args,GIAC_CONTEXT); 726 extern const unary_function_ptr * const at_point_div; 727 728 gen _birapport(const gen & args,GIAC_CONTEXT); 729 extern const unary_function_ptr * const at_birapport; 730 731 gen _puissance(const gen & args,GIAC_CONTEXT); 732 extern const unary_function_ptr * const at_puissance; 733 734 gen _axe_radical(const gen & args,GIAC_CONTEXT); 735 extern const unary_function_ptr * const at_axe_radical; 736 737 gen _polaire(const gen & args,GIAC_CONTEXT); 738 extern const unary_function_ptr * const at_polaire; 739 740 gen _pole(const gen & args,GIAC_CONTEXT); 741 extern const unary_function_ptr * const at_pole; 742 743 gen _polaire_reciproque(const gen & args,GIAC_CONTEXT); 744 extern const unary_function_ptr * const at_polaire_reciproque; 745 746 gen _est_orthogonal(const gen & args,GIAC_CONTEXT); 747 extern const unary_function_ptr * const at_est_orthogonal; 748 749 gen _est_conjugue(const gen & args,GIAC_CONTEXT); 750 extern const unary_function_ptr * const at_est_conjugue; 751 752 gen _est_faisceau_cercle(const gen & args,GIAC_CONTEXT); 753 extern const unary_function_ptr * const at_est_faisceau_cercle; 754 //=1 si 3 cercles ont meme axe radical,2 si concentriques et 0 sinon 755 int est_faisceau_cercle(const gen & c1,const gen & R1,const gen & c2,const gen & R2,const gen & c3,const gen & R3,GIAC_CONTEXT); 756 757 gen _est_faisceau_droite(const gen & args,GIAC_CONTEXT); 758 extern const unary_function_ptr * const at_est_faisceau_droite; 759 int est_faisceau_droite(const gen & a,const gen & b,const gen & c,GIAC_CONTEXT); 760 761 gen _enveloppe(const gen & args,GIAC_CONTEXT); 762 extern const unary_function_ptr * const at_enveloppe; 763 764 int graph_output_type(const gen & g); 765 gen put_attributs(const gen & lieu_geo,const vecteur & attributs,GIAC_CONTEXT); 766 vecteur seq2vecteur(const gen & g); 767 768 int est_aligne(const gen & a,const gen & b,const gen & c,GIAC_CONTEXT); 769 bool est_coplanaire(const gen & a,const gen & b,const gen & c,const gen & d,GIAC_CONTEXT); 770 bool est_cocyclique(const gen & a,const gen & b,const gen & c,const gen & d,GIAC_CONTEXT); 771 // True if a=coeff*b 772 bool est_parallele_vecteur(const vecteur & a,const vecteur &b,gen & coeff,GIAC_CONTEXT); 773 bool est_parallele_vecteur(const vecteur & a,const vecteur &b,GIAC_CONTEXT); 774 bool est_parallele(const gen & a,const gen & b,GIAC_CONTEXT); 775 bool est_perpendiculaire(const gen & a,const gen & b,GIAC_CONTEXT); 776 // check if a belongs to b, a must be a complex, b a line or circle or curve 777 int est_element(const gen & a_orig,const gen & b_orig,GIAC_CONTEXT); 778 bool est_carre(const gen & a,const gen & b,const gen & c,const gen & d,GIAC_CONTEXT); 779 int est_isocele(const gen & a,const gen & b,const gen & c,GIAC_CONTEXT); 780 bool est_equilateral(const gen & a,const gen & b,const gen & c,GIAC_CONTEXT); 781 int est_trianglerect(const gen & a,const gen & b,const gen & c,GIAC_CONTEXT); 782 //teste si deux cercles C1 centre c1 rayon R1 et C2 centre c2 rayon R2 783 //sont orthogonaux 784 bool est_orthogonal(const gen & c1,const gen & R1,const gen & c2,const gen & R2,GIAC_CONTEXT); 785 //teste si 4 points forment une division harmonique 786 bool est_harmonique(const gen & a,const gen & b,const gen & c,const gen & d,GIAC_CONTEXT); 787 788 gen _vector(const gen & args,GIAC_CONTEXT); 789 extern const unary_function_ptr * const at_vector; 790 gen _hyperplan(const gen & args,GIAC_CONTEXT); 791 gen _hypersphere(const gen & args,GIAC_CONTEXT); 792 gen hypersurface(const gen & args,const gen & equation,const gen & vars); 793 gen _hypersurface(const gen & args,GIAC_CONTEXT); 794 gen _Ox_2d_unit_vector(const gen & args,GIAC_CONTEXT); 795 gen _Oy_2d_unit_vector(const gen & args,GIAC_CONTEXT); 796 gen _frame_2d(const gen & args,GIAC_CONTEXT); 797 gen _Ox_3d_unit_vector(const gen & args,GIAC_CONTEXT); 798 gen _Oy_3d_unit_vector(const gen & args,GIAC_CONTEXT); 799 gen _Oz_3d_unit_vector(const gen & args,GIAC_CONTEXT); 800 gen _frame_3d(const gen & args,GIAC_CONTEXT); 801 symbolic symb_curve(const gen & source,const gen & plot); 802 extern const unary_function_ptr * const at_Bezier; 803 804 805 #if defined(GIAC_GENERIC_CONSTANTS) || (defined(VISUALC) && !defined(RTOS_THREADX)) || defined(x86_64) 806 extern unary_function_ptr point_sommet_tab_op[]; 807 extern unary_function_ptr nosplit_polygon_function[]; 808 extern unary_function_ptr measure_functions[]; 809 extern unary_function_ptr transformation_functions[]; 810 extern unary_function_ptr plot_sommets[]; 811 extern unary_function_ptr not_point_sommets[]; 812 extern unary_function_ptr notexprint_plot_sommets[]; 813 extern unary_function_ptr implicittex_plot_sommets[]; 814 815 #else 816 extern const unary_function_ptr * const point_sommet_tab_op; 817 extern const unary_function_ptr * const nosplit_polygon_function; 818 extern const unary_function_ptr * const measure_functions; 819 extern const unary_function_ptr * const transformation_functions; 820 extern const unary_function_ptr * const plot_sommets; 821 extern const unary_function_ptr * const not_point_sommets; 822 extern const unary_function_ptr * const notexprint_plot_sommets; 823 extern const unary_function_ptr * const implicittex_plot_sommets; 824 #endif 825 826 #ifndef NO_NAMESPACE_GIAC 827 } // namespace giac 828 #endif // ndef NO_NAMESPACE_GIAC 829 830 #endif // _GIAC_PLOT_H 831