Game Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesGame Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old February 27th, 2007, 10:43 PM
Nialsh's Avatar
Nialsh Nialsh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: Houston
Posts: 45 Nialsh User rank is Corporal (100 - 500 Reputation Level)Nialsh User rank is Corporal (100 - 500 Reputation Level)Nialsh User rank is Corporal (100 - 500 Reputation Level)Nialsh User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 15 m 52 sec
Reputation Power: 5
Send a message via AIM to Nialsh
Question Trapezoid 2d Affine Transform

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

Reply With Quote
  #2  
Old February 27th, 2007, 11:02 PM
BioSlayer's Avatar
BioSlayer BioSlayer is offline
C# Addict.
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Earth
Posts: 283 BioSlayer User rank is Sergeant (500 - 2000 Reputation Level)BioSlayer User rank is Sergeant (500 - 2000 Reputation Level)BioSlayer User rank is Sergeant (500 - 2000 Reputation Level)BioSlayer User rank is Sergeant (500 - 2000 Reputation Level)BioSlayer User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 8 h 52 m 11 sec
Reputation Power: 22
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.

Reply With Quote
  #3  
Old February 27th, 2007, 11:47 PM
Nialsh's Avatar
Nialsh Nialsh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: Houston
Posts: 45 Nialsh User rank is Corporal (100 - 500 Reputation Level)Nialsh User rank is Corporal (100 - 500 Reputation Level)Nialsh User rank is Corporal (100 - 500 Reputation Level)Nialsh User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 15 m 52 sec
Reputation Power: 5
Send a message via AIM to Nialsh
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

Reply With Quote
  #4  
Old February 28th, 2007, 01:10 AM
Lux Perpetua Lux Perpetua is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: San Francisco Bay
Posts: 1,418 Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 47 m 27 sec
Reputation Power: 334
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.

Reply With Quote
  #5  
Old February 28th, 2007, 02:44 AM
BioSlayer's Avatar
BioSlayer BioSlayer is offline
C# Addict.
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Earth
Posts: 283 BioSlayer User rank is Sergeant (500 - 2000 Reputation Level)BioSlayer User rank is Sergeant (500 - 2000 Reputation Level)BioSlayer User rank is Sergeant (500 - 2000 Reputation Level)BioSlayer User rank is Sergeant (500 - 2000 Reputation Level)BioSlayer User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 8 h 52 m 11 sec
Reputation Power: 22
Quote:
Originally Posted by Nialsh
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


Since that bottom row is implied (not really there) you can't do what you want.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesGame Development > Trapezoid 2d Affine Transform


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway