-
Notifications
You must be signed in to change notification settings - Fork 1
Draw polygon #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Draw polygon #10
Conversation
dektar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll be nice to have this functionality! Some comments below.
| * |color|. Each vertex is represented by it's x and y coordinate, and are | ||
| * listed sequentially in the vector. For example, a polygon with three | ||
| * vertices (0, 0), (0, 2), (2,1) is represented as a vector of integers | ||
| * {0, 0, 0, 2, 2, 1}. The last vertex will connect with the first vertex in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a little hard to read this polygon vector, especially for large numbers of vertices. What do you think of making a simple graphics::Point class and having a std::vectorgraphics::Point instead?
You could also add a DrawTriangle that takes int x1, int y1, int x2, int y2, int x3, int y3 as that's probably the most common polygon that would be used.
| } | ||
| } | ||
| std::vector<int> points = {20, 20, 20, 22, 22, 21}; | ||
| image.DrawPolygon(points, red); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add some polygon-speicifc tests: first, that drawing a polygon clockwise is the same as drawing the same thing counterclockwise? second, if drawing a rect is the same as drawing a polygon with four points?
I hope I do the library justice :)