3
$\begingroup$

I'm hoping that such a calculation as below will be very easy for the users of this website:

I have a 3D Carousel on my website and a colleague is going to render out some 3D components to sit on the carousel. However, he needs the angle that the "camera" is at on my 3D carousel. The issue is that my 3D carousel is faux 3D, meaning the images at the rear of the carousel do not travel along a Z plane but they just reduce in size to give the impression that they are.

I've added 2 black lines to the carousel and worked out (through a pixel measurement) that there is 243 pixels between the front and back of the carousel. In theory this carousel is perfectly circular.

The radius of the circle is:

r = 2.3 (a number provided by the component to work out the radius) w = 1000px (the width of the carousel's container) w / r = 434.782609 

I know that there are 243px between the two black lines and that the radius of the circle is 434.78px so how would I work out the angle of the camera using these measurements? I've provided a screenshot to help if I've not explained it properly - on the diagram, I need to find the blue angle:

Screenshot of 3D Carousel

View of what I need

I need to know how as opposed to just giving the answer because if we decide to change the angle, I need to work out how to reflect this in the 3D render of each component.

If you need a little more information, just comment saying what you need and I'll do my best to trawl through the javascript file to find the answer.

1 Answers 1

1

Am I understanding correctly? You have an area 1000 pixels wide by 243 pixels deep that you show objects in, representing (part of) the outer annulus of a 435 radius circle. The deeper an object, the smaller it is rendered. Is the back line the outer edge of the carousel, and if so shouldn't it be curved? The question would then be to find a relation between depth and size of the rendering.

If I have read it right and the camera is at the center, the distance to the front line is 435-243=192 pixels and the distance to the back line is 435 pixels. So an object on the back line should be 192/435 as large as one on the front line. Taking d as the depth from the front line, the size would be $\frac{192}{d+192}$ of the size on the front line. But I am not sure this was the question.

  • 0
    That is right. I changed when you posted the picture and it seemed that was what you are after. I had thought "camera angle" referred to the angle of the object as seen from the camera. In the picture it seems to be the angle to point the camera at to see a location.2011-02-15