Code Monkey home page Code Monkey logo

Comments (3)

nical avatar nical commented on August 15, 2024 1

cc @o0Ignition0o

from lyon.

nical avatar nical commented on August 15, 2024

After a discussion with @o0Ignition0o, I like his suggestion to compute the minimum bounding rect, so I suggest having two methods:

fn bounding_rect(&self) -> Rect

which is a naive implementation that returns the minimum rectangle containing the control points of the curve, and

fn minimum_bounding_rect(&self) -> Rect

Which is slightly more expensive but returns a tighter rect. find_y_inflection should be useful for this, and for some reason find_x_inflection is missing but it could be added. find_y_maximum is also relevant, but find_x_maximum, find_x_minimum and find_y_minimum are missing too (should not be hard to add the missing methods taking inspiration from the existing ones).

from lyon.

o0Ignition0o avatar o0Ignition0o commented on August 15, 2024

This looks good, I'll give it a try ! I'm also considering rotating the curve to "flatten" the start and end points, before invoking find_y_maximum. I don't know if it would be the fastest implementation to get the minimum_bounding_rect, but I'll make a pr and see if I can improve it :)

from lyon.

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.