guppi coor system



It's been rumoured that Rob Browning said:
> 
> linas@linas.org writes:
> 
> > (examples on how *not* to do it: the X11 rendering model, the phigs
> > rendering model, the CORE rendering model, etc.)
> 
> ... the original MacOS rendering model, the original windows rendering
> model, etc...
> 
> Apple's new UI sounds like it learned a lot from GL and display
> postscript and it supports live matrix manipulations for windows.
> That's why they can take their normal quicktime movie player and have
> it's window get "sucked down a vortex" when you close it, while the
> movie's still playing.  

Well, that's way out of line from where we want guippi to go, but ...
vortex mappings like that are quite complex; they require each pixel to
be remapped through some non-linear function.  If traditional
mip-mapping is used, then you have heavy cpu computations to set up
filtered mip-maps, which is computationally infeasible for live video.
Thus, part of quick-time's secrets is how to do high-quality image 
distortions without the traditional mip map filter overhead.

> > maybe that's not a good example, as the push & pop here are not really
> > needed in this example.
> 
> Well they're really useful, among other things, for creating
> composable graphic operations.  So you can say
> 
>   pushcontext

well, I suggest you want 'pushmatrix' and 'pushattributes to be
separated.   One does the coordinate pushmatrix far more often 
than the color/linestyle save&restore; and the attribute push can become
expensive ...

>     set-up-coords-for-graph
>     draw-graph-title
>     draw-graph
>     pushcontext
>       translate legend-1-position
>       scale legend-size
>       draw-legend graph-legend-1
>     popcontext
>     ;; Now we're back to the graph coord system.
>     draw-some-transparent-overlay
>   popcontext
>  
> Once you've done this, and say this code is put in a function called
> draw-graph-and-legend, you can trivially compose it with other matrix
> ops to get "4 up" graph printing (of course you'd do this with another
> wrapper function you call 4 times, but this code is just an
> illustration):
> 
>   pushcontext
>     translate center-of-top-left-corner
>     scale 0.5 0.5
>     draw-graph-and-legend
>   popcontext
>   pushcontext
>     translate center-of-top-right-corner
>     scale 0.5 0.5
>     draw-graph-and-legend
>   popcontext
>   pushcontext
>     translate center-of-bottom-left-corner
>     scale 0.5 0.5
>     draw-graph-and-legend
>   popcontext
>   pushcontext
>     translate center-of-bottom-right-corner
>     scale 0.5 0.5
>     draw-graph-and-legend
>   popcontext

And just to drive the point home,

scale 0.5 0.5 is just the 4x4 matrix

0.5    0     0     0
0     0.5    0     0
0      0    1.0    0
0      0     0     1


a rotate by t degrees in x-y plane is 

c     s     0      0
-s    c     0      0
0     0     1      0
0     0     0      1

c = cosine (t), s = sine(t)

a generic 3d translate is

1    0     0      tx
0    1     0      ty
0    0     1      tz
0    0     0      1

you compose matrices to get the desired combo.  Then, a point in
'modeling coords' is (x,y,z,1) and the point in device coords
is just M * (x,y,z,1)  (well, technically, for true 3d, to get
perspective effects, you need to divide by z at this point, and
you had to set up a funny matrix for get the perspective to work,
but we're not doing 3d right? :-) )


--linas





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]