Borrar filtros
Borrar filtros

Flip a plotted object horizontally?

2 visualizaciones (últimos 30 días)
Jeff Smith
Jeff Smith el 25 de Mzo. de 2018
Respondida: Walter Roberson el 25 de Mzo. de 2018
So I'm plotting a moving object that basically moves like the old DVD "away" loading screen. The object basically bounces around the plane, but without exceeding the limits I've set. (-15 to 15 in the x and y direction). I'm basically trying to figure out how to make the object flip horizontally so that the nose of the object is actually going in the direction of the object. How would I go about this?
BTW I'm using a for loop to move the object along the graph.
If you have any questions or need any of my code, I'll post it.
thanks.

Respuesta aceptada

Walter Roberson
Walter Roberson el 25 de Mzo. de 2018
Suppose you define the object so that the nose is at the left, with the resting value being x = 0, y = 0. Then as it moves from right to left, adjust the graphic object's X and Y coordinates as
object.XData = nose_x + model_x_coordinates;
object.YData = nose_y + mode_y_coordinates;
and to move towards the right,
object.XData = nose_x - model_x_coordinates;
object.YData = nose_y + model_y_coordinates; %because you do not flip it upside down when it moves to the right

Más respuestas (0)

Categorías

Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by