Skip to content

Conversation

@pinventado
Copy link
Member

I hope I do the library justice :)

@pinventado pinventado requested a review from dektar February 10, 2021 17:23
Copy link
Contributor

@dektar dektar left a 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
Copy link
Contributor

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);
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants