Re: easy plane normal vector question
- To: mathgroup at smc.vnet.net
- Subject: [mg89722] Re: easy plane normal vector question
- From: will parr <willpowers69 at hotmail.com>
- Date: Thu, 19 Jun 2008 05:41:33 -0400 (EDT)
thanks for your response, I found it very helpful. I am still struggling with the problem, although now I am having trouble with displaying the vector. So, I have got this far:
plane = 4.07919+ 0.0764884 x - 0.0632675 y
Following your advice:
vector = Flatten[{Coefficient[#, {x, y}] & /@ {plane}, -1}];
normaliseVec[v_] := v/Sqrt[v.v];
normVector = normaliseVec[vector]
{0.0761143, -0.0629581, -0.995109}
then to display the vector and the plane, using some 3D arrow code:
Between[a_, b_, x_] := b - (b - a)/Norm[b - a]*x;
Cone3D[s_, e_, w_] := Module[{v, b, b1, b2, A, r}, v = e - s;
A = RotationMatrix[\[Pi]/10, v];
b = {v[[2]], -v[[1]], 0};
b = b/Norm[b]*w;
r = {};
For[i = 0, i < 20, i++, b1 = RotationMatrix[i*\[Pi]/10, v].b;
b2 = RotationMatrix[(i + 1)*\[Pi]/10, v].b;
AppendTo[r, Polygon[{e, s + b1, s + b2}]];
AppendTo[r, Polygon[{s, s + b1, s + b2}]];];
r];
Arrow3D[s_, e_, cw_, aw_, al_] := Module[{m}, m = Between[s, e, al];
{Cylinder[{s, m}, cw], Cone3D[m, e, aw]}];
centroid ={-5.43852, 2.62127, 3.49737}
(*I think this might be where i went wrong*)
arrowEnd = centroid + normVector
now to display:
Show[Graphics3D[{EdgeForm[], Red,
Arrow3D[centroid, arrowEnd, 0.09, 0.3, 0.5],
AspectRatio -> Automatic}, Boxed -> False],
Plot3D[plane, {x, -11.1, -0.71}, {y, -1.86, 7.83},
PlotStyle -> Directive[Red, Opacity[.5]], Mesh -> None],
Boxed -> False, Axes -> True, AxesLabel -> {"x", "y", "z"},
AxesEdge -> {{-1, -1}, {-1, -1}, {-1, -1}}, PlotRange -> All,
ImageSize -> 300, BoxRatios -> 1, AspectRatio -> 1,
ViewPoint -> {0, Infinity, 0}]
if you then manipulate the image, you can see that the arrow does not appear to be perpendicular to the plane...
any suggestions would be very welcome,
thank you again,
Will