Code covered by the BSD License  

Highlights from
Map texture to patch

Be the first to rate this file! 18 Downloads (last 30 days) File Size: 2.32 KB File ID: #27764
image thumbnail

Map texture to patch

by Jonas

 

27 May 2010 (Updated 02 Jun 2010)

patchTexture maps a texture onto a patch object

| Watch this File

File Information
Description

SYNOPSIS: patchTexture(patchHandle,texture)

INPUT
patchHandle: handle to patch object
texture: texture to map onto the surface defined via patch
   Texture can be a grayscale or an RGB image

OUTPUT
none - the texture is mapped onto the patch identified by
patchHandle by reading the image at the [x,y] coordinates
of the vertices of the patch. The vertex coordinates are
rescaled so that a maximum of the image can be read.

 EXAMPLE
            [xx,yy,zz] = ndgrid(-100:100,-100:100,-100:100);
            img = xx.^2 + yy.^2 + zz.^2 < 99^2;
            img = convn(img,ones(5,5,5)/(5*5*5));
            p = isosurface(img,0.5);
            ph = patch(p);
            set(gca,'visible','off')
            axis equal
            texture = imread('autumn.tif');
            patchTexture(ph,texture)
            view(58,82)

SEE ALSO patch, surface

MATLAB release MATLAB 7.10 (2010a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
02 Jun 2010

Fixed a bug due to a missing function (thanks Ken, for reporting!). Also, updated the function so that one texture can be applied to several patches at once.

Tag Activity for this File
Tag Applied By Date/Time
graphics Jonas 27 May 2010 11:45:20
plotting Jonas 27 May 2010 11:45:20
patch Jonas 27 May 2010 11:45:20
texture Jonas 27 May 2010 11:45:20

Contact us at files@mathworks.com