From: Frank v. d. H. <dri...@gm...> - 2014-10-08 04:42:20
|
Hi Greg, Not a lot of information to go on, so some generalities... If you're scaling the object (e.g. an icon or image) relative to map, you need to translate the origin of the object to the origin of the map, then rotate and scale, then translate to the correct location. Otherwise your translation gets scaled and rotated. And just to cover the obvious, I assume that your geoRotate is in degrees. And in mathematical degrees (0 = X axis, CCW is +ve) as opposed to geographical degrees (0 is the Y axis, clockwise is positive). Frank On Wed, Oct 8, 2014 at 4:08 PM, Greg Knight <gre...@gm...> wrote: > Greetings, > > I'm using v10.6 of GeoTools. I am trying to do something that I think > should be relatively simple -- but perhaps I dont understand matrices well > enough. I am trying to translate, scale, and rotate a point. Translation > seems easy enough -- like I should be able to add the x and y offsets, then > scale and rotate around that same offset. > > So Ive tried a number of things similar to this: > > final AffineTransform translateTransform = > > AffineTransform.getTranslateInstance(geoX, geoY); > > final AffineTransform rotateTransform = > > > AffineTransform.getRotateInstance(Math.toRadians(geoRotate), 0.0, 0.0); > > final AffineTransform scaleTransform = > > AffineTransform.getScaleInstance(geoScale, geoScale); > > Then something like this: > > final Point2D sourcePoint = outerRing.get(j); > > > > // translate, rotate, scale > > final AffineTransform transform = new > AffineTransform(translateTransform); > > transform.concatenate(rotateTransform); > > transform.concatenate(scaleTransform); > > > > final Point2D targetPoint = new Point2D(); > > transform.transform(sourcePoint, targetPoint); > > For a source point of [ -95.75, 224.45 ] > > > The correct transformation should result in [ 716731.24, 3016405.92 ] > > Im getting [ 716942.89, 3016333.19 ] which is in the neighborhood, but > not really close enough. > > Where am I going wrong here? > > Thanks in advance! > > Greg > > > > > > > ------------------------------------------------------------------------------ > Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer > Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports > Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper > Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer > > http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > |