コード例 #1
0
 public static SFVec2F xy(float x, float y)
 {
     var v = new SFVec2F
     {
         X=x,
         Y=y
     };
     return v;
 }
コード例 #2
0
        public void ApplyChargeForce(double repulsion, SFVec2F distance)
        {
            double d;
            SFVec2F direction;
            SFVec2F force;

            d = distance.magnitude() + 0.1; // avoid massive forces at small distances (and divide by zero)
            direction = distance.normalise();
            force = direction * repulsion / (d * d * 0.5);

            ApplyForce(force);

            // using coulombs law:
            //      k*QA*QB
            // F = ________
            //        r^2
        }
コード例 #3
0
 public void ApplyForce(SFVec2F force)
 {
     this.Acceleration += (force / this.Mass);
 }
コード例 #4
0
 public TNode()
 {
     Children = new List<TNode>();
     Acceleration = SFVec2F.Zero;
     Point = SFVec2F.Zero;
 }