Length() public method

public Length ( ) : double
return double
Example #1
0
    public void TestPoint() {
      Point p1 = new Point(new double[] {(double) 3.0, (double) 4.0}, 0);
      Assert.IsTrue(p1.Length() == 5.0);
      Point p2 = new Point(new double[] {(double) 6.0, (double) 8.0}, 0);
      double d = p1.GetEucledianDistance(p2);
      Assert.IsTrue(d == 5.0);
      Point uv = p1.GetDirection(p2);
      Assert.IsTrue(uv.Length() == 1.0);
      p1.Add(p2);
      Assert.IsTrue(p1.Side[0] == 9.0);
      Assert.IsTrue(p1.Side[1] == 12.0);

      p2.Scale((double) 0.5);
      Assert.IsTrue(p2.Side[0] == 3.0);
      Assert.IsTrue(p2.Side[1] == 4.0);

      Point p = new Point(p2.Side, p2.Height);
      Assert.IsTrue(p.Equals(p2));

      p2.Scale((double)2.0);
      Assert.IsTrue(!p.Equals(p2));
    }