/// <summary> rval is centered on self. </summary> public Box ToBox(Vec dim3) { return Box.NewAround(this, dim3); }
/// <summary> will clobber 'this'. returns it for convenience only. </summary> public Vec Take(Vec that, Func<float, float, float> Comp) { x = Comp(x, that.x); y = Comp(y, that.y); z = Comp(z, that.z); d = Comp(d, that.d); return this; }
public float Distance(Vec that) { return (To3 - that.To3).Length(); }
public Vec Clamp(Vec min, Vec max) { var rval = this; rval.Take(min, Math.Max); rval.Take(max, Math.Min); return rval; }
public static Vec Zip(Vec a, Vec b, Vec c, Func<float, float, float, float> Comp) { Vec rval = 0; rval.x = Comp(a.x, b.x, c.x); rval.y = Comp(a.y, b.y, c.y); rval.z = Comp(a.z, b.z, c.z); rval.d = Comp(a.d, b.d, c.d); return rval; }
public static Vec Zip(Vec a, Vec b, Func<float, float, float> Comp) { Vec rval = a; return rval.Take(b, Comp); }