Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi friends i faced with a new task like converting or merging the rectangular image into a cuboid some thing like a rectangular image to cuboid using c# in asp.net
Posted
Comments
[no name] 3-May-13 8:08am    
You would have to do something like write some code. Or ask an answerable question.
Sergey Alexandrovich Kryukov 3-May-13 11:24am    
But I did not see a real answers there.
I put a real answer, based on working code, please see.
—SA

1 solution

Putting the image on any flat surface is pretty easy. You can use System.Drawing.Graphics. As you are working with ASP.NET, you will probably need to draw on a bitmap. This is not a problem at all, use the instance obtained from previously created instance of a bitmap:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx[^].

Now, suppose you can already draw a cuboid using some parallel projection, to keep things simple. How to draw on a tilted face of the cuboid. In case of cuboid and parallel projection, it's really simple. You should do some drawing in a rectangle or the same size and aspect ratio as the cuboid face in question, before doing the projection. But! you need to rotate and skew the image accordingly, to fit the face after projection. You can do it using the Transform property:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.transform.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.matrix.aspx[^].

All the detail of the drawing under transform will be projected accordingly, even the features if the shape of every character, everything. The mathematics is the matrix algebra and geometry, very simple (especially in case of cuboid an parallel projection), but you should do it. I did it; the look is impressive enough. :-)

—SA
 
Share this answer
 
Comments
madan b 5-May-13 8:09am    
thank you Sergey i will try with the options privide by ypu.
Sergey Alexandrovich Kryukov 5-May-13 14:19pm    
Those are not "options". This is the technique you really should use to render the desired effect, and nothing else.
So, will you accept the answer formally (green button)?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900