POV-Ray : Newsgroups : povray.newusers : Image maps and heightfields : Image maps and heightfields Server Time
28 Jul 2024 16:28:52 EDT (-0400)
  Image maps and heightfields  
From: Corona688
Date: 21 Mar 2008 19:45:01
Message: <web.47e4547bb02d5773bebf2c990@news.povray.org>
I have an unusual problem -- image maps that are a different size and aspect
ratio than the heightfield they match.

I have precise information on where they belong relative to the heightfield, and
I can get them to fit with hardcoded values, but any sort of macro to fit it
based on the information I have has eluded me for the last week.

Hence I politely ask for help creating a macro for the translations+rotations in
the pigment section, like:

IMG_FIT(-0.5, +0.0,
        +1.0, +1.0)

where the first two coordinates are the upper left corner of the imagemap
relative to the heightfield, and the second two are the lower right.  Yes, part
of the left side of the image would miss the heightfield, that is the idea.

My silly efforts so far, just so you know I've tried:

#macro IMGMAP_FIT(XSCALE, YSCALE, XOFF, YOFF)
        rotate <90, 0, 0>           // Face up
        translate<-0.5, -0.5, -0.5> // Center
        scale <-XSCALE, 1, -YSCALE> // Resize
        translate<(XSCALE-1)/2, 0, -(YSCALE-1)/2> // Relocate
#end


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.