|
|
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
|
|