May 14th, 2010, 12:11 PM  #1 
Newbie Joined: May 2010 Posts: 2 Thanks: 0  Coordinate conversion
Being new here, I wasn't sure where to post this, especially because I don't know what area of math the answer will lay in. Anyway, I am a 3D computer graphics designer with a programming problem that needs a mathematical solution. Basically, the problem I have is that I have a 2D planar object that is mapped in one coordinate system and needs to be converted to another. The exact numbers that are being dealt with can vary, because the shape will vary, but the new coordinate system is always the same. The new system can only have values between 0 and one. I will be dealing with the coordinates as (x,z) points, so that means that the target planar map will have x values from 0 to 1 and z values from 0 to 1. What I am doing is looping through all existing vertices, finding the min and max values of x and z. Then I subtract the min from the max to see if x or z contains the largest span of numbers. Here's a bit of code that should be simple enough to understand if you are at all familiar with simple programming languages. Code: // nNumVertices contains the total number of x/z points we are dealing with //aAllVerts is an array containing all x/z pairs var minVertX = 0; var minVertZ = 0; var maxVertX = 0; var maxVertZ = 0; // Find max and min x and z values for( j = 0; j < nNumVertices; j++ ) { if ( aVertices[1] < minVertX) { minVertX = aVertices[1]; } if ( aVertices[1] > maxVertX) { maxVertX = aVertices[1]; } if ( aVertices[2] < minVertZ) { minVertZ = aVertices[2]; } if ( aVertices[2] > maxVertZ) { maxVertZ = aVertices[2]; } } // Determine if the x or z direction contains the greatest span of values if( maxVertX  minVertX > maxVertZ  minVertZ) { maxVertValue = maxVertX  minVertX; } if( maxVertValue < maxVertZ  minVertZ) { maxVertValue = maxVertZ  minVertZ; } For example: (x,Z) Vartices to be converted: 203.58326721191406 / 133.94407653808594 646.3115234375 / 912.4210815429688 901.4326171875 / 1094.460205078125 1500.000244140625 / 1735.3692626953125 1500 / 133.94407653808594 In this illustration, the black values are the current x/z values, the blue values are what I want to convert to. Thanks, Beth 
May 18th, 2010, 06:57 AM  #2 
Newbie Joined: Apr 2009 Posts: 19 Thanks: 0  Re: Coordinate conversion
It seems to me that you're looking for the following: transform(x,y) = ((xminVertX)/maxVertValue, (yminVertY)/maxVertValue) 
May 18th, 2010, 10:27 AM  #3  
Newbie Joined: May 2010 Posts: 2 Thanks: 0  Re: Coordinate conversion Quote:
In the example, maxVertValue = 1735.3692626953125. I actually figured it out yesterday. But thanks for responding.  

Tags 
conversion, coordinate 
Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
MM to degree conversion  AJITnayak  Calculus  2  December 30th, 2013 08:21 PM 
coordinate conversion  tancm  Algebra  0  November 1st, 2012 05:07 AM 
Help with conversion  Denegen  Physics  0  May 22nd, 2012 10:57 PM 
Polar to Cartesian Coordinate Conversion Help  swm06  Algebra  2  April 13th, 2012 10:34 AM 
Conversion  Lpitt56  Algebra  5  February 29th, 2012 07:28 AM 