[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [help-3dldf] How to z-sort the polygons of a cuboid using with_focus
From: |
Laurence Finston |
Subject: |
Re: [help-3dldf] How to z-sort the polygons of a cuboid using with_focus |
Date: |
Wed, 21 Mar 2007 10:42:55 +0100 (CET) |
I hope it's alright with you that I've "cc"'ed this to the mailing list.
I'd like your comment on the focus and my answer to be in the archive.
Your graphic isn't included in this reply.
> Thank you!
>
> I am very happy with the results! (See the attached pdf)
>
You're welcome. Thank you for sending me the graphic. This is the first
time I've ever seen a non-trivial graphic made using the package that I
didn't make myself. (And I haven't seen many trivial ones, either.)
You may know this already, but one way of making a border around the
graphic is to use a `frame' picture and output it using the `parallel_x_y'
projection. I use this for animations, in order to keep consecutive
images aligned.
> Just so you know, I think there is a bug in the camera projection calculation.
> If I use
>
> focus f;
> set f with_position (10, 3, -2) with_direction (0, 0, 4) with_distance 30;
>
> the image will be upside down, and has to be rotated 180 degrees with
>
> ... with_angle 180;
>
> When the camera is moved around the image will flip to 45 degrees, and
> sometimes be correct.
Well, it may be a bug, but I don't think so. The orientation of the
camera, i.e., the "up" direction, is found by using the transformation
that would place the line `position' -- `direction' such that it comes to
lie on a main axis (usually the z-axis), with the distance of `position'
to the x-y plane equal to `distance'. To the best of my knowledge,
it's not obvious what `up' direction would "feel right" to a person, when
the the line `position' -- `direction' isn't parallel to the "ground
plane", usually the x-z plane. In most perspective constructions that one
sees, this is the case.
If you want a particular "up" direction, one way of doing this is to draw
points for the `position' and `direction' of the focus you want, a
line through them, a perpendicular, and a perpendicular planar figure,
say, a circle or a rectangle, coplanar with the perpendicular line. Then,
project this image using a different focus, or transform it so that the
planar figure lies in a major plane and use parallel projection. Then,
you can adjust the `up' direction using `with_angle'. You can even use
labels for the angles, to see what looks best.
There are a number of features I'd like to implement for foci, such as the
affine transformations, but I simply haven't had time. Currently, one has
to use assignment to change them. I hope someday I'll be able to work
more on the package.
> Sometimes the projection even gets inverted so
> that closer objects appear further away.
I don't quite understand this. This would happen if the focus was
transformed such that it lay in front of the objects. In principle, I
suppose it could happen, but I've never run into this effect. Trying to
project a point that lies in the containing `position' and perpendicular
to the line `position -- direction' would cause an error because of
division by 0. I believe points satisfying this condition are culled, but
I'm not sure what would happen if a non-point object intersected this
plane.
Laurence