Search in sources :

Example 1 with TriangleImpl

use of com.revolsys.geometry.model.util.TriangleImpl in project com.revolsys.open by revolsys.

the class TriangleTest method checkLongestSideLength.

public void checkLongestSideLength(final String wkt, final double expectedValue) throws Exception {
    final Geometry g = this.geometryFactory.geometry(wkt);
    final TriangleImpl t = newTriangle(g);
    double length = Triangles.longestSideLength(t.p0, t.p1, t.p2);
    // System.out.println("(Static) longestSideLength = " + length);
    assertEquals(expectedValue, length, 0.00000001);
    // Test Instance version
    // 
    length = t.longestSideLength();
    // System.out.println("(Instance) longestSideLength = " + length);
    assertEquals(expectedValue, length, 0.00000001);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) TriangleImpl(com.revolsys.geometry.model.util.TriangleImpl)

Example 2 with TriangleImpl

use of com.revolsys.geometry.model.util.TriangleImpl in project com.revolsys.open by revolsys.

the class TriangleTest method checkAcute.

public void checkAcute(final String wkt, final boolean expectedValue) throws Exception {
    final Polygon g = (Polygon) this.geometryFactory.geometry(wkt);
    final TriangleImpl t = newTriangle(g);
    final boolean isAcute = t.isAcute();
    // System.out.println("isAcute = " + isAcute);
    assertEquals(expectedValue, isAcute);
}
Also used : TriangleImpl(com.revolsys.geometry.model.util.TriangleImpl) Polygon(com.revolsys.geometry.model.Polygon)

Example 3 with TriangleImpl

use of com.revolsys.geometry.model.util.TriangleImpl in project com.revolsys.open by revolsys.

the class TriangleTest method checkCircumCentre.

public void checkCircumCentre(final String wkt, final Point expectedValue) throws Exception {
    final Geometry g = this.geometryFactory.geometry(wkt);
    final TriangleImpl t = newTriangle(g);
    Point circumcentre = Triangles.circumcentre(t.p0, t.p1, t.p2);
    // System.out.println("(Static) circumcentre = " + circumcentre);
    assertEquals(expectedValue.toString(), circumcentre.toString());
    // Test Instance version
    // 
    circumcentre = t.circumcentre();
    // System.out.println("(Instance) circumcentre = " +
    // circumcentre.toString());
    assertEquals(expectedValue.toString(), circumcentre.toString());
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) TriangleImpl(com.revolsys.geometry.model.util.TriangleImpl) Point(com.revolsys.geometry.model.Point)

Example 4 with TriangleImpl

use of com.revolsys.geometry.model.util.TriangleImpl in project com.revolsys.open by revolsys.

the class TriangleTest method checkCentroid.

public void checkCentroid(final String wkt, final Point expectedValue) throws Exception {
    final Geometry g = this.geometryFactory.geometry(wkt);
    final TriangleImpl t = newTriangle(g);
    Point centroid = Triangles.centroid(t.p0, t.p1, t.p2);
    // System.out.println("(Static) centroid = " + centroid);
    assertEquals(expectedValue.toString(), centroid.toString());
    // Test Instance version
    // 
    centroid = t.centroid();
    // System.out.println("(Instance) centroid = " + centroid.toString());
    assertEquals(expectedValue.toString(), centroid.toString());
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) TriangleImpl(com.revolsys.geometry.model.util.TriangleImpl) Point(com.revolsys.geometry.model.Point)

Example 5 with TriangleImpl

use of com.revolsys.geometry.model.util.TriangleImpl in project com.revolsys.open by revolsys.

the class TriangleTest method newTriangle.

public TriangleImpl newTriangle(final Polygon g) {
    final LineString line = g.getShell();
    final TriangleImpl t = newTriangle(line);
    return t;
}
Also used : LineString(com.revolsys.geometry.model.LineString) TriangleImpl(com.revolsys.geometry.model.util.TriangleImpl)

Aggregations

TriangleImpl (com.revolsys.geometry.model.util.TriangleImpl)9 Geometry (com.revolsys.geometry.model.Geometry)6 Point (com.revolsys.geometry.model.Point)3 LineString (com.revolsys.geometry.model.LineString)1 Polygon (com.revolsys.geometry.model.Polygon)1