public void Add(IPoint4 p, IVector4 v) { ITuple4_Double _p = p.AsTupleDouble(); ITuple4_Double _v = v.AsTupleDouble(); this.Set(_p.X + _v.X, _p.Y + _v.Y, _p.Z + _v.Z, _p.W + _v.W); }
public void Add(IVector4 v1, IVector4 v2) { ITuple4_Double _v1 = v1.AsTupleDouble(); ITuple4_Double _v2 = v2.AsTupleDouble(); this.Set(_v1.X + _v2.X, _v1.Y + _v2.Y, _v1.Z + _v2.Z, _v1.W + _v2.W); }
public void SimpleMul(IVector4 v1, IVector4 v2) { ITuple4_Double _v1 = v1.AsTupleDouble(); ITuple4_Double _v2 = v2.AsTupleDouble(); this.Set(_v1.X * _v2.X, _v1.Y * _v2.Y, _v1.Z * _v2.Z, _v1.W * _v2.W); }
public void ProjectTo(IVector4 where) { BuffVector4d aux = new BuffVector4d(where); aux.ProjV(new Vector4d(this.x, this.y, this.z, this.w)); this.Set(aux.X, aux.Y, aux.Z, aux.W); }
public void Sub(IPoint4 p, IVector4 v) { ITuple4_Double _p = p.AsTupleDouble(); ITuple4_Double _v = v.AsTupleDouble(); this.Set(_p.X - _v.X, _p.Y - _v.Y, _p.Z - _v.Z, _p.W - _v.W); }
public void Sub(IVector4 v1, IVector4 v2) { ITuple4_Double _v1 = v1.AsTupleDouble(); ITuple4_Double _v2 = v2.AsTupleDouble(); this.Set(_v1.X - _v2.X, _v1.Y - _v2.Y, _v1.Z - _v2.Z, _v1.W - _v2.W); }
public static Vector4d ToVector4d(this IVector4 p) { if (p is Vector4d) { return((Vector4d)p); } return(new Vector4d(p)); }
public void ProjectTo(IPoint4 p1, IVector4 where) { ITuple4_Double _p1 = p1.AsTupleDouble(); BuffVector4d aux = new BuffVector4d(where); aux.ProjV(new Vector4d(_p1.X, _p1.Y, _p1.Z, _p1.W)); this.Set(aux.X, aux.Y, aux.Z, aux.W); }
public BuffVector4d(IVector4 other) { ITuple4_Double _other = other.AsTupleDouble(); this.x = _other.X; this.y = _other.Y; this.z = _other.Z; this.w = _other.W; }
public void Lineal(IVector4 v2, double alpha, double beta) { ITuple4_Double _v2 = v2.AsTupleDouble(); this.Set(alpha * this.x + beta * _v2.X, alpha * this.y + beta * _v2.Y, alpha * this.z + beta * _v2.Z, alpha * this.w + beta * _v2.W); }
public Vector4d(IVector4 v) { ITuple4_Double _v = v.AsTupleDouble(); this.X = _v.X; this.Y = _v.Y; this.Z = _v.Z; this.W = _v.W; }
public static ITuple4_Double AsTupleDouble(this IVector4 v) { ITuple4_Double ret = v as ITuple4_Double; if (ret != null) { return(ret); } return(VectorUtils.Convert <ITuple4_Double>(v)); }
public double InvLerp(IVector4 v2, IVector4 vLerp) { BuffVector4d v12 = new BuffVector4d(v2); v12.Sub(this); BuffVector4d v1Lerp = new BuffVector4d(vLerp); v1Lerp.Sub(this); return(v12.Proj(v1Lerp)); }
public void Lineal(IVector4 v1, IVector4 v2, double alpha, double beta) { ITuple4_Double _v1 = v1.AsTupleDouble(); ITuple4_Double _v2 = v2.AsTupleDouble(); this.Set(alpha * _v1.X + beta * _v2.X, alpha * _v1.Y + beta * _v2.Y, alpha * _v1.Z + beta * _v2.Z, alpha * _v1.W + beta * _v2.W); }
public Vector4F(IVector4 <float> source) { if (source == null) { throw new ArgumentNullException(nameof(source)); } X = source.X; Y = source.Y; Z = source.Z; W = source.W; }
public void Update() { Assert.True(_lights.Count <= MaxLightCount); var vec = (Vector4 *)_pointer; var ivec = (IVector4 *)_pointer; vec[0] = new Vector4(CameraPosition); vec[1] = new Vector4(Ambient); ivec[2] = new IVector4(_lights.Count, LightCastingShadowNumber, 0, 0); for (int i = 0; i < _lights.Count; i++) { var l = _lights[i]; var p = _pointer + 48 + i * BytesInLight; vec = (Vector4 *)(p); vec[0] = new Vector4(l.Position); vec[1] = new Vector4(-l.Direction); vec[2] = new Vector4(l.Diffuse); vec[3] = new Vector4(l.Attenuation); var type = (int *)(p + BytesInLight - 4); type[0] = (int)l.Type; } if (Context.DirectStateAccess) { Context.BufferSubData(Handle, 0, SizeInBytes, _pointer); } else { Context.BindUniformBuffer(Handle); Context.BufferSubData(BindBufferTarget.UniformBuffer, 0, SizeInBytes, _pointer); } }
public double Proj(IVector4 v2) { return(this.Dot(v2) / this.Length); }
public double Dot(IVector4 v2) { ITuple4_Double _v2 = v2.AsTupleDouble(); return(this.X * _v2.X + this.Y * _v2.Y + this.Z * _v2.Z + this.W * _v2.W); }
public bool Equals(IVector4 other) { ITuple4_Double _other = other.AsTupleDouble(); return(this.Equals(_other.X, _other.Y, _other.Z, _other.W)); }
public bool EpsilonEquals(IVector4 other, double epsilon = EPSILON) { ITuple4_Double _other = other.AsTupleDouble(); return(this.EpsilonEquals(_other.X, _other.Y, _other.Z, _other.W, epsilon)); }
public void ProjV(IVector4 v1, IVector4 v2) { this.Mul(v1, this.Proj(v2)); }
public void Mul(IVector4 v1, double c) { ITuple4_Double _v1 = v1.AsTupleDouble(); this.Set(_v1.X * c, _v1.Y * c, _v1.Z * c, _v1.W * c); }
public void Lerp(IVector4 v1, IVector4 v2, double alpha) { this.Lineal(v1, v2, 1 - alpha, alpha); }
public void Abs(IVector4 v1) { ITuple4_Double _v1 = v1.AsTupleDouble(); this.Set(Math.Abs(_v1.X), Math.Abs(_v1.Y), Math.Abs(_v1.Z), Math.Abs(_v1.W)); }
public void Neg(IVector4 v1) { ITuple4_Double _v1 = v1.AsTupleDouble(); this.Set(-_v1.X, -_v1.Y, -_v1.Z, -_v1.W); }
public double Dot(IVector4 v2) { ITuple4_Double _v2 = v2.AsTupleDouble(); return(this.x * _v2.X + this.y * _v2.Y + this.z * _v2.Z + this.w * _v2.W); }
public void Add(IVector4 v2) { ITuple4_Double _v2 = v2.AsTupleDouble(); this.Set(this.x + _v2.X, this.y + _v2.Y, this.z + _v2.Z, this.w + _v2.W); }
public void Div(IVector4 v1, double c) { ITuple4_Double _v1 = v1.AsTupleDouble(); this.Set(_v1.X / c, _v1.Y / c, _v1.Z / c, _v1.W / c); }
public void SimpleMul(IVector4 v2) { ITuple4_Double _v2 = v2.AsTupleDouble(); this.Set(this.x * _v2.X, this.y * _v2.Y, this.z * _v2.Z, this.w * _v2.W); }
public void Sub(IVector4 v2) { ITuple4_Double _v2 = v2.AsTupleDouble(); this.Set(this.x - _v2.X, this.y - _v2.Y, this.z - _v2.Z, this.w - _v2.W); }