private void orient( final GL2 gl ) { if( this.config.getOrientation()[0] != 0 ) { gl.glMatrixMode( GLMatrixFunc.GL_MODELVIEW ); final double[] o = this.config.getOrientation(); for( int i = 0; i < o.length; i+=4 ) gl.glRotated( o[i], o[i+1], o[i+2], o[i+3] ); } }
/** * Default constructor */ public AxesRenderer2D() { this.xAxisConfig.setOrientation( new double[] { 0 } ); this.yAxisConfig.setOrientation( new double[] { this.xAxisConfig.getOrientation()[0]-Math.PI/2d } ); }
/** * Set the orientation of the x axis * @param rads angle in radians */ public void setOrientation( final double rads ) { this.xAxisConfig.setOrientation( new double[] { rads } ); this.yAxisConfig.setOrientation( new double[] { this.xAxisConfig.getOrientation()[0]-Math.PI/2d } ); }
@Override public void precalc() { // Create an axis line between the min and max value this.axisLine = new Line2d( (float)this.config.getMinValue(), 0, (float)this.config.getMaxValue(), 0 ); // Transform to (0,0) in data units this.transform = TransformUtilities.translateMatrix( -this.config.getMinValue(), 0 ); // Scale to pixels this.currentScale = this.axisLength / (this.config.getMaxValue() - this.config.getMinValue()); this.transform = TransformUtilities.scaleMatrix( (float)this.currentScale, 1 ) .times(this.transform); // Rotate to the preferred orientation this.transform = TransformUtilities.rotationMatrix( this.config.getOrientation()[0] ) .times(this.transform); // Translate to the preferred position this.transform = TransformUtilities.translateMatrix( this.config.getLocation()[0], this.config.getLocation()[1] ) .times( this.transform ); // Transform the axis this.axisLine = this.axisLine.transform( this.transform ); }
.times( this.dataTransformMatrix ); this.dataTransformMatrix = TransformUtilities.rotationMatrix( this.xAxisConfig.getOrientation()[0] ).times( this.dataTransformMatrix ); this.dataTransformMatrix = TransformUtilities.translateMatrix( xLoc[0], xLoc[1] ) .times( this.dataTransformMatrix );