- Create a grid using the "meshgrid" function.
- Define the vertices of the triangle and create a polyshape of the triangle providing the vertices of the triangle as input to the "polyshape" function.
- Create a figure and plot the defined grid and triangle.
- Attach a callback function to the created figure, say "KeyPressFcn" to capture key press events on the figure.
- Implement the "KeyPressFcn" such that -
- It identifies the key presses and configures the corresponding action to perform.
- An Action takes the current polyshape object as input and modifies its vertices as per pre-defined transformation.
- Clear the current figure and replot the modified polyshape to it.
- meshgrid function
- https://www.mathworks.com/help/matlab/ref/meshgrid.html
- polyshape function
- https://www.mathworks.com/help/matlab/ref/polyshape.html
- matrix-representation-of-geometric-transformations
- https://www.mathworks.com/help/images/matrix-representation-of-geometric-transformations.html
- create-callbacks-for-graphics-objects
- https://www.mathworks.com/help/matlab/creating_plots/create-callbacks-for-graphics-objects.html