Coder Social home page Coder Social logo

Comments (10)

darwindarak avatar darwindarak commented on June 16, 2024

👍 Sounds like a good idea.

Maybe we can minimize the disruption of renaming the package by using two repositories for a release cycle. We can go ahead and create the Contours.jl package now, and make the current module throw out warnings when it is loaded.

from contour.jl.

SimonDanisch avatar SimonDanisch commented on June 16, 2024

In GeometryTypes we started using the decompose function for these kind of tasks.
Maybe we should rename it to collect at some point, but it works in the following way:

points = decompose(Point, contour) # returns point coordinates of the line
lines = decompose(LineSegment, contour) # returns line segments
line = decompose(Line, contour) # returns a contigeous line
points = decompose(Point{3, Float32}, contour) # since we use types, we can also query types explicitely
points = decompose(Point{2, Float64}, contour) # return 2D points with Float64.
# this works for arbitrary geometry types as well:
points = decompose(Point, Pyramid(...))

This interface allows much flexibility while keeping the implementation very terse.
It helps in plotting environments, were you already know what kind of data you need, independant of the kind of data you actually have (e.g. you have Contour{Float64}, but for plotting you know that you always need Point{3, Float32}).
If you want to, you can use this as a low-level interface, and define higher level functions like lines on top of it.

from contour.jl.

tomasaschan avatar tomasaschan commented on June 16, 2024

Hm. We currently depend on FixedSizeArrays, but I think it would be more appropriate to depend on GeometryTypes directly, and re-use as many as possible of the types there. I'll re-work #30 to this end.

from contour.jl.

tomasaschan avatar tomasaschan commented on June 16, 2024

After looking at it again, it turns out that the relevant types from GeometryTypes are basically just re-exported from FixedSizeArrays. I won't go through the hassle, then :)

from contour.jl.

SimonDanisch avatar SimonDanisch commented on June 16, 2024

Haha yeah that's right. It would be rather about the LineSegment types and decompose ;)
If you have a nice and simple line type lying around, you could also add it to GeometryTypes if you want.

from contour.jl.

tomasaschan avatar tomasaschan commented on June 16, 2024

Hm. The LineSegment type could definitely provide a better abstraction over curves than our Curve2; is there a type (or typealias) in GeometryTypes representing a curve? Or is that just a Vector{LineSegment}?

from contour.jl.

SimonDanisch avatar SimonDanisch commented on June 16, 2024

Currently it is. But I think a curve should be another type, since linesegments are not joined... Or so I would think ;)

from contour.jl.

tomasaschan avatar tomasaschan commented on June 16, 2024

Yeah, true. Then for the moment we should probably stick with our Curve2{T} (which is just a wrapper around a Vector{Point2{T}}) 😄

from contour.jl.

SimonDanisch avatar SimonDanisch commented on June 16, 2024

Hehe, yeah I don't see why not!

from contour.jl.

tomasaschan avatar tomasaschan commented on June 16, 2024

Now that #32 is merged, we can re-work the internal representation of everything without breaking the publicly documented API. Closing this.

from contour.jl.

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.