|
|
dick balaska <dic### [at] buckosoftcom> wrote:
> It's not a gun, Mom, it's a flashlight. It just looks like a gun.
> I wondered if doing it in two rotates was an answer, as opposed to
> rotate <x, y, 0>
Yes, because the POV-Ray coordinate system is in x, y, z Cartesian space, not
spherical coordinates.
If you are getting a vector as a result, then you can likely just translate that
to spherical coordinates.
> Well, you should. There is no greater purpose in life than helping a
> fellow anonymous POV-er. I don't want no excuses about last night.
Slave.
Driver.
Give the following a whirl and see if you follow what's going on:
#################################################################
#version 3.71;
#declare Radiosity = off;
global_settings {
assumed_gamma 1
#if (Radiosity)
radiosity {
pretrace_start 0.04
pretrace_end 0.01
count 200
recursion_limit 3
nearest_count 10
error_bound 0.5
}
#end
}
#include "colors.inc"
#include "glass.inc"
#include "textures.inc"
#include "metals.inc"
#include "rand.inc"
#declare Perspective = image_width/image_height;
#declare P = Perspective;
#declare Camera = <0, 0, 0>;
camera {
perspective
up <0,1,0>
right x*Perspective
location Camera
look_at <0, 0, 1>
}
light_source {<1, 1, -50> color rgb <1,1,1>}
//plane {y, 0 texture {pigment {Gray50} normal {granite 0.1}} }
#declare Flashlight = <-0.4, -0.3, 0.7>;
#declare Size = 0.025;
#for (Y, -0.5, 0.5, 0.1)
#for (X, -0.5*P, 0.5*P, 0.1)
#declare LookAt = <X, Y, 1>;
sphere {LookAt Size pigment {rgbt <1, 0, 0, 0.9>}}
// Imagine a sphere at <0, 0, 1>
// rotating around the x-axis brings the height of the
// flashlight impact to the same height as the LookAt point
// Then, when it is rotated around the y-axis, it maintains this height
// and is oriented to point at the LookAt point
// Note that this "vector" direction is not corrected for the distance to the
plane
// and so it is is a cylindrical curve, it is not the same as the Lookat
point,
// but one can draw a line from the Flashlight
// to the LookAt point, which is in the +z view plane
#declare Xo = LookAt.y - Camera.y;
#declare Xa = LookAt.z - Camera.z;
#declare XAngle = degrees(atan2 (Xo, Xa));
#declare Yo = LookAt.x - Camera.x;
#declare Ya = LookAt.z - Camera.z;
#declare YAngle = degrees(atan2 (Yo, Ya));
#declare Xo2 = LookAt.y - Flashlight.y;
#declare Xa2 = LookAt.z - Flashlight.z;
#declare XAngle2 = degrees(atan2 (Xo, Xa));
#declare Yo2 = LookAt.x - Flashlight.x;
#declare Ya2 = LookAt.z - Flashlight.z;
#declare YAngle2 = degrees(atan2 (Yo, Ya));
sphere {<0, 0, 1> Size/2 pigment {rgbt <0, 1, 0, 0.9>} rotate x*XAngle rotate
y*YAngle}
sphere {<0, 0, 1> Size/4 pigment {White} rotate x*XAngle2 rotate y*YAngle2}
#end
#end
Post a reply to this message
|
|