Recently I've been looking at Povray, pyprocessing, and cfdg (version 3.0) as tools for creating digital images. I have branched two separate blogs where I mainly explore jruby + processing and processing.py

Monday, 20 December 2010

Translating processing coordinate to povray coordinates

Well this is extremely promising based on Dave Bollingers modified DXF export I think I've solved the translation problem, and it is very simple. In my startTriangle function of the PovTriangle class, for each coordinate of the triangle I multiply the Y and Z coordinates by -1.

 3   public StringBuilder startTriangle(float[][] point) {
 4     StringBuilder povString = new StringBuilder(getType());
 5     povString.append("\n{<");
 6     povString.append(point[0][0]);
 7     povString.append(", ");
 8     povString.append(point[0][1] * -1);
 9     povString.append(", ");
10     povString.append(point[0][2] * -1);
11     povString.append(">, <");
12     povString.append(point[1][0]);
13     povString.append(", ");
14     povString.append(point[1][1] * -1);
15     povString.append(", ");
16     povString.append(point[1][2] * -1);
17     povString.append(">, <");
18     povString.append(point[2][0]);
19     povString.append(", ");
20     povString.append(point[2][1] * -1);
21     povString.append(", ");
22     povString.append(point[2][2] * -1);
23     povString.append(">\n");
24     return povString;
25   }

Result is the pov file is now correct in the sense that normal camera positions (that are in front of screen) have a negative Z coordinate, and the test 'T' is displayed the right way up.

No comments:

Post a Comment

Followers

Blog Archive

About Me

My photo
Pembrokeshire, United Kingdom
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2