示例#1
0
 public bool IsEdge(Cubic <int> pos)
 {
     return(pos.Select2(this.Size, (i, sz) => ((i == 0) || ((i + 1) == sz))).AnyTrue());
 }
示例#2
0
 public bool IsSafe(Cubic <int> pos)
 {
     return(pos.Select2(this.Size, (i, sz) => ((i >= 0) && (i < sz))).AllTrue());
 }
示例#3
0
 public static Cubic <SpanOf <SpanF> > spanProjFromCubicDomainAndRange(Cubic <SpanF> _sdomain, Cubic <SpanF> _srange)
 {
     return(_sdomain.Select2(_srange, (dmn, rng) => spanProjFromDomainAndRange(dmn, rng)));
 }
示例#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)));
 }
示例#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));
    }