refactor stroke drawing

This commit is contained in:
2019-02-11 22:37:02 +01:00
parent 171ab31b47
commit 8ad005de8b
4 changed files with 221 additions and 199 deletions

View File

@@ -99,11 +99,11 @@ bool point_side(glm::vec2 a, glm::vec2 b, glm::vec2 p)
// a is a convex polygon
// a and b are a list of non repeating points
// returns the resulting intersection polygon points
std::vector<vertex_t> poly_intersect(const std::vector<vertex_t>& poly, const std::vector<glm::vec2>& clip)
std::vector<vertex_t> poly_intersect(const vertex_t* poly_begin, const vertex_t* poly_end, const std::vector<glm::vec2>& clip)
{
// implementing the Sutherland-Hodgman algorithm
// see https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm
std::vector<vertex_t> ret = poly;
std::vector<vertex_t> ret(poly_begin, poly_end);
for (int i = 0; i < clip.size(); i++)
{
std::vector<vertex_t> tmp;