that’s what the world would look like if penguins had won WW2.
after yesterday’s azimuthal projections today is Pitch Roll Yaw day!
woohoo!!
not much to say I’m afraid.
it is a spherical projection where you can tweak the pitch, the roll… and … the yaw.
well, well…
the PRYprojection method of the set of projections done for Mathmap by Peter Gawthrop.
well, well, well…
press ‘s’ to switch the source picture.
you get the distorted picture on top, the original picture underneath and the distorted picture used as a material to map a PV3D sphere at the bottom right.
the important thing to notice here is that the PV3D sphere is NOT MOVING. I intentionnally gave a low number of edges to the sphere so that one can see that it doesn’t move. In fact when you drag / tweak, only the map is being distorted.
ain’t it wonderful ?
unlike the previous article, this one requires a 2:1 ratio to work properly.
now off you go with a ZIP:
no FLA (don’t have a CS4 at hand) but rejoyce ! here’s a snippet:
package { import flash.events.Event; import flash.events.MouseEvent; import flash.display.Bitmap; import flash.display.Shader; import flash.display.Sprite; import flash.filters.ShaderFilter; /** * http://en.nicoptere.net/ * @author nicoptere */ public class BasicPRY extends Sprite { private var stopped:Boolean = true; private var photo:Bitmap; [Embed(source = 'equirectangular_pano.jpg')]private var img:Class; private var shader:Shader; [Embed(source = "PRYprojection.pbj", mimeType = "application/octet-stream")]private var PRY:Class; public function BasicPRY() { //creates a picture photo = new img() as Bitmap; addChild( photo ); //creates the shader shader = new Shader( new PRY() ); shader.data.imageSize.value = [ photo.width, photo.height ]; //update stage.addEventListener( Event.ENTER_FRAME, applyFilter ); stage.addEventListener( MouseEvent.CLICK, startStop ); } private function applyFilter( evt:Event ):void { if ( stopped ) return; var w:Number = stage.stageWidth; var h:Number = stage.stageHeight; var P:Number = ( h / 2 - mouseY ) / h * 360; var R:Number = 0; var Y:Number = ( w / 2 - mouseX ) / w * 360; shader.data.rotation.value = [ P, R, Y ]; photo.filters = [ new ShaderFilter( shader ) ]; } private function startStop( e:MouseEvent ):void { stopped = ( !stopped ) ? true : false; } } }
should give something like:
click to start/stop.
again: that’s how I got it to work, no warranty you’ll get the same at home.
I found it cool, and somehow it might come in handy.
hope you’ll like it too.
:)
my beloved readers wrote…