/** * Place a DisplayObject3D inside a new DisplayObject3D container, * and align the top-left corner of the do3d to the origin of the container; * apply the plane's orignal transformation to the container * @param plane * @param w width of do3d (or nested plane) * @param h height of do3d (or nested plane) * @return a DisplayObject3D container with plane as child */ private function do3dAlignTL3d(do3d:DisplayObject3D, w:Number, h:Number):DisplayObject3D { var cont:DisplayObject3D = new DisplayObject3D(); cont.x = do3d.x - w/2; //cont.x = plane.x - w / 2; cont.y = do3d.y + h/2; //cont.y = plane.y + h / 2; cont.z = do3d.z; cont.addChild(do3d); do3d.x = w / 2; do3d.y = -h / 2; do3d.z = 0; return cont; } /** * Place a DisplayObject3D inside a new DisplayObject3D container, * and align the top-center of the do3d to the origin of the container; * apply the plane's orignal transformation to the container * @param plane * @param w width of do3d (or nested plane) * @param h height of do3d (or nested plane) * @return a DisplayObject3D container with plane as child */ private function do3dAlignTC3d(do3d:DisplayObject3D, w:Number, h:Number):DisplayObject3D { var cont:DisplayObject3D = new DisplayObject3D(); cont.x = do3d.x; cont.y = do3d.y + h/2; cont.z = do3d.z; cont.addChild(do3d); do3d.y = -h / 2; do3d.z = 0; return cont; } /** * Transforms (from Normal Flash Coordinate system) a TL2d point to a StaticTL3d point. * @param point in TL2d coord system * @return point transformed to TLStatic3d coord system */ private function TL2dtoTLStatic3d(point:Point):Point { return new Point(point.x, -point.y); } /** * Transforms a TL3d point, to a StaticTL3d point. * @param point in TL3d coord system * @return point transformed to TLStatic3d coord system */ private function TL3dtoTLStatic3d(point:Point):Point { return new Point(point.x + viewport.width / 2, point.y - viewport.height/2 ); } /** * Transforms a StaticTL3d point, to a TL3d point. * @param point in StaticTL3d coord system * @return point transformed to TL3d coord system */ private function TLStatic3dtoTL3d(point:Point):Point { return new Point(point.x - viewport.width / 2, point.y + viewport.height/2 ); } /** * Transforms a TL2d point, to a TL3d point. * @param point in TL2d coord system * @return point transformed to TL3d coord system */ private function TL2dtoTL3d(point:Point):Point { return new Point(point.x - viewport.width/2, -point.y + viewport.height/2 ); }