|
|
Could somebody help me out here...
How can I define a plane in POV code? That is, if I give three coordinates to
a macro, what equation defines the points lying on the plane defined by these
3 coordinates? (Sheesh, that was messy...)
Let's say, I define 3 points. I now want to find a point at some equal
distance fom 2 of these points - and lying on the plane defined by the 3
points. How do I accomplish this?
My math is failing me...
Margus
Post a reply to this message
|
|
|
|
You need the normal, and a distance along the normal:
#macro plane3pts(a,b,c)
#local norm=vnormalize(vcross(b-a,c-a));
#local dst=vdot(a,norm);
plane{norm, dst}
#end
You may want to change the first line of the macro to (negate norm):
#local norm=-vnormalize(vcross(b-a,c-a));
One way will use right-hand-rule, the other left-hand-rule (counter-clockwise
vs clockwise order of points)... I'm not sure which is which, though. ;-)
-Nathan Kopp
Post a reply to this message
|
|
|
|
Oh! Oh!! 3D Math... now do you REALLY want the math behind this? Or a
quick and dirty way to do it in POVRay? Well, you're going to get the
math as I figure it out... (I just finished my last final a couple of
hours ago, and since I don't HAVE to use my brain, I want to)
Okay.. let's take three points... <x1,y1,z1>, <x2,y2,z2>, and
<x3,y3,z3>. Now, the midpoint formula for a point exactly on the line
half way in between point 1 and 2 is <(x1-x2)/2, (y1-y2)/2, (z1-z2)/2>
now all that remains is to determine the perpendicular vector that lies
along the same plane as point 3. This can be done by (unless I've gone
off the deep end here, and I have tested this to some extent, but I
could be wrong) taking any multiple of <xm-x3, ym-y2, zm-z3>. That
should give you your fourth point, however, said point is probably not
equidistant. This can be solved by trig now. Let's see... (I'm having
trouble visualizing now...) Can I get away by saying that point is
indeed on the plane, and tranforming it by a fraction of the vector
between point 1 and 2 will put it equidistant?? I doubt it, but will you
give a guy a break??
Steve
(my mind is hurting.. i should have written this down..)
Margus Ramst wrote:
>
> Could somebody help me out here...
> How can I define a plane in POV code? That is, if I give three coordinates to
> a macro, what equation defines the points lying on the plane defined by these
> 3 coordinates? (Sheesh, that was messy...)
> Let's say, I define 3 points. I now want to find a point at some equal
> distance fom 2 of these points - and lying on the plane defined by the 3
> points. How do I accomplish this?
>
> My math is failing me...
>
> Margus
Post a reply to this message
|
|