Beispiel #1
0
 public bool IsEdge(Cubic <int> pos)
 {
     return(pos.Select2(this.Size, (i, sz) => ((i == 0) || ((i + 1) == sz))).AnyTrue());
 }
Beispiel #2
0
 public bool IsSafe(Cubic <int> pos)
 {
     return(pos.Select2(this.Size, (i, sz) => ((i >= 0) && (i < sz))).AllTrue());
 }
Beispiel #3
0
 public static Cubic <SpanOf <SpanF> > spanProjFromCubicDomainAndRange(Cubic <SpanF> _sdomain, Cubic <SpanF> _srange)
 {
     return(_sdomain.Select2(_srange, (dmn, rng) => spanProjFromDomainAndRange(dmn, rng)));
 }
Beispiel #4
0
 public static int DotProduct(this Cubic <int> a, Cubic <int> b)
 {
     return(a.Select2(b, (c, d) => (c * d)).Aggregate((c, d) => (c + d)));
 }
Beispiel #5
0
    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));
    }