4 #ifndef tools_sg_plotter
5 #define tools_sg_plotter
7 #include "../lina/vec2f"
29 #include "../data_axis"
31 #include "../clist_contour"
32 #include "../tess_contour"
33 #include "../lina/geom3"
35 #include "../rtausmef"
38 #ifdef INLIBS_SG_PLOTTER_TIMING
39 #include "../sys/atime"
48 static const std::string& s_infos_what_def() {
49 static const std::string s_v(
"name entries mean rms fit_quality fit_ndf fit_parameters fit_errors");
52 static float default_infos_margin() {
return 0.005f;}
53 static float default_title_box_width() {
return 0.3f;}
54 static float default_title_box_height() {
return 0.05f;}
55 static float default_title_box_x_margin() {
return 0.01f;}
56 static float default_title_box_y_margin() {
return 0.005f;}
183 static const desc_fields s_v(parent::node_desc_fields(),63,
287 if(parent::touched())
return true;
308 parent::reset_touched();
522 float xfac = 1.0F/20.0F;
523 float yfac = 1.0F/20.0F;
526 float XSIZ = 20 * xfac;
527 float YSIZ = 20 * yfac;
528 float XMGL = 2 * xfac;
529 float XMGR = 2 * xfac;
530 float YMGL = 2 * yfac;
531 float YMGU = 2 * yfac;
533 float VSIZ = 0.28F * yfac;
534 float XVAL = 0.4F * xfac;
535 float YVAL = 0.4F * yfac;
536 float XTIC = 0.3F * yfac;
537 float YTIC = 0.3F * xfac;
538 float XLAB = 1.4F * xfac;
539 float YLAB = 0.8F * yfac;
540 float ASIZ = 0.28F * yfac;
542 float YHTI = 1.2F * yfac;
543 float TSIZ = 0.28F * yfac;
545 float zfac = 1.0F/20.0F;
546 float ZSIZ = 20 * zfac;
547 float ZMGD = 2 * zfac;
548 float ZMGU = 2 * zfac;
706 (*it).marker_size = 5;
724 (*it).marker_size = 5;
742 const std::string& key = (*it).first;
743 const std::string& sv = (*it).second;
754 }
else if(key==
"width") {
756 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
758 }
else if(key==
"height") {
760 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
762 }
else if(key==
"depth") {
764 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
767 }
else if(key==
"left_margin") {
769 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
771 }
else if(key==
"right_margin") {
773 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
775 }
else if(key==
"bottom_margin") {
777 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
779 }
else if(key==
"top_margin") {
781 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
783 }
else if(key==
"down_margin") {
785 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
787 }
else if(key==
"up_margin") {
789 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
792 }
else if(key==
"title") {
794 }
else if(key==
"title_up") {
798 }
else if(key==
"title_to_axis") {
800 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
802 }
else if(key==
"title_height") {
804 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
806 }
else if(key==
"title_automated") {
810 }
else if(key==
"title_hjust") {
816 }
else if(key==
"x_axis_enforced") {
820 }
else if(key==
"x_axis_automated") {
824 }
else if(key==
"x_axis_min") {
826 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
828 }
else if(key==
"x_axis_max") {
830 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
832 }
else if(key==
"x_axis_is_log") {
837 }
else if(key==
"y_axis_enforced") {
841 }
else if(key==
"y_axis_automated") {
845 }
else if(key==
"y_axis_min") {
847 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
849 }
else if(key==
"y_axis_max") {
851 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
853 }
else if(key==
"y_axis_is_log") {
858 }
else if(key==
"z_axis_enforced") {
862 }
else if(key==
"z_axis_automated") {
866 }
else if(key==
"z_axis_min") {
868 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
870 }
else if(key==
"z_axis_max") {
872 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
874 }
else if(key==
"z_axis_is_log") {
879 }
else if(key==
"value_top_margin") {
881 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
883 }
else if(key==
"value_bottom_margin") {
885 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
887 }
else if(key==
"value_bins_with_entries") {
889 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
891 }
else if(key==
"infos_width") {
893 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
895 }
else if(key==
"infos_x_margin") {
897 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
899 }
else if(key==
"infos_y_margin") {
901 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
904 }
else if(key==
"title_box_width") {
906 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
908 }
else if(key==
"title_box_height") {
910 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
912 }
else if(key==
"title_box_x_margin") {
914 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
916 }
else if(key==
"title_box_y_margin") {
918 if(!to<float>(sv,v)) {
style_failed(a_out,key,sv);
return false;}
921 }
else if(key==
"infos_what") {
928 }
else if(key==
"legends_automated") {
936 }
else if(key==
"legends_origin") {
940 }
else if(key==
"legends_size") {
944 }
else if(key==
"legends_origin_unit") {
949 }
else if(key==
"shape_automated") {
954 }
else if(key==
"shape") {
957 }
else if(sv==
"xyz") {
969 a_out <<
"tools::sg::plotter::set_from_style : unknown key " << key <<
"." << std::endl;
977 if(a_s==
"x_axis") {a_axis = &(
x_axis());
return true;}
978 else if(a_s==
"y_axis") {a_axis = &(
y_axis());
return true;}
979 else if(a_s==
"z_axis") {a_axis = &(
z_axis());
return true;}
980 else if(a_s==
"colormap_axis") {a_axis = &(
colormap_axis());
return true;}
989 std::string::size_type pos = a_field.find(
'.');
991 if(pos==std::string::npos) {
996 std::vector<std::string> _words;
997 words(a_field,
".",
false,_words);
998 if(_words.size()==2) {
999 const std::string& word0 = _words[0];
1000 const std::string& word1 = _words[1];
1001 std::string _s = word1+
" "+std::string(a_value);
1003 if(word0==
"background_style") {
if(!
background_style().from_string(a_out,a_cmaps,_s)) status =
false;}
1004 else if(word0==
"title_style") {
if(!
title_style().from_string(a_out,a_cmaps,_s)) status =
false;}
1005 else if(word0==
"infos_style") {
if(!
infos_style().from_string(a_out,a_cmaps,_s)) status =
false;}
1006 else if(word0==
"title_box_style") {
if(!
title_box_style().from_string(a_out,a_cmaps,_s)) status =
false;}
1007 else if(word0==
"inner_frame_style") {
if(!
inner_frame_style().from_string(a_out,a_cmaps,_s)) status =
false;}
1008 else if(word0==
"grid_style") {
if(!
grid_style().from_string(a_out,a_cmaps,_s)) status =
false;}
1009 else if(word0==
"wall_style") {
if(!
wall_style().from_string(a_out,a_cmaps,_s)) status =
false;}
1010 else if(!
s2axis(word0,_axis)) {
1011 a_out <<
"tools::sg::plotter::set_from_string : unexpected axis field " << word0 <<
"." << std::endl;
1018 }
else if(_words.size()==3) {
1019 const std::string& word0 = _words[0];
1020 const std::string& word1 = _words[1];
1021 const std::string& word2 = _words[2];
1023 std::string _s = word2+
" "+std::string(a_value);
1025 bool to_status = to<unsigned int>(word1,index);
1026 if(word0==
"bins_style") {
1028 a_out <<
"tools::sg::plotter::set_from_string : bad string " << word1 <<
" for an index." << std::endl;
1031 if(!
bins_style(index).from_string(a_out,a_cmaps,_s)) status =
false;
1033 }
else if(word0==
"errors_style") {
1035 a_out <<
"tools::sg::plotter::set_from_string : bad string " << word1 <<
" for an index." << std::endl;
1038 if(!
errors_style(index).from_string(a_out,a_cmaps,_s)) status =
false;
1040 }
else if(word0==
"func_style") {
1042 a_out <<
"tools::sg::plotter::set_from_string : bad string " << word1 <<
" for an index." << std::endl;
1045 if(!
func_style(index).from_string(a_out,a_cmaps,_s)) status =
false;
1047 }
else if(word0==
"points_style") {
1049 a_out <<
"tools::sg::plotter::set_from_string : bad string " << word1 <<
" for an index." << std::endl;
1052 if(!
points_style(index).from_string(a_out,a_cmaps,_s)) status =
false;
1054 }
else if(word0==
"left_hatch_style") {
1056 a_out <<
"tools::sg::plotter::set_from_string : bad string " << word1 <<
" for an index." << std::endl;
1061 }
else if(word0==
"right_hatch_style") {
1063 a_out <<
"tools::sg::plotter::set_from_string : bad string " << word1 <<
" for an index." << std::endl;
1068 }
else if(word0==
"legend_style") {
1070 a_out <<
"tools::sg::plotter::set_from_string : bad string " << word1 <<
" for an index." << std::endl;
1073 if(!
legend_style(index).from_string(a_out,a_cmaps,_s)) status =
false;
1075 }
else if(!
s2axis(word0,_axis)) {
1076 a_out <<
"tools::sg::plotter::set_from_string : unexpected axis field " << word0 <<
"." << std::endl;
1082 else if(word1==
"mag_style") {
if(!_axis->
mag_style().
from_string(a_out,a_cmaps,_s)) status =
false;}
1085 a_out <<
"tools::sg::plotter::set_from_string : unexpected style field " << word1 <<
"." << std::endl;
1090 a_out <<
"tools::sg::plotter::set_from_string : unexpected number of fields " << _words.size() <<
"." << std::endl;
1109 a_out <<
"plotter fields :" << std::endl;
1112 a_out <<
" " << (*itd).name() <<
", class " << (*itd).cls() << std::endl;
1116 a_out <<
"plotter data available styles :" << std::endl;
1117 a_out <<
" bins_style.<uint>, class style" << std::endl;
1118 a_out <<
" errors_style.<uint>, class style" << std::endl;
1119 a_out <<
" func_style.<uint>, class style" << std::endl;
1120 a_out <<
" points_style.<uint>, class style" << std::endl;
1121 a_out <<
" left_hatch_style.<uint>, class style" << std::endl;
1122 a_out <<
" right_hatch_style.<uint>, class style" << std::endl;
1123 a_out <<
" legend_style.<uint>, class style" << std::endl;
1126 a_out <<
"plotter available styles :" << std::endl;
1127 a_out <<
" title_style, class text_style" << std::endl;
1128 a_out <<
" infos_style, class text_style" << std::endl;
1129 a_out <<
" title_box_style, class text_style" << std::endl;
1130 a_out <<
" background_style, class style" << std::endl;
1131 a_out <<
" inner_frame_style, class style" << std::endl;
1132 a_out <<
" grid_style, class style" << std::endl;
1133 a_out <<
" wall_style, class style" << std::endl;
1136 a_out <<
"plotter available axes :" << std::endl;
1137 a_out <<
" x_axis" << std::endl;
1138 a_out <<
" y_axis" << std::endl;
1139 a_out <<
" z_axis" << std::endl;
1140 a_out <<
" colormap_axis" << std::endl;
1143 a_out <<
"plotter axis available styles :" << std::endl;
1144 a_out <<
" title_style, class text_style" << std::endl;
1145 a_out <<
" labels_style, class text_style" << std::endl;
1146 a_out <<
" mag_style, class text_style" << std::endl;
1147 a_out <<
" line_style, class line_style" << std::endl;
1148 a_out <<
" ticks_style, class line_style" << std::endl;
1151 a_out <<
"plotter style class fields :" << std::endl;
1155 a_out <<
" " << (*itd).name() <<
", class " << (*itd).cls() << std::endl;
1159 a_out <<
"plotter text_style class fields :" << std::endl;
1163 a_out <<
" " << (*itd).name() <<
", class " << (*itd).cls() << std::endl;
1167 a_out <<
"plotter line_style class fields :" << std::endl;
1171 a_out <<
" " << (*itd).name() <<
", class " << (*itd).cls() << std::endl;
1176 void style_failed(std::ostream& a_out,
const std::string& a_key,
const std::string& a_value) {
1177 a_out <<
"tools::sg::plotter::set_from_style :"
1178 <<
" failed for key " <<
sout(a_key)
1179 <<
" and value " <<
sout(a_value) <<
"."
1203 if(a_action.
done())
return;
1447 parent::operator=(a_from);
1448 if(&a_from==
this)
return *
this;
1564 if(!
object)
continue;
1572 #define TOOLS_SG_PLOTTER_NUMBER_OF(a__what) \
1573 size_t number_of_plotted_##a__what##s() const {\
1575 tools_vforcit(plottable*,m_plottables,it) {\
1576 plottable* object = *it;\
1577 if(!object) continue;\
1578 if(!object->is_valid()) continue;\
1579 if(safe_cast<plottable,a__what>(*object)) number++;\
1591 #undef TOOLS_SG_PLOTTER_NUMBER_OF
1597 if(!
object)
continue;
1600 a_names.push_back(object->
name());
1636 std::vector<plottable*>::iterator it;
1639 if(
object && safe_cast<plottable,T>(*
object)) {
1719 for(
size_t index=sz;index<=a_index;index++) {
1731 for(
size_t index=sz;index<=a_index;index++) {
1742 for(
size_t index=sz;index<=a_index;index++) {
1755 for(
size_t index=sz;index<=a_index;index++) {
1766 for(
size_t index=sz;index<=a_index;index++) {
1777 for(
size_t index=sz;index<=a_index;index++) {
1788 for(
size_t index=sz;index<=a_index;index++) {
1802 if(!
object)
continue;
1803 if(
bins1D* b1 = safe_cast<plottable,bins1D>(*
object)) {
1805 if(a_index==ibins) {
1806 if(b1->is_profile()) {
1821 }
if(safe_cast<plottable,bins2D>(*
object)) {
1823 if(a_index==ibins) {
1840 {
float XSIZ =
width;
1843 float wData = XSIZ-XMGL-XMGR;
1844 a_out[0] = wData*a_pos[0];}
1849 float hData = YSIZ-YMGL-YMGU;
1850 a_out[1] = hData*a_pos[1];}
1852 {
float ZSIZ =
depth;
1855 float dData = ZSIZ-ZMGD-ZMGU;
1856 a_out[2] = dData*a_pos[2];}
1864 {
float XSIZ =
width;
1867 float wData = XSIZ-XMGL-XMGR;
1872 a_vp[0] = (wData*a_pos[0] + XMGL)/XSIZ;}
1877 float hData = YSIZ-YMGL-YMGU;
1882 a_vp[1] = (hData*a_pos[1] + YMGL)/YSIZ;}
1884 {
float ZSIZ =
depth;
1887 float dData = ZSIZ-ZMGD-ZMGU;
1892 a_vp[2] = (dData*a_pos[2] + ZMGD)/ZSIZ;}
1901 {
float XSIZ =
width;
1904 float wData = XSIZ-XMGL-XMGR;
1909 a_pos[0] = (a_vp[0]*XSIZ - XMGL)/wData;}
1914 float hData = YSIZ-YMGL-YMGU;
1919 a_pos[1] = (a_vp[1]*YSIZ - YMGL)/hData;}
1921 {
float ZSIZ =
depth;
1924 float dData = ZSIZ-ZMGD-ZMGU;
1929 a_pos[2] = (a_vp[2]*ZSIZ - ZMGD)/dData;}
2231 float wData = XSIZ-XMGL-XMGR;
2236 float hData = YSIZ-YMGL-YMGU;
2241 float dData = ZSIZ-ZMGD-ZMGU;
2283 float xmn = -0.5F*wData;
2284 float ymn = -0.5F*hData;
2285 float zmn = -0.5F*dData;
2286 float xmx = 0.5F*wData;
2287 float ymx = 0.5F*hData;
2288 float zmx = 0.5F*dData;
2293 {x = xmn;y = ymn;z = zmn;
2296 {x = xmx;y = ymn;z = zmn;
2299 {x = xmx;y = ymx;z = zmn;
2302 {x = xmn;y = ymx;z = zmn;
2307 {x = xmn;y = ymn;z = zmx;
2310 {x = xmx;y = ymn;z = zmx;
2313 {x = xmx;y = ymx;z = zmx;
2316 {x = xmn;y = ymx;z = zmx;
2320 float xfac = _box.
mx()[0]-_box.
mn()[0];
2321 float yfac = _box.
mx()[1]-_box.
mn()[1];
2322 float zfac = _box.
mx()[2]-_box.
mn()[2];
2325 mtx.
mul_scale(hData/xfac,hData/yfac,hData/zfac);
2330 {
vec3f dir(1,-1,-10);
2331 float dx,dy,dz;dir.
value(dx,dy,dz);
2333 if(mtx.invert(inv)) {
2359 unsigned int nplottables = 0;
2360 unsigned int nbins = 0;
2361 unsigned int npoints = 0;
2362 unsigned int nfunc = 0;
2365 if(!
object)
continue;
2370 if(safe_cast<plottable,bins1D>(*
object)) {
2373 }
else if(safe_cast<plottable,bins2D>(*
object)) {
2377 }
else if(safe_cast<plottable,points2D>(*
object)) {
2380 }
else if(safe_cast<plottable,points3D>(*
object)) {
2384 }
else if(safe_cast<plottable,func1D>(*
object)) {
2387 }
else if(safe_cast<plottable,func2D>(*
object)) {
2405 bool superpose =
false;
2453 if((xmin<=0) || (xmax<=0) ) {
2459 if((xmin<=0) || (xmax<=0) ) {
2471 if((ymin<=0) || (ymax<=0) ) {
2477 if((ymin<=0) || (ymax<=0) ) {
2489 if((zmin<=0) || (zmax<=0) ) {
2495 if((zmin<=0) || (zmax<=0) ) {
2522 {
float XSIZ =
width;
2525 float wData = XSIZ-XMGL-XMGR;
2530 float hData = YSIZ-YMGL-YMGU;
2542 float dData = ZSIZ-ZMGD-ZMGU;
2554 float dx = xmax - xmin;
2555 float dy = ymax - ymin;
2556 float dz = zmax - zmin;
2584 unsigned int ibins = 0;
2589 if(!
object)
continue;
2590 if(
bins1D* b1 = safe_cast<plottable,bins1D>(*
object)) {
2599 *data_style,*_left_hatch_style,*_right_hatch_style,*error_style,ibins,
2600 superpose,boxX,boxY,zz);
2611 delete _left_hatch_style;
2612 delete _right_hatch_style;
2616 }
if(
bins2D* b2 = safe_cast<plottable,bins2D>(*
object)) {
2642 unsigned int ifunc = 0;
2645 if(!
object)
continue;
2646 if(
func1D* f1 = safe_cast<plottable,func1D>(*
object)) {
2659 }
else if(
func2D* f2 = safe_cast<plottable,func2D>(*
object)) {
2679 unsigned int ipoints = 0;
2682 if(!
object)
continue;
2683 if(
points2D* p2 = safe_cast<plottable,points2D>(*
object)) {
2712 unsigned int ibins = 0;
2715 if(!
object)
continue;
2716 if(safe_cast<plottable,bins1D>(*
object)) {
2718 }
else if(
bins2D* b2 = safe_cast<plottable,bins2D>(*
object)) {
2731 unsigned int ifunc = 0;
2734 if(!
object)
continue;
2735 if(safe_cast<plottable,func1D>(*
object)) {
2737 }
else if(
func2D* f2 = safe_cast<plottable,func2D>(*
object)) {
2749 unsigned int ipoints = 0;
2752 if(!
object)
continue;
2753 if(
points3D* p3 = safe_cast<plottable,points3D>(*
object)) {
2937 if(a_Sw_mn>a_Sw_mx) {
2943 if(a_is_log && (a_Sw_mn<=0) ) {
2951 float log_Sw_mn =
flog10(a_Sw_mn);
2952 float log_Sw_mx =
flog10(a_Sw_mx);
2958 float log_Sw_mn =
flog10(a_Sw_mn);
2959 mn =
fpow(10,log_Sw_mn)*(1.0f-0.4f);
2970 }
else if(a_Sw_mn==0) {
2985 float log_Sw_mn =
flog10(a_Sw_mn);
2986 float log_Sw_mx =
flog10(a_Sw_mx);
3127 float xmn = f1->
x_min();
3128 float xmx = f1->
x_max();
3140 unsigned int nstp = f1->
x_steps();
3143 float df = (xmx - xmn)/nstp;
3144 bool problem =
false;
3146 if(!f1->
value(xmn,vmin)) problem =
true;
3148 for(
unsigned int ibin=0;ibin<=nstp;ibin++) {
3149 float xx = xmn + ibin * df;
3151 if(!f1->
value(xx,val)) problem =
true;
3152 vmax = mx<float>(vmax,val);
3153 vmin = mn<float>(vmin,val);
3156 a_out <<
"tools::sg::plotter :"
3157 <<
" problem when getting some function value."
3167 float xmn = f2->
x_min();
3168 float xmx = f2->
x_max();
3178 float ymn = f2->
y_min();
3179 float ymx = f2->
y_max();
3200 float dfx = (xmx - xmn)/nx;
3201 float dfy = (ymx - ymn)/ny;
3203 bool problem =
false;
3205 if(!f2->
value(xmn,ymn,vmin)) problem =
true;
3207 for(
int jbin=ny-1;jbin>=0;jbin--) {
3208 for(
int ibin=nx-1;ibin>=0;ibin--) {
3209 float xx = xmn + ibin * dfx;
3210 float yy = ymn + jbin * dfy;
3212 if(!f2->
value(xx,yy,val)) problem =
true;
3213 vmin = mn<float>(vmin,val);
3214 vmax = mx<float>(vmax,val);
3218 a_out <<
"tools::sg::plotter :"
3219 <<
" problem when getting some function value."
3248 float wData = XSIZ-XMGL-XMGR;
3279 float hData = YSIZ-YMGL-YMGU;
3320 float wData = XSIZ-XMGL-XMGR;
3353 float hData = YSIZ-YMGL-YMGU;
3389 float dData = ZSIZ-ZMGD-ZMGU;
3423 size_t valn = a_cmap.
valn();
3425 size_t coln = a_cmap.
colorn();
3431 float wData = XSIZ-XMGL-XMGR;
3436 float hData = YSIZ-YMGL-YMGU;
3438 float hcmap = hData;
3448 float dData = ZSIZ-ZMGD-ZMGU;
3454 float zz = -
depth*0.5f;
3459 float w = XMGR*0.3F;
3460 float xx = wData+XMGR*0.1F;
3464 float h = hcmap/float(coln);
3469 for(
unsigned int index=0;index<coln;index++) {
3478 vtxs->
add(xx ,yy ,zz);
3479 vtxs->
add(xx + w ,yy ,zz);
3480 vtxs->
add(xx + w ,yy + h ,zz);
3481 vtxs->
add(xx ,yy + h ,zz);
3488 mat->color = colorf_black();
3501 vtxs->
add(xx ,0 ,zz);
3502 vtxs->
add(xx + w ,0 ,zz);
3503 vtxs->
add(xx + w ,hcmap ,zz);
3504 vtxs->
add(xx ,hcmap ,zz);
3505 vtxs->
add(xx ,0 ,zz);}
3517 if(safe_cast<base_colormap,by_value_colormap>(a_cmap)) {
3519 if((valn+1)==coln) {
3539 if(safe_cast<base_colormap,by_value_colormap>(a_cmap)) {
3541 if((valn+1)==coln) {
3547 for(
unsigned int index=0;index<valn;index++) {
3550 snpf(tmp,
sizeof(tmp),
"%g",a_cmap.
value(index));
3554 }
else if((coln+1)==valn) {
3560 for(
unsigned int index=0;index<valn;index++) {
3563 snpf(tmp,
sizeof(tmp),
"%g",a_cmap.
value(index));
3568 a_out <<
"tools::sg::plotter::update_cmap :"
3569 <<
" inconsistent by value colormap."
3602 if(
plottable_text* ptext = safe_cast<plotprim,plottable_text>(*(*it))) {
3604 }
else if(
plottable_box* pbox = safe_cast<plotprim,plottable_box>(*(*it))) {
3606 }
else if(
plottable_ellipse* pellipse = safe_cast<plotprim,plottable_ellipse>(*(*it))) {
3608 }
else if(
plottable_img* pimg = safe_cast<plotprim,plottable_img>(*(*it))) {
3618 const style& a_data_style,
3619 const style& a_left_hatch_style,
3620 const style& a_right_hatch_style,
3621 const style& a_errors_style,
3641 size_t xnbin = a_bins.
bins();
3642 std::vector<rep_bin1D> bins(xnbin);
3644 for(
size_t ibin=0;ibin<xnbin;ibin++) {
3646 float val = a_bins.
bin_Sw(
int(ibin));
3655 bmin = mn<float>(bmin,val);
3656 bmax = mx<float>(bmax,val);
3663 bool errors_visible = a_errors_style.
visible;
3673 {
float dbins = bmax-bmin;
3675 for(
size_t index=0;index<xnbin;index++) bins[index].m_ratio = (a_bins.
bin_Sw(
int(index))-bmin)/dbins;
3696 style data_style = a_data_style;
3700 std::vector<float> bars(xnbin);
3701 for(
size_t ibin=0;ibin<xnbin;ibin++) bars[ibin] = a_bins.
bin_error(
int(ibin));
3704 errors_visible =
false;
3708 const std::string& modeling = a_data_style.
modeling;
3717 bool _bar_chart =
false;
3729 bins,a_box_x,a_box_y,a_zz);
3738 bins,a_box_x,a_box_y,a_zz
3797 if(errors_visible) {
3798 std::vector<float> bars(xnbin);
3799 for(
size_t ibin=0;ibin<xnbin;ibin++) bars[ibin] = a_bins.
bin_error(
int(ibin));
3800 const std::string& modeling = a_errors_style.
modeling;
3811 unsigned int xn = a_bins.
x_bins();
3814 unsigned int yn = a_bins.
y_bins();
3818 float dx = (xmx-xmn)/xn;
3819 float dy = (ymx-ymn)/yn;
3820 int ibin = (int)((a_X-xmn)/dx);
3821 int jbin = (int)((a_Y-ymn)/dy);
3823 if((ibin<0)||(ibin>=int(xn))) {a_value=0;
return false;}
3824 if((jbin<0)||(jbin>=int(yn))) {a_value=0;
return false;}
3836 float val1 = a_bins.
bin_Sw(ibin,jbin);
3837 float val2 = a_bins.
bin_Sw(ibin+1,jbin);
3839 float val4 = a_bins.
bin_Sw(ibin,jbin+1);
3842 vec3f p1(xx_0,yy_0,val1);
3843 vec3f p2(xx_1,yy_0,val2);
3845 vec3f p4(xx_0,yy_1,val4);
3862 double m_limits_in[4];
3868 if( (a_X<func->m_limits_in[0])||
3870 (a_Y<func->m_limits_in[2])||
3880 if( (a_X<func->m_limits_in[0])||
3882 (a_Y<func->m_limits_in[2])||
3892 const style& a_data_style,
3901 if(!a_data_style.
visible)
return;
3905 unsigned int xnbin = a_bins.
x_bins();
3906 unsigned int ynbin = a_bins.
y_bins();
3908 const std::string& modeling = a_data_style.
modeling;
3912 a_out <<
"tools::sg::update_bins2D_xy : modeling_curve :" << std::endl;
3916 float zmin = a_box_z.
m_pos;
3918 bool zlog = a_box_z.
m_log;
3950 int n = nSec - 2 * 10;
3951 double dx = (limits[1]-limits[0]) /n;
3952 double dy = (limits[3]-limits[2]) /n;
3953 limits[0] = limits[0] - 10 * dx;
3954 limits[1] = limits[1] + 10 * dx;
3955 limits[2] = limits[2] - 10 * dy;
3956 limits[3] = limits[3] + 10 * dy;
3967 std::vector<double> zs(zn);
3968 for(
size_t zi=0;zi<zn;zi++) zs[zi] =
levels[zi];
3973 std::vector<double> zs(zn+1);
3974 float zmax = zmin + dz;
3975 double zd = (zmax-zmin)/zn;
3976 for(
unsigned int zi=0;zi<=zn;zi++) zs[zi] = zmin + zi * zd;
3985 #ifdef INLIBS_SG_PLOTTER_TIMING
3986 atime _start = atime::now();
3988 list_contour.ccontour::generate();
3989 #ifdef INLIBS_SG_PLOTTER_TIMING
3990 a_out <<
"tools::sg::update_bins2D_xy : contour generate elapsed " << atime::elapsed(_start) <<
"." << std::endl;
3991 _start = atime::now();
3995 a_out <<
"tools::sg::plotter::updateBins2D_XY : clist_contour::compact_strips () : failure." << std::endl;
3997 #ifdef INLIBS_SG_PLOTTER_TIMING
3998 a_out <<
"tools::sg::update_bins2D_xy : contour compact strips elapsed " << atime::elapsed(_start) <<
"." << std::endl;
4011 list_contour,a_box_x,a_box_y,a_box_z,a_zz );
4015 list_contour,a_box_x,a_box_y,a_box_z,a_zz );
4021 a_out <<
"tools::sg::plotter::updateFunction_XY(SbPlottableFunction2D) : "
4022 <<
"problem when getting some function value." << std::endl;
4032 std::vector<rep_bin2D> bins;
4034 for(
int jbin=ynbin-1;jbin>=0;jbin--) {
4035 for(
int ibin=xnbin-1;ibin>=0;ibin--) {
4036 if(hbe && (a_bins.
bin_entries(ibin,jbin)<=0))
continue;
4038 float val = a_bins.
bin_Sw(ibin,jbin);
4045 bins.push_back(
rep_bin2D(xx,xe,yy,ye,val,ibin,jbin));
4052 bmin = mn<float>(bmin,val);
4053 bmax = mx<float>(bmax,val);
4057 size_t number = bins.size();
4067 {
float dbins = bmax-bmin;
4069 for(
size_t index=0;index<number;index++) {
4070 bins[index].m_ratio = (bins[index].m_val-bmin)/dbins;
4149 unsigned int nstp = a_func.
x_steps();
4152 float df = (xmx - xmn)/nstp;
4154 bool problem =
false;
4155 std::vector<vec3f>
points(nstp+1);
4156 for(
unsigned int ibin=0;ibin<=nstp;ibin++) {
4157 float xx = xmn + ibin * df;
4159 if(!a_func.
value(xx,val)) problem =
true;
4160 points[ibin].set_value(xx,val,a_zz);
4163 a_out <<
"tools::sg::plotter::update_func1D_xy :"
4164 <<
" problem when getting some function value."
4168 const std::string& modeling = a_style.
modeling;
4172 std::vector<float>& pts = vtxs->
xyzs.
values();
4199 std::vector<float>& pts = _marks->
xyzs.
values();
4223 std::vector<float>& pts = vtxs->
xyzs.
values();
4252 if( (a_X<func->m_limits_in[0])||
4254 (a_Y<func->m_limits_in[2])||
4259 return double(
value);
4263 if( (a_X<func->m_limits_in[0])||
4265 (a_Y<func->m_limits_in[2])||
4290 float zmin = a_box_z.
m_pos;
4292 bool zlog = a_box_z.
m_log;
4324 int n = nSec - 2 * 10;
4325 double dx = (limits[1]-limits[0]) /n;
4326 double dy = (limits[3]-limits[2]) /n;
4327 limits[0] = limits[0] - 10 * dx;
4328 limits[1] = limits[1] + 10 * dx;
4329 limits[2] = limits[2] - 10 * dy;
4330 limits[3] = limits[3] + 10 * dy;
4341 std::vector<double> zs(zn);
4342 for(
size_t zi=0;zi<zn;zi++) zs[zi] =
levels[zi];
4347 std::vector<double> zs(zn+1);
4348 float zmax = zmin + dz;
4349 double zd = (zmax-zmin)/zn;
4350 for(
unsigned int zi=0;zi<=zn;zi++) zs[zi] = zmin + zi * zd;
4360 #ifdef INLIBS_SG_PLOTTER_TIMING
4361 atime _start = atime::now();
4363 list_contour.ccontour::generate();
4365 #ifdef INLIBS_SG_PLOTTER_TIMING
4366 a_out <<
"tools::sg::update_func2D_xy : contour generate elapsed " << atime::elapsed(_start) <<
"." << std::endl;
4367 _start = atime::now();
4371 a_out <<
"tools::sg::plotter::update_func2D_xy : clist_contour::compact_strips () : failure." << std::endl;
4373 #ifdef INLIBS_SG_PLOTTER_TIMING
4374 a_out <<
"tools::sg::update_func2D_xy : contour compact strips elapsed " << atime::elapsed(_start) <<
"." << std::endl;
4387 list_contour,a_box_x,a_box_y,a_box_z,a_zz );
4391 list_contour,a_box_x,a_box_y,a_box_z,a_zz );
4396 a_out <<
"tools::sg::plotter::update_func2D_xy : problem when getting some function value." << std::endl;
4509 a_out <<
"tools::sg::plotter::update_func2D_xy :"
4510 <<
" modeling " << modeling
4511 <<
" does not apply on Functi on2D in XY. Valid modelings ared curve, filled_curve and polygon."
4524 size_t number = a_points.
points();
4527 const std::string& modeling = a_style.
modeling;
4545 size_t number = a_points.
points();
4588 unsigned int xnbin = a_bins.
x_bins();
4589 unsigned int ynbin = a_bins.
y_bins();
4590 if(!xnbin || !ynbin)
return;
4592 const std::string& modeling = a_style.
modeling;
4601 std::vector<rep_bin2D> bins;
4603 for(
int jbin=ynbin-1;jbin>=0;jbin--) {
4604 for(
int ibin=xnbin-1;ibin>=0;ibin--) {
4605 if(hbe && (a_bins.
bin_entries(ibin,jbin)<=0))
continue;
4607 float val = a_bins.
bin_Sw(ibin,jbin);
4614 bins.push_back(
rep_bin2D(xx,xe,yy,ye,val,ibin,jbin));
4621 bmin = mn<float>(bmin,val);
4622 bmax = mx<float>(bmax,val);
4626 size_t number = bins.size();
4636 {
float dbins = bmax-bmin;
4638 for(
size_t index=0;index<number;index++) {
4639 bins[index].m_ratio = (bins[index].m_val-bmin)/dbins;
4660 std::vector<rep_top_face2D> faces((xnbin-1)*(ynbin-1));
4663 unsigned int xnbin_1 = xnbin-1;
4664 unsigned int ynbin_1 = ynbin-1;
4665 for(
unsigned int jbin=0;jbin<ynbin_1;jbin++) {
4666 for(
unsigned int ibin=0;ibin<xnbin_1;ibin++) {
4678 float xx = (xx_0+xe_0)/2;
4679 float xe = (xx_1+xe_1)/2;
4680 float yy = (yy_0+ye_0)/2;
4681 float ye = (yy_1+ye_1)/2;
4683 float val1 = a_bins.
bin_Sw(ibin,jbin);
4684 float val2 = a_bins.
bin_Sw(ibin+1,jbin);
4685 float val3 = a_bins.
bin_Sw(ibin+1,jbin+1);
4686 float val4 = a_bins.
bin_Sw(ibin,jbin+1);
4695 bmin = mn<float>(bmin,val1);
4696 bmax = mx<float>(bmax,val1);
4714 faces,a_box_x,a_box_y,a_box_z,
4734 bool zlog = a_box_z.
m_log;
4754 float zmin = a_box_z.
m_pos;
4788 int n = nSec - 2 * 10;
4789 double dx = (limits[1]-limits[0]) /n;
4790 double dy = (limits[3]-limits[2]) /n;
4791 limits[0] = limits[0] - 10 * dx;
4792 limits[1] = limits[1] + 10 * dx;
4793 limits[2] = limits[2] - 10 * dy;
4794 limits[3] = limits[3] + 10 * dy;
4804 size_t zn = cmap->
colorn();
4807 std::vector<double> zs(zn+1);
4808 float zmax = zmin + dz;
4809 double zd = (zmax-zmin)/zn;
4810 for(
size_t zi=0;zi<=zn;zi++) zs[zi] = zmin + zi * zd;
4816 list_contour.ccontour::generate();
4818 a_out <<
"tools::sg::plotter::update_bins2D_xyz : clist_contour::compact_strips () : failure." << std::endl;
4837 a_box_x,a_box_y,a_box_z,
ZZ);
4851 unsigned int a_index,
4852 const style& a_style,
4864 unsigned int nx = a_func.
x_steps();
4870 unsigned int ny = a_func.
y_steps();
4873 float dfx = (xmx - xmn)/nx;
4874 float dfy = (ymx - ymn)/ny;
4878 std::vector<rep_top_face2D> faces(nx*ny);
4879 {
bool problem =
false;
4880 unsigned int facei = 0;
4881 float* vprev =
new float[2*nx];
4882 for(
int jbin=ny-1;jbin>=0;jbin--) {
4885 for(
int ibin=nx-1;ibin>=0;ibin--) {
4887 float xx = xmn + ibin * dfx;
4888 float yy = ymn + jbin * dfy;
4889 float xe = xx + dfx;
4890 float ye = yy + dfy;
4894 if(!a_func.
value(xx,yy,val1)) problem =
true;
4896 if(ibin==
int(nx-1)) {
4897 if(!a_func.
value(xe,yy,val2)) problem =
true;
4902 if(jbin==
int(ny-1)) {
4903 if(ibin==
int(nx-1)) {
4904 if(!a_func.
value(xe,ye,val3)) problem =
true;
4908 if(!a_func.
value(xx,ye,val4)) problem =
true;
4910 val3 = vprev[2*ibin+1];
4911 val4 = vprev[2*ibin];
4916 vprev[2*ibin] = val1;
4917 vprev[2*ibin+1] = val2;
4927 a_out <<
"tools::sg::plotter::update_func2D_xyz :"
4928 <<
" problem when getting some function value."
4940 float vmin = faces[0].m_v1;
4941 float vmax = faces[0].m_v1;
4942 size_t number = faces.size();
4943 for(
size_t index=0;index<number;index++) {
4944 float vmean = faces[index].m_v1;
4945 vmean += faces[index].m_v2;
4946 vmean += faces[index].m_v3;
4947 vmean += faces[index].m_v4;
4950 vmin = mn<float>(vmin,vmean);
4951 vmax = mx<float>(vmax,vmean);
4953 faces[index].m_ratio = vmean;
4956 {
float dbins = vmax-vmin;
4958 for(
size_t index=0;index<number;index++) {
4959 faces[index].m_ratio = (faces[index].m_ratio-vmin)/dbins;
4989 bool zlog = a_box_z.
m_log;
4994 float xmin = a_box_x.
m_pos;
4996 bool xlog = a_box_x.
m_log;
4998 float ymin = a_box_y.
m_pos;
5000 bool ylog = a_box_y.
m_log;
5002 float zmin = a_box_z.
m_pos;
5004 bool zlog = a_box_z.
m_log;
5022 bool problem =
false;
5028 vtxs->
add(xx,yy,0);}
5034 vtxs->
add(xx,yy,0);}
5037 {
if(!a_func.
value(xmx,ymn,val)) problem =
true;
5045 vtxs->
add(xx,yy,val);}}
5047 for(
int ibin=nx-1;ibin>=0;ibin--) {
5049 float xx = xmn + ibin * dfx;
5054 {
if(!a_func.
value(xx,yy,val)) problem =
true;
5062 if((xx>=0)&&(xx<=1) && (yy>=0)&&(yy<=1) ) {
5064 vtxs->
add(xx,yy,val);
5075 a_out <<
"tools::sg::plotter::update_func2D_xyz :"
5076 <<
" problem when getting some function value."
5097 vtxs->
add(xx,yy,0);}
5103 vtxs->
add(xx,yy,0);}
5106 bool problem =
false;
5108 for(
unsigned int jbin=0;jbin<ny;jbin++) {
5111 float yy = ymn + jbin * dfy;
5114 {
if(!a_func.
value(xx,yy,val)) problem =
true;
5122 if((xx>=0)&&(xx<=1) &&
5125 vtxs->
add(xx,yy,val);
5133 {
if(!a_func.
value(xmn,ymx,val)) problem =
true;
5141 vtxs->
add(xx,yy,val);}}
5148 a_out <<
"tools::sg::plotter::update_func2D_xyz :"
5149 <<
" problem when getting some function value."
5192 float wData = XSIZ-XMGL-XMGR;
5197 float hData = YSIZ-YMGL-YMGU;
5243 {
float xx = -
width*0.5f+wbox*0.5f+xmargin;
5244 float yy =
height*0.5f-hbox*0.5F-ymargin;
5250 title_box->
width = wbox;
5251 title_box->
height = hbox;
5279 b1->
infos(opts,a_s);
5281 b2->
infos(opts,a_s);
5285 p2->
infos(opts,a_s);
5287 p3->
infos(opts,a_s);
5291 f1->
infos(opts,a_s);
5293 f2->
infos(opts,a_s);
5299 if(!
object)
continue;
5301 if(a_s.size()) a_s +=
"\n";
5303 object->
infos(opts,_s);
5323 std::vector<std::string> ws;
5324 words(sinfos,
"\n",
false,ws);
5325 size_t linen = ws.size()/2;
5335 matrix* infos_title_tsf = 0;
5338 std::string infos_title;
5340 std::vector<std::string> _ws;
5341 for(
size_t index=0;index<linen;index++) {
5342 const std::string& name = ws[2*index];
5343 const std::string&
value = ws[2*index+1];
5345 infos_title =
value;
5347 _ws.push_back(name);
5348 _ws.push_back(
value);
5352 linen = ws.size()/2;
5355 if(infos_title.size()) {
5356 float hbox = _height*0.05f;
5386 infos_title_tsf = _tsf;
5387 infos_title_text = txt;
5390 if(sinfos.empty())
return;
5397 infos->width = wbox;
5409 {
for(
size_t index=0;index<linen;index++) {
5410 const std::string& name = ws[2*index];
5411 const std::string&
value = ws[2*index+1];
5412 infos->lstrings.add(name);
5423 float title_hbox = 0;
5424 if(infos_title_tsf && infos_title_text) {
5425 title_hbox =
infos->height/linen;
5427 float yy = _height*0.5f - title_hbox*0.5F - _height*
infos_y_margin;
5432 infos_title_text->
height = title_hbox;
5435 float hbox =
infos->height;
5601 for(
size_t index=0;index<number;index++) {
5630 float xxx = w * 0.5f;
5631 float yyy = h * 0.5f;
5641 a_out <<
"tools::sg::plotter::update_legends : axis_2_vp() failed for x=" << x <<
", y=" << y <<
"." << std::endl;
5644 float xx =
width * (-0.5f+pos[0]);
5645 float yy =
height * (-0.5f+pos[1]);
5656 vec2f ur(1-xur,1-yur);
5658 float x =
width*ur[0] - w;
5659 float y =
height*ur[1] - h;
5661 float xx = -
width*0.5f + x;
5662 float yy = -
height*0.5f + y;
5679 float w2 =
width*0.5F;
5699 vtxs->
add(-w2,-h2,zz);
5700 vtxs->
add( w2,-h2,zz);
5701 vtxs->
add( w2, h2,zz);
5702 vtxs->
add(-w2, h2,zz);}
5722 vtxs->
add(-w2+d,-h2+d,zz);
5723 vtxs->
add( w2-d,-h2+d,zz);
5724 vtxs->
add( w2-d, h2-d,zz);
5725 vtxs->
add(-w2+d, h2-d,zz);
5774 ls->
add(0,0,0);ls->
add(1,0,0);
5775 ls->
add(1,0,0);ls->
add(1,1,0);
5776 ls->
add(1,1,0);ls->
add(0,1,0);
5777 ls->
add(0,1,0);ls->
add(0,0,0);
5780 ls->
add(0,0,1);ls->
add(1,0,1);
5781 ls->
add(1,0,1);ls->
add(1,1,1);
5782 ls->
add(1,1,1);ls->
add(0,1,1);
5783 ls->
add(0,1,1);ls->
add(0,0,1);
5786 ls->
add(0,0,0);ls->
add(0,0,1);
5787 ls->
add(1,0,0);ls->
add(1,0,1);
5788 ls->
add(1,1,0);ls->
add(1,1,1);
5789 ls->
add(0,1,0);ls->
add(0,1,1);
5796 if(number<=0)
return;
5798 bool draw_vertical =
true;
5799 bool draw_horizontal =
true;
5819 std::vector<float>& pts = vtxs->
xyzs.
values();
5828 pts.reserve(_number*6);
5829 for(
size_t count=0;count<_number;count++) {
5831 vtxs->
add(xx, 0 ,zz);
5832 vtxs->
add(xx, _width,zz);
5835 pts.reserve(_number*100*6);
5836 for(
size_t count=0;count<_number;count++) {
5844 pts.reserve(_number*6);
5845 for(
size_t count=0;count<_number;count++) {
5847 vtxs->
add(xx, 0 ,zz);
5848 vtxs->
add(xx,_width,zz);
5851 pts.reserve(_number*100*6);
5852 for(
size_t count=0;count<_number;count++) {
5860 if(draw_horizontal) {
5865 pts.reserve(_number*6);
5866 for(
size_t count=0;count<_number;count++) {
5868 vtxs->
add(0,yy ,zz);
5869 vtxs->
add(_width,yy,zz);
5872 pts.reserve(_number*100*6);
5873 for(
size_t count=0;count<_number;count++) {
5881 pts.reserve(_number*6);
5882 for(
size_t count=0;count<_number;count++) {
5884 vtxs->
add(0,yy, zz);
5885 vtxs->
add(_width,yy,zz);
5888 pts.reserve(_number*100*6);
5889 for(
size_t count=0;count<_number;count++) {
5973 const std::vector<rep_bin1D>& a_bins,
5980 float xmin = a_box_x.
m_pos;
5982 bool xlog = a_box_x.
m_log;
5984 float ymin = a_box_y.
m_pos;
5986 bool ylog = a_box_y.
m_log;
6005 size_t xnbin = a_bins.
size();
6006 for(
size_t index=0;index<xnbin;index++) {
6007 float xx = a_bins[index].m_x_min;
6008 float xe = a_bins[index].m_x_max;
6009 float y = a_bins[index].m_val;
6011 float val = a_bins[index].m_val;
6044 a_cmap.
get_color(a_bins[index].m_ratio,clr);
6046 clr = a_style.
color;
6057 vtxs->
add(xx,yp,a_zz);
6058 vtxs->
add(xx,y,a_zz);
6059 vtxs->
add(xe,y,a_zz);
6061 vtxs->
add(xe,y0,a_zz);
6076 const style& a_style,
6078 const std::vector<rep_bin1D>& a_bins,
6084 float xmin = a_box_x.
m_pos;
6086 bool xlog = a_box_x.
m_log;
6088 float ymin = a_box_y.
m_pos;
6090 bool ylog = a_box_y.
m_log;
6105 size_t xnbin = a_bins.
size();
6106 for(
size_t index=0;index<xnbin;index++) {
6107 float x = (a_bins[index].m_x_min + a_bins[index].m_x_max)/2;
6108 float y = a_bins[index].m_val;
6109 float val = a_bins[index].m_val;
6114 if((x<0)||(x>1)||(y<0)||(y>1))
continue;
6136 a_cmap.
get_color(a_bins[index].m_ratio,clr);
6138 clr = a_style.
color;
6148 vtxs->
add(x,y,a_zz);
6154 _marks->
add(x,y,a_zz);
6157 a_out <<
"tools::sg::plotter::rep_bins1D_xy_points :"
6175 const std::vector<rep_bin1D>& a_bins,
6182 float xmin = a_box_x.
m_pos;
6184 bool xlog = a_box_x.
m_log;
6186 float ymin = a_box_y.
m_pos;
6188 bool ylog = a_box_y.
m_log;
6203 float ye = rbin.
m_val;
6209 float val = rbin.
m_val;
6247 clr = a_style.
color;
6258 vtxs->
add(xx,yy,a_zz);
6259 vtxs->
add(xe,yy,a_zz);
6260 vtxs->
add(xe,ye,a_zz);
6261 vtxs->
add(xx,ye,a_zz);
6275 const std::vector<rep_bin1D>& a_bins,
6283 float xmin = a_box_x.
m_pos;
6285 bool xlog = a_box_x.
m_log;
6287 float ymin = a_box_y.
m_pos;
6289 bool ylog = a_box_y.
m_log;
6302 float ye = rbin.
m_val;
6308 float val = rbin.
m_val;
6348 clr = a_style.
color;
6359 vtxs->
add(xx,yy,a_zz);
6360 vtxs->
add(xe,yy,a_zz);
6361 vtxs->
add(xe,ye,a_zz);
6362 vtxs->
add(xx,ye,a_zz);
6363 vtxs->
add(xx,yy,a_zz);
6381 size_t xnbin = a_bins.size();
6382 std::vector<vec3f>
points(xnbin);
6383 for(
size_t index=0;index<xnbin;index++) {
6384 float x = (a_bins[index].m_x_min + a_bins[index].m_x_max)/2;
6385 float y = a_bins[index].m_val;
6390 std::vector<float>& pts = vtxs->
xyzs.
values();
6420 size_t number = a_bins.size();
6423 double* xs =
new double[number];
6424 double* ys =
new double[number];
6426 for(
size_t index=0;index<number;index++) {
6427 x = (a_bins[index].m_x_min + a_bins[index].m_x_max)/2;
6428 y = a_bins[index].m_val;
6429 xs[index] = x;ys[index] = y;
6433 delete [] xs;
delete [] ys;
6438 float step = (xmx - xmn)/nstp;
6439 std::vector<vec3f>
points(nstp+1);
6440 for(
unsigned int ibin=0;ibin<=nstp;ibin++) {
6441 float xx = xmn + ibin * step;
6442 double val = _spline.
eval(xx);
6443 points[ibin].set_value(xx,
float(val),a_zz);
6447 std::vector<float>& pts = vtxs->
xyzs.
values();
6476 const rep_box& a_box_x,
const rep_box& a_box_y,
float a_bmin,
float a_bmax,
float a_zz) {
6489 float xmin = a_box_x.
m_pos;
6491 bool xlog = a_box_x.
m_log;
6493 float ymin = a_box_y.
m_pos;
6495 bool ylog = a_box_y.
m_log;
6498 float range = a_bmax - a_bmin;
6507 float val = rbin.
m_val;
6512 xsize = (val - a_bmin) * (xe - xx) / range;
6513 ysize = (val - a_bmin) * (ye - yy) / range;
6521 xx = xx + ((xe-xx) - xsize)/2;
6523 yy = yy + ((ye-yy) - ysize)/2;
6557 vtxs->
add(xx,yy,a_zz);
6558 vtxs->
add(xe,yy,a_zz);
6559 vtxs->
add(xe,ye,a_zz);
6560 vtxs->
add(xx,ye,a_zz);
6573 const std::vector<rep_bin2D>& a_bins,
6575 float a_bmin,
float a_bmax,
float a_zz
6597 float xmin = a_box_x.
m_pos;
6599 bool xlog = a_box_x.
m_log;
6601 float ymin = a_box_y.
m_pos;
6603 bool ylog = a_box_y.
m_log;
6605 float range = a_bmax - a_bmin;
6606 size_t number = a_bins.size();
6607 for(
size_t index=0;index<number;index++) {
6609 float xx = a_bins[index].m_x_min;
6610 float xe = a_bins[index].m_x_max;
6611 float yy = a_bins[index].m_y_min;
6612 float ye = a_bins[index].m_y_max;
6613 float val = a_bins[index].m_val;
6618 xsize = (val - a_bmin) * (xe - xx) / range;
6619 ysize = (val - a_bmin) * (ye - yy) / range;
6627 xx = xx + ((xe-xx) - xsize)/2;
6629 yy = yy + ((ye-yy) - ysize)/2;
6667 vtxs->
add(xx,yy,a_zz);
6668 vtxs->
add(xe,yy,a_zz);
6670 vtxs->
add(xe,yy,a_zz);
6671 vtxs->
add(xe,ye,a_zz);
6673 vtxs->
add(xe,ye,a_zz);
6674 vtxs->
add(xx,ye,a_zz);
6676 vtxs->
add(xx,ye,a_zz);
6677 vtxs->
add(xx,yy,a_zz);
6697 float xmin = a_box_x.
m_pos;
6699 bool xlog = a_box_x.
m_log;
6701 float ymin = a_box_y.
m_pos;
6703 bool ylog = a_box_y.
m_log;
6715 float val = rbin.
m_val;
6739 clr = a_style.
color;
6751 vtxs->
add(xx,yy,a_zz);
6752 vtxs->
add(xe,yy,a_zz);
6753 vtxs->
add(xe,ye,a_zz);
6754 vtxs->
add(xx,ye,a_zz);
6767 const rep_box& a_box_x,
const rep_box& a_box_y,
float a_bmin,
float a_bmax,
float a_zz
6782 float xmin = a_box_x.
m_pos;
6784 bool xlog = a_box_x.
m_log;
6786 float ymin = a_box_y.
m_pos;
6788 bool ylog = a_box_y.
m_log;
6793 float range = a_bmax - a_bmin;
6797 size_t number = a_bins.size();
6798 for(
size_t index=0;index<number;index++) {
6800 float xx = a_bins[index].m_x_min;
6801 float xe = a_bins[index].m_x_max;
6802 float yy = a_bins[index].m_y_min;
6803 float ye = a_bins[index].m_y_max;
6804 float val = a_bins[index].m_val;
6811 int npt = range>0. ? (int)((val - a_bmin)*(nmax-nmin)/range + nmin):1;
6818 float xdbin = xe - xx;
6819 float ydbin = ye - yy;
6820 for(
int count=0;count<npt;count++) {
6825 if((xxx>=0)&&(xxx<=1) &&
6826 (yyy>=0)&&(yyy<=1) ) {
6827 vtxs->
add(xxx,yyy,a_zz);
6845 ,
const std::vector<rep_bin2D>&
6851 ::printf(
"debug : rep_bins2D_xy_text : dummy\n");
6977 float xmin = a_box_x.
m_pos;
6979 bool xlog = a_box_x.
m_log;
6981 float ymin = a_box_y.
m_pos;
6983 bool ylog = a_box_y.
m_log;
6985 float zmin = a_box_z.
m_pos;
7007 a_out <<
"tools::sg;:plotter::rep_contour_xy : problem with contour." << std::endl;
7013 float val = (float)a_contour.
get_plane(i);
7024 size_t icol = a_cmap.
colorn() ? (i % a_cmap.
colorn()) :0;
7025 _color = a_cmap.
color(icol);
7027 _color = a_style.
color;
7033 a_out <<
"tools::sg;:plotter::rep_contour_xy : problem with contour." << std::endl;
7037 if (pStrip->empty())
continue;
7056 xx = (float)a_contour.
get_xi(*pos2);
7057 yy = (float)a_contour.
get_yi(*pos2);
7069 vtxs->
add(xprev,yprev,a_zz+zz);
7070 vtxs->
add(xx,yy,a_zz+zz);
7096 float xmin = a_box_x.
m_pos;
7098 bool xlog = a_box_x.
m_log;
7100 float ymin = a_box_y.
m_pos;
7102 bool ylog = a_box_y.
m_log;
7104 float zmin = a_box_z.
m_pos;
7117 float zz = a_zz - 0.01F;
7121 _color = a_cmap.
color(0);
7123 _color = a_style.
color;
7127 mat->color = _color;
7142 vtxs->
add(xx,yy,zz);
7143 vtxs->
add(xe,yy,zz);
7144 vtxs->
add(xe,ye,zz);
7145 vtxs->
add(xx,ye,zz);
7156 a_out <<
"tools::sg;:plotter::rep_contour_xy_filled : problem with contour." << std::endl;
7165 float val = (float)a_contour.
get_plane(i);
7172 std::vector< std::vector<vec3f> > contourVector;
7176 if(pStrip->size() >2) {
7177 std::vector<vec3f> v;
7178 for (cline_strip::iterator pos2=pStrip->begin();pos2 != pStrip->end();pos2++) {
7179 unsigned int index=(*pos2);
7180 float xx = (float)a_contour.
get_xi(index);
7181 float yy = (float)a_contour.
get_yi(index);
7184 v.push_back(
vec3f(xx,yy,a_zz+zz));
7186 contourVector.push_back(v);
7190 std::vector<tess_triangle> tris;
7193 if(!tris.size())
continue;
7200 _color = a_cmap.
color(icol);
7202 _color = a_style.
color;
7209 for(
size_t itri=0;itri<tris.size();itri++) {
7217 AB.
cross(BC,vcross);
7244 const rep_box& a_box_x,
const rep_box& a_box_y,
const std::vector<float>& a_bars,
float aZ) {
7263 float xmin = a_box_x.
m_pos;
7265 bool xlog = a_box_x.
m_log;
7267 float ymin = a_box_y.
m_pos;
7269 bool ylog = a_box_y.
m_log;
7271 size_t xnbin = a_bins.size();
7273 for(
size_t index=0;index<xnbin;index++) {
7277 float val = a_bins[index].m_val;
7278 float bar_height = a_bars[index];
7280 float bar_min = val - bar_height/2;
7281 float bar_max = val + bar_height/2;
7283 float xx = a_bins[index].m_x_min;
7284 float xe = a_bins[index].m_x_max;
7300 float ex = (xe+xx)/2;
7303 float edx = 0.3F * (xe-xx);
7305 if((val>=0)&&(val<=1)) {
7306 vtxs->
add(ex-edx,val,aZ);
7307 vtxs->
add(ex+edx,val,aZ);
7312 }
else if(bar_max <0) {
7314 }
else if(bar_min <0) {
7320 vtxs->
add(ex,bar_max,aZ);
7322 }
else if(bar_max >1) {
7323 vtxs->
add(ex,bar_min,aZ);
7326 vtxs->
add(ex ,bar_min,aZ);
7327 vtxs->
add(ex ,bar_max,aZ);
7340 const rep_box& a_box_x,
const rep_box& a_box_y,
const std::vector<float>& a_bars,
float aZ){
7359 float xmin = a_box_x.
m_pos;
7361 bool xlog = a_box_x.
m_log;
7363 float ymin = a_box_y.
m_pos;
7365 bool ylog = a_box_y.
m_log;
7367 size_t xnbin = a_bins.size();
7369 for(
size_t index=0;index<xnbin;index++) {
7373 float val = a_bins[index].m_val;
7374 float bar_height = a_bars[index];
7376 float bar_min = val - bar_height/2;
7377 float bar_max = val + bar_height/2;
7379 float xx = a_bins[index].m_x_min;
7380 float xe = a_bins[index].m_x_max;
7396 float ex = (xe+xx)/2;
7399 float edx = 0.3F * (xe-xx);
7403 }
else if(bar_max <0) {
7405 }
else if(bar_min <0) {
7411 vtxs->
add(ex,bar_max,aZ);
7412 vtxs->
add(ex-edx,bar_max,aZ);
7413 vtxs->
add(ex+edx,bar_max,aZ);
7415 }
else if(bar_max >1) {
7416 vtxs->
add(ex-edx,bar_min,aZ);
7417 vtxs->
add(ex+edx,bar_min,aZ);
7418 vtxs->
add(ex,bar_min,aZ);
7421 vtxs->
add(ex-edx,bar_min,aZ);
7422 vtxs->
add(ex+edx,bar_min,aZ);
7423 vtxs->
add(ex ,bar_min,aZ);
7424 vtxs->
add(ex ,bar_max,aZ);
7425 vtxs->
add(ex-edx,bar_max,aZ);
7426 vtxs->
add(ex+edx,bar_max,aZ);
7439 const std::vector<rep_bin1D>& a_bins,
7461 float xmin = a_box_x.
m_pos;
7463 bool xlog = a_box_x.
m_log;
7465 float ymin = a_box_y.
m_pos;
7467 bool ylog = a_box_y.
m_log;
7472 size_t xnbin = a_bins.size();
7473 for(
size_t index=0;index<xnbin;index++) {
7474 float xx = a_bins[index].m_x_min;
7475 float xe = a_bins[index].m_x_max;
7476 float yy = a_bins[index].m_v_min;
7477 float ye = a_bins[index].m_val;
7479 yy = a_bins[index].m_val;
7480 ye = a_bins[index].m_v_min;
7500 points[0].set_value(xx,yy,a_zz);
7501 points[1].set_value(xe,yy,a_zz);
7502 points[2].set_value(xe,ye,a_zz);
7503 points[3].set_value(xx,ye,a_zz);
7504 points[4].set_value(xx,yy,a_zz);
7517 size_t numPoints = _hatcher.
points().size();
7518 size_t numVertices = _hatcher.
vertices().size();
7519 if((res) && numPoints && numVertices) {
7521 const std::vector<vec3f>& _points = _hatcher.
points();
7529 for(
size_t _index=0;_index<(*itv);_index++) {
7530 vtxs->
add(_points[ipt]);
7542 for(
size_t _index=0;_index<(*itv);_index++) {
7543 vtxs->
add(_points[ipt]);
7563 float xmin = a_box_x.
m_pos;
7565 bool xlog = a_box_x.
m_log;
7567 float ymin = a_box_y.
m_pos;
7569 bool ylog = a_box_y.
m_log;
7590 unsigned int number = a_points.
points();
7591 for(
unsigned int index=0;index<number;index++) {
7595 if((x<0)||(x>1)||(y<0)||(y>1))
continue;
7596 vtxs->
add(x,y,a_zz);
7610 unsigned int number = a_points.
points();
7613 double* xs =
new double[number];
7614 double* ys =
new double[number];
7616 {
for(
unsigned int index=0;index<number;index++) {
7618 xs[index] = x;ys[index] = y;
7622 delete [] xs;
delete [] ys;
7627 float step = (xmx - xmn)/nstp;
7628 std::vector<vec3f>
points(nstp+1);
7629 for(
unsigned int ibin=0;ibin<=nstp;ibin++) {
7630 float xx = xmn + ibin * step;
7631 double val = _spline.
eval(xx);
7632 points[ibin].set_value(xx,
float(val),a_zz);
7636 std::vector<float>& pts = vtxs->
xyzs.
values();
7666 float xmin = a_box_x.
m_pos;
7668 bool xlog = a_box_x.
m_log;
7670 float ymin = a_box_y.
m_pos;
7672 bool ylog = a_box_y.
m_log;
7686 _xyzs = &(_marks->
xyzs);
7697 _xyzs = &(vtxs->
xyzs);
7700 a_out <<
"tools::sg::plotter::rep_points2D_xy_points :"
7710 {
unsigned int number = a_points.
points();
7711 for(
unsigned int index=0;index<number;index++) {
7716 if((x<0)||(x>1)||(y<0)||(y>1))
continue;
7720 _xyzs->
values().resize(npts);
7725 {
unsigned int number = a_points.
points();
7726 for(
unsigned int index=0;index<number;index++) {
7731 if((x<0)||(x>1)||(y<0)||(y>1))
continue;
7746 float xmin = a_box_x.
m_pos;
7748 bool xlog = a_box_x.
m_log;
7750 float ymin = a_box_y.
m_pos;
7752 bool ylog = a_box_y.
m_log;
7754 float zmin = a_box_z.
m_pos;
7756 bool zlog = a_box_z.
m_log;
7770 _xyzs = &(_marks->
xyzs);
7781 _xyzs = &(vtxs->
xyzs);
7784 a_out <<
"tools::sg::plotter::rep_points3D_xy_points :"
7794 {
unsigned int number = a_points.
points();
7795 for(
unsigned int index=0;index<number;index++) {
7801 if((x<0)||(x>1)||(y<0)||(y>1)||(z<0)||(z>1))
continue;
7805 _xyzs->
values().resize(npts);
7810 {
unsigned int number = a_points.
points();
7811 for(
unsigned int index=0;index<number;index++) {
7817 if((x<0)||(x>1)||(y<0)||(y>1)||(z<0)||(z>1))
continue;
7831 float xmin = a_box_x.
m_pos;
7833 bool xlog = a_box_x.
m_log;
7835 float ymin = a_box_y.
m_pos;
7837 bool ylog = a_box_y.
m_log;
7839 float zmin = a_box_z.
m_pos;
7841 bool zlog = a_box_z.
m_log;
7858 float val = rbin.
m_val;
7885 if(yy>=ye)
continue;
7886 if(xx>=xe)
continue;
7887 if(zz>=ze)
continue;
7899 clr = a_style.
color;
7939 const std::vector<rep_top_face2D>& a_faces,
7941 float xmin = a_box_x.
m_pos;
7943 bool xlog = a_box_x.
m_log;
7945 float ymin = a_box_y.
m_pos;
7947 bool ylog = a_box_y.
m_log;
7949 float zmin = a_box_z.
m_pos;
7951 bool zlog = a_box_z.
m_log;
7973 size_t number = a_faces.
size();
7974 for(
size_t index=0;index<number;index++) {
7975 float xx = a_faces[index].m_x_min;
7976 float xe = a_faces[index].m_x_max;
7977 float yy = a_faces[index].m_y_min;
7978 float ye = a_faces[index].m_y_max;
7979 float val1 = a_faces[index].m_v1;
7980 float val2 = a_faces[index].m_v2;
7981 float val3 = a_faces[index].m_v3;
7982 float val4 = a_faces[index].m_v4;
7995 if(val1<0) val1 = 0;
7996 if(val1>1) val1 = 1;
7998 if(val2<0) val2 = 0;
7999 if(val2>1) val2 = 1;
8001 if(val3<0) val3 = 0;
8002 if(val3>1) val3 = 1;
8004 if(val4<0) val4 = 0;
8005 if(val4>1) val4 = 1;
8007 if((xx>=0)&&(xx<=1) &&
8010 (ye>=0)&&(ye<=1) ) {
8013 float v = (zlog?
take_log(val):val);
8018 a_cmap.
get_color(a_faces[index].m_ratio,clr);
8020 clr = a_style.
color;
8028 vtxs->
add(xx,ye,val4);
8029 vtxs->
add(xx,yy,val1);
8030 vtxs->
add(xe,yy,val2);
8046 vtxs->
add(xe,yy,val2);
8047 vtxs->
add(xe,ye,val3);
8048 vtxs->
add(xx,ye,val4);
8050 vtxs->
add_rgba(clr[0],clr[1],clr[2],clr[3]);
8051 vtxs->
add_rgba(clr[0],clr[1],clr[2],clr[3]);
8052 vtxs->
add_rgba(clr[0],clr[1],clr[2],clr[3]);
8076 float xmin = a_box_x.
m_pos;
8078 bool xlog = a_box_x.
m_log;
8080 float ymin = a_box_y.
m_pos;
8082 bool ylog = a_box_y.
m_log;
8084 float zmin = a_box_z.
m_pos;
8086 bool zlog = a_box_z.
m_log;
8092 mat->color = colorf_black();
8105 float zepsilon = 0.02f;
8107 size_t number = a_top_faces.size();
8108 for(
size_t index=0;index<number;index++) {
8109 float xx = a_top_faces[index].m_x_min;
8110 float xe = a_top_faces[index].m_x_max;
8111 float yy = a_top_faces[index].m_y_min;
8112 float ye = a_top_faces[index].m_y_max;
8113 float val1 = a_top_faces[index].m_v1;
8114 float val2 = a_top_faces[index].m_v2;
8115 float val3 = a_top_faces[index].m_v3;
8116 float val4 = a_top_faces[index].m_v4;
8129 if(val1<0) val1 = 0;
8130 if(val1>1) val1 = 1;
8132 if(val2<0) val2 = 0;
8133 if(val2>1) val2 = 1;
8135 if(val3<0) val3 = 0;
8136 if(val3>1) val3 = 1;
8138 if(val4<0) val4 = 0;
8139 if(val4>1) val4 = 1;
8141 if((xx>=0)&&(xx<=1) &&
8144 (ye>=0)&&(ye<=1) ) {
8146 vtxs->
add(xx,ye,val4+zepsilon);
8147 vtxs->
add(xx,yy,val1+zepsilon);
8149 vtxs->
add(xx,yy,val1+zepsilon);
8150 vtxs->
add(xe,yy,val2+zepsilon);
8152 vtxs->
add(xe,yy,val2+zepsilon);
8153 vtxs->
add(xe,ye,val3+zepsilon);
8155 vtxs->
add(xe,ye,val3+zepsilon);
8156 vtxs->
add(xx,ye,val4+zepsilon);
8170 const std::vector<rep_top_face2D>& a_top_faces,
8172 float a_bmin,
float a_bmax){
8175 size_t ncol = a_cmap.
colorn();
8178 float xmin = a_box_x.
m_pos;
8180 bool xlog = a_box_x.
m_log;
8182 float ymin = a_box_y.
m_pos;
8184 bool ylog = a_box_y.
m_log;
8186 float zmin = a_box_z.
m_pos;
8188 bool zlog = a_box_z.
m_log;
8209 float d_z = (zmx-zz)/ncol;
8211 size_t number = a_top_faces.
size();
8213 for(
size_t icol=0;icol<ncol;icol++) {
8218 _color = a_cmap.
color(icol);
8220 for(
size_t index=0;index<number;index++) {
8221 float xx = a_top_faces[index].m_x_min;
8222 float xe = a_top_faces[index].m_x_max;
8223 float yy = a_top_faces[index].m_y_min;
8224 float ye = a_top_faces[index].m_y_max;
8225 float val1 = a_top_faces[index].m_v1;
8226 float val2 = a_top_faces[index].m_v2;
8227 float val3 = a_top_faces[index].m_v3;
8228 float val4 = a_top_faces[index].m_v4;
8241 if(val1<0) val1 = 0;
8242 if(val1>1) val1 = 1;
8244 if(val2<0) val2 = 0;
8245 if(val2>1) val2 = 1;
8247 if(val3<0) val3 = 0;
8248 if(val3>1) val3 = 1;
8250 if(val4<0) val4 = 0;
8251 if(val4>1) val4 = 1;
8253 if((xx>=0)&&(xx<=1) &&
8256 (ye>=0)&&(ye<=1) ) {
8265 float z1 = zz+d_z*icol;
8272 const std::vector<vec3f>& result = clipper.
result();
8275 if(result.size()==3) {
8304 float z1 = zz+d_z*icol;
8311 const std::vector<vec3f>& result = clipper.
result();
8314 if(result.size()==3) {
8357 if(a_obj.
m_TEXT.empty())
return;
8391 float _width = pos2.
x()-pos.
x();
8406 }
else if(a_obj.
m_HJUST==
'C') {
8413 }
else if(a_obj.
m_VJUST==
'M') {
8427 float _height = pos2.
y()-pos.
y();
8442 }
else if(a_obj.
m_HJUST==
'C') {
8449 }
else if(a_obj.
m_VJUST==
'M') {
8475 }
else if(a_obj.
m_HJUST==
'C') {
8482 }
else if(a_obj.
m_VJUST==
'M') {
8496 }
else if(a_obj.
m_HJUST==
'C') {
8503 }
else if(a_obj.
m_VJUST==
'M') {
8543 a_angle_right = 3.0F*
fpi()/4.0F;
8544 a_angle_left =
fpi()/4.0F;
8546 }
else if(code==2) {
8549 a_angle_right = 3.0F*
fpi()/4.0F;
8550 a_angle_left =
fpi()/4.0F;
8552 }
else if(code==3) {
8554 a_spacing = 1.6f*0.07F;
8555 a_angle_right = 3.0F*
fpi()/4.0F;
8556 a_angle_left =
fpi()/4.0F;
8558 }
else if(code==4) {
8560 }
else if(code==5) {
8562 }
else if(code==6) {
8564 }
else if(code==7) {
8566 }
else if(code<=25) {
8570 }
else if(code<=99) {
8581 int j = (code - i * 100)/10;
8582 int k = code - i * 100 - j * 10;
8589 else if((j!=5)&&(k==5))
8591 else if((j==5)&&(k!=5))
8593 else if((j!=5)&&(k!=5))
8596 unsigned int NY = 1;
8598 a_spacing = float(NY) * float(i) * 0.07F;
8601 float angle = float(j==4?45:j*10);
8602 angle = 180.0F - angle;
8603 angle *=
fpi() / 180.0F;
8605 a_angle_right = angle;
8609 float angle = float(k==4?45:k*10);
8610 angle *=
fpi() / 180.0F;
8611 a_angle_left = angle;
8617 float xx,
float yy,
float xe,
float ye,
float a_zz){
8626 points[0].set_value(xx,yy,a_zz);
8627 points[1].set_value(xe,yy,a_zz);
8628 points[2].set_value(xe,ye,a_zz);
8629 points[3].set_value(xx,ye,a_zz);
8630 points[4].set_value(xx,yy,a_zz);
8642 size_t numPoints = _hatcher.
points().size();
8643 size_t numVertices = _hatcher.
vertices().size();
8644 if((res) && numPoints && numVertices) {
8646 const std::vector<vec3f>& _points = _hatcher.
points();
8648 if(a_strip_width==0) {
8653 for(
size_t index=0;index<(*itv);index++) {
8654 vtxs->
add(_points[ipt]);
8666 for(
size_t index=0;index<(*itv);index++) {
8667 vtxs->
add(_points[ipt]);
8720 vtxs->
add(pos1[0],pos1[1],z);
8721 vtxs->
add(pos2[0],pos1[1],z);
8722 vtxs->
add(pos2[0],pos2[1],z);
8723 vtxs->
add(pos1[0],pos2[1],z);
8724 vtxs->
add(pos1[0],pos1[1],z);
8743 vtxs->
add(pos1[0],pos1[1],z);
8744 vtxs->
add(pos2[0],pos1[1],z);
8745 vtxs->
add(pos2[0],pos2[1],z);
8746 vtxs->
add(pos1[0],pos2[1],z);
8763 float stripWidth = 0;
8766 rep_box_hatch(*
sep,spacing,angle_right,stripWidth,pos1[0],pos1[1],pos2[0],pos2[1],z);
8769 rep_box_hatch(*
sep,spacing,angle_left,stripWidth,pos1[0],pos1[1],pos2[0],pos2[1],z);
8779 vtxs->
add(pos1[0],pos1[1],z);
8780 vtxs->
add(pos2[0],pos1[1],z);
8781 vtxs->
add(pos2[0],pos2[1],z);
8782 vtxs->
add(pos1[0],pos2[1],z);
8804 vtxs->
add(pos1[0],pos1[1],z);
8805 vtxs->
add(pos2[0],pos1[1],z);
8806 vtxs->
add(pos2[0],pos2[1],z);
8807 vtxs->
add(pos1[0],pos2[1],z);
8808 vtxs->
add(pos1[0],pos1[1],z);
8814 a_out <<
"tools::sg::plotter::update_plottable_box FAIS PATTERN not yet handled." << std::endl;
8831 float rx = pos2[0]-pos[0];
8832 float ry = pos2[1]-pos[1];
8954 a_out <<
"tools::sg::plotter::update_plottable_box FAIS " << a_obj.
m_FAIS <<
" not yet handled." << std::endl;
8971 float scale = 2.0f*(
top[1]-pos[1]);
8983 mat->color = colorf_white();
9031 static float verify_log(
float a_val,
float a_min,
float a_dx,
bool a_log){
9034 return (
flog10(a_val) - a_min)/a_dx;
9041 if(a_val>(a_min+100.0F * a_dx))
return 100;
9042 if(a_val<(a_min-100.0F * a_dx))
return -100;
9044 return (a_val - a_min)/a_dx;
9050 return fpow(10,a_val*a_dx+a_min);
9052 return a_val*a_dx+a_min;
9059 return new style(_style);
9065 return new style(_style);
9071 return new style(_style);
9077 return new style(_style);
9083 return new style(_style);
9089 return new style(_style);
9133 {std::vector<plottable*>::iterator it;
9159 {std::vector<plotprim*>::iterator it;
9170 if(!
object)
continue;
9171 if(
bins1D* b1 = safe_cast<plottable,bins1D>(*
object)) {
9175 }
else if(
bins2D* b2 = safe_cast<plottable,bins2D>(*
object)) {
9189 if(!
object)
continue;
9190 if(
func1D* f1 = safe_cast<plottable,func1D>(*
object)) {
9194 }
else if(
func2D* f2 = safe_cast<plottable,func2D>(*
object)) {
9208 if(!
object)
continue;
9209 if(
points2D* p2 = safe_cast<plottable,points2D>(*
object)) {
9213 }
else if(
points3D* p3 = safe_cast<plottable,points3D>(*
object)) {
9240 static void add_pt(std::vector<float>& a_pts,
float a_x,
float a_y,
float a_z){
9241 a_pts.push_back(a_x);
9242 a_pts.push_back(a_y);
9243 a_pts.push_back(a_z);
9247 const rep_box& a_box_x,
const rep_box& a_box_y,std::vector<float>& a_pts) {
9248 float xmin = a_box_x.
m_pos;
9250 bool xlog = a_box_x.
m_log;
9252 float ymin = a_box_y.
m_pos;
9254 bool ylog = a_box_y.
m_log;
9260 const vec3f& _point = *it;
9266 if((xx>=0)&&(xx<=1)&&(yy>=0)&&(yy<=1))
add_pt(a_pts,xx,yy,zz);
9271 const rep_box& a_box_x,
const rep_box& a_box_y,std::vector<float>& a_pts) {
9279 float xmin = a_box_x.
m_pos;
9281 bool xlog = a_box_x.
m_log;
9283 float ymin = a_box_y.
m_pos;
9285 bool ylog = a_box_y.
m_log;
9292 {
unsigned int index = 0;
9293 std::vector<vec3f>::const_iterator it;
9294 for(it=a_points.begin();it!=a_points.end();++it,index++) {
9295 const vec3f& _point = *it;
9296 float xx = _point[0];
9297 float yy = _point[1];
9298 float zz = _point[2];
9302 if((xx>=0)&&(xx<=1) ) {
9309 }
else if(yprev<0) {
9310 float a = (yy - yprev)/(xx - xprev);
9311 float b = yy - a * xx;
9313 add_pt(a_pts,(1 - b)/a,1,zz);
9316 float a = (yy - yprev)/(xx - xprev);
9317 float b = yy - a * xx;
9318 add_pt(a_pts,(1 - b)/a,1,zz);
9322 }
else if (yy < 0) {
9328 }
else if(yprev>1) {
9329 float a = (yy - yprev)/(xx - xprev);
9330 float b = yy - a * xx;
9331 add_pt(a_pts,(1 - b)/a,1,zz);
9335 float a = (yy - yprev)/(xx - xprev);
9336 float b = yy - a * xx;
9344 }
else if( (yprev>1) || (yprev<0) ) {
9346 float a = (yy - yprev)/(xx - xprev);
9347 float b = yy - a * xx;
9349 add_pt(a_pts,(1 - b)/a,1,zz);
9365 std::vector<std::string> ws;
9366 words(a_s,
" ",
false,ws);
9367 if(ws.size()!=2)
return false;
9369 if(!to<float>(ws[0],x))
return false;
9371 if(!to<float>(ws[1],x))
return false;
9378 else if(a_s==
"axis") {a_v =
unit_axis;
return true;}
9383 {std::vector<base_colormap*>::iterator it;
9387 {std::vector<base_colormap*>::iterator it;
9391 {std::vector<base_colormap*>::iterator it;
9397 float& a_beg,
float& a_end){
9398 float xe = (a_end - a_beg)*a_bar_offset;
9399 float xw = (a_end - a_beg)*a_bar_width;
9400 a_end = a_beg + xe + xw;