示例#1
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);
        }
示例#2
0
        //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;
        }
示例#3
0
 protected sealed override void AddForce(Force force)
 {
     if (!Forces.Contains(force))
     {
         Forces.Add(force);
     }
 }
示例#4
0
 public void AddForce(ExternalForce3d force)
 {
     if (Forces.Contains(force))
     {
         return;
     }
     Forces.Add(force);
 }
示例#5
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);
            }
        }
示例#6
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));
            }
        }
 public void ApplyForce(Vector2 force)
 {
     Forces.Add(force);
 }
示例#8
0
 public void AddForce(string name, string address)
 {
     Forces.Add(new Force(name, address));
 }
示例#9
0
 /// <summary>
 /// Adds a record to both the forces and the time list
 /// </summary>
 /// <param name="force">The force to be inserted</param>
 /// <param name="time">The time to be inserted. This time is the time from the startdate</param>
 public void insertHit(double force, double time)
 {
     Forces.Add(force);
     Times.Add(time);
 }
示例#10
0
 internal override void InitializeForces()
 {
     Forces.Add(this.GetGravityForce());
     Forces.Add(this.GetAirResistanceForce());
     Forces.Add(this.GetTractionForce());
 }
示例#11
0
 protected virtual void AddForce(Force force)
 {
     Forces.Add(force);
 }