Home |
Search |
Today's Posts |
#38
![]() |
|||
|
|||
![]()
On Sat, 12 Mar 2005 03:15:42 GMT, "
wrote: But that formula for z does not appear to be correct! Hi Art, As I said, you are not working in Cartesians in the first place with "polygons." It is a formula for computer generation of the surface. If you absolutely need to understand the formula, read through the code that is used to construct the distribution curve: #define sz 2000000 #define bc 19 static double fr() {return rand()/(double)~(131);} static double sq(double x){return x*x;} int hi[bc]; int out=0; int main(){ {int j=bc; while(j--) hi[j]=0;} {int j=sz; while(j--) { double x = fr()*1.4-.7, y=fr()*1.4-.7, z=fr(); if(sq(x*x+y*y+z*z) z) { ++hi[(int)(z/sqrt(x*x+y*y+z*z)*bc)];} else ++out;}} {int j; for(j=0; jbc; ++j) printf("%d %d %8.2f\n", j, hi[j], (sz-out)*(j+.5)/(bc*bc/2));} printf ("%d out of box.\n", out); } If you still don't understand, the polar coordinate formulas are just as useful, simpler, and take very little work to construct a "polygon" that obtains complete closure. It is, after all, a construction much like any of a number of classic curves. You need only conform to the requirements of a Lambertian surface or emitter to obtain the curve you describe. 73's Richard Clark, KB7QHC |