Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I make a Polygon with size of {width=0,length=50,height=30}; I want to overlap Image on Polygon at position {width=0,length=25,height=15}. For this purpose I wrote some code:

myImage=

enter image description here

     Show[Rasterize[Show[Graphics3D[Polygon[{{0, 0, 0}, {0, 0, 30}, {0, 50, 30}, {0, 50, 0}}], 
                               Lighting -> {LightBlue}, Boxed -> False
                                   ](*Graphi3D is closed here*)
                        ](*Show is closed*),
                    "Image",Background -> None, ImageSize -> {300,300}
                   ](*RasterSize is closed here*), 
          Graphics[Inset[Image[myImage(*its a variable*), ImageSize -> {50, 50}],Scaled[{25, 15}]]]
        ](*Show is closed here*)

After evaluation of the above code I faced two problems

  1. Graphics3D is not rotated,

  2. Imageis not overlapped,

I want to overlap Image at a specific position on Polygon and if we have rotated Polygon automatically that overlapping Image was also rotated.

share|improve this question
    
possible duplicate of "Covering up" text in Graphics –  Jens Oct 19 '12 at 22:02
add comment

2 Answers

The good Doctor beat me, but anyway:

poly = {{0, 0, 0}, {0, 0, 30}, {0, 50, 30}, {0, 50, 0}};
texture = Import["http://i.stack.imgur.com/6LF9n.jpg"];
Graphics3D[{Lighting -> "Neutral", Texture[texture], 
  Polygon[poly, 
   VertexTextureCoordinates -> {{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {0, 
      1, 0}}]}, Boxed -> False]

butterfly on a page

share|improve this answer
    
@image_doctor,@ cormullion Thank you for your information... I have one more doubt,how can I overlap two Images on same polygon at different positions –  subbu Oct 19 '12 at 5:18
    
@subbu You can use ImageCompose to combine images into a single image, then use that as the texture. There are many options for positioning the images... –  cormullion Oct 19 '12 at 7:50
    
already i played with ImageCompose still i didn't get it,how can I overlap two or more Images on polygon...If you don't mine can you explain ? –  subbu Oct 19 '12 at 17:37
add comment

You can use Texture to draw your image on the polygon.

myImage=RandomImage[0.5, {15, 15}];

Graphics3D[{Texture@myImage, 
  Polygon[{{0, 0, 0}, {0, 0, 30}, {0, 50, 30}, {0, 50, 0}}, 
   VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}, 
 Lighting -> "Neutral", Boxed->False]

( With thanks to cormullion for the Boxed->False option. )

Mathematica graphics (* Boxed-> True *)

myImage=ExampleData[{"TestImage", "Lena"}]; (* Boxed-> True *)

Mathematica graphics

myImage = Import["http://i.stack.imgur.com/6LF9n.jpg"]; (* Boxed-> False *)

Mathematica graphics

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.