POV-Ray : Newsgroups : povray.advanced-users : How to model a cube in 2D? : Re: How to model a cube in 2D? Server Time
29 Jul 2024 20:24:14 EDT (-0400)
  Re: How to model a cube in 2D?  
From: Peter Popov
Date: 23 Jan 2001 14:05:36
Message: <qnir6tkibl7mngr1068p601c04gphvtkv1@4ax.com>
On Mon, 22 Jan 2001 05:29:37 -0800, Josh English
<eng### [at] spiritonecom> wrote:

>You will have eight coordinates for the eight vertices of the box, and I
>would leave them in 3D until the very end. So image we have an array
>containing those points, for each element of the array you have the
>standard x, y, and z coordinates:

>(From Johns Matrix page) To rotate a position p by y*theta
>newp.x = cos(theta)*p.x - sin(theta)*p.z
>newp.y = p.y
>newp.z = sin(theta)*p.x + cos(theta)*p.z
>p = newp
>
>Then do the conversions for the other rotations.

That's exactly what I am doing, though in a RHS coor. system the signs
are a bit different.

>As for lighting, I'd have to think about that a bit more. If each face
>was going to get a flat shade of color, I'd probably take the average of
>its four corners, and play with angles from light to the point and from
>the camera to the point to judge what kind of shading to put there.

I'd just take the plane formed by 3 of the points and calculate the
angle between the normal and the camera ray. Lighting is not my main
problem.

I have some trouble with the 3D calculations but I'll see if John's
page will help me solve them.

However, I still don't have a clue how to proceed once I have the
screen coordinates of the vertices. I have to start with a square and
scale, rotate & tilt it to its deformed shape. It is possible since a
cube face in orthographic projection will always be a parallelogram,
but how?


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

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