フィルターのクリア

Flip a plotted object horizontally?

2 ビュー (過去 30 日間)
Jeff Smith
Jeff Smith 2018 年 3 月 25 日
回答済み: Walter Roberson 2018 年 3 月 25 日
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.

採用された回答

Walter Roberson
Walter Roberson 2018 年 3 月 25 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by