Home > Archive > Matlab > April 2005 > drawing a plane
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Martin 2005-04-27, 9:01 am |
| Hi,
I want to draw a plane (A*x + B*y + C*z = D) inside the volume
defined by axis.
So far I’ve tried to calculate the 4 corners of the plane and use
patch or fill3 to visualise it. However as some of these corners are
outside the volume defined by the axis and, for what I’ve seen, the
3D clipping doesn’t work the plane is draw outside the axis, so it’s
not very good.
Any help would be greatly appreciated.
Martin.
| |
| Murphy O'Brien 2005-04-27, 4:02 pm |
| Martin wrote:
>
>
> Hi,
>
> I want to draw a plane (A*x + B*y + C*z = D) inside the volume
> defined by axis.
>
> So far I’ve tried to calculate the 4 corners of the plane and use
> patch or fill3 to visualise it. However as some of these corners
> are
> outside the volume defined by the axis and, for what I’ve seen, the
> 3D clipping doesn’t work the plane is draw outside the axis, so
> it’s
> not very good.
>
> Any help would be greatly appreciated.
> Martin.
If you use the axes to calculate the four corners, then they won't be
outside the axes.
Murphy
| |
| Martin 2005-04-28, 9:00 am |
| Thanks it sounds obvious.
The truth is that I’m not using the equation Ax+By+Cz = D to
calculate the plane.
What I’ve been doing is to apply many simple rules to a point cluster
in a 256x256x256 cube, rules like x < m*y + c (for whatever z) to
select the points that fall to one side of that half-space.
Interactively with a sliderbar I change m and c to find the best m
and c. This worked well, but then I wanted to draw the plane that
separated the two half-spaces and the problem came up. I’ve solved
the clipping problem but I have to check for each of the faces of the
cube as I can move the plane around, and as I have many of these
rules it becomes a bit more cumbersome to have to check for
boundaries. I would prefer that matlab did the 3d clipping it self.
Also as a curiosity. I’m not really sure what operations I have to do
in matlab to get the points of a plane directly from the Ax+By+Cz = D
equation. Any idea how to proceed?
Thanks again.
Martin.
Murphy O'Brien wrote:
>
>
> Martin wrote:
use[color=darkred]
corners[color=darkred]
> the
>
> If you use the axes to calculate the four corners, then they won't
> be
> outside the axes.
>
> Murphy
| |
| Murphy O'Brien 2005-04-28, 9:00 am |
| Martin wrote:
> <SNIP> I would prefer that matlab did the 3d clipping.
>
> Also, how does one get the points of a
> plane directly from the Ax+By+Cz => D
> equation.
>
Not sure about the clipping but is this what you want for the plane?
[x,y]=meshgrid([-2:.20:2],[-2:.2:2]);
z=-2*x+y+2;
surf(x,y,z)
Murphy
|
|
|
|
|