Пример #1
0
 public Matrixf33 Subtract(Matrixf33 other)
 {
     return(new Matrixf33(
                a - other.a, b - other.b, c - other.c,
                d - other.d, e - other.e, f - other.f,
                g - other.g, h - other.h, i - other.i));
 }
Пример #2
0
 public Matrixf33 Add(Matrixf33 other)
 {
     return(new Matrixf33(
                a + other.a, b + other.b, c + other.c,
                d + other.d, e + other.e, f + other.f,
                g + other.g, h + other.h, i + other.i));
 }
Пример #3
0
 public static Vector3 Mul(this Vector3 v, Matrixf33 m)
 {
     return(new Vector3(
                v.x * m.a + v.y * m.d + v.z * m.g,
                v.x * m.b + v.y * m.e + v.z * m.h,
                v.x * m.c + v.y * m.f + v.z * m.i));
 }
Пример #4
0
 public Matrixf33 Mul(Matrixf33 other)
 {
     return(new Matrixf33(
                a * other.a + b * other.d + c * other.g, a * other.b + b * other.e + c * other.h, a * other.c + b * other.f + c * other.i,
                d * other.a + e * other.d + f * other.g, d * other.b + e * other.e + f * other.h, d * other.c + e * other.f + f * other.i,
                g * other.a + h * other.d + i * other.g, g * other.b + h * other.e + i * other.h, g * other.c + h * other.f + i * other.i
                ));
 }
Пример #5
0
        public bool Equals(Matrixf33 other)
        {
            var areEqual =
                (a == other.a) && (b == other.b) && (c == other.c) &&
                (d == other.d) && (e == other.e) && (f == other.f) &&
                (g == other.g) && (h == other.h) && (i == other.i);

            return(areEqual);
        }
Пример #6
0
        /// <inheritdoc cref="GridPoint2.GetColor(ColorFunction)"/>
        public int __GetColor_Reference(int ax, int bx, int by, int cx, int cy, int cz)
        {
            var parm            = new Matrixf33(ax, 0, 0, bx, by, 0, cx, cy, cz);
            var parmInv         = parm.Inv();
            var pointInUnitCube = this.ToVector3().Mul(parmInv);
            var rect            = new Matrixf33(ax, 0, 0, 0, by, 0, 0, 0, cz);
            var pointInRect     = pointInUnitCube.Mul(rect);

            var rectX = GLMathf.FloorMod(Mathf.FloorToInt(pointInRect.x), ax);
            var rectY = GLMathf.FloorMod(Mathf.FloorToInt(pointInRect.y), by);
            var rectZ = GLMathf.FloorMod(Mathf.FloorToInt(pointInRect.z), cz);

            return(rectX + rectY * ax + rectZ * ax * by);
        }
Пример #7
0
 public Matrixf33 Div(Matrixf33 other)
 {
     return(Mul(other.Inv()));
 }