Beispiel #1
0
        public SingleBody(List <Vector2f> geometry, Vector2f position, Vector2f velocity, Vector2f acceleration, float rotation)
        {
            Geometry         = geometry;
            Position         = position;
            Velocity         = velocity;
            RotationVelocity = rotation;
            Acceleration     = acceleration;
            MassCenter       = new Vector2f(0, 0);
            foreach (var vector2F in Geometry)
            {
                MassCenter += vector2F;
            }

            MassCenter     *= 1f / Geometry.Count;
            Mass            = 1;
            EffectiveRadius = Geometry
                              .Select(elem => MathModule.Hypot(elem))
                              .Max();
            UpdateBoundingBox();
        }