POV-Ray : Newsgroups : povray.general : Q: Math Server Time
6 Nov 2024 00:28:47 EST (-0500)
  Q: Math (Message 1 to 9 of 9)  
From: Ken
Subject: Q: Math
Date: 14 Mar 1999 08:02:40
Message: <36EBB259.EE9B7690@pacbell.net>
Yet another 3D Pov math related exersize for the mathmaticaly
inclined.

  A triangle has three coordinates defining the locations of it's three
corners. Establishing the locations of these is pretty striaght forward
and follows the standad Pov 3 axis format.

The Challenge:

Given one of the three points is it possible to determine a right
angle to the third point. A more accurate way of describing this
is if, as viewed from a -z direction, I had a triangle whose two
bottom points (P1 -P2) were at y,0 +/- 1 and it's top point (P3)
was at y,1 x,0  how would I determine, through using math, how to
place an object like small cylinder or cone so that it is at a
right angle to the face of the triangle pointing back towards the
observer.


         object
    P3 O         P3     object at right angle
      / \          |==== 
     /   \         |
    /     \        |       ==>  -z
   /       \       |
P1 --------- P2    | P1,P2


  The solution as I see it lies with the location of the other two
corner points in three space and the location of the third in relation
to that. How to deterime that relation ship is what has me baffled.

  A use for this would be to place an object at every vertice of
a mesh object by storing the vertice locations in an array then
distributing them with the formula that will hopefully be provided
and a looping function. I understand there are inherent difficulties
involved with the initial orientation since there are two faces on
a trangle and it would be easy for the math to choose the wrong
normal but that would be a different application related exersize
that awaits the answer to the first part of the problem.

Any takers ?

Thank you,

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Nieminen Mika
Subject: Re: Q: Math
Date: 14 Mar 1999 11:24:32
Message: <36ebe2c0.0@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
:   A use for this would be to place an object at every vertice of
: a mesh object by storing the vertice locations in an array then
: distributing them with the formula that will hopefully be provided
: and a looping function.

  If I understood correctly, the compressed mesh macro can do exactly this.
Perhaps you want to check it?
http://www.geocities.com/SiliconValley/Lakes/1434/pcm.html

  Look at the rightmost bust in the image
http://www.geocities.com/SiliconValley/Lakes/1434/Images/Meshes.jpg

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Alexander Fried
Subject: Re: Q: Math
Date: 14 Mar 1999 11:33:53
Message: <36EBE4F7.B7C3F98F@jk.uni-linz.ac.at>
The function you are looking for is the cross product  (vcross(A,B)). It
takes two vectors as parameters defining the plane. For your example
these
would be V12 = P2 - P1 and V13 = P3 - P1. vcross gives the vector having
a
right angel to the plane: VR = vcross(V12,V13). The vector isn't
normalized.
The direction of the vector depends on the parameters. Turning the first
(V12) to the second (V13) VR will show in the direction a screw would
move
(being screwed). In your example it would show towards me. (This rule
has
got a name but I don't know the english name.)

Alex


Ken wrote:

> Yet another 3D Pov math related exersize for the mathmaticaly
> inclined.
>
>   A triangle has three coordinates defining the locations of it's three
> corners. Establishing the locations of these is pretty striaght forward
> and follows the standad Pov 3 axis format.
>
> The Challenge:
>
> Given one of the three points is it possible to determine a right
> angle to the third point. A more accurate way of describing this
> is if, as viewed from a -z direction, I had a triangle whose two
> bottom points (P1 -P2) were at y,0 +/- 1 and it's top point (P3)
> was at y,1 x,0  how would I determine, through using math, how to
> place an object like small cylinder or cone so that it is at a
> right angle to the face of the triangle pointing back towards the
> observer.
>
>          object
>     P3 O         P3     object at right angle
>       / \          |====
>      /   \         |
>     /     \        |       ==>  -z
>    /       \       |
> P1 --------- P2    | P1,P2
>
>   The solution as I see it lies with the location of the other two
> corner points in three space and the location of the third in relation
> to that. How to deterime that relation ship is what has me baffled.
>
>   A use for this would be to place an object at every vertice of
> a mesh object by storing the vertice locations in an array then
> distributing them with the formula that will hopefully be provided
> and a looping function. I understand there are inherent difficulties
> involved with the initial orientation since there are two faces on
> a trangle and it would be easy for the math to choose the wrong
> normal but that would be a different application related exersize
> that awaits the answer to the first part of the problem.
>
> Any takers ?
>
> Thank you,
>
> --
> Ken Tyler
>
> mailto://tylereng@pacbell.net


Post a reply to this message

From: Margus Ramst
Subject: Re: Math
Date: 14 Mar 1999 12:03:49
Message: <36ebebf5.0@news.povray.org>
Err... Every time I read a mathematical problem like this I feel kind of
stupid... Am I correct in assuming that you want to calculate the surface
normal of a triangle, whose vertices are given?
If so, try this (untested and you migh have to swap V2 and V3)

#macro Norm(V1,V2,V3)
    vnormalize(vcross(V2-V1,V3-V1))
#end

If not, I might still have the solution but I dont quite understand what you
need...

Margus


Post a reply to this message

From: Rudy Velthuis
Subject: Re: Math
Date: 14 Mar 1999 12:21:03
Message: <36ebefff.0@news.povray.org>
Margus Ramst schrieb in Nachricht <36ebebf5.0@news.povray.org>...
>Err... Every time I read a mathematical problem like this I feel kind of
>stupid... Am I correct in assuming that you want to calculate the surface
>normal of a triangle, whose vertices are given?
>If so, try this (untested and you migh have to swap V2 and V3)
>
>#macro Norm(V1,V2,V3)
>    vnormalize(vcross(V2-V1,V3-V1))
>#end


I think this is right. I wanted to give the same answer, but didn't know the
exact formula for the cross product anymore. Didn't know POV-Ray had a
function for it.

--
Rudy Velthuis


Post a reply to this message

From: Stephen Lavedas
Subject: Re: Q: Math
Date: 15 Mar 1999 01:38:58
Message: <36ECAB22.933A3630@virginia.edu>
Since the question has been answered I'll leave it alone, but I must say
that we JUST went over finding the normal to a plane through a point on
the plane in Linear Algebra last week.  I really like a class I can
apply to thinks I enjoy doing.

Steve


Ken wrote:
> 
> Yet another 3D Pov math related exersize for the mathmaticaly
> inclined.
> 
>   A triangle has three coordinates defining the locations of it's three
> corners. Establishing the locations of these is pretty striaght forward
> and follows the standad Pov 3 axis format.
> 
> The Challenge:
> 
> Given one of the three points is it possible to determine a right
> angle to the third point. A more accurate way of describing this
> is if, as viewed from a -z direction, I had a triangle whose two
> bottom points (P1 -P2) were at y,0 +/- 1 and it's top point (P3)
> was at y,1 x,0  how would I determine, through using math, how to
> place an object like small cylinder or cone so that it is at a
> right angle to the face of the triangle pointing back towards the
> observer.
> 
>          object
>     P3 O         P3     object at right angle
>       / \          |====
>      /   \         |
>     /     \        |       ==>  -z
>    /       \       |
> P1 --------- P2    | P1,P2
> 
>   The solution as I see it lies with the location of the other two
> corner points in three space and the location of the third in relation
> to that. How to deterime that relation ship is what has me baffled.
> 
>   A use for this would be to place an object at every vertice of
> a mesh object by storing the vertice locations in an array then
> distributing them with the formula that will hopefully be provided
> and a looping function. I understand there are inherent difficulties
> involved with the initial orientation since there are two faces on
> a trangle and it would be easy for the math to choose the wrong
> normal but that would be a different application related exersize
> that awaits the answer to the first part of the problem.
> 
> Any takers ?
> 
> Thank you,
> 
> --
> Ken Tyler
> 
> mailto://tylereng@pacbell.net


Post a reply to this message

From: Margus Ramst
Subject: Re: Q: Math
Date: 15 Mar 1999 03:24:05
Message: <36ECC3A3.90784F20@peak.edu.ee>
Stephen Lavedas wrote:
> 
> Since the question has been answered I'll leave it alone, but I must say
> that we JUST went over finding the normal to a plane through a point on
> the plane in Linear Algebra last week.  I really like a class I can
> apply to thinks I enjoy doing.
> 
> Steve
> 

Well, it's been a while since I studied it (and I wasn't into POV back
then). So maybe you remember how to accomplish this: given a normal vector
and the distance along that normal (like a plane{}), how can I create a
matrix of, let's say spheres, with their centres lying on that plane?
Should be some kind of reverse-engineering of the cross product, but what?

Margus


Post a reply to this message

From: Nieminen Mika
Subject: Re: Q: Math
Date: 15 Mar 1999 06:18:05
Message: <36ecec6d.0@news.povray.org>
Margus Ramst <mar### [at] peakeduee> wrote:
: Well, it's been a while since I studied it (and I wasn't into POV back
: then). So maybe you remember how to accomplish this: given a normal vector
: and the distance along that normal (like a plane{}), how can I create a
: matrix of, let's say spheres, with their centres lying on that plane?
: Should be some kind of reverse-engineering of the cross product, but what?

  Applying the matrix page:

object
{ ArrayOfSpheresInXZPlane

  translate y*Distance
  #local VX1=y;
  #local VX2=vnormalize(NormalVector);
  #local VY=vcross(VX2,VX1);
  #if (vlength(VY)>0)
    #local VY=vnormalize(VY);
    #local VZ1=vcross(VY,VX1);
    #local VZ2=vcross(VY,VX2);

    matrix < VX1.x, VY.x, VZ1.x,
             VX1.y, VY.y, VZ1.y,
             VX1.z, VY.z, VZ1.z,
                 0     0      0 >
 
    matrix < VX2.x, VX2.y, VX2.z,
              VY.x,  VY.y,  VY.z,
             VZ2.x, VZ2.y, VZ2.z,
                 0,     0,     0 >
  #end
}

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ken
Subject: Re: Q: Math
Date: 15 Mar 1999 22:35:18
Message: <36EDD1EF.861B5C71@pacbell.net>
Ken wrote:
> 
> Yet another 3D Pov math related exersize for the mathmaticaly
> inclined.

Thank you everyone who replied. I think I have the idea now. It's
just a matter of the implementation to work out. Easy... Right...

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

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