Re: plotting plane & a triangle
- To: mathgroup at smc.vnet.net
- Subject: [mg91347] Re: plotting plane & a triangle
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sun, 17 Aug 2008 06:38:52 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <g8685g$hse$1@smc.vnet.net>
skunkwerk wrote:
> i'm working on developing some 3d software and I was hoping to use
> mathematica to test the results of some of my code. Specifically, I'm
> trying to visualize a plane and a triangle, to see if they intersect,
> and if not, which side of the plane the triangle's points are on (I'm
> calculating this using algebra, and need to check the results)
>
> so far I've done:
> (the triangle)
> pl1 = Graphics3D[{Polygon[{{-80.2576, -594.271, 224.043}, {-120.608,
> -588.635, 221.101}, {1.32756, -598.31,261.244}}]}]
>
> (the plane)
> pl2 = Plot3D[0.402395*x - 0.899308*y + 0.171241*z + 274.122 = 0,{x,
-------------------------------------------------------------!!!!!
*Syntax error*: must be double equal sign (==) to check for equality.
Single equal sign (=) denotes the assignment operator (set a value to
something).
> -10000, 10000}, {y, -10000, 10000}]
>
> then:
> Show[pl1, pl2]
>
> questions:
> 1) the Polygon is displayed fine on its own, but the plane looks
> completely flat along z=0 and is axis-aligned, so I'm not sure what's
> wrong...
<snip>
You should write the equation of the plane as a function of two
variables x and y rather than as an equation of three variables x, y, and z.
Plot3D[5.83972 (-274.122 - 0.402395 x + 0.899308 y),
{x, -1000, 1000}, {y, -10000, 10000}]
Since,
Solve[0.402395*x - 0.899308*y + 0.171241*z + 274.122 == 0, z]
{{z -> 5.83972 (-274.122 - 0.402395 x + 0.899308 y)}}
z /. %[[1]]
5.83972 (-274.122 - 0.402395 x + 0.899308 y)
Regards,
-- Jean-Marc