Background: consider the following snippet:
gp := Graphics
bill = Import["https://i.stack.imgur.com/FyojA.jpg"];
poly1 = {{1, 0}, {.5, .86}, {-.5, .86}, {-1, 0}, {-.5, -.86}, {.5, -.86}};
g1 = {Texture[bill], Polygon[poly1, VertexTextureCoordinates -> poly1]};
poly2 = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
g2 = {Texture[bill], Polygon[poly2, VertexTextureCoordinates -> poly2]};
g1 // gp
g2 // gp
The option VertexTextureCoordinates
isn't entirely clear to me. I want to put an image with the correct ratios in the hexagon left. So for example on {{-.5,-.5},{.5,-.5},{.5,5},{-.5,.5}}. (I have not been able to get this to work although I have tried all sort of possibilities) However with the restriction that if I rescale the (coordinates of the) hexagon the image should be scaled accordingly.
EDIT-1:
Image as requested.
EDIT-2: This nicely sums up and demonstrates the answer by Heike:
rescale1[poly_, p1_, p2_] :=
Transpose[{Rescale[poly[[All, 1]], {p1[[1]], p2[[1]]}, {0, 1}],
Rescale[poly[[All, 2]], {p1[[2]], p2[[2]]}, {0, 1}]}]
Manipulate[
g = {Texture[bill],
Polygon[poly,
VertexTextureCoordinates -> rescale1[poly, leftbot, righttop]]} //
Graphics,
{leftbot, {0, 0}, {1, 1}}, {righttop, {0, 0}, {1, 1}},
Initialization :> {righttop = {1, 1}}, ControlPlacement -> Bottom]
Key is the mapping between the image and vertextexture coordinates.
ExampleData[{"TestImage", "Lena"}]
? Otherwise good question. $\endgroup$captain-bill.jpg
) using the built-in image uploader, and then everybody else can executeImport[(* URL for captain-bill.jpg *)]
... $\endgroup$