We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › creating surfaces in processing
Page Index Toggle Pages: 1
creating surfaces in processing (Read 1110 times)
creating surfaces in processing
Apr 4th, 2010, 8:21pm
 
Hi, I've had great success with 3D primitives and ready to move on but need some help.

I'm looking for suggestions on how to create isosurfaces using the facilities processing provides.  For a great picture of an isosurface see the wikipedia articles on isosurfaces

Essentially I have a bunch of points in 3d space on a grid that I want to tell processing to connect and contour into what appears in 3-space as a 'surface'. I have no issue assembling the proper array of points in space, just no idea how to generate the contour surface between them.

Thanks!
Re: creating surfaces in processing
Reply #1 - Apr 5th, 2010, 1:11am
 
Imagine a cube whose corners are on 8 points of data.
If the data values at those 8 points were all less than the isosurface's value, the isosurface would not intersect that cube.
Similarly, if the data values at those 8 points were all greater than the isosurface's value, the isosurface would not intersect that cube.

However, if some of the points are less than the value, and some are grater than the value, you know that part of the isosurface must be contained within that cube. How you would draw this part of the isosurface depends on which side of the isosurface the 8 points are on. The trick is working out how you would do this. I suggest you enumerate all possible cases, and then have a lookup table for which triangles you'd want to draw withing the cube...
Re: creating surfaces in processing
Reply #2 - Apr 5th, 2010, 2:54am
 
Hello,

I think the way to go is via the beginShape command.

I have a
math 3D plotter,
some of the figures are done by an array to store the values.

The values are then shown by beginShape
The latter graphics ones are simple isosurfaces.
Best download and run locally.

http://www.openprocessing.org/visuals/?visualID=7098

To do so, it is important to store the values in the right order. Otherwise the wholw thing gets fuzzy (see my sphere in the same program...).

Greetings,

Chrisir  Wink


Here is a code-fragment to show the already calculated values via beginShape:


Code:
void ShowLookupAsGrid() { 
 // nice
 colorMode(RGB,400);
 noStroke();
 if ((MaxindexI <= 0) && (MaxindexJ <= 0)) {  
   ShowSpecialMessage("LookUp-Table not defined.");  
 }  
 else {
   for (int i = 0; i < MaxindexI; i = i+1) {
for (int j = 0; j < MaxindexJ; j = j+1) {
 fill (2+abs(MyResults[i][j].x),2+abs(MyResults[i][j].y),2+abs(MyResults[i][j].z));
 beginShape(QUAD);  
 vertex(MyResults[i][j].x,MyResults[i][j].y,MyResults[i][j].z);
 vertex(MyResults[i+1][j].x,MyResults[i+1][j].y,MyResults[i+1][j].z);
 vertex(MyResults[i+1][j+1].x,MyResults[i+1][j+1].y,MyResults[i+1][j+1].z);  
 vertex(MyResults[i][j+1].x,MyResults[i][j+1].y,MyResults[i][j+1].z);
 endShape(CLOSE);  
} // j  
   } //i
 } // else  
} // ShowGraph2




Page Index Toggle Pages: 1