1

鉴于以下情况:

public class Actions 
{


    private MyMatrix matrix_1;
    private MyMatrix matrix_2;
    private MyMatrix transformMatrix;
    private final int VW = 40;
    private final int VH = 40;

    public static double[][] translateMatrixArr;


    public Edge doTransofrm(double xPoint,double yPoint,Edge myEdge,int transformType)
    {
        switch(transformType)
        {
        case 1:
            // initializations 
            Actions.translateMatrixArr = {{1.,0.,xPoint},{0.,1.,yPoint},{0.,0.,1.}};
            break;
        case 2:
            Actions.translateMatrixArr = // something else 
            break;
        case 3:
            Actions.translateMatrixArr = // something else

        }

        return null;
    }


...


}

我试着像@joschi在这里所说的那样做,但它不起作用。有什么办法吗?

问候

4

1 回答 1

1

您需要使用new来创建数组的实例:

Actions.translateMatrixArr = new double[][]{
    new double[] {1.,0.,xPoint}
,   new double[] {0.,1.,yPoint}
,   new double[] {0.,0.,1.}
};
于 2013-04-29T00:54:33.707 回答