|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi all!
I need to find the exact position of a translated and rotated camera. Imagine a
sphere and a camera that points to it (with look_at to <0,0,0>, the center of
the sphere) with camera location at <0,0,-15000> and that then has been rotated
by +60 degrees in the x axis. What I need to find is the location vector of the
camera.
In fact I need the location vector of the camera to make a trace() on the
Any ideas will be welcome.
Please try to send me an email.
Thanks in advance!
CVADRAT
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
vrotate() should do the trick:
vrotate(A,B)
Rotate A about origin by B. Given the x,y,z coordinates of a point in space
designated by the vector A, rotate that point about the origin by an amount
specified by the vector B. Rotate it about the x-axis by an angle specified in
degrees by the float value B.x. Similarly B.y and B.z specify the amount to
rotate in degrees about the y-axis and z-axis. The result is a vector containing
the new x,y,z coordinates of the point.
In your example, the new location can be found by calling vrotate(<0,0,-15000>,
<60,0,0>).
Regards Roman
"CVADRAT" <lud### [at] cvadratcom> wrote:
> Hi all!
>
> I need to find the exact position of a translated and rotated camera. Imagine a
> sphere and a camera that points to it (with look_at to <0,0,0>, the center of
> the sphere) with camera location at <0,0,-15000> and that then has been rotated
> by +60 degrees in the x axis. What I need to find is the location vector of the
> camera.
> In fact I need the location vector of the camera to make a trace() on the
>
> Any ideas will be welcome.
>
> Please try to send me an email.
>
> Thanks in advance!
> CVADRAT
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"CVADRAT" <lud### [at] cvadratcom> wrote:
> Hi all!
>
> I need to find the exact position of a translated and rotated camera. Imagine a
> sphere and a camera that points to it (with look_at to <0,0,0>, the center of
> the sphere) with camera location at <0,0,-15000> and that then has been rotated
> by +60 degrees in the x axis. What I need to find is the location vector of the
> camera.
> In fact I need the location vector of the camera to make a trace() on the
>
> Any ideas will be welcome.
>
> Please try to send me an email.
>
> Thanks in advance!
> CVADRAT
You might want to try the code below.
Tor Olav
http://subcube.com
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#include "colors.inc"
#include "transforms.inc"
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#declare Sphere =
sphere {
<0, 0, 0>, 500
pigment { color White }
}
#declare pCameraLocation = <0, 0, -1500>;
#declare pCameraLookAt = <0, 0, 0>;
#declare Camera =
camera {
location pCameraLocation
look_at pCameraLookAt
}
// This should work as long as there is no uneven scaling
#declare CameraTransform =
transform {
// translate 400*y
rotate 60*x
}
#declare NewCamera =
camera {
Camera
transform { CameraTransform }
}
#declare pNewCameraLocation =
vtransform(
pCameraLocation,
CameraTransform
);
#declare pNewCameraLookAt =
vtransform(
pCameraLookAt,
CameraTransform
);
#declare vNewCameraDirection =
pNewCameraLookAt - pNewCameraLocation;
#declare vNormal = <0, 0, 0>;
#declare pIntersection =
trace(
Sphere,
pNewCameraLocation,
vNewCameraDirection,
vNormal
);
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
background { color Blue/2 }
light_source { <100, 2000, -1000>, color White }
object { Sphere }
#if (vlength(vNormal) > 0)
sphere {
pIntersection, 10
pigment { color Orange }
}
#else
#debug "\n"
#debug "No intersection"
#debug "\n"
#end // if
camera {
// Camera
NewCamera
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|