Exemplo n.º 1
0
        public void Start_Stop_Calculations(bool index)
        {
            switch (index)
            {
            case true:
            {
                StartCalc();
                Calc();
                StartStop_button.Content = "Stop";

                start = false;
                break;
            }

            case false:
            {
                Helix.Children.Clear();
                Helix.Children.Add(light);
                Helix.InvalidateArrange();
                Helix.InvalidateVisual();
                StartStop_button.Content = "Start";
                start = true;
                break;
            }
            }
        }
Exemplo n.º 2
0
        public static void TestObjReader()
        {
            foreach (var f in GetInputFiles("angel.obj"))
            {
                WriteFileStats(f);

                Console.WriteLine("HelixToolkit OBJ Reader");
                Console.WriteLine("=======================");
                var helixObjModel3DGroup = Util.TimeIt(
                    () => Helix.LoadFileModel3DGroup(f), "Loading OBJ with Helix");

                var gFromHelix = helixObjModel3DGroup.ToIGeometry();
                TestWritingGeometry(gFromHelix, Path.Combine(TestOutputFolder, "helix"), f);

                Console.WriteLine("geometry3Sharp OBJ Reader");
                Console.WriteLine("=========================");
                var g3SharpObjList = Util.TimeIt(
                    () => G3Sharp.LoadMeshes(f), $"Loading OBJ with geometry3Sharp");

                for (var i = 0; i < g3SharpObjList.Count; ++i)
                {
                    var dmesh = g3SharpObjList[i];
                    CompareDMesh(dmesh, dmesh.ToIGeometry(), TestGeometries.SmallTolerance);
                }

                var gFromG3SharpObjList = g3SharpObjList.ToIGeometry();
                TestWritingGeometry(gFromG3SharpObjList, Path.Combine(TestOutputFolder, "g3sharp"), f);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///  OK Button... btnOK
        /// </summary>
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtName.Text != "" &&
                txtParentOne.Text != "" &&
                txtParentTwo.Text != "")
            {
                GENERATION = (int)nudGeneration.Value;
                PARENTONE  = txtParentOne.Text;
                PARENTTWO  = txtParentTwo.Text;
                NAME       = txtName.Text;
                AGE        = (int)nudAge.Value;

                AssignGenes();
                A_HELIX        = new Helix(A_RACE, A_STRENGTH, A_DEXTERITY, A_CONSTITUTION, A_INTELLIGENCE, A_WISDOM, A_CHARISMA, A_ARCANE, A_DIVINE);
                B_HELIX        = new Helix(B_RACE, B_STRENGTH, B_DEXTERITY, B_CONSTITUTION, B_INTELLIGENCE, B_WISDOM, B_CHARISMA, B_ARCANE, B_DIVINE);
                _DNA           = new DNA(A_HELIX, B_HELIX);
                ReturnCreature = new Creature(GENERATION, PARENTONE, PARENTTWO, _DNA, NAME, AGE);
                DialogResult   = DialogResult.OK;
                Close();
            }
            else
            {
                StringBuilder ErrorMessage = new StringBuilder();
                if (txtName.Text != "")
                {
                    ErrorMessage.Append("Please fill in Name or select Random.\n");
                }
                if (txtParentOne.Text != "" || txtParentTwo.Text != "")
                {
                    ErrorMessage.Append("Please fill in Name or select Random.\n");
                }
                MessageBox.Show("Creature Editor: Error", ErrorMessage.ToString(), MessageBoxButtons.OK);
            }
        }
    public void BeginInteractingWithHelix(Helix helix)
    {
        this.currentInteractingHelix = helix;

        // Populate compare screen
        this.compareScreenController.BlastPowerCurrent    = this.stats.Attack1Strength;
        this.compareScreenController.BlastPowerMultiplier = helix.Attack1StrengthModifier;
        this.compareScreenController.BlastPowerResult     = this.stats.GetUpdatedStat(this.stats.Attack1Strength, helix.Attack1StrengthModifier);

        this.compareScreenController.BlastSizeCurrent    = this.stats.Attack1Size;
        this.compareScreenController.BlastSizeMultiplier = helix.Attack1SizeModifier;
        this.compareScreenController.BlastSizeResult     = this.stats.GetUpdatedStat(this.stats.Attack1Size, helix.Attack1SizeModifier);

        this.compareScreenController.OrbPowerCurrent    = this.stats.Attack2Strength;
        this.compareScreenController.OrbPowerMultiplier = helix.Attack2StrengthModifier;
        this.compareScreenController.OrbPowerResult     = this.stats.GetUpdatedStat(this.stats.Attack2Strength, helix.Attack2StrengthModifier);

        this.compareScreenController.OrbCountCurrent    = this.stats.Attack2NumberOfProjectiles;
        this.compareScreenController.OrbCountMultiplier = helix.Attack2NumberOfProjectilesModifier;
        this.compareScreenController.OrbCountResult     = this.stats.GetUpdatedStat(this.stats.Attack2NumberOfProjectiles, helix.Attack2NumberOfProjectilesModifier);

        this.compareScreenController.SpeedCurrent    = this.stats.Speed;
        this.compareScreenController.SpeedMultiplier = helix.SpeedModifier;
        this.compareScreenController.SpeedResult     = this.stats.GetUpdatedStat(this.stats.Speed, helix.SpeedModifier);

        this.compareScreenController.HealthCurrent    = this.stats.Hitpoints;
        this.compareScreenController.HealthMultiplier = helix.HitpointsModifier;
        this.compareScreenController.HealthResult     = this.stats.GetUpdatedStat(this.stats.Hitpoints, helix.HitpointsModifier);


        this.compareScreenController.gameObject.SetActive(true);
        this.statsBarController.gameObject.SetActive(false);
    }
Exemplo n.º 5
0
        public void InstatiateSpecifedDNA()
        {
            Gene  race         = new Gene(1, 1, 1);
            Gene  strength     = new Gene(1, 1, 1);
            Gene  dexterity    = new Gene(1, 1, 1);
            Gene  constitution = new Gene(1, 1, 1);
            Gene  intelligence = new Gene(1, 1, 1);
            Gene  wisdom       = new Gene(1, 1, 1);
            Gene  charisma     = new Gene(1, 1, 1);
            Gene  arcane       = new Gene(1, 1, 1);
            Gene  divine       = new Gene(1, 1, 1);
            Helix alpha        = new Helix(race, strength, dexterity, constitution, intelligence, wisdom, charisma, arcane, divine);
            Helix beta         = new Helix(race, strength, dexterity, constitution, intelligence, wisdom, charisma, arcane, divine);
            DNA   dna          = new DNA(alpha, beta);

            Assert.AreSame(race, dna.Alpha.Race);
            Assert.AreSame(race, dna.Beta.Race);
            Assert.AreSame(strength, dna.Alpha.Strength);
            Assert.AreSame(strength, dna.Beta.Strength);
            Assert.AreSame(dexterity, dna.Alpha.Dexterity);
            Assert.AreSame(dexterity, dna.Beta.Dexterity);
            Assert.AreSame(constitution, dna.Alpha.Constitution);
            Assert.AreSame(constitution, dna.Beta.Constitution);
            Assert.AreSame(intelligence, dna.Alpha.Intelligence);
            Assert.AreSame(intelligence, dna.Beta.Intelligence);
            Assert.AreSame(wisdom, dna.Alpha.Wisdom);
            Assert.AreSame(wisdom, dna.Beta.Wisdom);
            Assert.AreSame(charisma, dna.Alpha.Charisma);
            Assert.AreSame(charisma, dna.Beta.Charisma);
            Assert.AreSame(arcane, dna.Alpha.Arcane);
            Assert.AreSame(arcane, dna.Beta.Arcane);
            Assert.AreSame(divine, dna.Alpha.Divine);
            Assert.AreSame(divine, dna.Beta.Divine);
        }
Exemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     screenPanelController = FindObjectOfType <ScreenPanelController>();
     ball           = FindObjectOfType <Ball>();
     helix          = FindObjectOfType <Helix>();
     numberOfLevels = SceneManager.sceneCountInBuildSettings;
 }
Exemplo n.º 7
0
        public void InstantiateRandomHelix()
        {
            Helix helix = new Helix();

            Assert.AreNotEqual(null, helix.Race.Value);
            Assert.AreNotEqual(null, helix.Race.Weight);
            Assert.AreNotEqual(null, helix.Race.Deviation);
            Assert.AreNotEqual(null, helix.Strength.Value);
            Assert.AreNotEqual(null, helix.Strength.Weight);
            Assert.AreNotEqual(null, helix.Strength.Deviation);
            Assert.AreNotEqual(null, helix.Dexterity.Value);
            Assert.AreNotEqual(null, helix.Dexterity.Weight);
            Assert.AreNotEqual(null, helix.Dexterity.Deviation);
            Assert.AreNotEqual(null, helix.Constitution.Value);
            Assert.AreNotEqual(null, helix.Constitution.Weight);
            Assert.AreNotEqual(null, helix.Constitution.Deviation);
            Assert.AreNotEqual(null, helix.Intelligence.Value);
            Assert.AreNotEqual(null, helix.Intelligence.Weight);
            Assert.AreNotEqual(null, helix.Intelligence.Deviation);
            Assert.AreNotEqual(null, helix.Charisma.Value);
            Assert.AreNotEqual(null, helix.Charisma.Weight);
            Assert.AreNotEqual(null, helix.Charisma.Deviation);
            Assert.AreNotEqual(null, helix.Wisdom.Value);
            Assert.AreNotEqual(null, helix.Wisdom.Weight);
            Assert.AreNotEqual(null, helix.Wisdom.Deviation);
            Assert.AreNotEqual(null, helix.Arcane.Value);
            Assert.AreNotEqual(null, helix.Arcane.Weight);
            Assert.AreNotEqual(null, helix.Arcane.Deviation);
            Assert.AreNotEqual(null, helix.Divine.Value);
            Assert.AreNotEqual(null, helix.Divine.Weight);
            Assert.AreNotEqual(null, helix.Divine.Deviation);
        }
Exemplo n.º 8
0
 public static SpeckleObject ToSpeckle(this Helix helix)
 {
     using (NurbsCurve nurbsCurve = helix.ToNurbsCurve())
     {
         return(nurbsCurve.ToSpeckle());
     }
 }
        public void InitDiamondSequences()
        {
            FastSequence VirusRing1 = new Ring <GoldDiamond>(3, DiamondRadius);

            AddSequence(VirusRing1);

            FastSequence VirusRing2 = new Ring <GoldDiamond>(6, DiamondRadius);

            AddSequence(VirusRing2);

            FastSequence bloodcellring = new Ring <RedDiamond>(4, DiamondRadius);

            AddSequence(bloodcellring);



            FastSequence VirusHelix1R = new Helix <RedDiamond>(8, MathHelper.PiOver2, DiamondRadius, 500, TurningDirection.Right, 2);

            AddSequence(VirusHelix1R);

            FastSequence VirusHelix2L = new Helix <GoldDiamond>(6, MathHelper.PiOver2 / 2, DiamondRadius, 350, TurningDirection.Left, 4);

            AddSequence(VirusHelix2L);

            FastSequence VirusHelix2R = new Helix <RedDiamond>(6, MathHelper.PiOver2 / 2, RedBloodCellRadius, 500, TurningDirection.Right, 3);

            AddSequence(VirusHelix2R);

            initSeqSetup();
        }
Exemplo n.º 10
0
        public void TestGeneResultCalculation()
        {
            // Result should be (Value * 2 + 2)
            // Gene(Value, Weight, Deviation)
            Gene  race         = new Gene(1, 1, 1); // 4
            Gene  strength     = new Gene(2, 1, 1); // 6
            Gene  dexterity    = new Gene(3, 1, 1); // 8
            Gene  constitution = new Gene(4, 1, 1); // 10
            Gene  intelligence = new Gene(5, 1, 1); // 12
            Gene  wisdom       = new Gene(6, 1, 1); // 14
            Gene  charisma     = new Gene(7, 1, 1); // 16
            Gene  arcane       = new Gene(8, 1, 1); // 18
            Gene  divine       = new Gene(9, 1, 1); // 20
            Helix alpha        = new Helix(race, strength, dexterity, constitution, intelligence, wisdom, charisma, arcane, divine);
            Helix beta         = new Helix(race, strength, dexterity, constitution, intelligence, wisdom, charisma, arcane, divine);
            DNA   dna          = new DNA(alpha, beta);

            Assert.AreEqual(4, dna.Race);
            Assert.AreEqual(6, dna.Strength);
            Assert.AreEqual(8, dna.Dexterity);
            Assert.AreEqual(10, dna.Constitution);
            Assert.AreEqual(12, dna.Intelligence);
            Assert.AreEqual(14, dna.Wisdom);
            Assert.AreEqual(16, dna.Charisma);
            Assert.AreEqual(18, dna.Arcane);
            Assert.AreEqual(20, dna.Divine);
        }
        public void InitVirusesSequences()
        {
            FastSequence VirusHelix1L = new Helix <Virus>(8, MathHelper.PiOver2, DiamondRadius, 500, TurningDirection.Left, 2);

            AddSequence(VirusHelix1L);
            initSeqSetup();
        }
Exemplo n.º 12
0
    public Vector3[,,] CreateGridOnHelix(Helix h, int w = 9)
    {
        width = w;

        Vector3[] points = h.points;
        triSize = h.sideLength;

        int length = h.sideCount;               // along the line of the helix
        int height = h.rotations;               // vertically up the helix
        int center = width / 2;                 // the z coord that falls on the line

        coords = new Vector3[length, height, width];
        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < length; x++)
            {
                for (int z = 0; z < width; z++)
                {
                    coords[x, y, z] = new Vector3(x, y, z);
                }
            }
        }

        positions = new Vector3[length, height, width];
        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < length; x++)
            {
                // get the angle from this point on the line to the center of the helix
                Vector3 targetDir = h.center - Vector3.Normalize(new Vector3(points[x].x, 0, points[x].z));
                float   angle     = Vector3.Angle(targetDir, Vector3.back);

                // compensate for the fact that Vector3.Angle only returns acute angles
                if (x > length / 2)
                {
                    angle  = Mathf.Abs(angle - 180);
                    angle += 180;
                }
                angle *= Mathf.Deg2Rad;

                for (int z = 0; z < width; z++)
                {
                    // get the distance from the point, perpendicular to the line of the helix
                    float dis = (float)triSize * (z - center);
                    if (x % 2 == 0)
                    {
                        dis += (float)triSize * 0.5f;
                    }

                    // calculate the position
                    float xPos = points[x].x + dis * Mathf.Sin(angle);
                    float yPos = points[(y * length) + x].y;
                    float zPos = points[x].z + dis * Mathf.Cos(angle);
                    positions[x, y, z] = new Vector3(xPos, yPos, zPos);
                }
            }
        }

        return(positions);
    }
Exemplo n.º 13
0
    public void EndInteractingWithHelix()
    {
        this.currentInteractingHelix = null;

        this.compareScreenController.gameObject.SetActive(false);
        this.statsBarController.gameObject.SetActive(true);
    }
Exemplo n.º 14
0
        public void ZygotGenerationTest()
        {
            DNA   dna   = new DNA();
            Helix zygot = null;

            Assert.IsTrue(dna.GenerateZygot(out zygot));
            Assert.IsNotNull(zygot);
        }
Exemplo n.º 15
0
 public static SpeckleObject ToSpeckle(this Helix helix)
 {
     using (NurbsCurve nurbsCurve = helix.ToNurbsCurve())
     {
         var curve = nurbsCurve.ToSpeckle();
         curve.Properties = helix.GetSpeckleProperties();
         return(curve);
     }
 }
Exemplo n.º 16
0
 public Base HelixToSpeckle(Helix helix)
 {
     using (NurbsCurve nurbsCurve = helix.ToNurbsCurve())
     {
         var curve = CurveToSpeckle(nurbsCurve);
         CopyProperties(curve, helix);
         return(curve);
     }
 }
 public Base HelixToSpeckle(Helix helix, string units = null)
 {
     using (NurbsCurve nurbsCurve = helix.ToNurbsCurve())
     {
         var curve = CurveToSpeckle(nurbsCurve, units ?? ModelUnits);
         CopyProperties(curve, helix);
         return(curve);
     }
 }
        public void InitBloodSequences()
        {
            FastSequence BloodCellHelix1L = new Helix <RedBloodCell>(8, MathHelper.Pi, RedBloodCellRadius, 900, TurningDirection.Left, 2);

            AddSequence(BloodCellHelix1L);

            FastSequence BloodCellHelix1R = new Helix <RedBloodCell>(10, MathHelper.Pi, RedBloodCellRadius, 900, TurningDirection.Right, 2);

            AddSequence(BloodCellHelix1R);
            initSeqSetup();
        }
Exemplo n.º 19
0
    public void ApplyHelix(Helix helix)
    {
        this.Attack1Strength = GetUpdatedStat(this.Attack1Strength, helix.Attack1StrengthModifier);
        this.Attack1Size     = GetUpdatedStat(this.Attack1Size, helix.Attack1SizeModifier);

        this.Attack2Strength            = GetUpdatedStat(this.Attack2Strength, helix.Attack2StrengthModifier);
        this.Attack2NumberOfProjectiles = GetUpdatedStat(this.Attack2NumberOfProjectiles, helix.Attack2NumberOfProjectilesModifier);

        this.Speed = GetUpdatedStat(this.Speed, helix.SpeedModifier);

        this.Hitpoints = GetUpdatedStat(this.Hitpoints, helix.HitpointsModifier);
    }
Exemplo n.º 20
0
        public static List <Tuple <Helix, int> > UpdateHelixes(Element[] elements)
        {
            int[] collection = Collect(elements, Helix.RecordName);
            List <Tuple <Helix, int> > helixes = new List <Tuple <Helix, int> >();

            foreach (int idx in collection)
            {
                string line  = elements[idx].line;
                Helix  helix = Helix.FromString(line);
                elements[idx] = helix;
                helixes.Add(new Tuple <Helix, int>(helix, idx));
            }
            return(helixes);
        }
Exemplo n.º 21
0
        public void InstantiateSpecificHelix()
        {
            Gene  race         = new Gene(1, 2, 3);
            Gene  strength     = new Gene(2, 3, 4);
            Gene  dexterity    = new Gene(3, 4, 5);
            Gene  constitution = new Gene(4, 5, 6);
            Gene  intelligence = new Gene(5, 6, 7);
            Gene  wisdom       = new Gene(6, 7, 8);
            Gene  charisma     = new Gene(7, 8, 9);
            Gene  arcane       = new Gene(8, 9, 10);
            Gene  divine       = new Gene(9, 10, 11);
            Helix helix        = new Helix(race, strength, dexterity, constitution, intelligence, wisdom, charisma, arcane, divine);

            Assert.AreEqual(1, helix.Race.Value);
            Assert.AreEqual(2, helix.Race.Weight);
            Assert.AreEqual(3, helix.Race.Deviation);

            Assert.AreEqual(2, helix.Strength.Value);
            Assert.AreEqual(3, helix.Strength.Weight);
            Assert.AreEqual(4, helix.Strength.Deviation);

            Assert.AreEqual(3, helix.Dexterity.Value);
            Assert.AreEqual(4, helix.Dexterity.Weight);
            Assert.AreEqual(5, helix.Dexterity.Deviation);

            Assert.AreEqual(4, helix.Constitution.Value);
            Assert.AreEqual(5, helix.Constitution.Weight);
            Assert.AreEqual(6, helix.Constitution.Deviation);

            Assert.AreEqual(5, helix.Intelligence.Value);
            Assert.AreEqual(6, helix.Intelligence.Weight);
            Assert.AreEqual(7, helix.Intelligence.Deviation);

            Assert.AreEqual(6, helix.Wisdom.Value);
            Assert.AreEqual(7, helix.Wisdom.Weight);
            Assert.AreEqual(8, helix.Wisdom.Deviation);

            Assert.AreEqual(7, helix.Charisma.Value);
            Assert.AreEqual(8, helix.Charisma.Weight);
            Assert.AreEqual(9, helix.Charisma.Deviation);

            Assert.AreEqual(8, helix.Arcane.Value);
            Assert.AreEqual(9, helix.Arcane.Weight);
            Assert.AreEqual(10, helix.Arcane.Deviation);

            Assert.AreEqual(9, helix.Divine.Value);
            Assert.AreEqual(10, helix.Divine.Weight);
            Assert.AreEqual(11, helix.Divine.Deviation);
        }
Exemplo n.º 22
0
        public void HelixToString()
        {
            Gene   race         = new Gene(1, 1, 1);
            Gene   strength     = new Gene(2, 1, 1);
            Gene   dexterity    = new Gene(3, 1, 1);
            Gene   constitution = new Gene(4, 1, 1);
            Gene   intelligence = new Gene(5, 1, 1);
            Gene   wisdom       = new Gene(6, 1, 1);
            Gene   charisma     = new Gene(7, 1, 1);
            Gene   arcane       = new Gene(8, 1, 1);
            Gene   divine       = new Gene(9, 1, 1);
            Helix  helix        = new Helix(race, strength, dexterity, constitution, intelligence, wisdom, charisma, arcane, divine);
            string check        = "Race: Value 1, Weight 1, Deviation 1.\nStrength: Value 2, Weight 1, Deviation 1.\nDexterity: Value 3, Weight 1, Deviation 1.\nConstitution: Value 4, Weight 1, Deviation 1.\nIntelligence: Value 5, Weight 1, Deviation 1.\nWisdom: Value 6, Weight 1, Deviation 1.\nCharisma: Value 7, Weight 1, Deviation 1.\nArcane: Value 8, Weight 1, Deviation 1.\nDivine: Value 9, Weight 1, Deviation 1.\nDeviation Index: 9";

            Assert.AreEqual(check, helix.ToString());
        }
Exemplo n.º 23
0
        HelixHardWired()
        {
            m_db = Utils.Db.GetCurDwg();

            using (CompBldrCurSpace compBldr = new CompBldrCurSpace(m_db)) {
                compBldr.Start();
                compBldr.PushXform(Utils.Db.GetUcsMatrix(m_db));

                Helix helix = new Helix();
                helix.Turns      = 10.0;
                helix.Twist      = true;
                helix.BaseRadius = 20.0;
                //creates the helix geometry based on the values set in prior function calls
                helix.CreateHelix();
                compBldr.AddToDb(helix);
                compBldr.Commit();
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// Displays the scene GUI handles.
        /// </summary>
        protected override void DisplaySceneGUIHandles()
        {
            base.DisplaySceneGUIHandles();
            HashSet <Object> undoObjects = new HashSet <Object>();

            for (int i = 0; i < this.Target.GetLeaves(ref s_Leaves); ++i)
            {
                undoObjects.Add(s_Leaves[i].BackFace);
                undoObjects.Add(s_Leaves[i].FrontFace);
            }
            undoObjects.Remove(null);
            Helix     newHelix  = null;
            Matrix4x4 oldMatrix = Handles.matrix;

            for (int i = 0; i < s_Leaves.Count; ++i)
            {
                if (s_Leaves[i].FrontFace == null || s_Leaves[i].BackFace == null)
                {
                    continue;
                }
                Handles.matrix = s_Leaves[i].FrontFace.transform.localToWorldMatrix;
                if (
                    SceneGUI.BeginHandles(undoObjects.ToArray(), "Modify Plant Leaf") &&
                    HelixMeshRibbonEditor.IsHandleEnabled
                    )
                {
                    newHelix = HelixHandles.MeshRibbon(
                        s_Leaves[i].FrontFace,
                        Vector3.zero,
                        Quaternion.identity,
                        Vector3.one,
                        HelixMeshRibbonEditor.HandleColor
                        );
                }
                if (SceneGUI.EndHandles())
                {
                    s_Leaves[i].FrontFace.Helix = newHelix;
                    s_Leaves[i].BackFace.Helix  = newHelix;
                }
            }
            Handles.matrix = oldMatrix;
        }
Exemplo n.º 25
0
        /// <summary>
        /// Displays the scene GUI handles.
        /// </summary>
        protected override void DisplaySceneGUIHandles()
        {
            base.DisplaySceneGUIHandles();
            Helix newHelix = null;

            if (SceneGUI.BeginHandles(target, "Change Helix Mesh Ribbon") && s_HandleTogglePreference.CurrentValue)
            {
                newHelix = HelixHandles.MeshRibbon(
                    this.Target,
                    Vector3.zero,
                    Quaternion.identity,
                    Vector3.one,
                    s_HandleColorPreference.CurrentValue
                    );
            }
            if (SceneGUI.EndHandles())
            {
                this.Target.Helix = newHelix;
            }
        }
        // TODO: send this as a spiral class
        public Base HelixToSpeckle(Helix helix, string units = null)
        {
            var u = units ?? ModelUnits;

            /* untested code to send as spiral
             * using (DS.Plane basePlane = DS.Plane.ByOriginNormal(helix.AxisPoint, helix.Normal))
             * {
             * var spiral = new Spiral();
             *
             * spiral.startPoint = PointToSpeckle(helix.StartPoint, u);
             * spiral.endPoint = PointToSpeckle(helix.EndPoint, u);
             * spiral.plane = PlaneToSpeckle(basePlane, u);
             * spiral.pitchAxis = VectorToSpeckle(helix.AxisDirection, u);
             * spiral.pitch = helix.Pitch;
             * spiral.turns = helix.Angle / (2 * Math.PI);
             *
             * // display value
             * DS.Curve[] curves = helix.ApproximateWithArcAndLineSegments();
             * List<double> polylineCoordinates =
             *  curves.SelectMany(c => PointListToFlatArray(new DS.Point[2] { c.StartPoint, c.EndPoint })).ToList();
             * polylineCoordinates.AddRange(PointToArray(curves.Last().EndPoint));
             * curves.ForEach(c => c.Dispose());
             * Polyline displayValue = new Polyline(polylineCoordinates, u);
             * spiral.displayValue = displayValue;
             *
             * CopyProperties(spiral, helix);
             *
             * spiral.length = helix.Length;
             * spiral.bbox = BoxToSpeckle(helix.BoundingBox.ToCuboid(), u);
             *
             * return spiral;
             * }
             */

            using (NurbsCurve nurbsCurve = helix.ToNurbsCurve())
            {
                var curve = CurveToSpeckle(nurbsCurve, u);
                CopyProperties(curve, helix);
                return(curve);
            }
        }
Exemplo n.º 27
0
        public void GenerateSpecificCreature()
        {
            Gene     race         = new Gene(1, 1, 1); // 4
            Gene     strength     = new Gene(2, 1, 1); // 6
            Gene     dexterity    = new Gene(3, 1, 1); // 8
            Gene     constitution = new Gene(4, 1, 1); // 10
            Gene     intelligence = new Gene(5, 1, 1); // 12
            Gene     wisdom       = new Gene(6, 1, 1); // 14
            Gene     charisma     = new Gene(7, 1, 1); // 16
            Gene     arcane       = new Gene(8, 1, 1); // 18
            Gene     divine       = new Gene(9, 1, 1); // 20
            Helix    alpha        = new Helix(race, strength, dexterity, constitution, intelligence, wisdom, charisma, arcane, divine);
            Helix    beta         = new Helix(race, strength, dexterity, constitution, intelligence, wisdom, charisma, arcane, divine);
            DNA      dna          = new DNA(alpha, beta);
            string   NAME         = "Mysterious B";
            string   pONE         = "Noch";
            string   pTWO         = "Dennis";
            string   RACE         = "Dwarf";
            int      GENERATION   = 2;
            int      AGE          = 10;
            int      MAXAGE       = 110; // Constitution * Race + Divine + 50 => 10 * 4 + 20 + 50 = 110
            Creature creature     = new Creature(
                GENERATION,
                pONE,
                pTWO,
                dna,
                NAME,
                AGE);

            Assert.AreEqual(pONE, creature.ParentOne);
            Assert.AreEqual(pTWO, creature.ParentTwo);
            Assert.AreEqual(dna, creature.Genetics);
            Assert.AreEqual(RACE, creature.GetRace());
            Assert.AreEqual(GENERATION, creature.Generation);
            Assert.AreEqual(AGE, creature.Age);
            Assert.AreEqual(MAXAGE, creature.GetMaxAge());
        }
        /// <summary>
        /// Displays the viewport handle.
        /// </summary>
        protected override void DisplaySceneGUIHandles()
        {
            base.DisplaySceneGUIHandles();
            Helix newHelix = null;

            if (
                SceneGUI.BeginHandles(this.Target, "Change Helix Particle Emitter") &&
                s_HandleTogglePreference.CurrentValue
                )
            {
                newHelix = HelixHandles.WireHelix(
                    target.GetHashCode(),
                    this.Target.Helix,
                    Vector3.zero,
                    Quaternion.identity,
                    Vector3.one,
                    s_HandleColorPreference.CurrentValue
                    );
            }
            if (SceneGUI.EndHandles())
            {
                this.Target.Helix = newHelix;
            }
        }
Exemplo n.º 29
0
 public Webhooks(TwitchAPI api)
 {
     helix = new Helix(api);
 }
Exemplo n.º 30
0
 public Clips(TwitchAPI api)
 {
     v5    = new V5(api);
     helix = new Helix(api);
 }
Exemplo n.º 31
0
    public static List<Helix> ReadHelixData(string path)
    {
        if (!File.Exists(path)) throw new Exception("File not found at: " + path);
        var pdbName = Path.GetFileName(path);
        
        var helices = new List<Helix>();
        var lines = File.ReadAllLines(path);
        
        foreach (var line in lines)
        {
            if (line.StartsWith("HELIX"))
            {
                var helix = new Helix();

                if (line.Length < 10)
                { helices.Add(helix); continue; }
                helix.helixNumber = int.Parse(line.Substring(7, 3).Trim());

                if (line.Length < 14)
                { helices.Add(helix); continue; }
                helix.helixIdentifier = line.Substring(11, 3).Trim();

                if (line.Length < 18)
                { helices.Add(helix); continue; }
                helix.initialResidueName = line.Substring(15, 3).Trim();

                if (line.Length < 20)
                { helices.Add(helix); continue; }
                helix.initialChainIdentifier = line.Substring(19, 1).Trim();

                if (line.Length < 25)
                { helices.Add(helix); continue; }
                helix.initialResidueSequenceNumber = int.Parse(line.Substring(21, 4).Trim());

                if (line.Length < 30)
                { helices.Add(helix); continue; }
                helix.terminalResidueName = line.Substring(27, 3).Trim();

                if (line.Length < 32)
                { helices.Add(helix); continue; }
                helix.terminalChainIdentifier = line.Substring(31, 1).Trim();

                if (line.Length < 37)
                { helices.Add(helix); continue; }
                helix.terminalResidueSequenceNumber = int.Parse(line.Substring(33, 4).Trim());

                if (line.Length < 76)
                { helices.Add(helix); continue; }
                helix.helixSize = int.Parse(line.Substring(71, 5).Trim());

                helices.Add(helix);
            }
        }

        return helices;
    }
Exemplo n.º 32
0
    public Helix(Helix helix)
    {

    }