Files Classes Functions Hierarchy
#include <windowscaleD2.h>
Public Member Functions | |
| windowscaleD2 () | |
| Construct in a bad state. | |
| windowscaleD2 (doublec xmin_, doublec xmax_, doublec ymin_, doublec ymax_) | |
| Create the window. | |
| void | construct (doublec xmin_, doublec xmax_, doublec ymin_, doublec ymax_) |
| Create the window. | |
| doublec | widthoverheight () const |
| Get the width divided by height ratio. | |
| doublec | heightoverwidth () const |
| Get the height divided by width ratio. | |
| boolc | isinside (doublec x, doublec y) const |
| Is the point inside the box? | |
| void | update () |
| Recalculate after changes to window dimensions. | |
| boolc | convertfrom (double &x, double &y, windowscaleD2 const &w2) const |
| Convert (x,y) from other window to this one. | |
| boolc | unitscale (double &x, double &y) const |
| Converts to ratio point in S to S'. | |
| void | unitscaleInverse (double &x, double &y) const |
| Converts the ratio point in S' to S. | |
| void | unitscaleInverse_x (double &x) const |
| Convert from ratio in x-axis only. | |
| void | unitscaleInverse_y (double &y) const |
| Convert from ratio in y-axis only. | |
| void | shiftx (doublec x) |
| Translate the window in the X-axis. | |
| void | shifty (doublec y) |
| Translate the window in the Y-axis. | |
| void | shiftxy (doublec x, doublec y) |
| Translate the window in the X and Y axes. | |
| void | shiftquadrant1 () |
| Move the window so bottom left of the window is at the origin. | |
| void | shiftquadrant2 () |
| Move the window so bottom right of the window is at the origin. | |
| void | shiftquadrant3 () |
| Move the window so top right of the window is at the origin. | |
| void | shiftquadrant4 () |
| Move the window so top left of the window is at the origin. | |
| void | shiftcenterx () |
| Center the window in the X-axis. | |
| void | shiftcentery () |
| Center the window in the Y-axis. | |
| void | shiftcenterxy () |
| Center the window in the X and Y axes. | |
| void | scalex (doublec scale) |
| Multiply xmin, xmax by scale. | |
| void | scaley (doublec scale) |
| Multiply ymin, ymax by scale. | |
| void | scalexy (doublec scale) |
| Multiply xmin, xmax, ymin, ymax by scale. | |
| operator stringc () const | |
| Serialize this object by writing it out as a string. | |
| void | serializeInverse (stringc &s) |
| Construct object from a string. | |
| void | unitwindow () |
| (0,0) (1,1) | |
Public Attributes | |
| double | xmin |
| x left | |
| double | ymin |
| y bottom | |
| double | xmax |
| x right | |
| double | ymax |
| y top | |
| double | oneoverxlength |
| 1/(xmax-xmin) | |
| double | oneoverylength |
| 1/(ymax-ymin) | |
Static Public Attributes | |
| static windowscaleD2 | unit |
| Unit window at 1st quadrant. | |
| static windowscaleD2 | unitcentered |
| Unit window with center at origin. | |
Let S be the coordinate space. Let S' be the same space scaled: (xmin,ymin) to (0,0). (xmax,ymax) to (1,1).
Definition at line 22 of file windowscaleD2.h.
| windowscaleD2::windowscaleD2 | ( | ) |
| boolc windowscaleD2::convertfrom | ( | double & | x, | |
| double & | y, | |||
| windowscaleD2 const & | w2 | |||
| ) | const |
Convert (x,y) from other window to this one.
Definition at line 271 of file windowscaleD2.cpp.
References unitscale().
Referenced by pointsgraph::draw(), and windowscaleD2test::test001().
00276 { 00277 bool res=true; 00278 00279 //double x2(x); 00280 //double y2(y); 00281 res &= w2.unitscale(x,y); 00282 unitscaleInverse(x,y); 00283 00284 return res; 00285 }
| doublec windowscaleD2::heightoverwidth | ( | ) | const |
Is the point inside the box?
Definition at line 104 of file windowscaleD2.cpp.
References xmax, xmin, ymax, and ymin.
Referenced by pointsgraph::draw(), and windowscaleD2test::test001().
00105 { 00106 //cout << "isinside" << SHOW(x) << " " << SHOW(y) << endl; 00107 if (x+zero<double>::val<xmin) 00108 return false; 00109 00110 if (x>xmax+zero<double>::val) 00111 return false; 00112 00113 if (y+zero<double>::val<ymin) 00114 return false; 00115 00116 if (y>ymax+zero<double>::val) 00117 return false; 00118 00119 return true; 00120 }
| windowscaleD2::operator stringc | ( | ) | const |
Serialize this object by writing it out as a string.
Definition at line 231 of file windowscaleD2.cpp.
References stringto(), xmax, xmin, ymax, and ymin.
00232 { 00233 string s; 00234 string s2; 00235 00236 stringto(s2,xmin); 00237 s += s2; 00238 s += " "; 00239 00240 stringto(s2,ymin); 00241 s += s2; 00242 s += " "; 00243 00244 stringto(s2,xmax); 00245 s += s2; 00246 s += " "; 00247 00248 stringto(s2,ymax); 00249 s += s2; 00250 00251 return s; 00252 }
| void windowscaleD2::scalex | ( | doublec | scale | ) |
| void windowscaleD2::scalexy | ( | doublec | scale | ) |
Multiply xmin, xmax, ymin, ymax by scale.
Definition at line 214 of file windowscaleD2.cpp.
References scalex(), and scaley().
Referenced by windowscaleD2test::test001().
| void windowscaleD2::scaley | ( | doublec | scale | ) |
| void windowscaleD2::serializeInverse | ( | stringc & | s | ) |
Construct object from a string.
Definition at line 254 of file windowscaleD2.cpp.
References update(), xmax, xmin, ymax, and ymin.
Referenced by windowscaleD2test::test001().
00255 { 00256 stringstream ss(s); 00257 ss >> xmin; 00258 ss >> ymin; 00259 ss >> xmax; 00260 ss >> ymax; 00261 00262 //cout << SHOW(xmin) << endl; 00263 //cout << SHOW(ymin) << endl; 00264 //cout << SHOW(xmax) << endl; 00265 //cout << SHOW(ymax) << endl; 00266 00267 update(); 00268 }
| void windowscaleD2::shiftcenterx | ( | ) |
Center the window in the X-axis.
Definition at line 184 of file windowscaleD2.cpp.
References shiftx(), xmax, and xmin.
Referenced by shiftcenterxy().
| void windowscaleD2::shiftcenterxy | ( | ) |
Center the window in the X and Y axes.
Definition at line 196 of file windowscaleD2.cpp.
References shiftcenterx(), and shiftcentery().
00197 { 00198 shiftcenterx(); 00199 shiftcentery(); 00200 }
| void windowscaleD2::shiftcentery | ( | ) |
Center the window in the Y-axis.
Definition at line 190 of file windowscaleD2.cpp.
References shifty(), ymax, and ymin.
Referenced by shiftcenterxy().
| void windowscaleD2::shiftquadrant1 | ( | ) |
| void windowscaleD2::shiftquadrant2 | ( | ) |
| void windowscaleD2::shiftquadrant3 | ( | ) |
| void windowscaleD2::shiftquadrant4 | ( | ) |
| void windowscaleD2::shiftx | ( | doublec | x | ) |
Translate the window in the X-axis.
Definition at line 146 of file windowscaleD2.cpp.
Referenced by shiftcenterx(), and shiftxy().
Translate the window in the X and Y axes.
Definition at line 158 of file windowscaleD2.cpp.
References shiftx(), and shifty().
Referenced by shiftquadrant1(), shiftquadrant2(), shiftquadrant3(), shiftquadrant4(), and windowscaleD2test::test002().
| void windowscaleD2::shifty | ( | doublec | y | ) |
Translate the window in the Y-axis.
Definition at line 152 of file windowscaleD2.cpp.
Referenced by shiftcentery(), and shiftxy().
| boolc windowscaleD2::unitscale | ( | double & | x, | |
| double & | y | |||
| ) | const |
Converts to ratio point in S to S'.
Definition at line 47 of file windowscaleD2.cpp.
References oneoverxlength, oneoverylength, xmin, and ymin.
Referenced by convertfrom().
00048 { 00049 bool res=true; 00050 00051 assert(oneoverxlength!=0); 00052 assert(oneoverylength!=0); 00053 x = (x-xmin)*oneoverxlength; 00054 y -= ymin; 00055 y *= oneoverylength; 00056 //y = (y-ymin)*oneoverylength; 00057 00058 /* 00059 if (unitscale_inside) 00060 { 00061 assert(x>=0.0); 00062 assert(y>=0.0); 00063 assert(x<=1.0); 00064 assert(y<=1.0); 00065 } 00066 */ 00067 00068 //TODO 00069 res &= (x+zero<double>::val>=0.0); 00070 res &= (y+zero<double>::val>=0.0); 00071 res &= (x<=(double)1.0+zero<double>::val); 00072 res &= (y<=(double)1.0+zero<double>::val); 00073 00074 #ifndef NDEBUG 00075 //if (isinside(x,y)==false) 00076 //{ 00077 // cout << "*this=" << (stringc)(*this) << endl; 00078 // cout << SHOW(x) << " " SHOW(y) << endl; 00079 // cout << SHOW(ymax-y) << endl; 00080 //} 00081 #endif 00082 00083 //assert( isinside(x,y) ); 00084 return res; 00085 }
| void windowscaleD2::unitscaleInverse | ( | double & | x, | |
| double & | y | |||
| ) | const |
| void windowscaleD2::unitscaleInverse_x | ( | double & | x | ) | const |
Convert from ratio in x-axis only.
Definition at line 93 of file windowscaleD2.cpp.
Referenced by pointsgraph::samplefunction().
| void windowscaleD2::unitscaleInverse_y | ( | double & | y | ) | const |
| void windowscaleD2::unitwindow | ( | ) |
| void windowscaleD2::update | ( | ) |
Recalculate after changes to window dimensions.
Definition at line 135 of file windowscaleD2.cpp.
References oneoverxlength, oneoverylength, xmax, xmin, ymax, and ymin.
Referenced by pointsgraph::domain(), pointsgraph::screen_rescaley(), serializeInverse(), unitwindow(), and pointsgraph::update().
00136 { 00137 oneoverxlength = (double)1.0; 00138 oneoverxlength /= (double)(xmax-xmin); 00139 oneoverylength = (double)1.0; 00140 oneoverylength /= (double)(ymax-ymin); 00141 00142 assert(oneoverxlength!=0); 00143 assert(oneoverylength!=0); 00144 }
| doublec windowscaleD2::widthoverheight | ( | ) | const |
1/(xmax-xmin)
Definition at line 63 of file windowscaleD2.h.
Referenced by unitscale(), and update().
1/(ymax-ymin)
Definition at line 65 of file windowscaleD2.h.
Referenced by unitscale(), and update().
windowscaleD2 windowscaleD2::unit [static] |
windowscaleD2 windowscaleD2::unitcentered [static] |
Unit window with center at origin.
Definition at line 30 of file windowscaleD2.h.
Referenced by windowscaleD2test::test001().
| double windowscaleD2::xmax |
x right
Definition at line 37 of file windowscaleD2.h.
Referenced by pointsgraph::domain(), heightoverwidth(), isinside(), operator stringc(), scalex(), pointsgraph::screen_rescaley(), serializeInverse(), shiftcenterx(), shiftquadrant2(), shiftquadrant3(), shiftx(), windowscaleD2test::test002(), unitscaleInverse(), unitscaleInverse_x(), unitwindow(), update(), and widthoverheight().
| double windowscaleD2::xmin |
x left
Definition at line 33 of file windowscaleD2.h.
Referenced by pointsgraph::domain(), heightoverwidth(), isinside(), operator stringc(), scalex(), pointsgraph::screen_rescaley(), serializeInverse(), shiftcenterx(), shiftquadrant1(), shiftquadrant4(), shiftx(), windowscaleD2test::test002(), unitscale(), unitscaleInverse(), unitscaleInverse_x(), unitwindow(), update(), and widthoverheight().
| double windowscaleD2::ymax |
y top
Definition at line 39 of file windowscaleD2.h.
Referenced by heightoverwidth(), isinside(), operator stringc(), scaley(), pointsgraph::screen_rescaley(), serializeInverse(), shiftcentery(), shiftquadrant3(), shiftquadrant4(), shifty(), unitscaleInverse(), unitscaleInverse_y(), unitwindow(), update(), and widthoverheight().
| double windowscaleD2::ymin |
y bottom
Definition at line 35 of file windowscaleD2.h.
Referenced by heightoverwidth(), isinside(), operator stringc(), scaley(), pointsgraph::screen_rescaley(), serializeInverse(), shiftcentery(), shiftquadrant1(), shiftquadrant2(), shifty(), unitscale(), unitscaleInverse(), unitscaleInverse_y(), unitwindow(), update(), and widthoverheight().
1.5.8