POV-Ray : Newsgroups : povray.general : Can't work out the right scale/translate : Can't work out the right scale/translate Server Time
2 Aug 2024 22:12:25 EDT (-0400)
  Can't work out the right scale/translate  
From: Phil Cook
Date: 30 Jun 2004 09:54:00
Message: <opsaet6upaefp2ch@news.povray.org>
I've been staring at this on and off for weeks and just can't figure out  
how to get the vertical scale/translate right:

Three files:

//Magic Gate1.inc
#declare CameraLocation=<0,1,-10>;
#declare CameraLookat=<0,1,0>;
#declare CameraRotate=10;
// end Magic Gate.inc

//Magic Gate2.pov run first with +fn
#include "Magic Gate1.inc"

camera{
location CameraLocation
look_at CameraLookat
rotate y*CameraRotate}
light_source{<0,18,0> rgb 1}

plane{y,0 pigment{red 1}}
plane{-y,-20 pigment{blue 0.5} finish{ambient 1}}

box{0,6 pigment{green 1} rotate y*-30 translate z*10 finish{ambient 0.5}}

sphere{0,1 pigment{red 1} finish{ambient 0.5} translate <0,15,30> rotate  
y*10}
//end Magic Gate2.pov

//Magic Gate1.pov
#include "Magic Gate1.inc"

camera{
location CameraLocation
look_at CameraLookat
rotate y*CameraRotate}
light_source{<0,18,0> rgb 1}

plane{y,0 pigment{rgb 1}}
plane{-y,-20 pigment{blue 1} finish{ambient 1}}

box{0,6 pigment{red 1} rotate y*-30 translate z*10}

#declare Distance = CameraLookat.z;
#declare  
Length=vlength(<0,0,Distance>-<CameraLocation.x,0,CameraLocation.z>);

difference{
box{z*5,<Length*(2/3)*2,(Length*(2/3)*2)/1.33,0>
pigment{image_map{png "Magic Gate2.png"}
scale<Length*(2/3)*2,(Length*(2/3)*2)/1.33,1>

//why -4?
translate y*-4
}
finish {ambient 1}
translate -x*(Length*(2/3))
rotate y*CameraRotate
}

plane{z, 0}
plane{-z, -0.001}
plane{-x, -1}
plane{x, -1}
plane{y, 0}
plane{-y, -5}
cutaway_textures
no_shadow
}

sphere{0,1 pigment{green 1} finish{ambient 0.5} translate <0,15,30> rotate  
y*10}
//end Magic Gate1.pov

Hopefully it should be obvious from the images and the titles what I'm  
trying to do, but the images don't quite line up as I would expect.  
Horizontally not bad; vertically enough of a discrepency to bug me.  
Knowing me probably something simple, but I just can't see it.

TIA

--
Phil Cook

-- 
All thoughts and comments are my own unless otherwise stated and I am  
happy to be proven wrong.


Post a reply to this message

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