Coder Social home page Coder Social logo

thelonious / kld-intersections Goto Github PK

View Code? Open in Web Editor NEW
342.0 18.0 53.0 1.9 MB

A library of intersection algorithms covering all SVG shape types

License: BSD 3-Clause "New" or "Revised" License

JavaScript 52.74% Mathematica 44.56% Shell 0.11% XSLT 1.77% HTML 0.83%
svg intersections bezier-curve circle rectangle line polyline polygon ellipse

kld-intersections's Introduction

kld-intersections


A library of intersection algorithms covering all permutations for any two of the following SVG shapes:

  • Arcs
  • Quadratic Bézier
  • Cubic Bézier
  • Circle
  • Ellipse
  • Line
  • Paths
  • Polygon
  • Polyline
  • Rectangle

Installation

npm install kld-intersections

Importing

The following sections indicate how you can import the code for use in various environments.

Node

const {ShapeInfo, Intersection} = require("kld-intersections");

Browsers

<script src="./node_modules/kld-intersections/dist/index-umd.js"></script>
<script>
  var ShapeInfo = KldIntersections.ShapeInfo;
  var Intersection = KldIntersections.Intersection;
</script>

Modern Browsers (ESM)

import {ShapeInfo, Intersection} from "./node_modules/kld-intersections/dist/index-esm.js";

Bundlers

import {ShapeInfo, Intersection} from "kld-intersections";

Usage

In order to perform an intersection, you need to create descriptions of each shape to intersect. This is done using ShapeInfo.

Once you have created your ShapeInfos, pass them into Intersection.intersect and you will get back an Intersection object. Intersection objects contain the intersections, an array of Point2D instances, in their points property.

The following example creates a path (from SVG path data) and a line. The two shapes are passed into Intersection.intersect and the results are displayed in the console.

const {ShapeInfo, Intersection} = require("kld-intersections");

const path = ShapeInfo.path("M40,70 Q50,150 90,90 T135,130 L160,70 C180,180 280,55 280,140 S400,110 290,100");
const line = ShapeInfo.line([15, 75], [355, 140]);
const intersections = Intersection.intersect(path, line);

intersections.points.forEach(console.log);

Each of the shape constructors in ShapeInfo supports a wide variety of formats. Be sure to look at the examples in the ShapeInfo docs to get an idea of how you can define shapes.

Note that there are some older APIs that have been deprecated. If you need to work with those APIs or wish to use the Intersection methods directly, you can read about those in Shapes API.

Queries

In the original intersection code written for kevlindev.com, there were some functions that allowed one to determine if a point was contained within a given shape. That code has been extracted into a separate class named IntersectionQuery. Those methods are currently limited to the following list:

  • IntersectionQuery.pointInCircle(point : Point2D, center : Point2D, radius : number)
  • IntersectionQuery.pointInEllipse(point : Point2D, center : Point2D, radiusX : number, radiusY : number)
  • IntersectionQuery.pointInPolyline(point : Point2D, points : Array)
  • IntersectionQuery.pointInPolygon(point : Point2D, points : Array)
  • IntersectionQuery.pointInRectangle(point : Point2D, topLeft : Point2D, bottomRight : Point2D)

The first argument is the point you wish to test. The remaining parameters describe the shape to test against. All methods return a boolean value indicating whether or not the given point is contained within the shape.

Note that currently bézier curves are not included in this list. As a workaround, bézier shapes can be approximated using polylines and then tested with pointInPolyline or pointInPolygon. See tessellate-cubic-beziers.js as an example of how you might tesselate bézier curves for this purpose.

Known Issues

Please note that the bézier-bézier intersections may not be well-behaved. There is work being done to make these more stable, but no eta is available at this time. As a workaround, bézier shapes can be approximated using polylines and then intersected with an appropriate polyline intersection method. See tessellate-cubic-beziers.js as an example of how you might do this.

Links and Related Projects

kld-intersections's People

Contributors

brettz9 avatar quazistax avatar thelonious 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

kld-intersections's Issues

Problem with intersectBezier2Polygon

Hello thelonious,
I'm trying to obtain the intersection between quadratic bezier and a polygon but I'm stuck with this error:
schermata 2018-02-07 alle 13 12 12
where this.intersectBezier2Polyline isn't a function.
Inspecting your code I found that intersectBezier2Polygon is amenable to intersectBezier2Polyline like intersectBezier2Circle is a particular case of intersectBezier2Ellipse (with rx e ry = r) but the two functions differ:

Intersection.intersectBezier2Circle = function(p1, p2, p3, c, r) { return Intersection.intersectBezier2Ellipse(p1, p2, p3, c, r, r);

Intersection.intersectBezier2Polygon = function(p1, p2, p3, points) { return this.intersectBezier2Polyline(p1, p2, p3, closePolygon(points)); };

Modifying the second all seems to work fine:
Intersection.intersectBezier2Polygon = function(p1, p2, p3, points) { return Intersection.intersectBezier2Polyline(p1, p2, p3, closePolygon(points)); };
Here's a pic of my working example:
schermata 2018-02-07 alle 15 25 35

Is it really required to have node engine limit?

Hello there! First of all, thanks for the amazing library.

And the question. In my company we have a pretty outdated node version used across the company (v8.16.0), and, while this library actually works under this node, yarn throws an error when trying to install it. I would like to update our node and stuff, but it's not that easy, since infrastructure is huge and it will involve a lot of tedious work of updating dependencies and testing and stuff...

So is it really required to have node v10 for this library to work or is it just a recommendation?

intersectBezier2Bezier3 cannot find all intersections for some case

First of all, thanks for a great software!

I found that intersectBezier2Bezier3 cannot find all intersections for some case.
I added two test cases, one passes and another fails.
hnakamur@5070de0

You can try the demo at http://bl.ocks.org/hnakamur/73af30f05fced219a33f
Please check intersections which are printed with console.log().
The demo source is at https://github.com/hnakamur/d3.js-drag-bezier-curves-example/tree/use-kld-intersections

Ellipse path shape and line shape intersection doesn't return the exact value

Here is the result https://jsfiddle.net/bf6439Lp/1/

the grey ellipse should be over the black ellipse (the small one) but that doesn't happen because the top left yellow point (the result of the intersection of an ellipse path ShapeInfo.path and a line ShapeInfo.line) is not in its right position

It's just a small difference but it causes a big problem

const path = "M990.9151527580099,72.43248960645849 A527,427 10,1,0 995.0763978351388,927.1662293868965 A527,427 10,0,0 990.9151527580099,72.43248960645849"
const kdlLine = ShapeInfo.line([0, 73], [1000, 73])
const kdlPath = ShapeInfo.path(path)
const intersections = Intersection.intersect(kdlPath, kdlLine)

Intersection: this.init is not a function

Thank you for this wonderful libray!

I am trying to use the library but I get this error:

VM564:2 Uncaught TypeError: this.init is not a function
    at Intersection (<anonymous>:2:10)
    at <anonymous>:1:1

It looks like this is window here and init of course is not there.
I checked and this happens on http://www.quazistax.com/testIntersection.html as well.

Do you have any hint for me on how to solve?

EDIT: I am using the release version 0.1.1.

No Intersections for intersectBezier3Bezier3 Edge Case

Hi, while porting your code to c# and writing test cases, I ran across this weird little edge case to Intersection.intersectBezier3Bezier3 that I thought you might be interested in.

Here is the geometry in svg form:

<svg xmlns="http://www.w3.org/2000/svg">
    <path gui:edit="editable" d="M150,150 C183.33333333333331,216.66666666666663 233.33333333333337,216.66666666666663 300,150" stroke="blue" stroke-width="5" fill="none"/>
    <path gui:edit="editable" d="M100,200 C166.66666666666663,133.33333333333337 233.33333333333337,133.33333333333337 300,200" stroke="orange" stroke-width="5" fill="none"/>
</svg>

Here are the current results:

nointersection

intersectBezier2Circle and intersectBeziers2Rectangle return not expected result for horizontal and vertical lines

I'm having an issue for some particular cases of intersection with Bezier curve, when the curve is actually a line (same abscissa or same ordinate for start point, end point and control point).
The return using and intersectBezier2Circle is empty.
The returned point using and intersectBeziers2Rectangle is the end point.
For the moment i use a work around consisting in delegate the compute to intersectCircleLine and intersectLineRectangle, but i think it would be better if these limit cases will be managed.

The use cases :

intersectBezier2Circle

const start = new Point2D(-621.1, 629);
const control = new Point2D(-461.70000000000005, 629);
const end = new Point2D(-302.3, 629);
const radius = 38.9;
Intersection.intersectBezier2Circle(start, control, end, end, radius);
result = [];

intersectBeziers2Rectangle

const start = new Point2D(-621.1, 629);
const control = new Point2D(-461.70000000000005, 629);
const end = new Point2D(-302.3, 629);
const r1 = new Point2D(-321, 609);
const r2: new Point2D(-279, 645);
Intersection.intersectBezier2Rectangle(start, control, end, r1, r2);
result = [Point2D{x: -302.3, y: 629}, Point2D{x: -302.3, y: 629}];

Add convenience layer for IntersectionQuery

Right now, you can use the intersection API 3 ways:

  1. Direct call to intersection method passing in essentially scalar values
  2. Via the Shapes API which still uses scalar values, but it creates intermediate objects for each support shape. These are then used by a single method in the intersection API to determine which low-level method to call
  3. Via the Affine Shapes API which is just like the Shapes API, but it lets you use Point2D, Vector2D, etc. in place of scalar values. This is for people who don't mind using those classes.

IntersectionQuery has been introduced recently and right now it has the equivalent of the intersection api's low-level interface. Using either of the Shapes API, we should be able to introduce a simple IntersectionQuery.contains(point, shape) method.

Question on `ShapeInfo.rectangle`

With:

ShapeInfo.rectangle({x: 100, y: 150, width: 30, height: 10});

...I'm getting:

[
  0: Point2D {x: 100, y: 150}
  1: Point2D {x: 200, y: 300}
]

I would have expected the second point to be extrapolated from the height and width. Is this an error, or are the docs that mention mix-and-matching being ok not applicable here?

Thanks!

Another Case of no intersections for intersectBezier3Bezier3 Edge Case

Hi, I ran across another weird intersection edge case for intersectBezier3Bezier3 that I thought you might be interested in.

Edge case

Here are the curves:

<path d="M150,150 C183.33333333333331,216.66666666666663 233.33333333333337,216.66666666666663 300,150"/>
<path d="M100,200 C166.66666666666663,133.33333333333337 233.33333333333337,133.33333333333337 300,200"/>

Error in the readme?

I think this line:

const line = ShapeInfo.line([15, 75], [355, 140]);

should read:

const line = ShapeInfo.line(15, 75, 355, 140);

Bring in SVG Path Element support

This may be buried deep in the 2D library on KevLinDev. Regardless, it looks like I missed porting this over, so I should pull this code in.

Maximum call stack size exceeded

const path1 = ShapeInfo.path(
 "M 157 612 L 157 612 C 157 612 162.93043615114098 608.5347819244295 166 607 C 168.27058484879018 605.8647075756049 170.69506244610156 605.0638173325685 173 604 C 175.03025890455189 603.0629574286684 176.93593725153866 601.8600261451923 179 601 C 180.9460170216421 600.1891595743158 183.08077895050255 599.872373204317 185 599 C 186.7694343789214 598.1957116459448 188.2305656210786 596.8042883540552 190 596 C 191.91922104949745 595.127626795683 194.0187415011529 594.7204576359444 196 594 C 197.68698082338213 593.386552427861 199.28064919915957 592.5158052402521 201 592 C 202.62799163965823 591.5116025081026 204.37200836034177 591.4883974918974 206 591 C 207.71935080084043 590.4841947597479 209.319237688354 589.6302858668672 211 589 C 211.98697761359682 588.6298833949012 213.02129963414217 588.3914801463432 214 588 C 214.69204566544784 587.7231817338209 215.29289321881345 587.2357022603956 216 587 C 217.30384048104054 586.5653865063198 218.67851173410534 586.3775680759699 220 586 C 221.01353523311383 585.7104185048246 221.9663772117566 585.2067245576487 223 585 C 223.6537204504606 584.8692559099079 224.3462795495394 585.1307440900921 225 585 C 226.0336227882434 584.7932754423513 226.9663772117566 584.2067245576487 228 584 C 228.6537204504606 583.8692559099079 229.33333333333334 584 230 584 C 230.66666666666666 584 231.33333333333334 584 232 584 C 232.33333333333334 584 232.66666666666666 584 233 584 C 233.66666666666666 584 234.33333333333334 584 235 584 C 236 584 237 584 238 584 C 238.66666666666666 584 239.33333333333334 584 240 584 C 240.66666666666666 584 241.36754446796633 584.2108185106779 242 584 C 242.44721359549996 583.8509288015 242.66666666666666 583.3333333333334 243 583 C 243.33333333333334 582.6666666666666 243.55278640450004 582.1490711985 244 582 C 244.63245553203367 581.7891814893221 245.33333333333334 582 246 582 C 246.33333333333334 582 246.70185760300004 582.1490711985 247 582 C 247.4216370213558 581.7891814893221 247.5783629786442 581.2108185106779 248 581 C 248.29814239699996 580.8509288015 248.70185760300004 581.1490711985 249 581 C 249.4216370213558 580.7891814893221 249.5783629786442 580.2108185106779 250 580 C 250.29814239699996 579.8509288015 250.66666666666666 580 251 580 C 251.33333333333334 580 251.66666666666666 580 252 580 C 252.33333333333334 580 253 580 253 580"
  );
const path2 = ShapeInfo.path(
    "M 218 268 L 218 268 C 218 268 223.3078404494596 277.0645346442572 225 282 C 231.3268648166052 300.4533557150985 237.8559579349404 318.9374065007258 242 338 C 247.87892617442165 365.0430604023396 250.88288048929005 392.6332644288103 255 420 C 256.55001755323724 430.30305785387094 257.66059560917324 440.66745184219354 259 451 C 259.99392948523655 458.6674560289678 259.96567909648905 481.45917664620674 262 474 C 264.9819972656439 463.0660100259724 262 440 262 440"
  );
const intersections = Intersection.intersect(path1, path2);

got error:

index-umd.js:166 Uncaught RangeError: Maximum call stack size exceeded
    at Polynomial.getRootsInInterval (index-umd.js:1955)
    at Polynomial.getRootsInInterval (index-umd.js:1974)
    at Polynomial.getRootsInInterval (index-umd.js:1974)
    at Polynomial.getRootsInInterval (index-umd.js:1974)
    at Polynomial.getRootsInInterval (index-umd.js:1974)
    at Polynomial.getRootsInInterval (index-umd.js:1974)
    at Polynomial.getRootsInInterval (index-umd.js:1974)
    at Polynomial.getRootsInInterval (index-umd.js:1974)
    at Polynomial.getRootsInInterval (index-umd.js:1974)
    at Polynomial.getRootsInInterval (index-umd.js:1974)

Polygons with gaps

I need to find the intersection points between a line and a polygon with a (polygonal) hole in it. Can this library do that? How would you define such a shape?

Polygon boolean function

Hi, does this library cover all polygon boolean functions (union, intersection, difference and XOR) ?

dependency gp-data-transformer is 404 in npm

when I install your package , the console throw a error " No valid versions available for gp-data-transformer". I found the dependency gp-data-transformer is 404 in npm

image

how can I resolve this problem ? Maybe you could provide some replaceable third-party libraries for me ?

Automatic creation of shapes from SVG elements

Hi Kevin :)

Automatic creation of shapes from SVG elements - is that a possibility?

Instead of

Intersection.intersectShapes(  
  IntersectionParams.newCircle(new Point2D(0,0), 50),
  IntersectionParams.newRect(0, 0, 60, 30))
)

we could then write

Intersection.intersectShapes(someSvgCircleElement, someSvgCircleElement)

(That would probably implicitly cause the ~same action as the current version - the lib would create/update its representation of the shape.)

Tobi

intersectBezier2Ellipse when the bezier is nearly a line

I found an issue when the bezier 2 is close to a line:

Intersection.intersectBezier2Ellipse(new Point2D(599.6212158203125, 399.6212158203125),
            new Point2D(749.8636506539298, 399.60549803175195),
            new Point2D(900.1052551269531, 400.1052551269531),
            new Point2D(740.8397695373246, 399.72029570133856),
            3.375, 3.375)

The found intersections are:

new Point2D(756.1673452777627, 399.74474836394853)
new Point2D(725.5121897521101, 399.69852555069036)

These are not points of the ellipse.

Any ideas ?

Fix License Organization Name

Currently there is no organization substituted in the license, causing it to sound like you cannot use your own organization's name to promote itself. Clearly this is not what was intended.

Please fix.

Assumptions about intersection points

Hi, thanks for this awesome utility.
In my application, I have to find which parts of a particular shape are overlapping with another shape. For example, given an "open circle" and a rectangle, I want to find out the arcs on the circle that are obscured (i.e. red in the following image). How can I determine these arcs? Can I assume that the intersection points are given in a particular order? If I define the blue arc with a Bézier curve, will the intersection points be listed in the same order as the Bézier points? What about a closed path, like an ellipse?
ohne titel

Object constructor broken with quadraticBezier

From https://github.com/thelonious/kld-intersections/blob/development/docs/ShapeInfo.md#quadratic-bezier:

ShapeInfo.quadraticBezier({p1: {x: 10, y: 20}, p2: {x: 5, y: 10}, p3: {x: 15, y: 30}})

But running this:

  const quadShape = ShapeInfo.quadraticBezier({
    p1: { x: 160, y: 50 },
    p2: { x: 110, y: 90 },
    p3: { x: 60, y: 50 },
  });
  console.log(quadShape);

Logs this:

ShapeInfo {name: "Bezier2", args: Array(3)}
  args: Array(3)
    0: Point2D {x: 160, y: 50}
    1: Point2D {x: 160, y: 50}
    2: Point2D {x: 160, y: 50}

SvgShapes. SVG transformations are ignored.

Transformations and 'viewBox' are completely ignored by the SvgShapes.

A workaround fix:
(svg rotated + viewBox + group rotated + elements rotated):

<svg transform="rotate(12 12 12)" viewBox="0,0, 800,800" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="go(evt)">
  <script type="text/javascript" xlink:href="../dist/index-umd.js"/>
  <script type="text/javascript" xlink:href="./show_intersections.js"/>
  <defs>
    <g id="intersection">
      <circle r="3" fill="none" stroke="red" stroke-width="1"/>
      <circle r="1" fill="black"/>
    </g>
  </defs>
  <g id="shapes" transform="rotate(12 12 12)">
    <polygon x="44" transform="matrix(1, 1, 4, 1.3, 2, 2)" points="48,20 100,17 125,98 64,130 18,98" fill="blue" opacity="0.5"/>
    <polygon y="12" transform="matrix(1, 3, 4,0.5, -5, 4)" points="20,48 17,100 98,125 130,64 98,18 43,16" fill="orange" opacity="0.5"/>
  </g>
  <g id="result"/>
</svg>

A simple fix might help when setting the points for SvgShapes:

let ctm = _polygon.getCTM();
        for (var i = 0; i < _polygon.points.numberOfItems; i++) {
          var point = _polygon.points.getItem(i);
		  point = point.matrixTransform(ctm);
		  //points.push(point);
          points.push(new Point2D(point.x, point.y));
 }

And the fix to show the output point in a proper place:


function go() {
    const shapes = getShapes();
	const container = document.getElementById("shapes");
    if (shapes !== null) {
        const [shape1, shape2] = shapes;
        const result = Intersection.intersect(shape1, shape2);
		// chrome, firefox
		let ctm = container.ownerSVGElement.getCTM() || container.ownerSVGElement.getScreenCTM();		
		if(ctm) ctm = ctm.inverse();
        const xml = result.points.map(point => {
			point = ctm ? point.transform(ctm): point;
            return `<use href="#intersection" x="${point.x}" y="${point.y}"/>`;
        }).join("\n");

        document.getElementById("result").innerHTML = xml;
    }
}

Suggestion: add a transformation matrix to the ShapeInfo element.
So shapes might be transformed independently

The latest version is broken

I'm getting the following error using the latest version:

Cannot read property 'concat' of undefined

This is the related code:

var method;
var args;

if ( shape1.name < shape2.name ) {
    method = "intersect" + shape1.name + shape2.name;
    args = shape1.params.concat( shape2.args );
}
else {
    method = "intersect" + shape2.name + shape1.name;
    args = shape2.params.concat( shape1.args );
}

if ( !(method in Intersection) ) {
    throw new Error("Intersection not available: " + method);
}

result = Intersection[method].apply(null, args);

It's probably happening because IntersectionArgs has no property named params.

Is it possible to find intersection area?

Just a question. I have Paths with strokeWidth. I want to find area of grey and black paths (on screenshot) and compare it to their intersection area to detect that user draw a letter.
Intersection of paths doesn't include information about strokeWidth. it seems that converting path to rectangle will not work for curved paths.
Is it possible to find intersection area with kdl-intersection package?
IMG_5350
IMG_5351

Inconsistent intersection points with line and path

I’m having an issue getting intersections to work correctly with a path and a line. I’ve been using kld-intersections to do intersections for my custom polygon nodes and it works great. I’ve been adding a cloud node to the DAG and wanted to get the edge arrows to line up nicely with the edges of the cloud but I can’t seem to get reliable intersection points for the path.

If I take a cloud path

ShapeInfo.path(“M80,80 a20,20 0 0,0 0,40 h50 a20,20 0 0,0 0,-40 a10,10 0 0,0 -15,-10 a15,15 0 0,0 -35,10z"

And a line through it like

ShapeInfo.line([-105, -45, 245, 230])

It won’t pick up the intersections on the arc part. If I move the line it may pick up intersections inside the cloud rather that along its path.
I'm not sure if I'm doing something wrong here, I've seen way more complicated path and line intersections working so I'm unsure what is going on.

Screenshot 2019-12-24 at 18 29 22

(circles are drawn for reported intersections, I added a rect to the background as well just to check the line was ok)

Adding some benchmarks

It would be great to have some benchmarks in my case I am interested in the rotated ellipse-ellipse and rotated ellipse-line cases

Questions about some logs

Hi~
I don't know what the specific effect of these two lines of code is.
But when I call it multiple times, the log is full of my screen.
Maybe I can submit PR to delete them?

console.log(`[startRadians = ${startRadians} endRadians = ${endRadians}]`);
console.log(`[startNormal = ${startNormal} endRadians = ${endNormal}]`);

ShapeInfo throws exception: Unable to extract value for size,width,height,w,h

Hi, I have an issue with the ShapeInfo for rounded rectangles, rr being a rectangle with rounded corners:
ShapeInfo.rectangle({x: rr.x, y: rr.y, w: rr.width, h: rr.height, rx: rr.rx, ry: rr.ry});
it throws an exception:

Uncaught TypeError: Unable to extract value for size,width,height,w,h
    at getValues (ShapeInfo.js? [sm]:59)
    at Function.rectangle (ShapeInfo.js? [sm]:272)

Seems like in the for loop of getValues in ShapeInfo.js, parsePoint shifts the args parameter without creating a copy.

Is that a bug or am I missing something?

Used to work in 0.6.0, but the dependency gp-data-transformer disappeared from npm. :(

self intersection

how to dectect a collision of sharpe on itself (path or polygon) ?

How to define a Ray ?

Hello Sir
How can I define a Ray ?
Like following image:
Screen Shot 2023-11-25 at 05 33 10
I know I can lengthen the segment with a long length
but maybe kld-intersections already has it's way to define easily ?

Get Bezier T value for point

Hi Kevin,
This is an awesome library! I don't have an issue but this is more of a question:
I know I can get the intersection points on a Bezier curve. Do you have a function to get the T values of said points?

Thanks,
Dan

Example or suggestions regarding viewBox?

I have a polyline shape using the code below:

<symbol viewBox="0 0 88 72" id="poly">
    <path d="M 0 36 18 0 70 0 88 36 70 72 18 72Z"></path>
</symbol>

The symbol is defined in the section of the SVG, and used by using the element.

Is there any way that the poly() function can be given the viewBox property to adjust the intersection point?

Typescript declaration file support

Hi, I'm using using this library and found it splendid! But currently our project is written in typescript so is there any type declaration file (.d.ts) support for this library?

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.