Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
2d image on arbitrary plane in 3d space

Subject: 2d image on arbitrary plane in 3d space

From: Ben

Date: 20 Aug, 2010 17:55:17

Message: 1 of 6

I wish to display an image on an arbitrary plane in 3D space. I search the website, and only found a topic

Show Image in Plane of 3D Axes
http://www.mathworks.com/matlabcentral/newsreader/view_thread/155794

But it only for a plane perpendicular to a particular axis. Could someone know how to solve my problem?

Thank you!

Ben

Subject: 2d image on arbitrary plane in 3d space

From: Sean

Date: 20 Aug, 2010 18:08:04

Message: 2 of 6

"Ben " <gogo.xa@gmail.com> wrote in message <i4mfi5$ll2$1@fred.mathworks.com>...
> I wish to display an image on an arbitrary plane in 3D space. I search the website, and only found a topic
>
> Show Image in Plane of 3D Axes
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/155794
>
> But it only for a plane perpendicular to a particular axis. Could someone know how to solve my problem?
>
> Thank you!
>
> Ben

a hint:
help slice

Subject: 2d image on arbitrary plane in 3d space

From: Walter Roberson

Date: 20 Aug, 2010 18:34:28

Message: 3 of 6

On 10-08-20 12:55 PM, Ben wrote:
> I wish to display an image on an arbitrary plane in 3D space. I search
> the website, and only found a topic
>
> Show Image in Plane of 3D Axes
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/155794
>
> But it only for a plane perpendicular to a particular axis. Could
> someone know how to solve my problem?

The texturemap solution given in that thread is valid for any arbitrary plane:
just define appropriate XData, YData, and ZData.

Subject: 2d image on arbitrary plane in 3d space

From: Ben

Date: 20 Aug, 2010 19:40:08

Message: 4 of 6

Walter Roberson <roberson@hushmail.com> wrote in message <i4mht6$l12$3@canopus.cc.umanitoba.ca>...
> On 10-08-20 12:55 PM, Ben wrote:
> > I wish to display an image on an arbitrary plane in 3D space. I search
> > the website, and only found a topic
> >
> > Show Image in Plane of 3D Axes
> > http://www.mathworks.com/matlabcentral/newsreader/view_thread/155794
> >
> > But it only for a plane perpendicular to a particular axis. Could
> > someone know how to solve my problem?
>
> The texturemap solution given in that thread is valid for any arbitrary plane:
> just define appropriate XData, YData, and ZData.

Hi Walter,

Could you kindly give me an example? Please bear the questions from layman.

Thank you.
Ben

Subject: 2d image on arbitrary plane in 3d space

From: Walter Roberson

Date: 20 Aug, 2010 19:47:27

Message: 5 of 6

On 10-08-20 02:40 PM, Ben wrote:
> Walter Roberson <roberson@hushmail.com> wrote in message
> <i4mht6$l12$3@canopus.cc.umanitoba.ca>...
>> On 10-08-20 12:55 PM, Ben wrote:

>> > Show Image in Plane of 3D Axes
>> > http://www.mathworks.com/matlabcentral/newsreader/view_thread/155794

>> The texturemap solution given in that thread is valid for any
>> arbitrary plane: just define appropriate XData, YData, and ZData.

> Could you kindly give me an example? Please bear the questions from layman.

A plane is defined by a*x + b*y + c*z + d = 0
Re-write this to solve for z:

c*z = 0 - a*x - b*y - d
so
z = -1/c * (a*x + b*y)

Now meshgrid or ndgrid to create your (X,Y) combinations and plug the grid'd
variable in to the above to create an array Z of values.

Now try something like,

surf(X, Y, Z, TheImage, 'FaceColor', 'texturemap')

If this complains about the color data not being the right size, then

h = surf(X, Y, Z)
set(h, 'CData', TheImage, 'FaceColor', 'texturemap')

Subject: 2d image on arbitrary plane in 3d space

From: Ben

Date: 21 Aug, 2010 02:10:08

Message: 6 of 6

Walter Roberson <roberson@hushmail.com> wrote in message <i4mm62$rf5$1@canopus.cc.umanitoba.ca>...
> On 10-08-20 02:40 PM, Ben wrote:
> > Walter Roberson <roberson@hushmail.com> wrote in message
> > <i4mht6$l12$3@canopus.cc.umanitoba.ca>...
> >> On 10-08-20 12:55 PM, Ben wrote:
>
> >> > Show Image in Plane of 3D Axes
> >> > http://www.mathworks.com/matlabcentral/newsreader/view_thread/155794
>
> >> The texturemap solution given in that thread is valid for any
> >> arbitrary plane: just define appropriate XData, YData, and ZData.
>
> > Could you kindly give me an example? Please bear the questions from layman.
>
> A plane is defined by a*x + b*y + c*z + d = 0
> Re-write this to solve for z:
>
> c*z = 0 - a*x - b*y - d
> so
> z = -1/c * (a*x + b*y)
>
> Now meshgrid or ndgrid to create your (X,Y) combinations and plug the grid'd
> variable in to the above to create an array Z of values.
>
> Now try something like,
>
> surf(X, Y, Z, TheImage, 'FaceColor', 'texturemap')
>
> If this complains about the color data not being the right size, then
>
> h = surf(X, Y, Z)
> set(h, 'CData', TheImage, 'FaceColor', 'texturemap')

Hi Walter,

Thanks a lot. It works very nice in my application!

Best,
Ben

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us