Package chunmap.model.coord

Examples of chunmap.model.coord.CPoint


  }

  @Test
  public void testIsSimple2() {
    List<CPoint> points = new ArrayList<CPoint>();
    CPoint p1 = new Coordinate2D(10, 20);
    CPoint p2 = new Coordinate2D(20, 40);
    CPoint p3 = new Coordinate2D(30, 60);
    CPoint p5 = new Coordinate2D(50, 100);
    points.add(p1);
    points.add(p3);
    points.add(p5);
    points.add(p2);
    LineString ls = new LineString(points);
View Full Code Here


  }

  @Test
  public void testIsSimple3() {
    List<CPoint> points = new ArrayList<CPoint>();
    CPoint p1 = new Coordinate2D(10, 20);
    CPoint p3 = new Coordinate2D(30, 60);
    CPoint p5 = new Coordinate2D(50, 100);
    points.add(p1);
    points.add(p3);
    points.add(p5);
    points.add(p1);
    LineString ls = new LineString(points);
View Full Code Here

  }

  @Test
  public void testIsSimple4() {
    List<CPoint> points = new ArrayList<CPoint>();
    CPoint p1 = new Coordinate2D(1, 1);
    CPoint p2 = new Coordinate2D(1, 2);
    CPoint p3 = new Coordinate2D(3, 2);
    CPoint p4 = new Coordinate2D(4, 0);
    points.add(p3);
    points.add(p1);
    points.add(p2);
    points.add(p3);
    points.add(p4);
View Full Code Here

   * {@link chunmap.model.elem.Line#getX(double)} 的测试方法。
   */
  @Test
  public void testGetX() {
    // y=4x+1;
    CPoint p1 = new Coordinate2D(1, 5);
    CPoint p2 = new Coordinate2D(-1, -3);
    Line l1 = new Line(p1, p2);
    double x1 = l1.getX(9);
    assertTrue(MyDouble.approximateEquals(x1, 2));
  }
View Full Code Here

   * 测试水平线
   */
  @Test
  public void testCritical() {
    // y=5;
    CPoint p1 = new Coordinate2D(1, 5);
    CPoint p2 = new Coordinate2D(-1, 5);
    Line l1 = new Line(p1, p2);
    double x1 = l1.getX(9);
    String s = x1 + "";
    assertTrue(s.equals("NaN"));

View Full Code Here

   * 测试垂直线
   */
  @Test
  public void testCritical2() {
    // x=1
    CPoint p1 = new Coordinate2D(1, 5);
    CPoint p2 = new Coordinate2D(1, 0.5);
    Line l1 = new Line(p1, p2);
    double x1 = l1.getX(9);
    assertTrue(MyDouble.approximateEquals(x1, 1));

    double y1 = l1.getY(10);
View Full Code Here

  }

  @Test
  public void testCritical3() {
    // x=1
    CPoint p1 = new Coordinate2D(1, 5);
    Line l1 = new Line(p1, Double.NEGATIVE_INFINITY);
    double x1 = l1.getX(9);
    assertTrue(MyDouble.approximateEquals(x1, 1));

    double y1 = l1.getY(10);
View Full Code Here

   * 的测试方法。
   */
  @Test
  public void testCrossCoordinate2D() {
    // y=4x+1;
    CPoint p1 = new Coordinate2D(1, 5);
    CPoint p2 = new Coordinate2D(-1, -3);
    Line l1 = new Line(p1, p2);

    // y=x-1;
    Line l2 = new Line(1, -1);
    CPoint p = new Coordinate2D(-2d / 3d, (-2d / 3d) - 1);
    assertTrue(p.equals(l1.crossPoint(l2)));
    assertTrue(p.equals(l2.crossPoint(l1)));
  }
View Full Code Here

  }

  @Test
  public void testCriticalCrossCoordinate2D() {
    // y=4x+1;
    CPoint p1 = new Coordinate2D(1, 5);
    CPoint p2 = new Coordinate2D(1, 3);
    Line l1 = new Line(p1, p2);

    // y=x-1;
    Line l2 = new Line(1, -1);
    CPoint p = new Coordinate2D(1, 0);
    assertTrue(p.equals(l1.crossPoint(l2)));
    assertTrue(p.equals(l2.crossPoint(l1)));
  }
View Full Code Here

  @Test
  public void testDistance() {
    // y=x+1;
    Line l = new Line(1, 1);
    CPoint p = new Coordinate2D(0, 0);
    double d = l.distance(p);
    assertTrue(MyDouble.approximateEquals(Math.sqrt(2) / 2d, d));
  }
View Full Code Here

TOP

Related Classes of chunmap.model.coord.CPoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.