Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Image reflection post and replies

Return to the Image reflection thread
Login to post to this thread

want to reflect a 2D image - Nov 25, 2012 at 8:05AM
Javier Mas
5 Posts

Hello I need some help. I have added a rocket as a 2D image inside a Plotting Panel. The rocket moves along the x axis in the positive direction with some variable speed v. A soon as the velocity turns negative I would like the rocket image to flip so as to point always in the direction of movement.
I have tried with the transformation editor in the Transform element of the popup panel. In it I see an item called Matrix Transf. It is a 2*3 matrix and I have not been able to  make it work.
I guess at some point I would need to insert a -1 for a reflection in the y axis, in the form Math.signum(v) or so. Can somebody help me?. Thanks a lot.


Replies to want to reflect a 2D image

Re: want to reflect a 2D image - Nov 26 2012 3:46PM
Francisco Esquembre
104 Posts

Javier,

A very simple solution is to multiply the size of the rocket by -1. See attached example.

Another (perhaps more physical) solution is to rotate the rocket according to the velocity vector.

(I mean it is more physical because physical rockets rotate but do not flip.)



Paco

Attached File: ejs_ReverseImageExample.zip



The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics