-----Original Message----- From: Ted Hill Sent: Thursday, June 09, 2005 11:38 AM To: 'Alexey Ushakov' Subject: RE: [JAVA2D] AffineTransform question
Hi Alexey, The value that I am looking for is the double value to pass to AffineTransform scaleAtx = AffineTransform.getScaleInstance(double, double) So that when scaleAtx is preconcatenated with myCurrentTransform, we can precisely control the resulting value from passing myCurrentTransform to this method: public static double getScaleYElement(final AffineTransform atx) { double scaleYElement = 0; final double scaleY = atx.getScaleY(); final double shearY = atx.getShearY(); scaleYElement = Math.sqrt(Math.pow(scaleY, 2) + Math.pow(shearY, 2)); return scaleYElement; } -----Original Message----- From: Discussion list for Java 2D API [mailto:[EMAIL PROTECTED] On Behalf Of Alexey Ushakov Sent: Thursday, June 09, 2005 10:56 AM To: [EMAIL PROTECTED] Subject: Re: [JAVA2D] AffineTransform question Hello Ted, Applying scaling means simply multiplication diagonal coefficients of the transform matrix to the specified scaling values. > So my logic should be like this > > if(currentScaleY < SCALE_MAX) > { > AffineTransform tempAtx = new AffineTransform(currentTransform); > tempAtx.preConcatenate(scaleIncrementAtx); > > if(getScaleYElement(getScaleYElement(tempAtx)) < SCALE_MAX) > { > currentTransform.preConcatenate(scaleIncrementAtx); > } > else // calc the increment that will result in max scale > value > { > // ?? how to calc zoomIncrement in this case ?? > zoomIncrement = ?? So, if I understood your task correctly zoomIncrement should be SCALE_MAX/currentScaleY. > > AffineTransform adjustedIncrementAtx = > AffineTransform.getScaleInstance(zoomIncrement, zoomIncrement); > > currentTransform.preConcatenate(adjustedIncrementAtx); > } > } BTW, you could use following check currentScaleY + scaleIncrementAtx < SCALE_MAX/currentScaleY instead of > if(getScaleYElement(getScaleYElement(tempAtx)) < SCALE_MAX) > { Best Regards, Alexey ======================================================================== === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".