Пример #1
0
        public static void PhysicsUpdate(OrbitWidgetIconData icon)
        {
            var ralitivePoint = (icon.IconData.WorldPosition - icon.InsertionPoint);

            icon._orbitEllipseSemiMaj = (ralitivePoint).Length();

            icon._orbitAngleRadians     = Math.Atan2(ralitivePoint.Y, ralitivePoint.X);
            icon._eccentricity          = icon._focalDistance / icon._orbitEllipseSemiMaj;
            icon._orbitEllipseSemiMinor = icon._orbitEllipseSemiMaj * Math.Sqrt(1 - icon._eccentricity * icon._eccentricity);
            SetPointArray();

            PointD pointD = new PointD()
            {
                x = icon.InsertionPoint.X, y = icon.InsertionPoint.Y
            };                                                                                     //may make this ralitive

            double minDist = PointDFunctions.CalcDistance(pointD, icon._points[icon._index]);

            for (int i = 0; i < icon._points.Length; i++)
            {
                double dist = PointDFunctions.CalcDistance(pointD, icon._points[i]);
                if (dist < minDist)
                {
                    minDist = dist;
                    _index  = i;
                }
            }
        }
Пример #2
0
 double CalcDistance(PointD p1, PointD p2)
 {
     return(PointDFunctions.Length(PointDFunctions.Sub(p1, p2)));
 }
Пример #3
0
 void ActionAddDB()
 {
     _state.SpaceMasterVM.SMSetOrbitToEntity(OrderingEntity.Entity, TargetEntity.Entity, PointDFunctions.Length(_orbitWidget.Periapsis), _state.CurrentSystemDateTime);
     CloseWindow();
 }