Message Boards Message Boards

0
|
2975 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to use VertexTextureCoordinates?

Posted 2 years ago

Thank you for your help. How should I understand VertexTextureCoordinates?

pic = ExampleData[{"TestImage", "House"}];

enter image description here

V = {{0, Sqrt[3]/2, 1/2}, {0, Sqrt[3]/2, -(1/2)}, {0, 0, -1},
   {0, -(Sqrt[3]/2), -(1/2)}, {0, -(Sqrt[3]/2), 1/2}, {0, 0, 1}};
Graphics3D[{Texture[pic], EdgeForm[Red], 
  Polygon[V, 
   VertexTextureCoordinates -> {{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {0, 
      1, 1}, {0, 0, 1}, {1, 1, 1}}]}, Lighting -> "Neutral", 
 ViewPoint -> {8, 6, 4}, Axes -> True]

enter image description here

Attachments:
POSTED BY: Mariano Gonzalez
2 Replies

Mariano,

I guess you basically have to rescale the (2D texture) vertex coordinates:

Graphics3D[{Texture[pic], Polygon[v, VertexTextureCoordinates -> Rescale[Rest /@ v]]}, 
 Boxed -> True, Axes -> True]

enter image description here

... well, at least I hope this is you have in mind.

Muchos saludos a Lima -- Henrik

POSTED BY: Henrik Schachner

Hi Henrik,

It's exactly what I wanted.

For use in a polygon with n sides.

Thanks for your help.

Saludos para Ti tambiƩn.

POSTED BY: Mariano Gonzalez
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract