This discussion is archived
3 Replies Latest reply: Oct 22, 2010 9:06 PM by DarrylBurke RSS

Lines And Endpoints

803051 Newbie
Currently Being Moderated
I haven't asked a stupid question in a while, so here goes.

I'm using a LineArray and an Appearance to initialize a Shape3D object. I make 2 Point3d's to hold the endpoints. One is a point in 3D space. The other is 0,0,0. I expected a line from my arbitrary point to the origin of my coordinate system. What I get is a line from one arbitrary point to another arbitrary point.

All I want from this post to make sure that what I expected to happen is what I should have expected. That way, I know the strange behavior is my mistake, not a quirk of the language. (For instance, that the second point isn't relative to the first, instead of absolute coordinates.)

If you happen to spot my mistake, that'd be nice to know too.
        tempShip.shipLine=new LineArray(2,LineArray.COORDINATES|LineArray.COLOR_3|LineArray.NORMALS);
        Point3d[] tempPt=new Point3d[2];
        tempPt[0]=new Point3d();
        tempPt[1]=new Point3d();
        tempPt[0].x=tempShip.xyzloc.x;
        tempPt[0].y=tempShip.xyzloc.y;
        tempPt[0].z=tempShip.xyzloc.z;
        tempPt[1].x=0.0;
        tempPt[1].y=0.0;
        tempPt[1].z=0.0;
        tempShip.shipLine.setCoordinates(0,tempPt);

        Appearance appline = new Appearance();
        appline.setMaterial(materials[i+2]);
        appline.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
        appline.setCapability(Material.ALLOW_COMPONENT_WRITE);
        LineAttributes la = new LineAttributes();
        la.setLineWidth(3.0f);
        appline.setLineAttributes(la);
 
        tempShip.shipLineShape=new Shape3D(tempShip.shipLine,appline);
        tempShip.shipTransGroup.addChild(tempShip.shipLineShape);

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points