//!Apply an OpenGL scale matrix to this public GLMatrix4d applyScale(GLVector2d scale) { //improved version //Assuming z = 1 m[0] *= scale.x; m[1] *= scale.x; m[2] *= scale.x; m[3] *= scale.x; m[4] *= scale.y; m[5] *= scale.y; m[6] *= scale.y; m[7] *= scale.y; return(this); }
//!Apply an OpenGL translate matrix to this public GLMatrix4d applyTranslate(GLVector2d trans) { ////improved version ////assuming z = 0 m[12] += m[0] * trans.x + m[4] * trans.y; m[13] += m[1] * trans.x + m[5] * trans.y; m[14] += m[2] * trans.x + m[6] * trans.y; return(this); }
//!Apply an OpenGL translate matrix to this public GLMatrix4d applyTranslate( GLVector2d trans) { ////improved version ////assuming z = 0 m[12] += m[0]*trans.x + m[4]*trans.y; m[13] += m[1]*trans.x + m[5]*trans.y; m[14] += m[2]*trans.x + m[6]*trans.y; return this; }
//!Apply an OpenGL scale matrix to this public GLMatrix4d applyScale( GLVector2d scale) { //improved version //Assuming z = 1 m[0]*=scale.x; m[1]*=scale.x; m[2]*=scale.x; m[3]*=scale.x; m[4]*=scale.y; m[5]*=scale.y; m[6]*=scale.y; m[7]*=scale.y; return this; }
//!Copy a vector public GLVector2d( GLVector2d gv) { Buffer.BlockCopy( gv.val, 0, val, 0, Buffer.ByteLength( gv.val ) ); }
//!Get the vector projection of this and a vector public GLVector2d vectorProjection( GLVector2d vin) { return this * dot(vin); }
//!Get the projection of this and a vector public double projection( GLVector2d vin) { return dot(vin); }
//!Get the orthogonal projection of this and a vector public GLVector2d orthogonalProjection( GLVector2d vin) { return vin - vectorProjection(vin); }
//!Get the dot product of this and a vector public double dot( GLVector2d gv) { return x*gv.x + y*gv.y; }
//!Copy a vector public GLVector2d(GLVector2d gv) { Buffer.BlockCopy(gv.val, 0, val, 0, Buffer.ByteLength(gv.val)); }
//!Get the vector projection of this and a vector public GLVector2d vectorProjection(GLVector2d vin) { return(this * dot(vin)); }
//!Get the orthogonal projection of this and a vector public GLVector2d orthogonalProjection(GLVector2d vin) { return(vin - vectorProjection(vin)); }
//!Get the projection of this and a vector public double projection(GLVector2d vin) { return(dot(vin)); }
//!Get the dot product of this and a vector public double dot(GLVector2d gv) { return(x * gv.x + y * gv.y); }