[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help-3dldf] Re: button-hole problem

From: Laurence Finston
Subject: Re: [help-3dldf] Re: button-hole problem
Date: Sat, 23 Apr 2005 19:55:03 +0200
User-agent: IMHO/0.98.3+G (Webmail for Roxen)

Martijn van Manen wrote:

> Here is my eternal sorry again for not participating
> a lot. I really am sorry, but I just don't have the time.

No need to apologize.  I know you're busy, that's why I haven't bothered you.

> > What I do is the following:  A `Focus' contains a `Point' representing the
> > position of the "camera" in space and another representing the direction
> > view.  The "up" direction is determined somehow, I don't remember how, and
> > be modified by using a `real' value for an angle of rotation. 
> Here is a crucial point in my opinion. What is the "Up" direction?

> I wanted very much to use 3DLDF for an article. So I did some
> experiments. But I could not get it right. I tried stuff with
> the focus and the distance, but to no avail. In what source file
> do I find how the "Up" direction is determined?
> Line whereabouts?

The "up" direction is that direction, which will correspond to the direction
of the positive y-axis in the projection.  It's determined in the `Focus'
constructor currently at line 9053 in the file `CWEB/points.web'.  For
simplicity, I describe only the case that the projection is performed by (in
effect) placing Focus::position on the negative z-axis and using the x-y plane
as the plane of projection.  This is the default, and if you're using 1.2.0,
this is what will happen, because I haven't made it possible to use the other
axes, since it doesn't matter a bit which axis one uses.

In fact, the Focus is never transformed, the transformation is applied to the
objects in the space.  Focus::up starts out as the point (0, 1, 0).
Focus::transform is the transformation that aligns the line Focus::position --
Focus::direction with the z-axis with position at the origin and direction on
the positive z-axis.  If an `angle' argument is specified, up is rotated
around the z-axis by this angle.  Then it is multiplied by the inverse of
Focus::transform.  Finally, Focus::transform is shifted by (0, 0,
-Focus::distance).  The perspective transformation is created by taking an
identity matrix and setting persp[2][2] = 0 and persp[2][3] = 1/distance
(indexing starts at 0).  This is why distance may not be 0.

The point is that the plane of projection is specified by position and
direction.  I could just as easily specify direction by using position and an
normal vector for the plane of projection.  The way it is now, "up" can be
rotated freely around the line from position to direction.  If you need a
better way of setting "up", let me know what you want and I'll try to
implement it.  I don't think this would be too difficult.

> Pascals theorem by the way roughly says that through any five points in
> the plane there is a unique ellipse.
> An ellipse is given by an equation
> a x2 + bxy + cy2 + d x + e y = 1 
> So if you have five points, you get five unknowns a,b,c,d,e and
> five equations. So you can determine a solution. 
> Ofcourse, a mathematician would know say that I'm retarded. He/she
> would be right, but this I think is the computational essence.

Thank you.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]