using namespace std; #include #include class boxworld { public: int XDIM; // virtual 3d dimensions int YDIM; int ZDIM; // zoom ratio - right now, not tied to ZDIM, but probably should! double ZR; double tiltR; // tilt angle in radians // shortening ratio (scales z axis): usually should set to one: double SR; int xshift; // static display shift values int yshift; double toRadians(int degrees); void setSR(double s); void setZR(double z); void tilt(int d); boxworld(int xd, int yd, int zd, double zr0, int trd); boxworld(int xd, int yd, int zd, double zr0, int trd, double sr0); // critical function to convert 3d coordinate to 2d coordinate stored in // x2 and y2; returns 0 on success int point(int x, int y, int z, int *x2, int *y2); // draws box onto win, using color gc, (x0,y0,z0) is top, left // near corner of box, and xd, yd, zd are the dimension of each edge void drawbox(Glib::RefPtr win, int x0, int y0, int z0, int xd, int yd, int zd, Glib::RefPtr gc); // draws line on win, color gc, between (x0,y0,z0) and (x1,y1,z1) void drawline(Glib::RefPtr win, int x0, int y0, int z0, int x1, int y1, int z1, Glib::RefPtr gc); // draws circle on win, color gc, filled=true||false, with center at // (x0,y0,z0) and radius r void drawcircle(Glib::RefPtr win, bool filled, int x0, int y0, int z0, double r, Glib::RefPtr gc); double dscale(double x, double z0); void drawimage(Glib::RefPtr win, Glib::RefPtr gc, Glib::RefPtr image, int x, int y, int z, int w, int h); void drawimage(Glib::RefPtr win, Glib::RefPtr gc, Glib::RefPtr image, int x, int y, int z); // suggested window width and height int wwidth(); int wheight(); }; // boxworld