|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
Hi,
I'm trying to get an affine transform that will turn a square image into a trapezoid like this: original Code:
+----+ | | | | +----+ transformed Code:
+--+ / \ / \ +--------+ I understand that the transform matrix has a row for each axis and that each axis has a scale and a skew, but that's about it. Sometimes the numbers get together behind the scenes and hold a seance where they do inexplicable things like boil frogs and rotate entire images. So if there's a good resource on that, I'd like to know about it. Thanks for any help Neal |
|
#2
|
||||
|
||||
|
Here is the matrix for 2D transformations:
1 2 3 4 5 6 7 8 9 You will want to mess with values 7 and 8. They are usually 0. EDIT: I agree matrixes are magical in nature at first, but after you use them long enough then they loose their magic and gain ingenuity.
__________________
There are none so blind as those who will not see. — Jonathan Swift My 2D Physics Engine. My Remake of UQM. Both are written in C#. Last edited by BioSlayer : February 27th, 2007 at 11:06 PM. |
|
#3
|
||||
|
||||
|
Do you know how to do it in Java? It looks to me like they don't want you playing with the bottom row.
Here's the javadoc for AffineTransform |
|
#4
|
|||
|
|||
|
You might be confused here: an affine transformation can never map a square to a trapezoid, only to a parallelogram. What you really want is a projective transformation.
Some background. |
|
#5
|
||||
|
||||
|
Quote:
Since that bottom row is implied (not really there) you can't do what you want. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Game Development > Trapezoid 2d Affine Transform |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|