1
나는 그릴 필요가있는 점의 값을 계산하고 이것을 Point3f 배열에 넣었습니다. 나는 526 435 점을 가지고있다. 다음 단계는 점을 하나씩 차례대로 그리는 것입니다. 연속 선처럼 보이게하거나 LineStripArray를 사용하여 점 사이에 선을 그립니다. 포인트별로 포인트를 그리는 방법을 찾지 못했기 때문에 LineStripArray를 사용하려고했습니다.Java 3D에서 Point3f 배열에서 Lorenz attractor를 그립니다.
나는 here의 코드를 촬영했습니다 그리고 난 다음 코드로 방법 "createLineTypes"의 내용을 변경했습니다 :
Group lineGroup = new Group();
Appearance app = new Appearance();
ColoringAttributes ca = new ColoringAttributes(black, ColoringAttributes.SHADE_FLAT);
app.setColoringAttributes(ca);
Computing comp = new Computing();
//the following row computes the values of the points I want to draw
//and it works alright; the points are saved into
//**static List<Vector3> computed_values** from class Computing,
// where Vector3 class defines a 3D point actually
comp.do_the_job();
Point3f[] dashPts = new Point3f[Computing.computed_values.size()];
for(int i = 0; i < Computing.computed_values.size(); i++)
{
dashPts[i] = new Point3f((int)Computing.computed_values.get(i).getX(), (int)Computing.computed_values.get(i).getY(), (int)Computing.computed_values.get(i).getZ());
}
System.out.print(Computing.computed_values.size());
int[] a = {Computing.computed_values.size()};
LineStripArray dash = new LineStripArray(Computing.computed_values.size(), LineArray.COORDINATES, a);
dash.setCoordinates(0, dashPts);
LineAttributes dashLa = new LineAttributes();
dashLa.setLineWidth(1.0f);
dashLa.setLinePattern(LineAttributes.PATTERN_SOLID);
Shape3D dashShape = new Shape3D(dash, app);
lineGroup.addChild(dashShape);
return lineGroup;
문제는 단지 1 수직 선을 그립니다 것입니다. 어떤 아이디어?