Question: Using OpenFrameworks and C + + in Visual Studio: 1 ) Create a TriangleShape as a subclass of Shape. This shape should have a position,

Using OpenFrameworks and C++ in Visual Studio:
1) Create a TriangleShape as a subclass of Shape. This shape should have a position, rotation and scale parameters. The triangle shape when drawn should use a matrix transformation that uses these properties.
2) Create a "heading vector" and draw it. The heading vector indicates the direction of travel of the triangle. The vector should start at the position of the triangle (near it's center) and go through the top corner of the traingle (in an isosceles triangle, the vector would be drawn through the corner with smallest angle). The vector should be 2-3X the height of the triangle.
3) Support the functionality of "dragging" the triangle with the mouse. Only valid mouse down events inside the triangle should initiate dragging.
4) Now support rotating the triangle using the LEFT and RIGHT arrow keys. The triangle should rotate in place around it's position (roughly the center). The heading vector should rotate with it.
5) Now support moving the triangle forwards and backwards ALONG the heading vector. (hint r(t)= o + dt). Use the UP/DOWN arrow keys for this.
6) Create your own .PNG sprite image. It should have a transparent image and be non-circular so that you can easily tell if it is rotate.
7) Create a new Shape called "ImageShape" derived from Shape which displayes an image instead of a traingle. The image should rotate around it's center.
8) Support all the above functionality with the new ImageShape. (heading vector and movement). Note that for the purposes of selection with the mouse, you can use a bounding rectangle of the image for this assignment.
9) Create a simple GUI panel with the following controls:
turn heading vector on/off (toggle)
toggle between image shape or triangle shape
a float slider to control the scale (of the triangle or image).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!