有对Java3D 熟悉的师兄师姐么?
帮我看看这段代码吧。我要崩溃了!!
=========================================
public class Demo extends Applet {
final static long serialVersionUID =3;
ReadMRI rm;
QuadraticCurve Qc;
StraightLine Sl;
private String filename;
    public BranchGroup createSceneGraph(){
     BranchGroup objRoot = new BranchGroup();
     TransformGroup objTrans = new TransformGroup();
        objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        objRoot.addChild(objTrans);        double[] temp = Sl.getArrayCoords();
        for(int i = 0;i< Sl.SizeofVertx()*3;i++){
         System.out.println(temp[i]+" "); 
        }
        Appearance appSL = new Appearance();
        LineAttributes sla = new LineAttributes(1.0f,LineAttributes.PATTERN_SOLID,true);
        LineArray SLArray = new LineArray(Sl.SizeofVertx(), LineArray.COORDINATES);//这个是设置顶点个数的,我这里等于68.
        appSL.setLineAttributes(sla);
        ColoringAttributes SLinecolor = new ColoringAttributes();
        SLinecolor.setColor(255,255,0);
        appSL.setColoringAttributes(SLinecolor);        
        SLArray.setCoordinate(0, Sl.getArrayCoords());//用这个我画出来的是一条过原点的直线只有两个顶点。后面我贴出来上面for循环打印结果
        Shape3D SLines3D = new Shape3D(SLArray, appSL);        objTrans.addChild(SLines3D);
        
        BoundingSphere bounds =
            new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
        
        MouseWheelZoom z = new MouseWheelZoom();
        z.setTransformGroup(objTrans);
        objTrans.addChild(z);
        z.setSchedulingBounds(bounds);
        
        MouseRotate ms = new MouseRotate();
        ms.setTransformGroup(objTrans);
        objTrans.addChild(ms);
        ms.setSchedulingBounds(bounds);        objRoot.compile();
        return objRoot;
    }
    Demo(String s){
     filename = s;
rm = new ReadMRI(filename);
Qc = new QuadraticCurve(rm,20,50,0.3);
Sl = new StraightLine(rm,20);
Qc.PieceCurve(rm,20);// the 20th piece
Sl.RoughCurve(rm,20);

setLayout(new BorderLayout());
        GraphicsConfiguration config =
           SimpleUniverse.getPreferredConfiguration();        Canvas3D c = new Canvas3D(config);
        add("Center", c);        // Create a simple scene and attach it to the virtual universe
        BranchGroup scene = createSceneGraph();
        SimpleUniverse u = new SimpleUniverse(c);        u.getViewingPlatform().setNominalViewingTransform();        u.addBranchGraph(scene);
    }
}
=========================================
控制台输出:
0.191106 1.17692 0.10000000000000003  
0.15504800000000007 1.07837 0.10000000000000003  
0.15504800000000007 1.07837 0.10000000000000003  
0.12379800000000007 0.9557699999999999 0.10000000000000003  
0.12379800000000007 0.9557699999999999 0.10000000000000003  
0.090144 0.7706699999999999 0.10000000000000003  
0.090144 0.7706699999999999 0.10000000000000003  
0.058894 0.587981 0.10000000000000003  
0.058894 0.587981 0.10000000000000003  
0.013221000000000038 0.393269 0.10000000000000003  
0.013221000000000038 0.393269 0.10000000000000003  
-0.003605999999999998 0.3355769999999999 0.10000000000000003  
-0.003605999999999998 0.3355769999999999 0.10000000000000003  
-0.015625 0.31875 0.10000000000000003  
-0.015625 0.31875 0.10000000000000003  
-0.025239999999999985 0.30192300000000005 0.10000000000000003  
-0.025239999999999985 0.30192300000000005 0.10000000000000003  
-0.010816999999999966 0.263462 0.10000000000000003  
-0.010816999999999966 0.263462 0.10000000000000003  
0.010816999999999966 0.21538499999999994 0.10000000000000003  
0.010816999999999966 0.21538499999999994 0.10000000000000003  
0.058894 0.167308 0.10000000000000003  
0.058894 0.167308 0.10000000000000003  
0.13581699999999997 0.136058 0.10000000000000003  
0.13581699999999997 0.136058 0.10000000000000003  
0.20793300000000003 0.12163499999999994 0.10000000000000003  
0.20793300000000003 0.12163499999999994 0.10000000000000003  
0.27524000000000004 0.136058 0.10000000000000003  
0.27524000000000004 0.136058 0.10000000000000003  
0.2824519999999999 0.167308 0.10000000000000003  
0.2824519999999999 0.167308 0.10000000000000003  
0.272837 0.2105769999999999 0.10000000000000003  
0.272837 0.2105769999999999 0.10000000000000003  
0.2800480000000001 0.23942300000000005 0.10000000000000003  
0.2800480000000001 0.23942300000000005 0.10000000000000003  
0.31850999999999996 0.27067300000000005 0.10000000000000003  
0.31850999999999996 0.27067300000000005 0.10000000000000003  
0.33293300000000003 0.299519 0.10000000000000003  
0.33293300000000003 0.299519 0.10000000000000003  
0.36899000000000004 0.354808 0.10000000000000003  
0.36899000000000004 0.354808 0.10000000000000003  
0.378606 0.400481 0.10000000000000003  
0.378606 0.400481 0.10000000000000003  
0.366587 0.419712 0.10000000000000003  
0.366587 0.419712 0.10000000000000003  
0.344827 0.4370820000000001 0.10000000000000003  
0.344827 0.4370820000000001 0.10000000000000003  
0.31850999999999996 0.49663499999999994 0.10000000000000003  
0.31850999999999996 0.49663499999999994 0.10000000000000003  
0.304087 0.5855769999999999 0.10000000000000003  
0.304087 0.5855769999999999 0.10000000000000003  
0.289663 0.6817300000000001 0.10000000000000003  
0.289663 0.6817300000000001 0.10000000000000003  
0.272837 0.7754800000000001 0.10000000000000003  
0.272837 0.7754800000000001 0.10000000000000003  
0.27043300000000003 0.85 0.10000000000000003  
0.27043300000000003 0.85 0.10000000000000003  
0.26802899999999996 0.9149000000000002 0.10000000000000003  
0.26802899999999996 0.9149000000000002 0.10000000000000003  
0.27043300000000003 0.9581700000000001 0.10000000000000003  
0.27043300000000003 0.9581700000000001 0.10000000000000003  
0.253606 1.0351 0.10000000000000003  
0.253606 1.0351 0.10000000000000003  
0.24399000000000004 1.0976 0.10000000000000003  
0.24399000000000004 1.0976 0.10000000000000003  
0.241587 1.14567 0.10000000000000003  
0.241587 1.14567 0.10000000000000003  
0.191106 1.17692 0.10000000000000003 划线是从第一行坐标到第二行坐标
第三行坐标到第四行坐标,以此类推。
我要疯掉了,明明应该是对的。大家救救我吧!!!!