image thumbnail

Map texture to patch

version (2.32 KB) by Jonas
patchTexture maps a texture onto a patch object


Updated 02 Jun 2010

View License

SYNOPSIS: patchTexture(patchHandle,texture)

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

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.

[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);
axis equal
texture = imread('autumn.tif');

SEE ALSO patch, surface

Cite As

Jonas (2022). Map texture to patch (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!