public bool IsEdge(Cubic <int> pos) { return(pos.Select2(this.Size, (i, sz) => ((i == 0) || ((i + 1) == sz))).AnyTrue()); }
public bool IsSafe(Cubic <int> pos) { return(pos.Select2(this.Size, (i, sz) => ((i >= 0) && (i < sz))).AllTrue()); }
public static Cubic <SpanOf <SpanF> > spanProjFromCubicDomainAndRange(Cubic <SpanF> _sdomain, Cubic <SpanF> _srange) { return(_sdomain.Select2(_srange, (dmn, rng) => spanProjFromDomainAndRange(dmn, rng))); }
public static int DotProduct(this Cubic <int> a, Cubic <int> b) { return(a.Select2(b, (c, d) => (c * d)).Aggregate((c, d) => (c + d))); }
public static float CubicIntDist(Cubic <int> v1, Cubic <int> v2) { var c = v1.Select2(v2, (a, b) => ((a - b) * (a - b))).Aggregate((a, b) => (a + b)); return(Mathf.Sqrt((float)c)); }