• Create Account

### #Actualreppinfreedom

Posted 17 November 2012 - 10:36 PM

I have conversion classes for converting between isometric and normal coordinates... I just want to keep the code lighter and faster.

If I wanted perfect accuracy I would calculate out everything on a non isometric coordinate grid. I would just set a velocity and angle... But, I want things to run faster and not require many conversions and calculations.
[source lang="java"] public static function getXyVelocity(Velocity:Number, Angle:Number):Point { var newPoint = new Point(); newPoint.x = - Velocity * Math.cos(Angle * Math.PI / 180); newPoint.y = - Velocity * Math.sin(Angle * Math.PI / 180); return newPoint; }[/source]

Then I would run a conversion to isometric velocity and angle from normal.

[source lang="java"]package Michael{public class iso3dTransformer { static var Ratio:Number=2; public static function convertToIso(screenPoint:Object):Object { var zPos:Number=screenPoint.z; var yPos:Number=screenPoint.y-screenPoint.x/Ratio+screenPoint.z; var xPos:Number=screenPoint.x/Ratio+screenPoint.y+screenPoint.z; return new Object(x:xPos,y:yPos,z:zPos); } public static function transformForDisplay(displayPoint:Object):Object { var zPos:Number=displayPoint.z; var yPos:Number=(displayPoint.x+displayPoint.y)/Ratio-displayPoint.z; var xPos:Number=displayPoint.x-displayPoint.y; return new Object(x:xPos,y:yPos,z:zPos); }}}[/source]

### #3reppinfreedom

Posted 17 November 2012 - 10:25 PM

I have conversion classes for converting between isometric and normal coordinates... I just want to keep the code lighter and faster.

If I wanted perfect accuracy I would calculate out everything on a non isometric coordinate grid. I would just set a velocity and angle...
[source lang="java"] public static function getXyVelocity(Velocity:Number, Angle:Number):Point { var newPoint = new Point(); newPoint.x = - Velocity * Math.cos(Angle * Math.PI / 180); newPoint.y = - Velocity * Math.sin(Angle * Math.PI / 180); return newPoint; }[/source]

Then I would run a conversion to isometric velocity and angle from normal.

[source lang="java"]package Michael{public class iso3dTransformer { static var Ratio:Number=2; public static function convertToIso(screenPoint:Object):Object { var zPos:Number=screenPoint.z; var yPos:Number=screenPoint.y-screenPoint.x/Ratio+screenPoint.z; var xPos:Number=screenPoint.x/Ratio+screenPoint.y+screenPoint.z; return new Object(x:xPos,y:yPos,z:zPos); } public static function transformForDisplay(displayPoint:Object):Object { var zPos:Number=displayPoint.z; var yPos:Number=(displayPoint.x+displayPoint.y)/Ratio-displayPoint.z; var xPos:Number=displayPoint.x-displayPoint.y; return new Object(x:xPos,y:yPos,z:zPos); }}}[/source]

### #2reppinfreedom

Posted 17 November 2012 - 10:22 PM

I have conversion classes for converting between isometric and normal coordinates... I just want to keep the code lighter and faster.

If I wanted perfect accuracy I would calculate out everything on a non isometric coordinate grid. I would just set a velocity and angle...
[source lang="java"] public static function getXyVelocity(Velocity:Number, Angle:Number):Point { var newPoint = new Point(); newPoint.x = - Velocity * Math.cos(Angle * Math.PI / 180); newPoint.y = - Velocity * Math.sin(Angle * Math.PI / 180); return newPoint; }[/source]

Then I would run a conversion to isometric coordinates.

[source lang="java"]package Michael{public class iso3dTransformer { static var Ratio:Number=2; public static function convertToIso(screenPoint:Object):Object { var zPos:Number=screenPoint.z; var yPos:Number=screenPoint.y-screenPoint.x/Ratio+screenPoint.z; var xPos:Number=screenPoint.x/Ratio+screenPoint.y+screenPoint.z; return new Object(x:xPos,y:yPos,z:zPos); } public static function transformForDisplay(displayPoint:Object):Object { var zPos:Number=displayPoint.z; var yPos:Number=(displayPoint.x+displayPoint.y)/Ratio-displayPoint.z; var xPos:Number=displayPoint.x-displayPoint.y; return new Object(x:xPos,y:yPos,z:zPos); }}}[/source]

### #1reppinfreedom

Posted 17 November 2012 - 10:19 PM

I have conversion classes for converting between isometric and normal coordinates... I just want to keep the code lighter and faster.

[source lang="java"]package Michael{public class iso3dTransformer { static var Ratio:Number=2; public static function convertToIso(screenPoint:Object):Object { var zPos:Number=screenPoint.z; var yPos:Number=screenPoint.y-screenPoint.x/Ratio+screenPoint.z; var xPos:Number=screenPoint.x/Ratio+screenPoint.y+screenPoint.z; return new Object(x:xPos,y:yPos,z:zPos); } public static function transformForDisplay(displayPoint:Object):Object { var zPos:Number=displayPoint.z; var yPos:Number=(displayPoint.x+displayPoint.y)/Ratio-displayPoint.z; var xPos:Number=displayPoint.x-displayPoint.y; return new Object(x:xPos,y:yPos,z:zPos); }}}[/source]

PARTNERS