public void DistanceTest() { double expected = _p.Distance(_p2); double actual = _p.VectorTo(_p2).Rho(); Assert.AreEqual(expected, actual); }
public double Square() { double p = Perimiter() / 2; double sideA = Point1.Distance(Point2); double sideB = Point2.Distance(Point3); double sideC = Point3.Distance(Point1); return(Math.Sqrt(p * (p - sideA) * (p - sideB) * (p - sideC))); }
public void distance_point() { var a = new Point2(1, 2); var b = new Point2(3, 5); var d1 = a.Distance(b); var d2 = b.Distance(a); d1.Should().Be(d2); d1.Should().Be(System.Math.Sqrt(13)); }
private double[] Sides() { double[] x = new double[3]; x[0] = Point2.Distance(this.A, this.B); x[1] = Point2.Distance(this.A, this.C); x[2] = Point2.Distance(this.B, this.C); return(x); }
public bool ContainKeepers(Vector3 location, float additionalOffset = 0) { var location2d = location.c(); if (_keeperSpots.Any(k => Point2.Distance(location2d, k) <= _keeperSkipRange + additionalOffset)) { return(true); } return(false); }
private List <Point2> GetColumns(Point2 po, int size) { List <Point2> cols = new List <Point2>(); int distanse = size / 2; for (int i = -distanse; i < distanse; i++) { for (int j = -distanse; j < distanse; j++) { Point2 pos = po + new Point2(i, j); if (pos.x < 0 || pos.y < 0 || pos.x >= mapSize || pos.y >= mapSize) { continue; } if (Point2.Distance(po, pos) < distanse) { cols.Add(pos); } } } return(cols); }
public double Perimiter() { return(Point1.Distance(Point2) + Point2.Distance(Point3) + Point3.Distance(Point1)); }
[Test] public void Distance() { Assert.AreEqual(1.0f, Point2.Distance(new Point2(0, 0), new Point2(0, 1))); Assert.AreEqual(1.0f, Point2.Distance(new Point2(0, 0), new Point2(1, 0))); Assert.AreEqual(MathF.Sqrt(2), Point2.Distance(new Point2(0, 0), new Point2(1, 1))); }
/// <summary> /// 计算地图上两点距离 /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <returns></returns> public float GetHCost(AStarNode2X start, AStarNode2X end) { return((float)Point2.Distance(start.mapPos, end.mapPos)); }