Exemple #1
0
        public void getForcesDiagram(AbstractCase ac, LineElement line, LineForceComponent component, float[,] controlPoints, out float fI, out float fJ)
        {
            Vector3 vI, vJ;

            switch (component)
            {
            case LineForceComponent.Axial:
            case LineForceComponent.Shear22:
            case LineForceComponent.Shear33:
                vI = new Vector3(model.Results.ElementJointForces[line.Id, 0, 0],
                                 model.Results.ElementJointForces[line.Id, 0, 1],
                                 model.Results.ElementJointForces[line.Id, 0, 2]);
                vJ = new Vector3(model.Results.ElementJointForces[line.Id, 1, 0],
                                 model.Results.ElementJointForces[line.Id, 1, 1],
                                 model.Results.ElementJointForces[line.Id, 1, 2]);
                break;

            default:
                vI = new Vector3(model.Results.ElementJointForces[line.Id, 0, 3],
                                 model.Results.ElementJointForces[line.Id, 0, 4],
                                 model.Results.ElementJointForces[line.Id, 0, 5]);
                vJ = new Vector3(model.Results.ElementJointForces[line.Id, 1, 3],
                                 model.Results.ElementJointForces[line.Id, 1, 4],
                                 model.Results.ElementJointForces[line.Id, 1, 5]);
                break;
            }

            // Transform to the line's local coordinate system
            // From the global system
            // (WARNING: This is supposed to come in the joint's local coordinate system)
            vI = toLocal(line, vI);
            vJ = toLocal(line, vJ);

            switch (component)
            {
            case LineForceComponent.Axial:
            case LineForceComponent.Torsion:
                fI = vI.X;
                fJ = vJ.X;
                break;

            case LineForceComponent.Shear22:
            case LineForceComponent.Moment22:
                fI = vI.Y;
                fJ = vJ.Y;
                break;

            default:
                fI = vI.Z;
                fJ = vJ.Z;
                break;
            }

            //float fI = model.Results.ElementJointForces[line.Id, 0, (int)component];
            //float fJ = model.Results.ElementJointForces[line.Id, 1, (int)component];


            // Add Isostatic curves if there's a load on the LineElement
            addToShearMomentDiagram(ac, line, controlPoints, component, 1f);
        }
Exemple #2
0
        public float[] GetForceAtPoint(AbstractCase ac, LineElement line, LineForceComponent component, float xPos)
        {
            if (!model.HasResults)
            {
                return(null);
            }

            float[,] controlPoints = new float[1, 2];
            controlPoints[0, 0]    = xPos;
            controlPoints[0, 1]    = 0f;

            float fI, fJ;

            getForcesDiagram(ac, line, component, controlPoints, out fI, out fJ);

            // Los valores en los nodos se encuentran volteados. Del lado izquierdo positivo
            // es arriba, mientras del lado derecho positivo es abajo, por lo que si se tienen
            // dos valores positivos se debería pintar una recta con pendiente negativa y si
            // se tienen dos negativos al revés. DeltaY = Y1 + Y2 (por el cambio de signo).
            controlPoints[0, 1] += controlPoints[0, 0] * (fI + fJ) - fI;

            // Copy to 1-dimensional array
            float[] ret = new float[2];
            for (int i = 0; i < 2; i++)
            {
                ret[i] = controlPoints[0, i];
            }

            return(ret);
        }
Exemple #3
0
        public float[,] GetCurvedAxis(LineElement l, AbstractCase ac, DeformationAxis component, int numPoints)
        {
            if (!model.HasResults)
            {
                return(null);
            }

            /// controlPoints[i, 0]: x position on Beam, controlPoints[i, 1]: 'deflection' for x position, controlPoints[i,2]: deformation angle
            float[,] controlPoints = new float[numPoints, 3];

            float[] controlPointsX = new float[1]; // requestXCtrlPts(load);
            for (int i = 0, bufi = 0; i < numPoints; i++)
            {
                controlPoints[i, 0] = i / (numPoints - 1f);

                // Adjust control points
                if ((bufi < controlPointsX.Length) && (controlPointsX[bufi] <= controlPoints[i, 0]))
                {
                    controlPoints[i, 0] = controlPointsX[bufi++];
                }

                controlPoints[i, 1] = 0f; // controlPoints[i, 0] * (fdJ - fdI);

                controlPoints[i, 2] = 0.0f;
            }

            getCurvedAxis(l, ac, component, controlPoints);

            return(controlPoints);
        }
Exemple #4
0
 /// <summary>
 /// Repairs the IsActive state of the abstract cases so that no active case depends upon an unactive case
 /// </summary>
 /// <param name="changedAc">The last abstract case that has changed</param>
 public void RepairAbstractCases(AbstractCase changedAc)
 {
     if (!changedAc.IsActive)
     {
         // If IsActive == false then deactivate all dependant cases
         Dictionary <AbstractCase, LinkedList <AbstractCase> > adjacency = BuildAnalysisCaseAdjacency();
         repairAbstractCases(changedAc, adjacency);
     }
 }
Exemple #5
0
        private void getDeformationAt(AreaElement area, AbstractCase abstractCase, Vector3 request, ref Vector3 deformation)
        {
            Random myRandomizer = new Random(0);

            float max = 0.5f;

            deformation.X += max * (float)myRandomizer.NextDouble();
            deformation.Y += max * (float)myRandomizer.NextDouble();
            deformation.Z += max * (float)myRandomizer.NextDouble();
        }
Exemple #6
0
 private void store(OleDbConnection cn, AbstractCase obj, Canguro.Model.Model model)
 {
     if (obj is AnalysisCase && obj.IsActive)
     {
         store(cn, (AnalysisCase)obj);
     }
     else if (obj is LoadCombination && obj.IsActive)
     {
         store(cn, (LoadCombination)obj, model);
     }
 }
Exemple #7
0
        private void analysisCasesCheckedListBox_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (!updatingDialog)
            {
                AbstractCase aCase = (AbstractCase)analysisCasesCheckedListBox.Items[e.Index];
                aCase.IsActive = (e.NewValue == CheckState.Checked);

                Canguro.Model.Model.Instance.RepairAbstractCases(aCase);
                UpdateDialog();
            }
        }
Exemple #8
0
        private void store(OleDbConnection cn, LoadCombination obj, Canguro.Model.Model model)
        {
            List <AbstractCaseFactor> list = obj.Cases;

            string sql       = "";
            string steel     = CodeYN(model.SteelDesignOptions.DesignCombinations.Contains(obj));
            string concrete  = CodeYN(model.ConcreteDesignOptions.DesignCombinations.Contains(obj));
            string alum      = CodeYN(model.AluminumDesignOptions.DesignCombinations.Contains(obj));
            string cold      = CodeYN(model.ColdFormedDesignOptions.DesignCombinations.Contains(obj));
            string comboType = GetComboType(obj.Type);

            foreach (AbstractCaseFactor f in list)
            {
                AbstractCase aCase = f.Case as AbstractCase;
                sql = "";
                if (aCase != null) // && aCase.IsActive)
                {
                    if (aCase is LoadCombination)
                    {
                        sql = "INSERT INTO [Combination Definitions] " +
                              "(ComboName,ComboType,CaseType,CaseName,ScaleFactor,SteelDesign,ConcDesign,AlumDesign,ColdDesign) VALUES " +
                              "(\"" + obj.Name + "\",\"\",\"Combo\",\"" + aCase.Name + "\"," + f.Factor + "," + steel + "," + concrete + "," + alum + "," + cold + ");";
                    }
                    else if (aCase is AnalysisCase)
                    {
                        AnalysisCaseProps props = ((AnalysisCase)aCase).Properties;
                        if (props is StaticCaseProps)
                        {
                            // StaticCaseProps sprops = (StaticCaseProps)props;
                            sql = "INSERT INTO [Combination Definitions] " +
                                  "(ComboName,ComboType,CaseType,CaseName,ScaleFactor,SteelDesign,ConcDesign,AlumDesign,ColdDesign) VALUES " +
                                  "(\"" + obj.Name + "\",\"" + comboType + "\",\"Linear Static\",\"" + aCase.Name + "\"," + f.Factor + "," + steel + "," + concrete + "," + alum + "," + cold + ");";
                        }
                        else if (props is ResponseSpectrumCaseProps)
                        {
                            sql = "INSERT INTO [Combination Definitions] " +
                                  "(ComboName,ComboType,CaseType,CaseName,ScaleFactor,SteelDesign,ConcDesign,AlumDesign,ColdDesign) VALUES " +
                                  "(\"" + obj.Name + "\",\"" + comboType + "\",\"Response Spectrum\",\"" + aCase.Name + "\"," + f.Factor + "," + steel + "," + concrete + "," + alum + "," + cold + ");";
                        }
                        //steel = concrete = alum = cold = "\"\"";
                    }
                    if (sql.Length > 0)
                    {
                        new OleDbCommand(sql, cn).ExecuteNonQuery();
                    }
                }
            }

            // Insert record in RESULTS Named Set
            sql = " INSERT INTO [Named Sets - Database Tables 2 - Selections] " +
                  "(DBNamedSet, SelectType, [Selection]) VALUES (\"RESULTS\", \"Combo\", \"" + obj.Name + "\");";
            new OleDbCommand(sql, cn).ExecuteNonQuery();
        }
 private void addCaseButton_Click(object sender, EventArgs e)
 {
     foreach (object item in casesListBox.SelectedItems)
     {
         AbstractCase obj = item as AbstractCase;
         if (obj != null)
         {
             currentCombo.Cases.Add(new AbstractCaseFactor(obj));
         }
     }
     updateEditPage(false);
 }
        private bool Contains(IList <AbstractCaseFactor> factors, AbstractCase acase)
        {
            foreach (AbstractCaseFactor fac in factors)
            {
                if (acase.Name.Equals(fac.Case.Name))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #11
0
        public bool GetDeformationVectors(AreaElement area, Vector3[] localAxes, AbstractCase abstractCase, Vector3[] ctrlPoints, Vector3[] deformations)
        {
            // Dummy routine

            int verticesInList = ctrlPoints.Length;

            for (int i = 0; i < verticesInList; ++i)
            {
                getDeformationAt(area, abstractCase, ctrlPoints[i], ref deformations[i]);
            }

            return(true);
        }
Exemple #12
0
        private void addLoadDeflection(AbstractCase ac, LineElement line, float lineLength, float[,] controlPoints, DeformationAxis component, float scale, float EI)
        {
            if (ac == null)
            {
                return;
            }

            if (ac is LoadCombination)
            {
                foreach (AbstractCaseFactor acf in ((LoadCombination)ac).Cases)
                {
                    addLoadDeflection(acf.Case, line, lineLength, controlPoints, component, acf.Factor, EI);
                }
            }
            else if (ac is AnalysisCase)
            {
                if (((AnalysisCase)ac).Properties is StaticCaseProps)
                {
                    foreach (StaticCaseFactor staticCase in ((StaticCaseProps)((AnalysisCase)ac).Properties).Loads)
                    {
                        if (staticCase.AppliedLoad is LoadCase)
                        {
                            LoadCase lc = staticCase.AppliedLoad as LoadCase;
                            if (line.Loads[lc] != null)
                            {
                                foreach (Load load in line.Loads[lc])
                                {
                                    //addUniformLoadDeflection(line, lineLength, load as LineLoad, controlPoints, component, scale, EI);
                                    //addTriangularLoadDeflection(line, lineLength, load as LineLoad, controlPoints, component, scale, EI);
                                    if (load is DirectionalLineLoad)
                                    {
                                        addLoadDeflection(line, lineLength, load as DirectionalLineLoad, controlPoints, component, scale, EI);
                                    }
                                }
                            }
                            if (lc.SelfWeight > 0f)
                            {
                                if (line.Properties is StraightFrameProps)
                                {
                                    StraightFrameProps frameProps = line.Properties as StraightFrameProps;
                                    selfWeight.La = selfWeight.Lb = frameProps.Section.Area * frameProps.Section.Material.UnitWeight;
                                    //addUniformLoadDeflection(line, lineLength, selfWeight, controlPoints, component, lc.SelfWeight * scale, EI);
                                    addLoadDeflection(line, lineLength, selfWeight, controlPoints, component, lc.SelfWeight * scale, EI);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #13
0
 private void repairAbstractCases(AbstractCase changedAc, Dictionary <AbstractCase, LinkedList <AbstractCase> > adjacency)
 {
     if (adjacency.ContainsKey(changedAc))
     {
         foreach (AbstractCase ac in adjacency[changedAc])
         {
             if (ac.IsActive)
             {
                 ac.IsActive = false;
                 repairAbstractCases(ac, adjacency);
             }
         }
     }
 }
Exemple #14
0
        private void addToShearMomentDiagram(AbstractCase ac, LineElement line, float[,] controlPoints, LineForceComponent component, float scale)
        {
            if (ac == null)
            {
                return;
            }

            if (ac is LoadCombination)
            {
                foreach (AbstractCaseFactor acf in ((LoadCombination)ac).Cases)
                {
                    addToShearMomentDiagram(acf.Case, line, controlPoints, component, acf.Factor);
                }
            }
            else if (ac is AnalysisCase)
            {
                if (((AnalysisCase)ac).Properties is StaticCaseProps)
                {
                    foreach (StaticCaseFactor staticCase in ((StaticCaseProps)((AnalysisCase)ac).Properties).Loads)
                    {
                        if (staticCase.AppliedLoad is LoadCase)
                        {
                            LoadCase lc = staticCase.AppliedLoad as LoadCase;
                            if (line.Loads[lc] != null)
                            {
                                foreach (Load load in line.Loads[lc])
                                {
                                    if (load is DirectionalLineLoad)
                                    {
                                        addToShearMomentDiagram(line, load as DirectionalLineLoad, controlPoints, component, scale);
                                    }
                                }
                            }

                            if (lc.SelfWeight > 0f)
                            {
                                if (line.Properties is StraightFrameProps)
                                {
                                    StraightFrameProps frameProps = line.Properties as StraightFrameProps;
                                    selfWeight.La = selfWeight.Lb = frameProps.Section.Area * frameProps.Section.Material.UnitWeight;
                                    addToShearMomentDiagram(line, selfWeight, controlPoints, component, lc.SelfWeight * scale);
                                }
                            }
                        }
                    }
                }
            }
        }
        public StatisticalEnsemble(IMethod method, List <OutComesModel> input, int N, int CurGuestScore, int CurHostsScore)
        {
            cases          = method;
            StatisticsData = input;
            var allOutComes = StatisticsData.Where(x =>
                                                   x.Guests + x.Hosts > CurGuestScore + CurHostsScore &&
                                                   x.Guests >= CurGuestScore &&
                                                   x.Guests <= CurGuestScore + N &&
                                                   x.Guests - CurGuestScore + x.Hosts - CurHostsScore <= N &&
                                                   x.Hosts >= CurHostsScore &&
                                                   x.Hosts <= CurHostsScore + N)
                              .ToList();

            AbstractCase.Save(allOutComes, "All");
            PriorProbability = allOutComes.Sum(x => x.P);
        }
Exemple #16
0
        public float[,] GetForcesDiagram(AbstractCase ac, LineElement line, LineForceComponent component, int numPoints)
        {
            if (!model.HasResults)
            {
                return(null);
            }

            float[,] controlPoints = new float[numPoints, 2];

            float[] controlPointsX = new float[1]; // requestXCtrlPts(load);
            for (int i = 0, bufi = 0; i < numPoints; i++)
            {
                controlPoints[i, 0] = i / (numPoints - 1f);

                // Adjust control points
                if ((bufi < controlPointsX.Length) && (controlPointsX[bufi] <= controlPoints[i, 0]))
                {
                    controlPoints[i, 0] = controlPointsX[bufi++];
                }

                controlPoints[i, 1] = 0f; // controlPoints[i, 0] * (fdJ - fdI);
            }

            float fI, fJ;

            getForcesDiagram(ac, line, component, controlPoints, out fI, out fJ);

            for (int i = 0, bufi = 0; i < numPoints; i++)
            {
                // Los valores en los nodos se encuentran volteados. Del lado izquierdo positivo
                // es arriba, mientras del lado derecho positivo es abajo, por lo que si se tienen
                // dos valores positivos se debería pintar una recta con pendiente negativa y si
                // se tienen dos negativos al revés. DeltaY = Y1 + Y2 (por el cambio de signo).
                controlPoints[i, 1] += controlPoints[i, 0] * (fI + fJ) - fI;
            }

            return(controlPoints);
        }
Exemple #17
0
        private void btnAcheterPropriete_Click(object sender, EventArgs e)
        {
            Player       currentPlayer = game.CurrentPlayer;
            AbstractCase currentCase   = game.Cases[game.CurrentPlayer.CurrentCaseIndex];

            if (currentCase is PropertyCase)
            {
                PropertyCase property = currentCase as PropertyCase;

                if (property.Owner == null)
                {
                    if (currentPlayer.Wealth >= property.Price)
                    {
                        currentPlayer.Wealth = currentPlayer.Wealth - property.Price;
                        property.Owner       = currentPlayer;
                        property.Invalidate();
                    }
                }
            }

            btnAcheterPropriete.Enabled = false;
            UpdateTabs();
        }
Exemple #18
0
        public Vector3[] GetCurve(LineElement l, AbstractCase ac, int numPoints, float deformationScale, float paintScaleFactorTranslation, out float[] xPos)
        {
            if (l == null)
            {
                xPos = null;
                return(null);
            }

            Vector3 iPos, jPos;

            iPos = new Vector3(model.Results.JointDisplacements[l.I.Id, 0],
                               model.Results.JointDisplacements[l.I.Id, 1],
                               model.Results.JointDisplacements[l.I.Id, 2]);
            iPos = deformationScale * paintScaleFactorTranslation * iPos + l.I.Position;

            jPos = new Vector3(model.Results.JointDisplacements[l.J.Id, 0],
                               model.Results.JointDisplacements[l.J.Id, 1],
                               model.Results.JointDisplacements[l.J.Id, 2]);
            jPos = deformationScale * paintScaleFactorTranslation * jPos + l.J.Position;

            float[,] local2Values = GetCurvedAxis(l, model.Results.ActiveCase.AbstractCase, Analysis.LineDeformationCalculator.DeformationAxis.Local2, numPoints);
            float[,] local3Values = GetCurvedAxis(l, model.Results.ActiveCase.AbstractCase, Analysis.LineDeformationCalculator.DeformationAxis.Local3, numPoints);

            int nVertices = local2Values.GetLength(0);

            Vector3[] curve = new Vector3[nVertices];
            xPos = new float[nVertices];
            for (int i = 0; i < nVertices; i++)
            {
                xPos[i]  = local2Values[i, 0];
                curve[i] = iPos + local2Values[i, 0] * (jPos - iPos) +
                           local2Values[i, 1] * deformationScale * paintScaleFactorTranslation * l.LocalAxes[1] +
                           local3Values[i, 1] * deformationScale * paintScaleFactorTranslation * l.LocalAxes[2];
            }

            return(curve);
        }
Exemple #19
0
        public float[] GetCurvedPoint(LineElement l, AbstractCase ac, DeformationAxis component, float xPos)
        {
            if (!model.HasResults)
            {
                return(null);
            }

            /// controlPoints[i, 0]: x position on Beam, controlPoints[i, 1]: 'deflection' for x position, controlPoints[i,2]: deformation angle
            float[,] controlPoints = new float[1, 3];
            controlPoints[0, 0]    = xPos;
            controlPoints[0, 1]    = 0f;
            controlPoints[0, 2]    = 0.0f;

            getCurvedAxis(l, ac, component, controlPoints);

            // Copy to 1-dimensional array
            float[] ret = new float[3];
            for (int i = 0; i < 3; i++)
            {
                ret[i] = controlPoints[0, i];
            }

            return(ret);
        }
Exemple #20
0
 public float[,] GetCurvedAxis(AreaElement area, AbstractCase ac, DeformationAxis component, int numPoints)
 {
     return(null);
 }
Exemple #21
0
        public void UpdateTabs()
        {
            Player       currentPlayer = game.CurrentPlayer;
            AbstractCase currentCase   = game.Cases[game.CurrentPlayer.CurrentCaseIndex];

            tabs.TabPages.Clear();

            if (!game.HasPlayed && currentPlayer.NbDoubles <= 0) // @TODO : Player hasn't played ( firt throw )
            {
                btnLancerDes.Enabled = true;

                tabs.TabPages.Add(tabCaseDes);
            }
            else
            {
                if (currentPlayer.NbDoubles > 0)
                {
                    btnLancerDes.Enabled = true;

                    tabs.TabPages.Add(tabCaseDes);
                }
                if (currentCase is StartCase || currentCase is FreeParkingCase || currentCase is GoToJailCase || currentCase is JailCase)
                {
                    string title = currentCase.ToString();

                    if (currentCase is StartCase)
                    {
                        title += Environment.NewLine + "Vous gagnez 200F";
                    }
                    else if (currentCase is JailCase)
                    {
                        if (currentPlayer.IsInJail == true)
                        {
                            title += Environment.NewLine + "En prison !";
                        }
                        else
                        {
                            title += Environment.NewLine + "Visite simple";
                        }
                    }
                    else if (currentCase is GoToJailCase)
                    {
                        title += Environment.NewLine + "Allez en prison !";
                    }

                    lblCaseCoin.Text = title;

                    pbxCaseCoin.BackgroundImage       = currentCase.GetBoardCaseImage(game);
                    pbxCaseCoin.BackgroundImageLayout = ImageLayout.Zoom;

                    tabs.TabPages.Add(tabCaseCoin);
                }
                else if (currentCase is TaxCase)
                {
                    TaxCase taxe = currentCase as TaxCase;
                    pbxCaseTaxeCarte.BackgroundImage = taxe.GetBoardCaseImage(game);
                    tabs.TabPages.Add(tabCaseTaxe);
                }
                else if (currentCase is CardCase)
                {
                    CardCase specialCard = currentCase as CardCase;

                    lblChanceChancellerie.Text         = game.LastSpecialCard.ToString();
                    pbxCaseChanceImage.BackgroundImage = specialCard.TypeImage;
                    lblCaseChanceChancelTitre.Text     = specialCard.ToString();


                    tabs.TabPages.Add(tabCaseChanceChancel);
                }
                else if (currentCase is PropertyCase)
                {
                    PropertyCase property = currentCase as PropertyCase;

                    if (property.Owner == currentPlayer || property.Owner != null)
                    {
                        if (property.Owner == currentPlayer)
                        {
                            lblCasePropAchetee.Text = $"Bienvenue chez vous, {currentPlayer.Name} !";
                        }
                        else
                        {
                            if (!property.IsMortgaged)
                            {
                                lblCasePropAchetee.Text = $"Vous êtes chez {property.Owner.Name}.{Environment.NewLine}Vous payez {property.GetRent(game)}F de loyer";
                            }
                            else
                            {
                                lblCasePropAchetee.Text = $"Propriété hypothéquée {Environment.NewLine} Vous ne payez rien";
                            }
                        }

                        pbxCasePropAchetee.BackgroundImage = property.GetPropertyCardImage(2);

                        tabs.TabPages.Add(tabCasePropAchetee);
                    }
                    else
                    {
                        if (currentPlayer.Wealth >= property.Price)
                        {
                            btnAcheterPropriete.Enabled       = true;
                            pbxCasePropSimple.BackgroundImage = property.GetPropertyCardImage(2);
                            lblCasePropSimplePrixAchat.Text   = "Prix d'achat :" + Environment.NewLine + $"{property.Price}F";
                            tabs.TabPages.Add(tabCasePropSimple);
                        }
                        else
                        {
                            pbxCasePropSimple.BackgroundImage = property.GetPropertyCardImage(2);
                            lblCasePropSimplePrixAchat.Text   = "Vous n'avez pas assez de Flouzz.";
                            btnAcheterPropriete.Enabled       = false;
                            tabs.TabPages.Add(tabCasePropSimple);
                        }
                    }
                }
            }

            // Load the properties
            flpProperties.Controls.Clear();
            var cases = game.CurrentPlayer.GetProperties(game);

            foreach (PropertyCase c in cases)
            {
                PropertyManager pm = new PropertyManager()
                {
                    Property = c,
                    Game     = game,
                    FrmGame  = this,
                };

                flpProperties.Controls.Add(pm);

                pm.UpdateBuildings();
            }
            tabs.TabPages.Add(tabProperties);
        }
Exemple #22
0
        //public Vector3 GetPoint(LineElement l, AbstractCase ac, float xPos, float deformationScale, float paintScaleFactorTranslation)
        //{
        //    if (l == null)
        //    {
        //        return Vector3.Empty;
        //    }

        //    Vector3 iPos, jPos;
        //    iPos = new Vector3(model.Results.JointDisplacements[l.I.Id, 0],
        //                     model.Results.JointDisplacements[l.I.Id, 1],
        //                     model.Results.JointDisplacements[l.I.Id, 2]);
        //    iPos = deformationScale * paintScaleFactorTranslation * iPos + l.I.Position;

        //    jPos = new Vector3(model.Results.JointDisplacements[l.J.Id, 0],
        //                     model.Results.JointDisplacements[l.J.Id, 1],
        //                     model.Results.JointDisplacements[l.J.Id, 2]);
        //    jPos = deformationScale * paintScaleFactorTranslation * jPos + l.J.Position;

        //    float[,] local2Values = GetCurvedPoint(l, model.Results.ActiveCase.AbstractCase, Analysis.LineDeformationCalculator.DeformationAxis.Local2, xPos);
        //    float[,] local3Values = GetCurvedPoint(l, model.Results.ActiveCase.AbstractCase, Analysis.LineDeformationCalculator.DeformationAxis.Local3, xPos);

        //    Vector3 point = iPos + local2Values[0, 0] * (jPos - iPos) +
        //        local2Values[0, 1] * deformationScale * paintScaleFactorTranslation * l.LocalAxes[1] +
        //        local3Values[0, 1] * deformationScale * paintScaleFactorTranslation * l.LocalAxes[2];

        //    return point;
        //}

        private void getCurvedAxis(LineElement l, AbstractCase ac, DeformationAxis component, float[,] controlPoints)
        {
            Vector3 vI, vJ, mI, mJ, dI, dJ;

            vI = new Vector3(model.Results.ElementJointForces[l.Id, 0, 0],
                             model.Results.ElementJointForces[l.Id, 0, 1],
                             model.Results.ElementJointForces[l.Id, 0, 2]);

            vJ = new Vector3(model.Results.ElementJointForces[l.Id, 1, 0],
                             model.Results.ElementJointForces[l.Id, 1, 1],
                             model.Results.ElementJointForces[l.Id, 1, 2]);

            mI = new Vector3(model.Results.ElementJointForces[l.Id, 0, 3],
                             model.Results.ElementJointForces[l.Id, 0, 4],
                             model.Results.ElementJointForces[l.Id, 0, 5]);

            mJ = new Vector3(model.Results.ElementJointForces[l.Id, 1, 3],
                             model.Results.ElementJointForces[l.Id, 1, 4],
                             model.Results.ElementJointForces[l.Id, 1, 5]);

            dI = l.I.Position + new Vector3(model.Results.JointDisplacements[l.I.Id, 0],
                                            model.Results.JointDisplacements[l.I.Id, 1],
                                            model.Results.JointDisplacements[l.I.Id, 2]);

            dJ = l.J.Position + new Vector3(model.Results.JointDisplacements[l.J.Id, 0],
                                            model.Results.JointDisplacements[l.J.Id, 1],
                                            model.Results.JointDisplacements[l.J.Id, 2]);

            // Transform to the line's local coordinate system
            // From the global system
            // (WARNING: This is supposed to come in the joint's local coordinate system)
            vI = toLocal(l, vI);
            vJ = toLocal(l, vJ);

            mI = toLocal(l, mI);
            mJ = toLocal(l, mJ);

            dI = toLocal(l, dI);
            dJ = toLocal(l, dJ);

            float fI = 0f, fJ = 0f, fmI = 0f, fmJ = 0f, fdI = 0f, fdJ = 0f;
            float EI         = ((StraightFrameProps)l.Properties).Section.Material.TypeProperties.E;
            float lineLength = l.Length;

            switch (component)
            {
            case DeformationAxis.Local2:
                fI = vI.Y; fmI = -mI.Z; fdI = dI.Y;
                fJ = vJ.Y; fmJ = -mJ.Z; fdJ = dJ.Y;

                EI *= ((StraightFrameProps)l.Properties).Section.I33;
                break;

            case DeformationAxis.Local3:
                fI = vI.Z; fmI = mI.Y; fdI = dI.Z;
                fJ = vJ.Z; fmJ = mJ.Y; fdJ = dJ.Z;

                EI *= ((StraightFrameProps)l.Properties).Section.I22;
                break;
            }

            addLoadDeflection(ac, l, lineLength, controlPoints, component, 1.0f, EI);
            addMomentDeflection(fmI, lineLength, controlPoints, EI, -1);
            addMomentDeflection(fmJ, lineLength, controlPoints, EI, 1);
        }
Exemple #23
0
        /// <summary>
        /// Action roll dice for player
        /// </summary>
        public void RollDice()
        {
            turnCount++;

            // Roll dice process
            int roll1 = DieOne.Roll();
            int roll2 = DieSecond.Roll();

            int sum = roll1 + roll2;

            doPlayAgain = roll1 == roll2;

            // If number are the same player can re-roll dices
            if (doPlayAgain)
            {
                InfoBulle = "Double, Relancez!!";

                Reader(infoBulle);

                doubleDiceCount++;

                if (doubleDiceCount >= 3)
                {
                    //TODO send player to jail

                    SetNextPlayerTurn();
                }
            }
            else
            {
                InfoBulle = "Avancez de " + sum + " cases";
                Reader(infoBulle);

                SetNextPlayerTurn();
            }

            // Move
            AbstractCase currentCase = Cases[CurrentPlayer.CurrentCaseIndex];

            CurrentPlayer.CurrentCaseIndex = CalculateNextCase(CurrentPlayer.CurrentCaseIndex, sum);
            AbstractCase nextCase = Cases[CurrentPlayer.CurrentCaseIndex];

            currentCase.Players.Remove(CurrentPlayer);
            nextCase.Players.Add(CurrentPlayer);

            // Execute case action
            string result = nextCase.Action(CurrentPlayer, (Platter)Model);

            if (nextCase.GetType() == typeof(PropertyCase) || nextCase.GetType() == typeof(StationCase))
            {
                MsgBoxYesNo msgbox = new MsgBoxYesNo(result);
                if ((bool)msgbox.ShowDialog())
                {
                    // Todo Buy property
                }
            }
            else
            {
                new MsgBoxOk(result).ShowDialog();
            }
        }
Exemple #24
0
 public Vector3[] GetCurve(AreaElement area, AbstractCase ac, int numPoints, float deformationScale, float paintScaleFactorTranslation, out float[] xPos)
 {
     xPos = null;
     return(null);
 }
Exemple #25
0
 private void getCurvedAxis(AreaElement area, AbstractCase ac, DeformationAxis component, float[,] controlPoints)
 {
 }
 public void SetNextCase(AbstractCase value)
 {
     _nextCase = value;
 }
 public void SetPreviousCase(AbstractCase value)
 {
     _previousCase = value;
 }
Exemple #28
0
 public float[] GetCurvedPoint(AreaElement area, AbstractCase ac, DeformationAxis component, float xPos)
 {
     return(null);
 }