图生活吧

博客园 首页 新随笔 联系 订阅 管理

定义一个自定义的坐标转换类

package 
{
	import as3isolib.geom.*;
	import as3isolib.geom.transformations.*;
	
	public class MyTransformation implements IAxonometricTransformation
	{
		public function MyTransformation ()
		{
			
		}
		
		public function screenToSpace (screenPt:Pt):Pt
		{
			var z:Number = screenPt.z;
			var y:Number = screenPt.y;
			var x:Number = screenPt.x;
			
			return new Pt(x, y, z);
		}
		
		public function spaceToScreen (spacePt:Pt):Pt
		{
			var z:Number = spacePt.z;
			var y:Number = spacePt.y;
			var x:Number = spacePt.x;
			
			return new Pt(x, y, z);
		}
		
	}
}

设置新的坐标转换

package  
{
	import as3isolib.geom.*;

	public class IsoApplication extends Sprite
	{
		public function IsoApplication() 
		{
			IsoMath.transformationObject = new MyTransformation;
		}
	}
}

  

  

posted on 2013-01-29 22:58  图生活吧  阅读(350)  评论(0编辑  收藏  举报