Index: src/graphics.h.in =================================================================== RCS file: /cvs/octave/src/graphics.h.in,v retrieving revision 1.50 diff -c -p -r1.50 graphics.h.in *** src/graphics.h.in 28 Jan 2008 22:42:19 -0000 1.50 --- src/graphics.h.in 30 Jan 2008 13:34:55 -0000 *************** public: *** 1274,1279 **** --- 1274,1280 ---- octave_value get_buttondownfcn (void) const { return buttondownfcn.get (); } + bool is_clipping (void) const { return clipping.is_on (); } std::string get_clipping (void) const { return clipping.current_value (); } void execute_createfcn (const octave_value& data = octave_value ()) const *************** private: *** 2166,2171 **** --- 2167,2222 ---- // --------------------------------------------------------------------- + class OCTINTERP_API graphics_xform + { + public: + graphics_xform (void) + : xform (xform_eye ()), xform_inv (xform_eye ()) + { + sx = sy = sz = "linear"; + } + + graphics_xform (const Matrix& xm, const Matrix& xim, + const scaler& x, const scaler& y, const scaler& z) + : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z) { } + + graphics_xform (const graphics_xform& g) + : xform (g.xform), xform_inv (g.xform_inv), sx (g.sx), + sy (g.sy), sz (g.sz) { } + + ~graphics_xform (void) { } + + graphics_xform& operator = (const graphics_xform& g) + { + xform = g.xform; + xform_inv = g.xform_inv; + sx = g.sx; + sy = g.sy; + sz = g.sz; + + return *this; + } + + static ColumnVector xform_vector (double x, double y, double z); + + static Matrix xform_eye (void); + + ColumnVector transform (double x, double y, double z, + bool scale = true) const; + + ColumnVector untransform (double x, double y, double z, + bool scale = true) const; + + Matrix xscale (const Matrix& m) const { return sx.scale (m); } + Matrix yscale (const Matrix& m) const { return sy.scale (m); } + Matrix zscale (const Matrix& m) const { return sz.scale (m); } + + private: + Matrix xform; + Matrix xform_inv; + scaler sx, sy, sz; + }; + class OCTINTERP_API axes : public base_graphics_object { public: *************** public: *** 2192,2197 **** --- 2243,2257 ---- update_camera (); } + graphics_xform get_transform (void) const + { return graphics_xform (x_render, x_render_inv, sx, sy, sz); } + + Matrix get_transform_matrix (void) const { return x_render; } + Matrix get_inverse_transform_matrix (void) const { return x_render_inv; } + Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; } + Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; } + Matrix get_transform_zlim (void) const { return x_zlim; } + private: scaler sx, sy, sz; Matrix x_render, x_render_inv; Index: src/graphics.cc =================================================================== RCS file: /cvs/octave/src/graphics.cc,v retrieving revision 1.80 diff -c -p -r1.80 graphics.cc *** src/graphics.cc 28 Jan 2008 22:42:19 -0000 1.80 --- src/graphics.cc 30 Jan 2008 13:34:55 -0000 *************** axes::properties::get_boundingbox (void) *** 2068,2073 **** --- 2070,2113 ---- return pos; } + ColumnVector + graphics_xform::xform_vector (double x, double y, double z) + { return ::xform_vector (x, y, z); } + + Matrix + graphics_xform::xform_eye (void) + { return ::xform_matrix (); } + + ColumnVector + graphics_xform::transform (double x, double y, double z, + bool use_scale) const + { + if (use_scale) + { + x = sx.scale (x); + y = sy.scale (y); + z = sz.scale (z); + } + + return ::transform (xform, x, y, z); + } + + ColumnVector + graphics_xform::untransform (double x, double y, double z, + bool use_scale) const + { + ColumnVector v = ::transform (xform_inv, x, y, z); + + if (use_scale) + { + v(0) = sx.unscale (v(0)); + v(1) = sy.unscale (v(1)); + v(2) = sz.unscale (v(2)); + } + + return v; + } + octave_value axes::get_default (const caseless_str& name) const {