Exemple #1
0
 public void setVector(clsVector vector)
 {
     setVector(vector.x, vector.y, vector.z);
 }
Exemple #2
0
 public void add(clsVector Vector)
 {
     this.x += Vector.x;
     this.y += Vector.y;
     this.z += Vector.z;
 }
Exemple #3
0
        public clsVector bisection2d(clsVector vector)
        {
            clsVector t = this.normalized;
            clsVector v = vector.normalized;

            if ((t.x == v.x) || (t.y == v.y))
            {
                // return the perpendicular of collinear vectors
                return perpendicular2d;
            }
            else return  (t + v).normalized;
        }
Exemple #4
0
 public clsVector rotate2d(float degrees)
 {
     clsVector result = new clsVector(this.x, this.y, this.z);
     result.x = this.x * (float)Math.Cos(degrees) - this.y * (float)Math.Sin(degrees);
     result.y = this.x * (float)Math.Sin(degrees) - this.y * (float)Math.Cos(degrees);
     return result;
 }
Exemple #5
0
 public clsVector reflection(clsVector vector)
 {
     // R = V - 2 * (V . N) * N
     clsVector n = vector.normalized; // n must be normalized
     return this - (n * (2 * this.dotProduct(n)));
 }
Exemple #6
0
 public float dotProduct(clsVector vector)
 {
     return this.dotProduct(this, vector);
 }
Exemple #7
0
 public float dotProduct(clsVector vectorA, clsVector vectorB) 
 {
     return vectorA.x * vectorB.x + vectorA.y * vectorB.y + vectorA.z * vectorB.z;
 }
Exemple #8
0
 public clsVector crossProduct(clsVector vector)
 {
     return this.crossProduct(this, vector);
 }
Exemple #9
0
 // returns a vector that is perpendicular to the plane created by this and the passed vector
 public clsVector crossProduct(clsVector vectorA, clsVector vectorB)
 {
     return new clsVector(vectorA.y * vectorB.z - vectorA.z * vectorB.y, vectorA.z * vectorB.x - vectorA.x * vectorB.z, vectorA.x * vectorB.y - vectorA.y * vectorB.x);
 }