public void Recalculate() { // TODO: Check. Vector vt = new Vector(); vt.FillAsVectorProduction(this.v, this.v_); this.v_.FillAsVectorProduction(vt, this.v); }
public void Transform(Vector v) { float nx = this.a00 * v.x + this.a01 * v.y + this.a02 * v.z; float ny = this.a10 * v.x + this.a11 * v.y + this.a12 * v.z; float nz = this.a20 * v.x + this.a21 * v.y + this.a22 * v.z; v.x = nx; v.y = ny; v.z = nz; }
public void Fill(Vector v, float a) { float sin = (float)Math.Sin(0.5 * a); this.x = sin * v.x; this.y = sin * v.y; this.z = sin * v.z; this.w = (float)Math.Cos(0.5 * a); this.UpdateMatrix(); }
public void Fill(Vector v, Vector v1, Vector v2) { float cosA = v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; float sinA_2 = (float)Math.Sqrt (0.5 * (1 - cosA)); this.x = v.x * sinA_2; this.y = v.y * sinA_2; this.z = v.z * sinA_2; this.w = (float)Math.Sqrt (0.5 * (1 + cosA)); this.UpdateMatrix(); }
public void Fill(Vector v1, Vector v2) { float cosA = v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; float sinA_2 = (float)Math.Sqrt (0.5 * (1 - cosA)); float cosA_2 = (float)Math.Sqrt (0.5 * (1 + cosA)); this.w = cosA_2; if (this.w != 0) { this.x = (v1.y * v2.z - v1.z * v2.y); this.y = (v1.z * v2.x - v1.x * v2.z); this.z = (v1.x * v2.y - v1.y * v2.x); float d = sinA_2 / (float)Math.Sqrt (this.x * this.x + this.y * this.y + this.z * this.z); this.x *= d; this.y *= d; this.z *= d; } else { this.x = 0; this.y = 0; this.z = 1; } this.UpdateMatrix(); }
public void FillAsVectorProduction(Vector vi, Vector vj) { this.x = vi.y * vj.z - vi.z * vj.y; this.y = vi.z * vj.x - vi.x * vj.z; this.z = vi.x * vj.y - vi.y * vj.x; }
/// <summary> /// Fills as distinction. this <- (vj - vi) /// </summary> /// <param name='vi'> Begin point.</param> /// <param name='vj'> End point.</param> public void FillAsDistinction(Vector vi, Vector vj) { this.x = vj.x - vi.x; this.y = vj.y - vi.y; this.z = vj.z - vi.z; }
public void Fill(Vector v) { this.x = v.x; this.y = v.y; this.z = v.z; }
public void Deduct(Vector v) { this.x -= v.x; this.y -= v.y; this.z -= v.z; }
public void Add(Vector v) { this.x += v.x; this.y += v.y; this.z += v.z; }
public static float ScalarProduction(Vector vi, Vector vj) { return vi.x * vj.x + vi.y * vj.y + vi.z * vj.z; }
public static float Angle(Vector vi, Vector vj) { return (float)Math.Acos(vi.x * vj.x + vi.y * vj.y + vi.z * vj.z); // return (float)Math.Acos(Vector.ScalarProduction(vi, vj)); }