Creates a matrix from a vector translation
This is equivalent to (but much faster than):

mat3.identity(dest);
mat3.translate(dest, dest, vec);

@param {mat3} out mat3 receiving operation result
@param {vec2} v Translation vector
@returns {mat3} out
962636
function fromTranslation(out, v) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 1;
  out[5] = 0;
  out[6] = v[0];
  out[7] = v[1];
  out[8] = 1;
  return out;
}
1046841
function(t, obj) {
            	var V, R = null, x, y, z;
            	if (t.determinant) { R = t.elements; }
            	switch (this.elements.length) {
            	case 2:
                        V = obj.elements || obj;
                        if (V.length != 2) { return null; }
                        if (!R) { R = matrix$2.Rotation(t).elements; }
                        x = this.elements[0] - V[0];
                        y = this.elements[1] - V[1];
                        return Vector.create([
            		V[0] + R[0][0] * x + R[0][1] * y,
            		V[1] + R[1][0] * x + R[1][1] * y
                        ]);
                        break;
            	case 3:
                        if (!obj.direction) { return null; }
                        var C = obj.pointClosestTo(this).elements;
                        if (!R) { R = matrix$2.Rotation(t, obj.direction).elements; }
                        x = this.elements[0] - C[0];
                        y = this.elements[1] - C[1];
                        z = this.elements[2] - C[2];
                        return Vector.create([
            		C[0] + R[0][0] * x + R[0][1] * y + R[0][2] * z,
            		C[1] + R[1][0] * x + R[1][1] * y + R[1][2] * z,
            		C[2] + R[2][0] * x + R[2][1] * y + R[2][2] * z
                        ]);
                        break;
            	default:
                        return null;
            	}
                }
1179107
public Vector3f transform(Vector3f vec){
        return transform(vec.x, vec.y, vec.z, vec);
    }
738719
function(matrix) {
    this.vertices = this.vertices.map(function(v) {
      return matrix.transformPoint(Vector.fromArray(v)).toArray();
    });
    if (this.normals) {
      var invTrans = matrix.inverse().transpose();
      this.normals = this.normals.map(function(n) {
        return invTrans.transformVector(Vector.fromArray(n)).unit().toArray();
      });
    }
    this.compile();
    return this;
  }
435945
def from_voigt(cls, voigt_input):
        
        voigt_input = np.array(voigt_input)
        rank = sum(voigt_input.shape) // 3
        t = cls(np.zeros([3] * rank))
        if voigt_input.shape != t._vscale.shape:
            raise ValueError("Invalid shape for voigt matrix")
        voigt_input = voigt_input / t._vscale
        this_voigt_map = t.get_voigt_dict(rank)
        for ind in this_voigt_map:
            t[ind] = voigt_input[this_voigt_map[ind]]
        return cls(t)
302563
public Matrix4 setToTransform (IVector3 translation, IQuaternion rotation, IVector3 scale) {
        double sx = scale.x(), sy = scale.y(), sz = scale.z();
        return setToRotation(rotation).set(
            m00 * sx, m10 * sy, m20 * sz, translation.x(),
            m01 * sx, m11 * sy, m21 * sz, translation.y(),
            m02 * sx, m12 * sy, m22 * sz, translation.z(),
            0f, 0f, 0f, 1f);
    }
228513
public Matrix3 setToTransform (IVector translation, double rotation, double scale) {
        return setToRotation(rotation).set(m00 * scale, m10 * scale, translation.x(),
                                           m01 * scale, m11 * scale, translation.y(),
                                           0f, 0f, 1f);
    }
566007
function (data, noRoam, out) {
        var transform = noRoam ? this._rawTransform : this.transform;
        out = out || [];
        return transform
            ? v2ApplyTransform(out, data, transform)
            : vector.copy(out, data);
    }
193028
public static void diag( DMatrix4x4 input , DMatrix4 out ) {
        out.a1 = input.a11;
        out.a2 = input.a22;
        out.a3 = input.a33;
        out.a4 = input.a44;
    }
351298
public double[] mult(double[] vec, double[] out) {
        if (out == null || out.length != 2) {
            out = new double[2];
        }

        if (vec == out) {
            double tx = m00*vec[0] + m01*vec[1] + m02;
            double ty = m10*vec[0] + m11*vec[1] + m12;

            out[0] = tx;
            out[1] = ty;
        } else {
            out[0] = m00*vec[0] + m01*vec[1] + m02;
            out[1] = m10*vec[0] + m11*vec[1] + m12;
        }

        return out;
    }
1295840
function(v) {

      // [0, v'] = Q * [0, v] * Q'

      // Q
      var w1 = this['w'];
      var x1 = this['x'];
      var y1 = this['y'];
      var z1 = this['z'];

      // [0, v]
      var w2 = 0;
      var x2 = v[0];
      var y2 = v[1];
      var z2 = v[2];

      // Q * [0, v]
      var w3 = /*w1 * w2*/ -x1 * x2 - y1 * y2 - z1 * z2;
      var x3 = w1 * x2 + /*x1 * w2 +*/ y1 * z2 - z1 * y2;
      var y3 = w1 * y2 + /*y1 * w2 +*/ z1 * x2 - x1 * z2;
      var z3 = w1 * z2 + /*z1 * w2 +*/ x1 * y2 - y1 * x2;

      var w4 = w3 * w1 + x3 * x1 + y3 * y1 + z3 * z1;
      var x4 = x3 * w1 - w3 * x1 - y3 * z1 + z3 * y1;
      var y4 = y3 * w1 - w3 * y1 - z3 * x1 + x3 * z1;
      var z4 = z3 * w1 - w3 * z1 - x3 * y1 + y3 * x1;

      return [x4, y4, z4];
    }
430929
public Matrix4x3f transformAab(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, Vector3f outMin, Vector3f outMax) {
        float xax = m00 * minX, xay = m01 * minX, xaz = m02 * minX;
        float xbx = m00 * maxX, xby = m01 * maxX, xbz = m02 * maxX;
        float yax = m10 * minY, yay = m11 * minY, yaz = m12 * minY;
        float ybx = m10 * maxY, yby = m11 * maxY, ybz = m12 * maxY;
        float zax = m20 * minZ, zay = m21 * minZ, zaz = m22 * minZ;
        float zbx = m20 * maxZ, zby = m21 * maxZ, zbz = m22 * maxZ;
        float xminx, xminy, xminz, yminx, yminy, yminz, zminx, zminy, zminz;
        float xmaxx, xmaxy, xmaxz, ymaxx, ymaxy, ymaxz, zmaxx, zmaxy, zmaxz;
        if (xax < xbx) {
            xminx = xax;
            xmaxx = xbx;
        } else {
            xminx = xbx;
            xmaxx = xax;
        }
        if (xay < xby) {
            xminy = xay;
            xmaxy = xby;
        } else {
            xminy = xby;
            xmaxy = xay;
        }
        if (xaz < xbz) {
            xminz = xaz;
            xmaxz = xbz;
        } else {
            xminz = xbz;
            xmaxz = xaz;
        }
        if (yax < ybx) {
            yminx = yax;
            ymaxx = ybx;
        } else {
            yminx = ybx;
            ymaxx = yax;
        }
        if (yay < yby) {
            yminy = yay;
            ymaxy = yby;
        } else {
            yminy = yby;
            ymaxy = yay;
        }
        if (yaz < ybz) {
            yminz = yaz;
            ymaxz = ybz;
        } else {
            yminz = ybz;
            ymaxz = yaz;
        }
        if (zax < zbx) {
            zminx = zax;
            zmaxx = zbx;
        } else {
            zminx = zbx;
            zmaxx = zax;
        }
        if (zay < zby) {
            zminy = zay;
            zmaxy = zby;
        } else {
            zminy = zby;
            zmaxy = zay;
        }
        if (zaz < zbz) {
            zminz = zaz;
            zmaxz = zbz;
        } else {
            zminz = zbz;
            zmaxz = zaz;
        }
        outMin.x = xminx + yminx + zminx + m30;
        outMin.y = xminy + yminy + zminy + m31;
        outMin.z = xminz + yminz + zminz + m32;
        outMax.x = xmaxx + ymaxx + zmaxx + m30;
        outMax.y = xmaxy + ymaxy + zmaxy + m31;
        outMax.z = xmaxz + ymaxz + zmaxz + m32;
        return this;
    }
542038
function(y) {
            
            if (y == null) return this.decompose(this.mtx).translateY;
            
            return new Matrix(this.mtx && this.mtx.translate(0,y));
        }
205470
function transform(m) {
    // Identity matrix.
    if (m === undefined) {
        m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
    } else {
        m = m.slice();
    }

    // Performs the 3x3 matrix multiplication of the current matrix with the input matrix a.
    function _mmult(a, m) {
        m = m.slice();

        var m0 = m[0];
        var m1 = m[1];
        var m2 = m[2];
        var m3 = m[3];
        var m4 = m[4];
        var m5 = m[5];
        var m6 = m[6];
        var m7 = m[7];
        var m8 = m[8];

        m[0] = a[0] * m0 + a[1] * m3;
        m[1] = a[0] * m1 + a[1] * m4;
        m[3] = a[3] * m0 + a[4] * m3;
        m[4] = a[3] * m1 + a[4] * m4;
        m[6] = a[6] * m0 + a[7] * m3 + m6;
        m[7] = a[6] * m1 + a[7] * m4 + m7;

        return transform(m);
    }

    return {
        matrix: function () {
            return m.slice();
        },

        clone: function () {
            return transform(m);
        },

        prepend: function (t) {
            if (t.matrix) {
                t = t.matrix();
            }
            return _mmult(m, t);
        },

        append: function (t) {
            if (t.matrix) {
                t = t.matrix();
            }
            return _mmult(t, m);
        },

        translate: function (x, y) {
            return _mmult([1, 0, 0, 0, 1, 0, x, y, 1], m);
        },

        scale: function (x, y) {
            if (y === undefined) {
                y = x;
            }
            return _mmult([x, 0, 0, 0, y, 0, 0, 0, 1], m);
        },

        skew: function (x, y) {
            if (y === undefined) {
                y = x;
            }
            var kx = Math.PI * x / 180.0;
            var ky = Math.PI * y / 180.0;
            return _mmult([1, Math.tan(ky), 0, -Math.tan(kx), 1, 0, 0, 0, 1], m);
        },

        rotate: function (angle) {
            var c = Math.cos(radians(angle));
            var s = Math.sin(radians(angle));
            return _mmult([c, s, 0, -s, c, 0, 0, 0, 1], m);
        },

        transformPoint: function (point) {
            var x = point.x;
            var y = point.y;
            return {x: x * m[0] + y * m[3] + m[6],
                y: x * m[1] + y * m[4] + m[7]};
        }
    };
}
200103
function(bb, v)
{
    var ix = Math.abs(bb.r - bb.l);
    var modx = (v.x - bb.l) % ix;
    var x = (modx > 0) ? modx : modx + ix;
    
    var iy = Math.abs(bb.t - bb.b);
    var mody = (v.y - bb.b) % iy;
    var y = (mody > 0) ? mody : mody + iy;
    
    return new Vect(x + bb.l, y + bb.b);
}
488902
def translate(conic, vector):
        
        # Translation matrix
        T = N.identity(len(conic))
        T[:-1,-1] = -vector
        return conic.transform(T)
902778
def *(par1)
      out = Vector.new(self)
      if par1.is_a?Numeric
        out.x *= par1
        out.y *= par1
        if out.z != nil
          out.z *= par1
        end
      elsif par1.is_a?Matrix
        return (self.to_matrix * par1).to_vector
      elsif par1.is_a?Vector
        ary1 = [self.x, self.y]
        if out.z != nil
          ary1 << out.z
        end

        ary2 = [par1.x, par1.y]
        if out.z != nil
          ary2 << par1.z
        end

        aryr = Matrix.mult_array(ary1, ary2)
        out.x = aryr[0]
        out.y = aryr[1]
        if aryr[2] != nil
          out.z = aryr[2]
        end
      else
        Error.call "Unable to add '#{par1} to this vector", Error::ERR_HIGH
      end
      return out
    end