math - Drawing a plane -
i want draw plane given equation: ax+by+cz+d=0. first tried draw him seting x,y , z equation. did not work fine because there planes 0x+0y+z + 0 = 0 , etc...
my current solution this: - draw plane on zy plane giving 4 coordinates goes infinity. - find out rotation should done in order bring normal of given plane(a,b,c) lay on z axis. - find translation should done in order plane on x axis. - make opposit transformation rotation , translation hence the
plane in place.
ok
this great thing can make proper math calculations(tried alot of times...) dot product , etc....
can me in understanding exact way should done or give me formula in put abcd , right transformation?
any helpful!
is you're asking?
transforming simple plane xy plane plane simple:
your plane ax+by+cz+d=0
the xy plane z=0. i.e. a=b=d=0, while c=whatever want. we'll 1 simplicity's sake.
when have plane in form, normal of plane defined vector (a,b,c)
so want rotation take (0,0,1) (a,b,c)*
*note work if {a,b,c} unitary. may have divide b , c each sqrt(a^2+b^2+c^2).
rotating around 2 of axes can direction other direction, we'll pick x , y;
here rotation matrices rotations x axis, , b y axis.
rx := {{1, 0, 0}, {0, cos[a], sin[a]}, {0, -sin[a], cos[a]}}
ry := {{cos[b], 0, -sin[b]}, {0, 1, 0}, {sin[b], 0, cos[b]}}
if rotation x, followed rotation y, of vector normal xy plane, (0,0,1), get:
ry.rx.{0,0,1} = {-cos[a] sin[b], sin[a], cos[a] cos[b]}
which b c values.
i.e.
a = -cos[a]sin[b]
b = sin[a]
c = cos[a]cos[b]
from here, it's simple.
a = asin[b]
so = -cos[asin[b]]sin[b]
cos[asin[x]] = sqrt(1-x^2) so:
a = -sqrt[1-b^2] * sin[b]
b = asin[-a/sqrt[1-b^2]]
a = asin[b] (rotation x axis)
b = asin[-a/sqrt[1-b^2]] (rotation y axis)
so have angles x , y axes need rotate by.
after this, need shift plane or down until matches 1 have.
the plane have @ moment, (after 2 rotations) going ax+by+cz=0.
the plane want ax+bx+cz+d=0. find out d, see z axis crosses plane.
i.e. cz+d=0 -> z = -d/c
so transform z in ax+by+cz=0 -d/c give:
ax+by+c(z+d/c) = ax+by+cz+d=0. oh @ that!
it turns out don't have maths once have angles rotate by!
the 2 angles give a,b, , c. d copy had.
hope that's of help, i'm not entirely sure how plan on drawing plane though...
edited fix horrible formatting. it's better now.
Comments
Post a Comment