鉴于以下内容:
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所说here那样做,但它不起作用。有什么方法吗?
此致
答案 0 :(得分:1)
您需要使用new
来创建数组实例:
Actions.translateMatrixArr = new double[][]{
new double[] {1.,0.,xPoint}
, new double[] {0.,1.,yPoint}
, new double[] {0.,0.,1.}
};