Git Product home page Git Product logo

Comments (5)

gracicot avatar gracicot commented on July 3, 2024 1

Perfect! Sorry for the noise.

For the records, since I'm not supporting holes in my application, I opted to send std::span<std::vector<glm::vec2>, 1>{std::addressof(points), 1}, where points is a std::vector<glm::vec2>

from earcut.hpp.

mrgreywater avatar mrgreywater commented on July 3, 2024

I think there's some confusion about the types.

The input type for earcut has a structure like vector<vector<point>>. For the point type, it's sufficient if nth<0, ...> and nth<1, ...> is defined. For the vector type, it's necessary to define container methods such as 'size', operator[] etc.

Namely, the functions Earcut::operator() and Earcut::linkedList are using points[i].size(), but it is documented that specializing the nth is enough to make it compatible.

points[i] would be a vector, therefore points[i].size() is the number of points of the polygon/point-list/vector with the index i.

from earcut.hpp.

gracicot avatar gracicot commented on July 3, 2024

Hmm, right now I'm trying to send a std::vector<glm::vec2>. I would need to send a std::vector<std::vector<glm::vec2>>? What is the second dimension is supposed to represent? I'm not sure how to layout my data

from earcut.hpp.

gracicot avatar gracicot commented on July 3, 2024

Ah! I see, this is to support holes inside a polygon?

from earcut.hpp.

mrgreywater avatar mrgreywater commented on July 3, 2024

Yes, to support holes. The first vector<point> is the main surrounding polygon, further point-lists define holes.

std::vector<std::vector<glm::vec2>> would work.

from earcut.hpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.