Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the Particle class
 /// </summary>
 /// <param name="m">Mass of particle</param>
 /// <param name="p">Initial position of particle</param>
 public Particle(float m, Vector3D p)
 {
     this.mass = m;
     this.position = p;
     this.isFixed = false;
     this.isEnable = false;
     this.age = 0.0F;
     this.isDisposed = false;
     this.velocity = new Vector3D();
     this.force = new Vector3D();
 }
Esempio n. 2
0
 /// <summary>
 /// Sets all three coordinates of vector at a time
 /// copy coordinates of parameter vector
 /// </summary>
 /// <param name="p">Vector to copy</param>
 public void Set(Vector3D p)
 {
     this.x = p.x;
     this.y = p.y;
     this.z = p.z;
 }
Esempio n. 3
0
 /// <summary>
 /// Substracts in place two vectors, coordinates by coordinates
 /// </summary>
 /// <param name="p">Vector to substract</param>
 /// <returns>Current vector substracted of p</returns>
 public Vector3D Subtract(Vector3D p)
 {
     this.x -= p.x;
     this.y -= p.y;
     this.z -= p.z;
     return this;
 }
Esempio n. 4
0
 /// <summary>
 /// Calculate the resultant of two vectors
 /// </summary>
 /// <param name="p">Vector to substract</param>
 /// <returns>Resultant vector</returns>
 public Vector3D Minus(Vector3D p)
 {
     return new Vector3D(this.x - p.x, this.y - p.y, this.z - p.z);
 }
Esempio n. 5
0
 /// <summary>
 /// Calculate the resultant of two vectors
 /// </summary>
 /// <param name="p">Vector to add</param>
 /// <returns>Resultant vector</returns>
 public Vector3D Plus(Vector3D p)
 {
     return new Vector3D(this.x + p.x, this.y + p.y, this.z + p.z);
 }
Esempio n. 6
0
 /// <summary>
 /// Multiply two vectors, coordinate by coordinate
 /// </summary>
 /// <param name="p">Vector to multiply</param>
 /// <returns>New vector that holds multiplication result</returns>
 public float Dot(Vector3D p)
 {
     return (this.x * p.x) + (this.y * p.y) + (this.z * p.z);
 }
Esempio n. 7
0
 /// <summary>
 /// Calculate distance to given vector
 /// </summary>
 /// <param name="p">Distant vector</param>
 /// <returns>Euclydian distance</returns>
 public float DistanceTo(Vector3D p)
 {
     float dx = this.x - p.x;
     float dy = this.y - p.y;
     float dz = this.z - p.z;
     return (float)Math.Sqrt((dx * dx) + (dy * dy) + (dz * dz));
 }
Esempio n. 8
0
 /// <summary>
 /// Calculate vectorial product
 /// u.Cross(v)
 /// </summary>
 /// <param name="p">Second term of vectorial product</param>
 /// <returns>Vectorial product u^v</returns>
 public Vector3D Cross(Vector3D p)
 {
     return new Vector3D(
         (this.y * p.z) - (this.z * p.y),
         (this.z * p.x) - (this.x * p.z),
         (this.x * p.y) - (this.y * p.x));
 }
Esempio n. 9
0
 /// <summary>
 /// Adds in place two vectors, coordinates by coordinates
 /// </summary>
 /// <param name="p">Vector to add</param>
 /// <returns>Current vector added with p</returns>
 public Vector3D Add(Vector3D p)
 {
     this.x += p.x;
     this.y += p.y;
     this.z += p.z;
     return this;
 }
Esempio n. 10
0
 /// <summary>
 /// Initializes a new instance of the Vector3D class
 /// copying the coordinate of the argument vector
 /// </summary>
 /// <param name="p">Vector to copy</param>
 public Vector3D(Vector3D p)
 {
     this.x = p.x;
     this.y = p.y;
     this.z = p.z;
 }