Exemplo n.º 1
0
	/**
	 * ÉèÖÃÊýÖµ
	 * 
	 * @param matrix
	 *            Ö¸¶¨¾ØÕó
	 */
	public void setValue(Matrix3 matrix)
	{
		if (matrix == null)
		{
			return;
		}
		for (int i = 0; i < data.Length; i++)
		{
			this.data[i] = matrix.data[i];
		}
	}
Exemplo n.º 2
0
	    /**
	     * 3x3矩阵与向本量m的乘积(无视W)
	     * 
	     * @param m
	     *            矩阵
	     */
	    public void multiplyBy(Matrix3 m)
	    {
		    x = (m.data[0] * x + m.data[1] * y + m.data[2] * z);
		    y = (m.data[3] * x + m.data[4] * y + m.data[5] * z);
		    z = (m.data[6] * x + m.data[7] * y + m.data[8] * z);
	    }
Exemplo n.º 3
0
 public Matrix3(Matrix3 t)
 {
     setData(t.data);
 }
Exemplo n.º 4
0
	/**
	 * 3x3¾ØÕóµÄÄæ¾ØÕó¼ÆËã
	 * 
	 * @return Äæ¾ØÕó
	 * @throws Exception
	 */
	public Matrix3 inverse()
	{
		float t = this.det();
		if (t == 0)
		{
			throw new Exception();
		}
		float[] b = new float[9];
		b[M00] = (data[M11] * data[M22] - data[M12] * data[M21]) / t;
		b[M01] = -(data[M01] * data[M22] - data[M21] * data[M02]) / t;
		b[M02] = (data[M01] * data[M12] - data[M02] * data[M11]) / t;
		b[M10] = -(data[M10] * data[M22] - data[M12] * data[M20]) / t;
		b[M11] = (data[M00] * data[M22] - data[M02] * data[M20]) / t;
		b[M12] = -(data[M00] * data[M12] - data[M02] * data[M10]) / t;
		b[M20] = (data[M10] * data[M21] - data[M11] * data[M20]) / t;
		b[M21] = -(data[M00] * data[M21] - data[M01] * data[M20]) / t;
		b[M22] = (data[M00] * data[M11] - data[M01] * data[M10]) / t;
		Matrix3 m = new Matrix3(b);
		return (m);
	}
Exemplo n.º 5
0
	/**
	 * 3x3¾ØÕóµÄ×ó³Ë(µ±Ç°¾ØÕó×ó³Ëma)£¬²¢½«½á¹û·ÅÈëmb
	 * @param ma ×ó³Ë¾ØÕó
	 * @param mb ½á¹û¾ØÕó
	 */
	public void multiply(Matrix3 ma,Matrix3 mb)
	{
		float v00 = data[M00] * ma.data[M00] + data[M10] * ma.data[M01] + data[M20] * ma.data[M02];
		float v01 = data[M00] * ma.data[M10] + data[M10] * ma.data[M11] + data[M20] * ma.data[M12];
		float v02 = data[M00] * ma.data[M20] + data[M10] * ma.data[M21] + data[M20] * ma.data[M22];

		float v10 = data[M01] * ma.data[M00] + data[M11] * ma.data[M01] + data[M21] * ma.data[M02];
		float v11 = data[M01] * ma.data[M10] + data[M11] * ma.data[M11] + data[M21] * ma.data[M12];
		float v12 = data[M01] * ma.data[M20] + data[M11] * ma.data[M21] + data[M21] * ma.data[M22];

		float v20 = data[M02] * ma.data[M00] + data[M12] * ma.data[M01] + data[M22] * ma.data[M02];
		float v21 = data[M02] * ma.data[M10] + data[M12] * ma.data[M11] + data[M22] * ma.data[M12];
		float v22 = data[M02] * ma.data[M20] + data[M12] * ma.data[M21] + data[M22] * ma.data[M22];

		mb.data[M00] = v00;
		mb.data[M01] = v01;
		mb.data[M02] = v02;
		mb.data[M10] = v10;
		mb.data[M11] = v11;
		mb.data[M12] = v12;
		mb.data[M20] = v20;
		mb.data[M21] = v21;
		mb.data[M22] = v22;
	}
Exemplo n.º 6
0
	/**
	 * 3x3¾ØÕóµÄ×ó³Ë(µ±Ç°¾ØÕó×ó³ËM)
	 * 
	 * @param ma
	 *            ¾ØÕóm
	 */
	public void multiply(Matrix3 ma)
	{
		multiply(ma,this);
	}
Exemplo n.º 7
0
 public Matrix3(Matrix3 t)
 {
     setData(t.data);
 }
Exemplo n.º 8
0
 /**
  * 3x3¾ØÕóµÄ×ó³Ë(µ±Ç°¾ØÕó×ó³ËM)
  *
  * @param ma
  *            ¾ØÕóm
  */
 public void multiply(Matrix3 ma)
 {
     multiply(ma, this);
 }