POV-Ray : Newsgroups : povray.advanced-users : Tough math help needed : Tough math help needed Server Time
29 Jul 2024 16:34:00 EDT (-0400)
  Tough math help needed  
From: Peter Popov
Date: 27 Aug 2001 16:13:14
Message: <sn9lotkt2skm94gunq0g6gm8rch2f8oq9r@4ax.com>
I have a tough problem to solve and I am really stuck. I hope some of
the more math-talented people here can help me.

It's a XYZ -> UVW transformation function that I want to find the
inverse of. Let's first take a look at the simpler case, XY -> UV.

Take a unit square and a point P in it with coordinates a, b. These
are the XY coordinates. Now take four random points in space.
Supposing they are not coplanar, there's a unique second-order
function passing through them known as the 'saddle' function. It is
actually a hyperbolic function.

The hyperbolloid is the only second-order function that has two sets
of rulings. Each ruler of one set intersects all rulers of the other
and vice versa. Also, no two rulers of one set intersect. This means
that at each point on the surface, exactly one ruler of one set and
one of the other are present, which makes them a perfect choice for UV
coordinates.

Let's go back to the four arbitrary points in space I mentioned, let's
call them A, B, C and D (ASCII art follows, use a fixed-width font)

 D-----C
/     /
A    /
 \_B/

AB and DC belong to one set of rulers, [1] and AD and BC belong to the
other, [2]. Now, if we take two points on AB and DC, M and N resp., so
that the AM:AB = DN:DC, the line MN will belong to [1] and will have a
U coordinate of exactly that ratio. Let's choose M and N so that that
ratio is a. The point P' on MN for which MP':MN = b then has UV
coordinates a and b (directly follows from the above). Let's find its
XY coordinates:

(note: everything is vectors, i.e. AB = B - A, except a and b)

AM = a*AB
DN = a*DC
MN = AN - AM = AD + DN - AM
MP' = b*MN = b*(AD + DN - AM) = b*(AD + a*DC - a*AB) =
    = b*(AD + a*(DC - AB))
AP' = AM + MP' = a*AC + b*(AD + a*(DC - AB))
P' = A + AP' = A + a*AC + b*(AD + a*(DC - AB))

OK, this was the easy part :)

Now, knowing A, B, C, D and P', how do I find a and b (or P, it's the
same)?


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.