How to apply a texture to a specific portion of a surface?

조회 수: 11 (최근 30일)
Akku Appakonam
Akku Appakonam 2020년 4월 8일
답변: darova 2020년 4월 8일
Hi,
I was wondering if there was any way to texturemap multiple images onto specific portions of a surface. So far I've used the following code to transform my x, y, and z data into a surface plot. Say I wanted to apply a texture to only the triangular face that forms when connecting the 3 vertices highlited in the figure in red (it doesn't necessarily have to be a triangle). I tried overlaying a new surface, replacing my x, y, z data with the 3 vertices, but that just plots a triangluar face without conforming to the dips and bends in the previous surface. Any idea of how I might go about this? Greatly appreciate all the help!
xmin = min(x);
xmax = max(x);
ymin = min(y);
ymax = max(y);
N = 500; % Number of y values in uniform grid
M = 500; % Number of x values in uniform grid
xu = linspace(xmin, xmax, M); % Uniform x-coordinates
yu = linspace(ymin, ymax, N); % Uniform y-coordinates
[X, Y] = meshgrid(xu, yu); % Create meshes for xu and yu
F = TriScatteredInterp(x(:), y(:), z(:)); % Create interpolant
Z = F(X, Y); % Evaluate interpolant (N-by-M matrix)
s = surf(X, Y, Z);
  댓글 수: 2
KSSV
KSSV 2020년 4월 8일
Apply texture? What you mean by applying texture? What you expect?
Akku Appakonam
Akku Appakonam 2020년 4월 8일
Appreciate the reply. I mean applying an image to the surface like this:
except I would like it to be on just a portion of the figure.

댓글을 달려면 로그인하십시오.

채택된 답변

darova
darova 2020년 4월 8일
  • Use inpolygon to copy region you want
  • Create new surface
  • Apply texture to object

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by