Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templates cannot contain more than one tangent point between the end points #5

Open
notator opened this issue Sep 27, 2022 · 0 comments

Comments

@notator
Copy link
Owner

notator commented Sep 27, 2022

Contrary to the README: A template can only have 3 point/control pairs. The startPair, endPair and a single, optional tangentPair in between.
In other words: 4 or 6 relevant coordinates: See Converter.js:

    // points is an array of point. Each point has an .x and a .y numeric attribute.
    // The values are taken directly from the "d" attribute of an SVG "path" element.       
    function getPointPairs(points)
    {
        let pointPairs = {};

        pointPairs.startPair = {};
        pointPairs.startPair.point = points[0];
        pointPairs.startPair.control = points[1];

        pointPairs.endPair = {};
        pointPairs.endPair.point = points[points.length - 1];
        pointPairs.endPair.control = points[points.length - 2];

        if(points.length === 6)
        {
            pointPairs.tangentPair = {};
            pointPairs.tangentPair.control = points[2];
            pointPairs.tangentPair.point = points[3];
        }
        return pointPairs;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant