Thanks for reporting. Did you test the library itself? The demo is a bit complicated when using open paths (if I remember right, it doesn't support them or if supports you cannot change the order of operations boolean/offset). The JS libary itself supports open paths. You can try using as a base eg. http://jsclipper.sourceforge.net/6.4.2.2/index.html?p=open_closed.html (code: http://jsclipper.sourceforge.net/6.4.2.2/index.html?p=sources_as_text/open_closed.txt) or even simpler http://jsclipper.sourceforge.net/6.4.2.2/index.html?p=starter_offset.html...
The downside is that this integerisation lowers precision. If floats would be used throughout the library, this integerisation is not needed. I mentioned this a while ago to Angus: one cause for minor self intersections can be this integerisation.
Also float->integer and integer->float cause rounding errors. It is safe to make comparisons using floating point coordinates inside Clipper because bigger float is bigger float the same way bigger integer is bigger integer.
Performance increase is amazing! What is the main reason for the increase?
I found these about Martinez. The demo seems to work nice and there are also an animation about the process: https://rawgit.com/voidqk/polybooljs/master/dist/demo.html The project is on Github MIT licensed: https://github.com/voidqk/polybooljs There is a text "Based somewhat on the F. Martinez (2008) algorithm". More explanations about the algorithm: http://syntheti.cc/article/polygon-clipping-pt2/
https://rawgit.com/voidqk/polybooljs/master/dist/demo.html https://github.com/voidqk/polybooljs "Based somewhat on the F. Martinez (2008) algorithm" http://syntheti.cc/article/polygon-clipping-pt2/
Angus, any thoughts about this? http://www.cs.ucr.edu/~vbz/cs230papers/martinez_boolean.pdf
I released a float version of Javascript Clipper, which is based on C# 6.4.2. The demo: http://jsclipper.sourceforge.net/6.4.2.2_fpoint/main_demo.html I changed the rangetest to raise an exception if a coordinate is outside +-ClipperLib.ClipperBase.maxValue or the absolute value of coordinate is smaller than ClipperLib.ClipperBase.minValue. ClipperLib.ClipperBase.maxValue = Math.sqrt(Number.MAX_VALUE); // 1.3407807929942596e+154 ClipperLib.ClipperBase.minValue = Math.sqrt(Number.MIN_VALUE); // 2.2227587494850775e-162...
I released a float version of Javascript Clipper, which is based on C# 6.4.2. The demo: http://jsclipper.sourceforge.net/6.4.2.2_fpoint/main_demo.html I changed the rangetest to raise an exception if a coordinate is outside +-ClipperLib.ClipperBase.maxValue or the absolute value of coordinate is smaller than ClipperLib.ClipperBase.minValue. ClipperLib.ClipperBase.maxValue = Math.sqrt(Number.MAX_VALUE); // 1.3407807929942596e+154 ClipperLib.ClipperBase.minValue = Math.sqrt(Number.MIN_VALUE); // 2.2227587494850775e-162...
I have released a floating point version of Javascript Clipper. The main reasons for releasing are: the library code is smaller (no Int128), calling logic is simpler (no need for scaling coordinates) and the execution speed is faster (about 2x when using big integers), Give it a try: http://jsclipper.sourceforge.net/6.4.2.2_fpoint/main_demo.html
Hi! This is a forum for general discussion about Javascript Clipper. If you think you have find a bug, please report it in https://sourceforge.net/p/jsclipper/tickets/.
What version of Clipper are you using? The newest is 6.4.2 (2017-02-27).
Web Workers 6
migration5to6
Main_Demo 6
Home 6
documentation
update to 6.4.2
Web Workers 6
migration5to6
Main_Demo 6
documentation
documentation
Home 6
This is fixed in upcoming 6.4.2.1.
I'm now working on it. Seems promising. I have to make extensive tests first. I made also changes regarding calling IntPoint, DoublePoint and SlopesEqual -functions inside library. The average time of calling 1503 operations (offset and boolean) decreased from 2.1ms to 1.5ms.
I'm now working on it. Seems promising. I have to make extensive tests first.
even/odd offsets missing
Union of polygons with colinear edges (2)
Offsetting open shapes with self intersecting lines
ZFillFunction broken in 6.2.1.0
IntPoint's Z values not preserved
horizontal end segment of an open path gets reversed.
Thanks. The issue is fixed in 6.4.2.1, which is coming soon.
Working with existing svg paths
If paths are only polygons (MLVHZ mlvhz), then you can use normalize_clipper_poly(polystr, quiet) to convert SVG-path to Clipper Path(s) and format_output(polystr, ExPolygonsOrNot) to convert from (stringified) Clipper Path(s) to SVG-path. The functions are in http://jsclipper.sourceforge.net/6.2.1.2/main_demo.html source. You probably have to edit those functions to suit your needs. If the path has curves, your option could be to convert path to cubic curves using Raphael and then polygonize them...
ClipperLib.JS.Lighten always returns a Paths
Thanks for reporting! Fixed in upcoming 6.4.2.1.
TypeError: this.ParseFirstLeft is not a function
Thanks for reporting. This will be fixed in upcoming 6.4.2.1.
ir is not defined
Thanks for reporting. This will be fixed in upcoming 6.4.2.1 version.
Undesired zero width bridge when performing difference operation
Hi, Thanks for reporting. This issue is true in 6.2.1.2. The upcoming 6.4.2.1 fixes this problem. 6.2.1.2: [[{"X":128,"Y":64},{"X":64,"Y":64},{"X":64,"Y":96},{"X":32,"Y":96},{"X":32,"Y":64},{"X":96,"Y":64},{"X":96,"Y":32},{"X":128,"Y":32}]] 6.4.2.1: [[{"X":128,"Y":32},{"X":128,"Y":64},{"X":96,"Y":64},{"X":96,"Y":32}]]
Incorrect result from edge-case with clip type Difference
Angus, is there any development regarding floating point version of Clipper?
Thanks for contacting. Could you test, what result gives C# Clipper, from which JS Clipper is ported? Meanwhile you can use a workaround. After ctDifference operation, apply a little negative offset to the solution, eg. -0.001. See the documentation: https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclipperoffsetexecute or the example: http://jsclipper.sourceforge.net/6.2.1.2/index.html?p=sources_as_text/starter_offset.txt.
Thanks for interest, Javier! I assume that after summer I have time to make the update.
I'm not sure, but I think that the source of unrobustness may be the rounding to...
Glad to hear that your work on Clipper 2 has started! Do you think Clipper 2 will...
Thanks for reporting! I think it is fixed now in 6.2.1.2: https://sourceforge.net/projects/jsclipper/files/?source=navbar...
documentation
documentation
documentation
I tested those paths at http://jsclipper.sourceforge.net/6.2.1.1/main_demo.html....
documentation
Thanks for reporting. The bug is fixed now in version 6.2.1.1. https://sourcefor...
Web Workers 6
ExPolygons and PolyTree 6
Main_Demo 6
Home 6
Home 6
Home 6
documentation
Because current stable C# Clipper is not perfect in common line joining, you can...
Clipper makes those relationships automatically if you use PolyTree as a solution...
Because current stable C# Clipper is not perfect in common line joining, you can...
Union of polygons with colinear edges
Inverse Function Question
Open path fixes
Bugfix: when ForceSimplePolygons is enabled, the PolyTree structure could be incorrect (r471)
This is fixed in 6.2.1.0.
find intersection of two open paths (lines)
Last segment of an open path is ignored (patch included)
This is fixed in 6.2.1.0.
Usage outside of Webbrowser
even/odd offsets missing
Inherit never inherited
This is fixed in 6.2.1.0.
Incorrect instanceof line
This is fixed in 6.2.1.0.
This has to be some bug in original C# Clipper. I tested in the last stable C# Clipper...
Fine! I'm waiting Angus Johnson to make updates. He wrote at the Sourceforge page...
I made an update, where those open path bugs are fixed or should be at least: ht...
I made an update, where this is fixed. https://sourceforge.net/projects/jsclippe...
I have not found any issues when testing with about 100 000 operations/polygon combinations....
The time of making 1503 operations: FPoint: 1836 ms IntPoint: 5688 FPoint: http://jsclipper.sourceforge.net/6.1.3.4b_fpoint/main_demo3.html...
I have no timetable for adding new fixes. I assume that all those bugs are fixed...
Or if you need also those outside-areas, use XOR.
It is the DIFFERENCE operation so that the SUBJECT is the canvas path (eg 640x480)...
Hi, Markus! Hard to say without any example image. Could you make an image about...
I don't know why this happens. It should be two polygons. When I have time and money,...
If those open paths consist only of one line segment, you could use line intersection...
If those open paths consist only of one line segment, you could use line intersection...
Thanks for reporting. This was a bug in 6.1.3a (rev 452) version of original C# Clipper...
I tried in experimental Javascript FPoint Clipper: http://codepen.io/timo22345/pen/LpEbWB/left/?editors=101...
Varying delta by segment should be possible at least when miter joins are used, but...
It should be possible. The node.js support is added by these lines: var isNode =...