コード例 #1
0
        /// <summary>
        /// Calculating eccentricity cose by II order
        /// </summary>
        public void Calculate()
        {
            ei = ElementGeometry.li / 400;
            e0 = new List <double>()
            {
                ElementGeometry.h / 30, 20 / 10.0
            }.Max();

            if (ElementGeometry.λ > λ_lim)
            {
                //// drugi red
                var ρ     = 0.01;
                var n_bal = 0.4;
                var n     = Forces.NEd / (ElementGeometry.b * ElementGeometry.h * Material.beton.fcd / 10);
                var nu    = 1 + (ρ * Material.armatura.fyd / Material.beton.fcd / 10);

                var Kφ = 1;
                var Kr = (nu - n) / (nu - n_bal);
                Kr = Kr >= 1 ? Kr : 1;///if Kr>=1 then use it else use 1
                var t1 = (Material.armatura.fyd * 10 / (Material.armatura.Es * 1000));
                var t2 = (1 / (0.45 * (ElementGeometry.h - ElementGeometry.d1)));
                var Ko = (Material.armatura.fyd / (Material.armatura.Es * 100)) * (1 / (0.45 * (ElementGeometry.h - ElementGeometry.d1)));

                var K = Kφ * Kr * Ko;

                e2 = K * Math.Pow(ElementGeometry.li, 2) * 1 / Math.Pow(Math.PI, 2);
            }
            MEd = Forces.MEd(e2);
        }
コード例 #2
0
        /// <summary>
        /// Updates the Physics of the entity.
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Update(GameTime gameTime)
        {
            //ITEM: c) Implementou corretamente o cálculo de deslocamento da bala, levando em conta a inércia e fazendo uso de vetores;
            Vector2 forces        = Vector2.Zero;
            Vector2 instantForces = Vector2.Zero;
            float   secs          = (float)gameTime.ElapsedGameTime.TotalSeconds;

            #region Calculate Forces
            //Constant forces
            foreach (Vector2 force in ConstantForces.Values)
            {
                forces += force;
            }

            //Forces applied once
            while (Forces.Count > 0)
            {
                instantForces += (Forces.Pop() / Mass); //Since it will be applied only once, must do a BIG BOOM.
            }
            #endregion Calculate Forces

            Vector2 acceleration = (forces / Mass) + Gravity;
            Vector2 accelSecs    = acceleration * secs;

            Entity.Position += GlobalForces.MetersToPixels((Momentum + accelSecs / 2) * secs);
            Momentum        += (accelSecs + instantForces);
            Momentum        *= (Vector2.One - Friction);

            if (Rotate)
            {
                Entity.Rotation = Momentum.GetAngle();
            }
        }
コード例 #3
0
ファイル: Hinge.cs プロジェクト: zdimension/phytestcs
        //private readonly Force _torque2Sup = null!;

        public Hinge(float size, PhysicalObject object1, Vector2f object1RelPos,
                     PhysicalObject?object2 = null, Vector2f object2RelPos = default, ForceType?type = null)
            : base(1e8f, 0, size, object1, object1RelPos, object2, object2RelPos, type ?? ForceType.Hinge)
        {
            ShowInfos = false;

            type ??= ForceType.Hinge !;
            _torque1 = new Force(type, new Vector2f(0, 0), new Vector2f(1, 0))
            {
                Source = this
            };
            _torque2 = new Force(type, new Vector2f(0, 0), new Vector2f(-1, 0))
            {
                Source = this
            };
            object1 !.Forces.Add(_torque1);
            object1.Forces.Add(_torque2);
            object1.Hinge = this;

            Force1.OnlyTorque = true;
            if (Force2 != null)
            {
                Force2.OnlyTorque = true;
            }

            Size = size;
        }
コード例 #4
0
        public NodalDisplacement DetermineRigidbodyPointDisplacement(Point2D coordinate, LoadPattern loadPattern)
        {
            LateralLevelForce forceAtLoadPattern = Forces.First(f => f.LoadPattern == loadPattern);

            var alpha = new Unitless((coordinate - LateralLevel.CenterOfRigidity).SignedAngleTo(Vector2D.XAxis));
            var d     = new Length(coordinate.DistanceTo(LateralLevel.CenterOfRigidity), LengthUnit.Inch);

            Moment M = forceAtLoadPattern.TotalT(LateralLevel.CenterOfRigidity);

            var rotation = (Unitless)(M / LevelStiffness.J);

            Length displacementX = (Length)(forceAtLoadPattern.DirectX / LevelStiffness.X + d * rotation * Result.Sin(alpha));
            Length displacementY = (Length)(forceAtLoadPattern.DirectY / LevelStiffness.Y + d * rotation * Result.Cos(alpha));

            if (LoadPatternTypeConverter.Convert(loadPattern) == LoadPatternType.Earthquake)
            {
                displacementX = (Length)(displacementX * Cd);
                displacementY = (Length)(displacementY * Cd);
            }

            return(new NodalDisplacement
            {
                LoadPattern = loadPattern,
                Ux = displacementX.ConvertTo(LengthUnit.Inch),
                Uy = displacementY.ConvertTo(LengthUnit.Inch),
                Rz = 0
            });
        }
コード例 #5
0
 private void SaveForces()
 {
     foreach (var force in Forces.Where(force => force.Changed))
     {
         force.SaveChanges();
     }
 }
コード例 #6
0
     public override string ToString()
     {
         return($@"//////Result///////
 Forces:
     {"Msd:",-12}{Forces.Msd,13:F2}{"kNm",-5}
     {"Nsd:",-12}{Forces.Nsd,13:F2}{"kN",-5}
     {"Msds:",-12}{Forces.Msds(Geometry.h, Geometry.d1),13:F2}{"kNm",-5} 
 Material:
     Reinforcement:  {Material.armatura}
     Concrete:       {Material.beton}
 Geometry:
     {"b:",-12}{Geometry.b,13:F2}{Geometry.unit,-5}
     {"h:",-12}{Geometry.h,13:F2}{Geometry.unit,-5}
     {"d1:",-12}{Geometry.d1,13:F2}{Geometry.unit,-5}
     {"d2:",-12}{Geometry.d2,13:F2}{Geometry.unit,-5}
     {"d:",-12}{Geometry.d,13:F2}{Geometry.unit,-5}
 Result:
     {"εc/εs1:",-12}{KofZaProracunPravougaonogPreseka.εc,13:F3}{"/",1}{KofZaProracunPravougaonogPreseka.εs1,-5:F3}{"‰",1}
     {"εs2:",-12}{KofZaProracunPravougaonogPreseka.εs2(Geometry.d, Geometry.d2),13:F3}{"‰",-5}
     {"μSd:",-12}{KofZaProracunPravougaonogPreseka.μRd,13:F3}{"",-5}
     {"x:",-12}{X,13:F2}{"",-5}
     {"As1_req:",-12}{As1_pot,13:F2}{"cm2",-5}
     {"As2_req:",-12}{As2_pot,13:F2}{"cm2",-5}
     {"μSd_lim:",-12}{Kof_lim.μRd,13:F3}");
     }
コード例 #7
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            //ClippingBox
            //args.Pipeline.DrawBox(ClippingBox, System.Drawing.Color.Black);
            if (!(Value is null)) //if no point or, force AND moment are zero, nothing to draw
            {
                System.Drawing.Color col = args.Color;
                if (!DrawUtil.CheckSelection(col))
                {
                    col = DrawUtil.DrawColorLoads;
                }
                else
                {
                    drawInfoPanel(args.Pipeline, args.Viewport);
                }

                args.Pipeline.DrawPoint(Value.Location, Rhino.Display.PointStyle.X, 5, DrawUtil.DrawColorLoads);

                if (!(Forces.IsTiny() && Moments.IsTiny() && Displacement.IsTiny() && DisplacementRotational.IsTiny()) && DrawUtil.ScaleFactorLoads > 0.0001)
                {
                    if (!_loadCondition.isValid)
                    {
                        updateLoadTransforms();
                    }
                    _loadCondition.Draw(args.Pipeline, col);
                }
            }
        }
コード例 #8
0
        private void drawInfoPanel(Rhino.Display.DisplayPipeline pipeline, Rhino.Display.RhinoViewport viewport)
        {
            if (DrawUtil.DrawInfo)
            {
                if (_infoPanel == null)
                {
                    _infoPanel = new InfoPanel();
                    _infoPanel.Positions.Add(Value.Location);

                    _infoPanel.Content.Add("LC: " + LoadCase);
                    if (!Forces.IsTiny())
                    {
                        _infoPanel.Content.Add("Force: " + Forces.Length);
                    }
                    if (!Moments.IsTiny())
                    {
                        _infoPanel.Content.Add("Moment: " + Moments.Length);
                    }
                    if (!Displacement.IsTiny())
                    {
                        _infoPanel.Content.Add("Displacement: " + Displacement.Length);
                    }
                    if (!DisplacementRotational.IsTiny())
                    {
                        _infoPanel.Content.Add("Rot.Displacement: " + DisplacementRotational.Length);
                    }
                }
                _infoPanel.Draw(pipeline, viewport);
            }
        }
コード例 #9
0
 protected sealed override void AddForce(Force force)
 {
     if (!Forces.Contains(force))
     {
         Forces.Add(force);
     }
 }
コード例 #10
0
        public bool AddLecturer(Lecturer lecturer, string departmentName)
        {
            bool result = true;

            new Lecturer(lecturer.GetForname(), lecturer.GetName(), lecturer.GetBirthdayDate(), lecturer.GetAcademicTitle(), lecturer.GetPosition());
            foreach (var item in Forces)
            {
                if (item.GetForceName() == departmentName)
                {
                    foreach (var lect in item.Lecturers)
                    {
                        if (lect.Equals(lecturer))
                        {
                            result = false;
                        }
                        else
                        {
                            item.AddLecturer(lecturer);
                            result = true;
                        }
                    }
                }
                else
                {
                    Force force = new Force(departmentName, null);
                    Forces.Add(force);
                    force.AddLecturer(lecturer);
                    result = true;
                }
            }
            return(result);
        }
コード例 #11
0
        private void ReinforcementCalc()
        {
            var Msds = Forces.Msds(Geometry.h, Geometry.d1);

            Mrd_limit = (Kof_lim.μRd * Geometry.b * Math.Pow(Geometry.d, 2) * Material.beton.fcd / 10) / 100;

            if (Msds <= Mrd_limit)
            {
                As1_pot = (KofZaProracunPravougaonogPreseka.ω * Geometry.b * Geometry.d * Material.beton.fcd / 10 / Material.armatura.fyd) + (Forces.Nsd / Material.armatura.fyd);
            }
            else
            {
                As2_pot = (Msds * 100 - Mrd_limit * 100) / ((Geometry.d - Geometry.d2) * Material.armatura.fyd);
                As1_pot = Mrd_limit * 100 / (Kof_lim.ζ * Geometry.d * Material.armatura.fyd) + (Forces.Nsd / Material.armatura.fyd) + As2_pot;

                As2_pot = As2_pot < 0 ? 0 : As2_pot;
            }

            if ((As1_pot + As2_pot) / Geometry.b / Geometry.h > ρ_max)
            {
                throw new Exception("ρ_max exceeded! Make section bigger");
            }

            if (As2_pot != 0)
            {
                KofZaProracunPravougaonogPreseka = Kof_lim;
            }
            X = KofZaProracunPravougaonogPreseka.ξ * Geometry.d;

            if (Forces.IsMsdNegativ)
            {
                As2_pot = As1_pot;
                As1_pot = (Msds * 100 - Mrd_limit * 100) / ((Geometry.d - Geometry.d2) * Material.armatura.fyd);
            }
        }
コード例 #12
0
    private IEnumerator Spawn()
    {
        while (infinite || remainingToSpawn > 0)
        {
            float scale = Mathf.Round(((spawnNumber - remainingToSpawn) * 0.02f) * 10.0f) / 10.0f;

            Debug.Log("Scale=" + scale.ToString());
            float      pos         = Random.Range(-5.0f, 5.0f);
            Vector3    newPosition = transform.position + new Vector3(pos, 0, 0);
            GameObject newObject   = Instantiate(reference, newPosition, transform.rotation);
            newObject.transform.localScale += new Vector3(scale, scale, 0);
            Rigidbody rb = newObject.GetComponent <Rigidbody>();
            if (rb)
            {
                Vector3 direction = new Vector3(
                    -pos / 10,
                    -1.0f,
                    0);
                direction *= Random.Range(minStrength, maxStrength);
                Forces forces = newObject.GetComponent <Forces>();
                forces.force = direction;
            }
            remainingToSpawn--;

            yield return(new WaitForSeconds(ratePerSecond));
        }
    }
コード例 #13
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            //draw clippingbox
            //args.Pipeline.DrawBox(ClippingBox, System.Drawing.Color.Black);
            if (!(Value is null))
            {
                System.Drawing.Color col = args.Color;
                if (!DrawUtil.CheckSelection(col))
                {
                    col = DrawUtil.DrawColorLoads;
                }
                else
                {
                    drawInfoPanel(args.Pipeline, args.Viewport);
                }

                args.Pipeline.DrawCurve(Value, DrawUtil.DrawColorLoads, args.Thickness + 1);

                if (DrawUtil.ScaleFactorLoads > 0.0001 && !(Forces.IsTiny() && Moments.IsTiny()))
                {
                    if (!_loadCondition.isValid)
                    {
                        updateLoadTransforms();
                    }
                    _loadCondition.Draw(args.Pipeline, col);
                }
            }
        }
コード例 #14
0
 public void Execute(List <Particle> particles, float dt)
 {
     particles.ForEach(x => x.ForceAccumulator = new HyperPoint <float>(0f, 0f));
     Forces.ForEach(x => x.CalculateForce(particles));
     DoConstraints(Constraints, particles, dt, SpringConstant, SpringDemping);
     particles.ForEach(x => x.Velocity += (x.ForceAccumulator + x.ForceConstraint) / x.Massa * dt);
 }
コード例 #15
0
ファイル: FollowRoad.cs プロジェクト: KiiraHoke/OldProjet
 // Use this for initialization
 void Start()
 {
     // Initialisation
     this.transform.position = Highway.PointOnPath(road.nodes.ToArray(), percentage);
     transform.forward = Highway.PointOnPath(road.nodes.ToArray(), percentage + percentageViewOffset) - transform.position;
     // Forces
     forces = GetComponent<Forces>();
 }
コード例 #16
0
 public void SetLoadTargetForce(string name,
                                string loadPattern,
                                ForcesActive forcesActive,
                                Forces forceValues,
                                Forces relativeForcesLocation,
                                eItemType itemType = eItemType.Object)
 {
 }
コード例 #17
0
 public void AddForce(ExternalForce3d force)
 {
     if (Forces.Contains(force))
     {
         return;
     }
     Forces.Add(force);
 }
コード例 #18
0
        /*
         #region fields for using in serialization - deserialization
         *
         * private List<double[]> DisplacementsValues;
         * private LoadCase[] DisplacementsCases;
         *
         * private LoadCase[] ForcesCases;
         * private List<double[]> ForcesValues;
         *
         #endregion
         *
         *
         * /// <summary>
         * /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the target object.
         * /// </summary>
         * /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data.</param>
         * /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext" />) for this serialization.</param>
         * /// <exception cref="System.NotImplementedException"></exception>
         * public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
         * {
         *  info.AddValue("ReleasedMap",ReleasedMap);
         *  info.AddValue("FixedMap",FixedMap);
         *  info.AddValue("ReversedReleasedMap",ReversedReleasedMap);
         *  info.AddValue("ReversedFixedMap",ReversedFixedMap);
         *  info.AddValue("settlementsLoadCase",settlementsLoadCase);
         *
         *  FillArraysFromDictionary();
         *
         *  info.AddValue("DisplacementsCases", DisplacementsCases);
         *  info.AddValue("DisplacementsValues", DisplacementsValues);
         *  info.AddValue("ForcesCases", ForcesCases);
         *  info.AddValue("ForcesValues", ForcesValues);
         *
         *  //info.AddValue("KffCholesky", );
         *  //info.AddValue("KffLdl", KffLdl);
         *  info.AddValue("Kss", Kss);
         *  info.AddValue("Kfs", Kfs);
         * }
         *
         * private void FillArraysFromDictionary()
         * {
         *  DisplacementsCases = new LoadCase[displacements.Count];
         *  DisplacementsValues = new List<double[]>();
         *
         *  var cnt = 0;
         *
         *  foreach (var pair in displacements)
         *  {
         *      DisplacementsCases[cnt++] = pair.Key;
         *      DisplacementsValues.Add(pair.Value);
         *  }
         *
         *  ForcesCases = new LoadCase[displacements.Count];
         *  ForcesValues = new List<double[]>();
         *
         *  cnt = 0;
         *
         *  foreach (var pair in forces)
         *  {
         *      ForcesCases[cnt++] = pair.Key;
         *      ForcesValues.Add(pair.Value);
         *  }
         * }
         *
         * protected StaticLinearAnalysisResult(SerializationInfo info, StreamingContext context)
         * {
         *  ReleasedMap = info.GetValue<int[]>("ReleasedMap");
         *  FixedMap = info.GetValue<int[]>("FixedMap");
         *  ReversedReleasedMap = info.GetValue<int[]>("ReversedReleasedMap");
         *  ReversedFixedMap = info.GetValue<int[]>("ReversedFixedMap");
         *  settlementsLoadCase = info.GetValue<LoadCase>("settlementsLoadCase");
         *
         *  DisplacementsCases = info.GetValue<LoadCase[]>("DisplacementsCases");
         *  DisplacementsValues = info.GetValue<List<double[]>>("DisplacementsValues");
         *  ForcesCases = info.GetValue<LoadCase[]>("ForcesCases");
         *  ForcesValues = info.GetValue<List<double[]>>("ForcesValues");
         *
         *  KffCholesky = info.GetValue<CSparse.Double.Factorization.SparseCholesky>("KffCholesky");
         *  //KffLdl = info.GetValue<CSparse.Double.Factorization.SparseLDL>("KffLdl");
         *
         *  Kss = info.GetValue<CSparse.Double.CompressedColumnStorage>("Kss");
         *  Kfs = info.GetValue<CSparse.Double.CompressedColumnStorage>("Kfs");
         * }
         *
         * [OnDeserialized]
         * private void FillDictionaryFromArray(StreamingContext context)
         * {
         *  displacements.Clear();
         *  forces.Clear();
         *
         *  for (var i = 0; i < DisplacementsValues.Count; i++)
         *  {
         *      displacements[DisplacementsCases[i]] = DisplacementsValues[i];
         *  }
         *
         *  for (var i = 0; i < ForcesValues.Count; i++)
         *  {
         *      forces[ForcesCases[i]] = ForcesValues[i];
         *  }
         * }
         */
        #endregion

        public void Clear()
        {
            Displacements.Clear();
            Forces.Clear();
            ElementForces.Clear();
            ConcentratedForces.Clear();
            SupportReactions.Clear();
        }
コード例 #19
0
        //public ISteelMaterial Material { get; set; }


        public List <IMemberForce> GetForce(string LoadCaseName)
        {
            var f = Forces.Where(a => a.LoadCaseName == LoadCaseName).ToList();

            if (f == null)
            {
                throw new Exception("Member force for load combination not found");
            }

            return(f);
        }
コード例 #20
0
        private void SetKof()
        {
            if (TypeDim == TypeDimensioning.Bound)
            {
                μSd = coeffService.GetByμ(Forces.Msds(Geometry.h, Geometry.d1), Geometry.b, Geometry.d).μRd;
            }
            else
            {
                μSd = coeffService.GetNew(Material.beton.εcu2, Material.armatura.eps_ud).μRd;
            }

            KofZaProracunPravougaonogPreseka = coeffService.GetByμ(μSd);
        }
コード例 #21
0
        public void Forces()
        {
            double mass         = 155;
            double acceleration = 9.18;

            var forces = new Forces(acceleration, mass);

            forces.LawofForces();

            double actual   = forces.Force;
            double expected = 1422.9;

            Assert.AreEqual(expected‬, actual, 0.000000000001);
        }
コード例 #22
0
        /// <summary>
        /// If TypeDim == TypeDimensioning.Free
        /// </summary>
        private void FreeDim()
        {
            double d_r = 0;
            double h_r = 0;

            d_r = Math.Sqrt(Forces.Msds(Geometry.h, Geometry.d) * 100 / (Geometry.b * KofZaProracunPravougaonogPreseka.μRd * Material.beton.fcd / 10));
            h_r = d_r + this.Geometry.d1;
            if (h_r % 5 != 0)
            {
                Geometry.h = h_r - (h_r % 5) + 5;
            }
            else
            {
                Geometry.h = h_r;
            }
            ReinforcementCalc();
        }
コード例 #23
0
        public override string WhatAreYou(Being suspect)
        {
            if (suspect == null)
            {
                return("I don't exist");
            }
            else if (suspect.Forces.Contains(Force.DarkSide) &&
                     Forces.Contains(Force.DarkSide))
            {
                return("I'm a Sith");
            }
            else if (suspect.Forces.Contains(Force.LightSide))
            {
                return("I'm a Jedi");
            }

            return("I'm neither Sith nor Jedi");
        }
コード例 #24
0
        private void SaveForces(IEAElement element)
        {
            //see saveHistroy (clone)
            IEnumerable <string> removedForceEvaluations =
                element.TaggedValues.Where(tv => tv.Name.StartsWith(EATaggedValueKeys.ForceEvaluation))
                .Select(tv => tv.GUID)
                .Except(Forces.Select(f => f.TaggedValueGUID));

            foreach (string tagGUID in removedForceEvaluations)
            {
                element.RemoveTaggedValueByGUID(tagGUID);
            }

            foreach (IForceEvaluation forceEvaluation in Forces)
            {
                forceEvaluation.SaveChanges();
            }
        }
コード例 #25
0
 public void updpos(float x, float y)
 {
     if (type == "char" || type == "center")
     {
         pos.x     = x;
         pos.y     = y;
         aud.x     = x;
         aud.pos.x = x;
     }
     if (type == "center")
     {
         //Debug.Log("center updated");
         doupdate(x, y);
     }
     if (type == "char")
     {
         Forces.recalcCenter();
     }
 }
コード例 #26
0
        public CarBehaviour()
        {
            previousYawVelocity = 0;
            ForwardVelocity     = 0;
            ThrottleInput       = 0;
            BrakeInput          = 0;

            YawAngle   = 0;
            SteerAngle = 0;

            currentDateTime = previousDateTime = DateTime.Now;

            XCoordinate = YCoordinate = 0;

            tyre         = new Tyre();
            Forces       = new Forces();
            Movement     = new Movement();
            Position     = new Position();
            Acceleration = new Acceleration.Acceleration();
        }
コード例 #27
0
ファイル: ForceChooser.cs プロジェクト: minakhan01/Astronomy
    public static IForceDelegate InstantiateForce(Forces force, GameObject host)
    {
        IForceDelegate forceD = null;

        switch (force)
        {
        case Forces.Gravity:
            // leave as null - GE has gravity built-in
            break;

        case Forces.InverseR:
            forceD = new InverseR();
            break;

        case Forces.InverseR3:
            forceD = new InverseR3();
            break;

        case Forces.ForceR:
            forceD = new ForceR();
            break;

        case Forces.ForceR2:
            forceD = new ForceR2();
            break;

        case Forces.Custom:
            forceD = host.GetComponent <IForceDelegate>();
            if (forceD == null)
            {
                Debug.LogError("Custom IForceDelegate is not attached to " + host.name);
            }
            break;

        default:
            Debug.LogError("Unknown force (was it added to ForceChooser? => " + force);
            break;
        }

        return(forceD);
    }
コード例 #28
0
        private void LoadForces(IEAElement element)
        {
            Forces.Clear();
            IEnumerable <IForceEvaluation> forces =
                element.TaggedValues.Where(tv => tv.Name.StartsWith(EATaggedValueKeys.ForceEvaluation))
                .Select(tv =>
            {
                try
                {
                    return((IForceEvaluation) new ForceEvaluation(this, tv));
                }
                catch (ForceNotInModelException)
                {
                    return(null);
                }
            }).Where(tv => tv != null);

            foreach (IForceEvaluation force in forces)
            {
                Forces.Add(force);
            }
        }
コード例 #29
0
        private void drawInfoPanel(Rhino.Display.DisplayPipeline pipeline, Rhino.Display.RhinoViewport viewport)
        {
            if (DrawUtil.DrawInfo)
            {
                if (_infoPanel == null)
                {
                    _infoPanel = new InfoPanel();
                    _infoPanel.Positions.Add(Value.PointAtNormalizedLength(0.5));

                    _infoPanel.Content.Add("LC: " + LoadCase);
                    if (!Forces.IsTiny())
                    {
                        _infoPanel.Content.Add("Force: " + Forces.Length);
                    }
                    if (!Moments.IsTiny())
                    {
                        _infoPanel.Content.Add("Moment: " + Moments.Length);
                    }
                }
                _infoPanel.Draw(pipeline, viewport);
            }
        }
コード例 #30
0
        private void drawInfoPanel(Rhino.Display.DisplayPipeline pipeline, Rhino.Display.RhinoViewport viewport)
        {
            if (DrawUtil.DrawInfo)
            {
                if (_infoPanel == null)
                {
                    _infoPanel = new InfoPanel();
                    var amp = AreaMassProperties.Compute(Value);
                    _infoPanel.Positions.Add(Value.ClosestPoint(amp.Centroid));

                    _infoPanel.Content.Add("LC: " + LoadCase);
                    if (!Forces.IsTiny())
                    {
                        _infoPanel.Content.Add("Force: " + Forces.Length);
                    }
                    if (!Moments.IsTiny())
                    {
                        _infoPanel.Content.Add("Moment: " + Moments.Length);
                    }
                }
                _infoPanel.Draw(pipeline, viewport);
            }
        }
コード例 #31
0
        public virtual void Update()
        {
            Vector2D displacement = N2.Position.Subtract(N1.Position);
            Vector2D center       = N1.Position.AddScaled(displacement, 0.5);
            Vector2D velocity     = N1.Velocity.Subtract(N2.Velocity);

            double projectedVelocity = velocity.Dot(displacement.Normalize());

            // Follows the linear muscle model
            double normalizedLength = displacement.Norm / InitialLength;
            double forceMag         = 0;

            if (normalizedLength > constants.MuscleNormalizedMinLength)
            {
                forceMag = (ActiveConstant * action + PassiveConstant) * (normalizedLength - constants.MuscleNormalizedMinLength);
            }

            forceMag += projectedVelocity * DampingConstant;
            Forces.Clear();
            foreach (Node n in new Node[] { N1, N2 })
            {
                Forces.Add(n, center.Subtract(n.Position).ScaleTo(forceMag));
            }
        }