Length() public method

public Length ( ) : double
return double
Example #1
0
        protected EngineBase(int id, ISpaceCraft parent, DVector2 offset, EngineFlame flame)
        {
            _parent = parent;

            _offsetLength = offset.Length();
            _offsetRotation = offset.Angle() - Math.PI / 2.0;

            _engineFlame = flame;
        }
Example #2
0
        public LandingLeg(ISpaceCraft parent, DVector2 offset, bool isLeft)
        {
            _parent = parent;
            _isLeft = isLeft;

            _offsetLength = offset.Length();
            _offsetRotation = _offsetRotation = offset.Angle() - Math.PI/2.0;

            _texture = isLeft ? new Bitmap("Textures/landingLegLeft.png") : new Bitmap("Textures/landingLegRight.png");
        }
Example #3
0
        protected StructureBase(DVector2 relativePosition, string texturePath, IMassiveBody parent)
        {
            _parent = parent;

            _initialDistance = relativePosition.Length();

            _rotationOffset = relativePosition.Angle();
            _initialRotation = parent.Rotation;

            _texture = new Bitmap(texturePath);
        }
Example #4
0
        public ReEntryFlame(int maxParticles, double particleRate, DVector2 offset)
        {
            _random = new Random();

            _particles = new Particle[maxParticles];

            _availableParticles = new Queue<int>(maxParticles);

            for (int i = 0; i < maxParticles; i++)
            {
                _particles[i] = new Particle();

                _availableParticles.Enqueue(i);
            }

            _particleRate = particleRate;

            _offsetAngle = offset.Angle();
            _offsetLength = offset.Length();
        }
Example #5
0
        public virtual void UpdateChildren(DVector2 position, DVector2 velocity)
        {
            Position = position - new DVector2(StageOffset.X*Math.Sin(Rotation) + StageOffset.Y*Math.Cos(Rotation),
                                               -StageOffset.X*Math.Cos(Rotation) + StageOffset.Y*Math.Sin(Rotation));
            Velocity.X = velocity.X;
            Velocity.Y = velocity.Y;

            MachNumber = velocity.Length() * 0.0029411764;

            foreach (ISpaceCraft child in Children)
            {
                child.UpdateChildren(Position, Velocity);
            }
        }
Example #6
0
        // Finds the orbtial delta time step by assuming 200 points along the oribtal cirumference
        private static double GetOrbitalDt(DVector2 positon, DVector2 velocity, out double terminationRadius)
        {
            double orbitalAltitude = positon.Length();

            double approximateOrbitDiameter = orbitalAltitude * 2 * Math.PI;

            // Terminate the trace if it comes within 1/100 of starting point
            terminationRadius = approximateOrbitDiameter * 0.01;

            double approximateOrbitPeriod = approximateOrbitDiameter / velocity.Length();

            return approximateOrbitPeriod * 0.005;
        }
Example #7
0
        public virtual void UpdateChildren(DVector2 position, DVector2 velocity)
        {
            var rotationOffset = new DVector2(Math.Cos(Pitch), Math.Sin(Pitch));

            Position = position - new DVector2(StageOffset.X * rotationOffset.Y + StageOffset.Y * rotationOffset.X,
                                               -StageOffset.X * rotationOffset.X + StageOffset.Y * rotationOffset.Y);
            Velocity.X = velocity.X;
            Velocity.Y = velocity.Y;

            MachNumber = velocity.Length() * 0.0029411764;

            foreach (ISpaceCraft child in Children)
            {
                child.UpdateChildren(Position, Velocity);
            }
        }