publicclass PolygonAdd { publicstaticvoid main(String argv[]) { // Original shapes: 4 touching rectangles // (area works correctly with them if not transformed)
Shape b = new Rectangle(0,0,100,10);
Shape t = new Rectangle(0,90,100,10);
Shape l = new Rectangle(0,10,10,80);
Shape r = new Rectangle(90,10,10,80);
// Create a transform to rotate them by 10 degrees
AffineTransform M = new AffineTransform();
M.translate(-50,-50);
M.scale(3,3);
M.rotate(Math.toRadians(10));
M.translate(70,40);
Area area = new Area();
area.add(new Area(M.createTransformedShape(b)));
area.add(new Area(M.createTransformedShape(l)));
area.add(new Area(M.createTransformedShape(t)));
area.add(new Area(M.createTransformedShape(r)));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.