Hello Enrico,

You might also like to have a look at the very useful JTS
GeometricShapeFactory class. Here is an example based on your
description...

    // two reference points
    Coordinate c0 = new Coordinate( x0, y0 );
    Coordinate c1 = new Coordinate( x1, y1 );

    // length of perpendicular dimension
    double dist = ...

    GeometricShapeFactory shapeFactory = new GeometricShapeFactory();

    Coordinate centre = new Coordinate(
            c0.x + (c1.x - c0.x) / 2,
            c0.y + (c1.y - c0.y) / 2);

    shapeFactory.setCentre( centre );

    shapeFactory.setWidth( c0.distance( c1 ) );
    shapeFactory.setHeight( dist );

    double radians = Math.atan2( c1.y - c0.y, c1.x - c0.x );
    shapeFactory.setRotation( radians );
    Geometry rect = shapeFactory.createRectangle();

Michael

------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide.  Store less, Store more with what you own, Move data to 
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to