Coder Social home page Coder Social logo

Comments (3)

Hapaxia avatar Hapaxia commented on July 1, 2024

You're suggesting a concave polygon triangulated from the Spline, I presume.
With the freedom of the Spline, this would allow overlapping areas which, I think, would be expected to be non-filled.
When you also factor in the interpolated Splines, you get many points that would be used, resulting in very many triangles.

It seems that you mean to create a separate drawable object called Polygon that would store triangles but can be created from a Spline's current points. I'm not sure which approach would be better: separating the Polygon from the Spline or just adding "fill" flag to Spline and switching its calculation over to triangulation.

I will, either way, look into triangulation to make sure I can implement this in a relatively simple way.

from selbaward.

degski avatar degski commented on July 1, 2024

You're suggesting a concave polygon triangulated from the Spline, I presume.

Yes.

With the freedom of the Spline, this would allow overlapping areas which, I think, would be expected to be non-filled.

Do you mean that the [larger] Polygon could have holes? that would be great of course.

It seems that you mean to create a separate drawable object called Polygon that would store triangles but can be created from a Spline's current points.

Yes to the latter, if that requires triangles, yes.

I'm not sure which approach would be better: separating the Polygon from the Spline or just adding "fill" flag to Spline and switching its calculation over to triangulation.

In a way the sw::Spline is (just) a special kind of (sw::)Polygon, one with transparent fill. There will obviously be much overlap (all the stuff related to the outline), so my vote would be to "marry" the two. Then sw::Spline could become just a [specialized] typedef of sw::Polygon, as not to break existing code or require people to change their code-base.

I will, either way, look into triangulation to make sure I can implement this in a relatively simple way.

Great, I think this can be very useful and eventually should be put up for inclusion in SFML, as this class will be just another square, circle etc. From the whole SW collection, this one stands out as being close to existing functionality. Thanks for looking into this.

from selbaward.

Hapaxia avatar Hapaxia commented on July 1, 2024

Hi again.

I would like to just mention that Polygon has now been added to Selba Ward.

It is still in its early phase (currently at v1.1) but can currently triangulate a given set of points as long as there are no overlaps and the points are given in an anti-clockwise direction.

Future plans for this include:

  • allowing points in clockwise direction with a 'clockwise flag',
  • automatically detecting direction of points,
  • other triangulation methods,
  • triangulation refinements (e.g. post-processing),
  • allowing holes.

Note that it is not directly connected to Spline and just takes all of the points' positions and creates a polygon from that. Of course, you can get all of Spline's points' positions manually but the next version of Spline will include a simple way to 'export' all of those positions at once (and will be compatible with the 'dump' style method of Polygon that takes all points at once).

So, I shall now consider this issue complete (i.e. fixed) although feel free to open others for separate issues or others regarding Polygon/Spline.

Fixed in commit 3a65737

from selbaward.

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.