Giter Site home page Giter Site logo

raphlinus / spline-research Goto Github PK

View Code? Open in Web Editor NEW
216.0 18.0 12.0 2.6 MB

A repository for research code, papers, interactive visualizers, etc., for spline research

License: Apache License 2.0

JavaScript 94.91% HTML 0.35% Gnuplot 0.03% Python 0.64% PostScript 3.33% TeX 0.75% Shell 0.01%

spline-research's Introduction

Spline research

This repo contains protoype research code for a new spline. It is based on my earlier Spiro work and builds on my PhD thesis but has significant advantages.

First, the new spline is robust. That means that a small change to an input point yields a proportionally small change in the generated spline. By contrast, Spiro was prone to large flips, as a loop would change direction. Even worse, Spiro would sometimes fail to converge (often producing incorrect results resembline particle accelerator tracks). This lack of robustness was a major reason Spiro didn’t catch on more widely.

Second, it uses explicit tangents as a unifying and simple user experience refinement to control a wide range of behaviors. These explicit tangents replace Spiro’s “one-way constraints,” which were powerful but confusing from a user-experience perspective. With explicit tangents, the designer make smooth straight-to-curved transitions, control the curvature when a curve is terminated at a corner, control the exact locations of extrema (especially important for font design), and signal a transition from low curvature to high curvature regions. The new control is intuitive and will be familiar to designers experienced in Bézier drawing.

The new spline should be useful in font design (my original motivation), vector illustration in general, CAD, and other applications such as maps and representation of path centerlines for autonomous vehicles.

Try the online demo.

Read more about the spline in research paper 1.

License

The code in this repository is licensed under the terms of the Apache-2 or MIT license, at your choice.

The ideas in this repository are free for all to implement. Previously there were patents and a provisional patent application, but those are hereby passed into the public domain.

Contributions

Contributions are welcome.

Raph Levien

spline-research's People

Contributors

raphlinus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spline-research's Issues

Question about splitting splines

I wasn't sure whether this would be the most appropriate way to get in contact, but I'm wondering if you ever looked into splitting splines as part of your research?

At $JOB we develop a CAD system and a common task is to break an entity into two at a particular point. For example, say the first half generates the desired shape perfectly, but you don't need the rest. This is easy enough to implement for regular shapes like lines and arcs, and even ellipse segments, but I wasn't sure how it'd be implemented for a B-Spline or Bezier Curve.

Have you come across anything in the literature around this sort of operation?

Closed all-smooth shapes not smooth

The following closed shape with three smooth point and no tangents doesn't appear smooth at the first point:

{"subpaths":[{"closed":true,"pts":[{"x":223.86,"y":168.2,"c":1},{"x":483.06,"y":64.2,"c":1},{"x":491.86,"y":273,"c":1}]}]}

Whereas setting explicit tangents on one point makes all points properly smooth.

{"subpaths":[{"closed":true,"pts":[{"x":223.86,"y":168.2,"c":1},{"x":483.06,"y":64.2,"c":1},{"x":491.86,"y":273,"c":1,"t":2.393}]}]}

Add CurveToLine and LineToCurve types

README correctly indicates that Spiro's Left and Right constraints were confusing to use and removed them in this implementation.
In code I find this confusion is because they're named according to the order of the array which is easily confused with left and right as screen coordinates. I suggest calling them CurveToLine and LineToCurve and re-adding them to spline-research as they continue to be a useful way to weld lines to curves. The implementation is easy by translating them to a corner with an explicit tangent early in solve. This terminology may help in Spiro too.

To solve the confusion in a GUI, you may need to show this as a new type of explicit tangent.

(context: i'm translating this library to F# to here: https://github.com/terryspitz/dactyl-font/tree/spline-research/spline-research)

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.