Rich wrote:
I suspected that's what the "3rd" was for; I'll try to pin it down specifically ...
I was almost right - the "3rd" variables are the lower left corner, not upper right. There are some extensive comments in lorenz.c I wrote (with a contribution from Sylvie) that explain the relationship between the fractint pixel coordinates and the complex plane. Other places in the code to look at would be places that convert between corners and center-mag. I can look that up, but what is below should be definitive. This code was needed in lorenz because the transformation between pixels and complex plane had to happen each point. Let it not be said there are NO comments in the fractint code <grin!> Well - the options are - no comments, or long essays! Tim /* Conversion of complex plane to screen coordinates for rotating zoom box. Assume there is an affine transformation mapping complex zoom parallelogram to rectangular screen. We know this map must map parallelogram corners to screen corners, so we have following equations: a*xxmin+b*yymax+e == 0 (upper left) c*xxmin+d*yymax+f == 0 a*xx3rd+b*yy3rd+e == 0 (lower left) c*xx3rd+d*yy3rd+f == ydots-1 a*xxmax+b*yymin+e == xdots-1 (lower right) c*xxmax+d*yymin+f == ydots-1 First we must solve for a,b,c,d,e,f - (which we do once per image), then we just apply the transformation to each orbit value. */ /* Thanks to Sylvie Gallet for the following. The original code for setup_convert_to_screen() solved for coefficients of the complex-plane-to-screen transformation using a very straight- forward application of determinants to solve a set of simultaneous equations. The procedure was simple and general, but inefficient. The inefficiecy wasn't hurting anything because the routine was called only once per image, but it seemed positively sinful to use it because the code that follows is SO much more compact, at the expense of being less general. Here are Sylvie's notes. I have further optimized the code a slight bit. Tim Wegner July, 1996 Sylvie's notes, slightly edited follow: You don't need 3x3 determinants to solve these sets of equations because the unknowns e and f have the same coefficient: 1. First set of 3 equations: a*xxmin+b*yymax+e == 0 a*xx3rd+b*yy3rd+e == 0 a*xxmax+b*yymin+e == xdots-1 To make things easy to read, I just replace xxmin, xxmax, xx3rd by x1, x2, x3 (ditto for yy...) and xdots-1 by xd. a*x1 + b*y2 + e == 0 (1) a*x3 + b*y3 + e == 0 (2) a*x2 + b*y1 + e == xd (3) I subtract (1) to (2) and (3): a*x1 + b*y2 + e == 0 (1) a*(x3-x1) + b*(y3-y2) == 0 (2)-(1) a*(x2-x1) + b*(y1-y2) == xd (3)-(1) I just have to calculate a 2x2 determinant: det == (x3-x1)*(y1-y2) - (y3-y2)*(x2-x1) And the solution is: a = -xd*(y3-y2)/det b = xd*(x3-x1)/det e = - a*x1 - b*y2 The same technique can be applied to the second set of equations: c*xxmin+d*yymax+f == 0 c*xx3rd+d*yy3rd+f == ydots-1 c*xxmax+d*yymin+f == ydots-1 c*x1 + d*y2 + f == 0 (1) c*x3 + d*y3 + f == yd (2) c*x2 + d*y1 + f == yd (3) c*x1 + d*y2 + f == 0 (1) c*(x3-x2) + d*(y3-y1) == 0 (2)-(3) c*(x2-x1) + d*(y1-y2) == yd (3)-(1) det == (x3-x2)*(y1-y2) - (y3-y1)*(x2-x1) c = -yd*(y3-y1)/det d = yd*(x3-x2))det f = - c*x1 - d*y2 - Sylvie */