public static Triangle createTriangle ( Geometry geom ) throws IllegalArgumentException { Coordinate [ ] coordinates = geom . getCoordinates ( ) ; if ( coordinates . length != 4 ) { throw new IllegalArgumentException ( "The geometry must be a triangle" ) ; } return new Triangle ( coordinates [ 0 ] , coordinates [ 1 ] , coordinates [ 2 ] ) ; }
A factory to create a DTriangle from a Geometry