|
|
Alain <ele### [at] netscapenet> wrote:
> You want to scale the image relative to it's center. Use:
> translate -0.5 //center around origin
> scale<XSCALE,1,YSCALE> //scale it
> translate 0.5 // return it to it's original position
>
> Now, you want to place if acording to your offset
> translate<XOFF,1,YOFF>
>
> --
> Alain
> -------------------------------------------------
> Adult, n.: One old enough to know better.
Thank you so much, your help was key! I have finally realized my goal of
placing images on heightfields algorithmically by their global coordinates
alone.
On the off chance anyone else is struggling to match Canadian Toporama imagery
to Canadian Geobase DEM data:
#macro IMGMAP_FIT(XSCALE, YSCALE, XOFF, YOFF)
rotate <90, 0, 0> // Face up
translate <-0.5, -0.5, -0.5> // Center on origin
scale<XSCALE, 1, YSCALE> // Scale
translate<0.5, 0.5, 0.5> // Move off origin
translate<(XSCALE-1)/2, 0, -(YSCALE-1)/2> // Position upper-left
translate<-XOFF, 0, YOFF> // Translate
#end
#macro DEM_FIT(DEMLAT, DEMLON, DEMH, DEMW,
IMGLAT, IMGLON, IMGH, IMGW)
IMGMAP_FIT( IMGW/DEMW, IMGH/DEMH,
(DEMLON-IMGLON)/DEMH,
(DEMLAT-IMGLAT)/DEMW)
#end
height_field
{
tga "062L10w.tga"
water_level 0
/* Match the orientation of the map to screen coordinates */
translate<-0.5, -0.5, -0.5>
rotate <0, -90, 0>
translate<+0.5, +0.5, +0.5>
pigment
{
image_map { gif "062L10.gif" once }
// Toporama gives different aspects for different latitudes
// of map! A general image-fitter makes it so much tidier.
DEM_FIT(182700, -370800, 900, 900,
182700, -370800, 900, 1800)
}
}
Also note that ye olde dem2pov.c fails for Geobase DEM data, since
smaller-than-one spatial resolutions round to ZERO. I'll find somewhere to
post fixes once I have something better than my current hack.
Post a reply to this message
|
|