Package chunmap.model.coord

Examples of chunmap.model.coord.Coordinate2D


   * {@link chunmap.model.elem.Line#getVerticalK()} 的测试方法。
   */
  @Test
  public void testGetVerticalK() {
    // y=4x+1;
    Coordinate2D p1 = new Coordinate2D(1, 5);
    Coordinate2D p2 = new Coordinate2D(-1, -3);
    Line l1 = new Line(p1, p2);
    double k = l1.getVerticalK();
    assertTrue(MyDouble.approximateEquals(k, -0.25));
  }
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

  }

  @Test
  public void testGetCoordinate() {
    CPoint coor = coorArray.getCoordinate(0);
    CPoint Expcoor = new Coordinate2D(1, 1.1);
    assertEquals(coor, Expcoor);
  }
View Full Code Here

  @Test
  public void testIntersection() {
    MonotonyChain chain1 = new MonotonyChain();
    MonotonyChain chain2 = new MonotonyChain();

    CPoint p1 = new Coordinate2D(0, 0);
    CPoint p2 = new Coordinate2D(1, 2);
    CPoint p3 = new Coordinate2D(0.5, 0.9);
    CPoint p4 = new Coordinate2D(1, 1);

    chain1.add(p1);
    chain1.add(p2);
    chain2.add(p3);
    chain2.add(p4);
View Full Code Here

  @Test
  public void testIntersection2() {
    MonotonyChain chain1 = new MonotonyChain();
    MonotonyChain chain2 = new MonotonyChain();

    CPoint p1 = new Coordinate2D(0, 0);
    CPoint p2 = new Coordinate2D(1, 2);
    CPoint p3 = new Coordinate2D(0.5, 1);
    CPoint p4 = new Coordinate2D(1, 1);

    chain1.add(p1);
    chain1.add(p2);
    chain2.add(p3);
    chain2.add(p4);
View Full Code Here

  @Test
  public void testIntersection3() {
    MonotonyChain chain1 = new MonotonyChain();
    MonotonyChain chain2 = new MonotonyChain();

    CPoint p1 = new Coordinate2D(0, 0);
    CPoint p2 = new Coordinate2D(1, 2);
    CPoint p3 = new Coordinate2D(0.5, 1);
    CPoint p5 = new Coordinate2D(2, 0);
    CPoint p6 = new Coordinate2D(2, 1);

    chain1.add(p1);
    chain1.add(p2);
    chain1.add(p5);
View Full Code Here

  @Test
  public void testIntersection4() {
    MonotonyChain chain1 = new MonotonyChain();
    MonotonyChain chain2 = new MonotonyChain();

    CPoint p1 = new Coordinate2D(1, 2);
    CPoint p2 = new Coordinate2D(1, 2);

    chain1.add(p1);
    chain2.add(p2);

    PointLineBag geos = chain1.intersection(chain2);
View Full Code Here

  @Test
  public void testIntersection5() {
    MonotonyChain chain1 = new MonotonyChain();
    MonotonyChain chain2 = new MonotonyChain();

    CPoint p1 = new Coordinate2D(0, 0);
    CPoint p2 = new Coordinate2D(1, 2);
    CPoint p3 = new Coordinate2D(0.5, 1);

    chain1.add(p1);
    chain1.add(p2);
    chain2.add(p3);
View Full Code Here

TOP

Related Classes of chunmap.model.coord.Coordinate2D

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.