public override void OnPhysicsUpdate() { if (_dv != _newtonMoveDB.DeltaVForManuver_m.Length()) { CreatePointArray(); } Vector3 pos = myPosDB.RelativePosition_AU; var ralitivePos = new PointD() { X = pos.X, Y = pos.Y }; double minDist = PointDFunctions.Length(PointDFunctions.Sub(ralitivePos, _points[_index])); for (int i = 0; i < _points.Count(); i++) { double dist = PointDFunctions.Length(PointDFunctions.Sub(ralitivePos, _points[i])); if (dist < minDist) { minDist = dist; _index = i; } } }
public override void OnPhysicsUpdate() { Vector3 pos = myPosDB.RelativePosition_AU; var ralitivePos = new PointD() { X = pos.X, Y = pos.Y }; double minDist = PointDFunctions.Length(PointDFunctions.Sub(ralitivePos, _points[_index])); for (int i = 0; i < _points.Count(); i++) { double dist = PointDFunctions.Length(PointDFunctions.Sub(ralitivePos, _points[i])); if (dist < minDist) { minDist = dist; _index = i; } } }
double CalcDistance(PointD p1, PointD p2) { return(PointDFunctions.Length(PointDFunctions.Sub(p1, p2))); }