public SpObject(SpObject copy) : this(copy != null ? copy.M : default(Double), copy != null ? copy.P : default(SpVector), copy != null ? copy.S : default(SpVector), copy != null ? copy.A : default(SpVector), copy != null ? from f in copy.Forces select new SpVector(f) : null) { }
private SpObject CreateInstance() { SpObject obj = new SpObject(); return obj; }
private void AddRespectiveGravitationalForces(SpObject o1, SpObject o2) { SpVector fo1o2 = (o2.P - o1.P).Normalize() * SpConst.G * o1.M * o2.M / (o2.P - o1.P).Length2; SpVector fo2o1 = -fo1o2; o1.Forces.Add(fo1o2); o2.Forces.Add(fo2o1); }
public SpItem(String name = default(String), SpObject coord = default(SpObject)) : base(coord ?? new SpObject()) { Name = name ?? String.Empty; }
public void AddItem(SpObject obj) { if (m_Items.Contains(obj) == false) { this.S += obj.S * (this.M != 0.0 ? obj.M / this.M : 1.0); this.P += obj.P * (this.M != 0.0 ? obj.M / this.M : 1.0); this.M += obj.M; m_Items.Add(obj); } }
protected bool Equals(SpObject obj) { if (obj == null) return false; else return this.M.Equals(obj.M) && this.P.Equals(obj.P) && this.S.Equals(obj.S) && this.A.Equals(obj.A) && this.Forces.SequenceEqual(obj.Forces); }