Esempio n. 1
0
        public DirectionControllerRing(EditorOptions options, ItemOptions itemOptions, ShipPartDNA dna, IContainer energyTanks, Thruster[] thrusters, ImpulseEngine[] impulseEngines)
            : base(options, dna, itemOptions.DirectionController_Damage.HitpointMin, itemOptions.DirectionController_Damage.HitpointSlope, itemOptions.DirectionController_Damage.Damage)
        {
            _itemOptions    = itemOptions;
            _energyTanks    = energyTanks;
            _thrusters      = thrusters;
            _impulseEngines = impulseEngines;

            Design = new DirectionControllerRingDesign(options, true);
            Design.SetDNA(dna);

            GetMass(out _mass, out _volume, out double radius, out _scaleActual, dna, itemOptions, true);
            Radius = radius;

            #region neurons

            double area = Math.Pow(radius, itemOptions.DirectionController_Ring_NeuronGrowthExponent);

            int neuronCount = Convert.ToInt32(Math.Ceiling(itemOptions.DirectionController_Ring_NeuronDensity_Half * area));
            if (neuronCount == 0)
            {
                neuronCount = 1;
            }

            _neuronsLinear   = NeuralUtility.CreateNeuronShell_Ring(1, neuronCount);
            _neuronsRotation = NeuralUtility.CreateNeuronShell_Line(1);

            _neurons = _neuronsLinear.Neurons.
                       Concat(_neuronsRotation.Neurons).
                       ToArray();

            #endregion
        }
Esempio n. 2
0
        private Model3D CreateGeometry(bool isFinal)
        {
            const double ANGLE1     = 58;   // got to angle1 and 2 by experimentation
            const double ANGLE2     = 32;
            const double HALFROTATE = 18;   // the first rotation around Z is 18 because there are 10 points (36 degrees / 2) -- it needs half a rotation to line up

            Tuple <Vector3D, double>[][] ringRotations = new[]
            {
                new[] { Tuple.Create(new Vector3D(1, 0, 0), ANGLE1) },
                new[] { Tuple.Create(new Vector3D(1, 0, 0), -ANGLE1) },

                new[] { Tuple.Create(new Vector3D(0, 0, 1), HALFROTATE), Tuple.Create(new Vector3D(0, 1, 0), ANGLE2) },
                new[] { Tuple.Create(new Vector3D(0, 0, 1), HALFROTATE), Tuple.Create(new Vector3D(0, 1, 0), -ANGLE2) },

                new[] { Tuple.Create(new Vector3D(0, 0, 1), HALFROTATE), Tuple.Create(new Vector3D(1, 0, 0), 90d), Tuple.Create(new Vector3D(0, 0, 1), ANGLE1) },
                new[] { Tuple.Create(new Vector3D(0, 0, 1), HALFROTATE), Tuple.Create(new Vector3D(1, 0, 0), 90d), Tuple.Create(new Vector3D(0, 0, 1), -ANGLE1) },
            };

            return(DirectionControllerRingDesign.CreateGeometry(
                       this.MaterialBrushes, base.SelectionEmissives,
                       GetTransformForGeometry(isFinal),
                       ringRotations, isFinal));
        }