From: Magnus Lie Hetland <magnus@he...>  20040728 20:10:54

Andre Wobst <wobsta@...>: > [snip] > Well, I have to look at MetaPost at some point. If you mean a the language/user level  indeed. Very relevant to PyX. But I guess, perhaps, you mean at the implementation/code level? Well... I guess it's still relevant (although I'm not sure I'd dare venture into that without a good lantern and a trusty sword by my side... Or something :]) > Don't we really want to create a transformation by setting 3 2d > input and output points? That's the canonical problem, I guess. > This is a linear problem. How is it in MetaPost? There's an example on page 32 of the User Manual; the transform T (called T' in the manual) is not yet defined: (0, 1) transformed T =3D (3, 4) (1, 1) transformed T =3D (7, 1) (1, 0) transformed T =3D (4, 3) The solugion to this gives the transform factors txx =3D 4 txy =3D 3 [called tyx in the manual] tyx =3D 3 tyy =3D 4 tx =3D 0 ty =3D 0 But the problem needn't be this straightforward; these equations must be fully integrated with the general equation stuff, of course. For example, on the same page in the manual, the following equations are used to specify that a given (as yet unknown) transform is shapepreserving: txx =3D tyy; tyx =3D txy This automatically only allows rotation, shifting and uniform scaling. This is used in a very neat example on page 33 of the manual (figure 28). > Is it allowed to define write P =3D t*p where the points P and p are > not defined as well as t is not defined? What does MetaPost with > such an equation? Does it store it for later evaluation I don't really know; for each nonlinear term you have to know (*or* be able to figure out through some other linear equation system) one of the two factors before you can start solving things, of course. But how you deal with this in general (i.e. how you know when to solve a certain subset of the equations but not the rest of the equations) I don't know. > (for example until p and P becomes known)? And what about having > several transformations: P =3D t2*t1*p? I would think that would be allowed (as long as you supplied more equations in addition) but I'm not sure. > And what about restricting a transformation to a rotation, for > example? That can certainly be done (see the example above). > I should take a look at MetaPost/MetaFont at some point. Sounds like a good move, indeed :) I guess one of the few reasons I haven't dropped MetaPost is that PyX doesn't quite implement all of its functionality (such as this) yet. :] (Also, it's nice to be able to use the output from MetaPost directly in pdflatex without a hickup; if PyX could restrict itself to the same subset of EPS, possibly with a switch, such as mps=3DTrue or something, that would be very nice :}) > Andr=E9 =20 Magnus Lie Hetland "Canned Bread: The greatest thing since sliced http://hetland.org bread!" [from a can in Spongebob Squarepants] 