POV-Ray : Newsgroups : povray.advanced-users : Question for the Math Geniuses (Geniuii? Genies?) Server Time
29 Jul 2024 16:23:02 EDT (-0400)
  Question for the Math Geniuses (Geniuii? Genies?) (Message 1 to 4 of 4)  
From: Bryan Valencia
Subject: Question for the Math Geniuses (Geniuii? Genies?)
Date: 23 Feb 2001 13:53:41
Message: <3A96B27C.8177F826@209software.com>
Here is my problem.

This is a math question, not so much a POV question.

Let's say I have a triangle, which defines a plane.  But all I have
are the 3 corner points.

Now, I want to get the plane's equation in the form

y(altitude) = f(x,z)

Of course I understand that the equation may be impossible if the
plane is completely vertical, but we can trap for that, and besides in
my application, it will never happen.

The language I will be using is C++ or Pascal, and the function I want
to write will look something like this;


function GetY(AX, AY, AZ, BX, BY, BZ, CX, CY, CZ, X, Z:double)double;



--
Bryan Valencia
www.209software.com


Post a reply to this message

From: David Fontaine
Subject: Re: Question for the Math Geniuses (Geniuii? Genies?)
Date: 23 Feb 2001 17:49:40
Message: <3A96E8A2.409DA121@faricy.net>
If you have triangle ABC, the cross-product of A-C (CA) and B-C (CB) will
give you a vector perpendicular to the triangle. Cross-product of <u,v,w>
and <x,y,z> is <vz-wy,wx-uz,uy-vx>. The x,y,z components of this new
vector are the coefficients for the equation of a plane, Ax+By+Cz=D. To
find D, plug one of the original points in for x, y and z. Now that we
have the equation, it is simply a matter of solving for y: y=(D-Ax-Cz)/B



double GetY(double Ax, double Ay, double Az,
    double Bx, double By, double Bz,
    double Cx, double Cy, double Cz,
    double _X, double _Z)
{
 double _A, _B, _C, _D;

   _A = (Ay-Cy)*(Bz-Cz) - (Az-Cz)*(By-Cy);
   _B = (Az-Cz)*(Bx-Cx) - (Ax-Cx)*(Bz-Cz);
   _C = (Ax-Cx)*(By-Cy) - (Ay-Cy)*(Bx-Cx);
   _D = _A*Ax + _B*Ay + _C*Az;
   return (_D - _A*_X - _C*_Z) / _B;
}


--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

From: Bryan Valencia
Subject: Re: Question for the Math Geniuses (Geniuii? Genies?)
Date: 23 Feb 2001 21:30:02
Message: <3A971D71.54F5C7E0@209software.com>
A Million Thanks!

Where did you learn 3d Geometry?  I need to go there!

David Fontaine wrote:

> If you have triangle ABC, the cross-product of A-C (CA) and B-C (CB) will
> give you a vector perpendicular to the triangle. Cross-product of <u,v,w>
> and <x,y,z> is <vz-wy,wx-uz,uy-vx>. The x,y,z components of this new
> vector are the coefficients for the equation of a plane, Ax+By+Cz=D. To
> find D, plug one of the original points in for x, y and z. Now that we
> have the equation, it is simply a matter of solving for y: y=(D-Ax-Cz)/B
>
> double GetY(double Ax, double Ay, double Az,
>     double Bx, double By, double Bz,
>     double Cx, double Cy, double Cz,
>     double _X, double _Z)
> {
>  double _A, _B, _C, _D;
>
>    _A = (Ay-Cy)*(Bz-Cz) - (Az-Cz)*(By-Cy);
>    _B = (Az-Cz)*(Bx-Cx) - (Ax-Cx)*(Bz-Cz);
>    _C = (Ax-Cx)*(By-Cy) - (Ay-Cy)*(Bx-Cx);
>    _D = _A*Ax + _B*Ay + _C*Az;
>    return (_D - _A*_X - _C*_Z) / _B;
> }
>
> --
> David Fontaine  <dav### [at] faricynet>  ICQ 55354965
> My raytracing gallery:  http://davidf.faricy.net/

--
Bryan Valencia
www.eloan.com
925-560-2661


Post a reply to this message

From: David Fontaine
Subject: Re: Question for the Math Geniuses (Geniuii? Genies?)
Date: 23 Feb 2001 22:11:16
Message: <3A9725F3.EDF82BA4@faricy.net>
Bryan Valencia wrote:

> A Million Thanks!

Hey, math is fun :)


> Where did you learn 3d Geometry?  I need to go there!

(cough) not in school...
I do a lot of math on my own. I think it was fractals got me into complex
numbers. Polyhedra got me into 3d trig. POV got me into vectors and matrices. I
just adapt 2d trig to work in 3d... find a way to make it two-dimensional.
Think orthographic camera. Like say, finding the angles on an octahedron: an
orthographic view of a vertex would be a square with two diagonals drawn
through it, giving you four 45-45-90 triangles. But you know these are really
60-60-60 triangles. It's a relatively simple matter of trig to measure the
triangles. An easier way would probably be to use vectors; consider that the

just summarize everything; knowing math and applying it are two different
things. It helps if you can think visually.

<rant>
My last four years of math were pretty mediocre, the first two of those
complete review (algebra in 6th grade)... finally, fortunately, I have calculus
(11th grade now) so I'm getting new semi-interesting stuff. I've pretty much
been soured on the matter though. Science especially, I feel I was misplaced. I
don't think I can enjoy school anymore until I get to college.

The whole instution I find purely repulsive; repressive, authoritarian (ungodly
authoritarian), unencouraging, unintellectual, uninterested, inflexible
(ungodly inflexible), discriminating, too arbitrary, narrowly focused and
overly sociopolitical. Now considering that I'm in International Baccalaureate,
somewhere the system went horribly wrong, and it was a long time ago.
</rant>

--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

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