Hi, I have a question about new clipper - Clipper2. Are there any plans for JS implementation? Tzvetelin
Screenshots:
Screenshots:
Offsetting open shapes with self intersecting lines
I also replicated this issue with the latest 6.4.2 My testing data is: [[0,0, 10,0, 6,4, 10,0, 6,-4, 10,0]] Offsetting delta is 1.000 Expected solution is an arrow shape, but a horizontal line actually.
I also replicated this issue with the latest 6.4.2 My testing data is: [[0,0, 10,0, 6,4, 10,0, 6,-4, 10,0]] Offsetting delta is 1.000 Expected solution is an arrow shape, but a horizontal line actually.
doesn't remove that point
ClipperLib.JS.Lighten can't remove the first point of a closed path.
I've been struggling trying to use Javascript Clipper to union polygons from GeoJSON data on a map. (Specifically, I have individual county polygons that I need to merge into regions.) Sample code: var CLIP = new ClipperLib.Clipper(); var polygon1 = [{"X":40.859099,"Y":-84.340531},{"X":40.860994,"Y":-84.109586},{"X":40.90473,"Y":-84.109516},{"X":40.920429,"Y":-83.880423},{"X":40.819919,"Y":-83.880063},{"X":40.64469,"Y":-83.880194},{"X":40.643069,"Y":-84.107787},{"X":40.685957,"Y":-84.222799},{"X":40.684926,"Y":-84.396778},{"X":40.815941,"Y":-84.397374},{"X":40.859099,"Y":-84.340531}];...
Union not joining adjacent rectangles
I've found the problem. Even though the documentation says UNION operations can be performed on one set or both sets of polygons, but all other boolean operations require both sets of polygons to derive meaningful solutions. https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibpolytype you really need both subject and clip sets. So, the fix was to add the second polygon as ptClip and then the union works correctly
Hi Timo, thanks for responding so quickly. You're right it's something weird in the demo. However, I'm still facing the issue in my actual code. I've tried to simplify the paths. To reproduce, copy this in to starter_offset.html: var p1 = [[{"X":703,"Y":594},{"X":703,"Y":719},{"X":827,"Y":1960}]]; var p2 = [[{"X":827,"Y":2029},{"X":827,"Y":2098},{"X":1199,"Y":3015}]]; ClipperLib.JS.ScaleUpPaths(p1, 5); ClipperLib.JS.ScaleUpPaths(p2, 5); var co = new ClipperLib.ClipperOffset(2, 0.25); co.AddPaths(p1,...
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...
On the other hand I can't reproduce it in the c# version of the library: If I replace contents of GenerateRandomPolygon with var subj = new Polygon(new IntPoint[] {new IntPoint(10000, 10000), new IntPoint(20000, 10000), new IntPoint(17000, 15000), new IntPoint(10000, 4000), new IntPoint(12000, 4000), new IntPoint(19000, 15000)}); var co = new ClipperOffset(); co.AddPath(subj, JoinType.jtRound, EndType.etOpenRound); co.Execute(ref subjects, 400); (crude, I know) It doesn't do anything strange when...
Union problem
c.AddPath is not a function at Function.ClipperLib.Clipper.SimplifyPolygon
We have been using Javascript Clipper for a few years now to dynamically generate some graphics with offset paths in an in-browser sketch tool. It really saved a ton of work. Thank you! One thing I've always wanted is access to the version control for this project so I can see the iterative changes and better understand what changes have been made and to help me locate bug sources in our code's interaction with the clipper. Is there a reason there isn't public access to the version control?
Are you planning to copy port bundle handling code from seen.cm's version of martinez.?
The 2x factor may NOT be discernible in the new clipper which uses a output contours 2 support edges for the boolean primitives. I have even added that approach to Murtas bundle based approach(gpc for alternate parity only).
The 2x factor may NOT be discernible in the new clipper which uses a output contours 2 support edges for the boolean primitives.
How do I download the floating version? The 2x factor may NOT be discernible in the new clipper which uses a output contours 2 support edges for the boolean primitives.
Incorrect result of clip case with ExPolygons solutions (v5.0.2.3)
Hello Timo, this is an excellent library that I'm using with great pleasure, maybe I could contribute (for example, I'd like to remove the calls to alert('xyz') for a custom global logging/error reporting mechanism, that could be console.log, this is because alert() interferes a lot with the user interface, and the developer (user of the library) cannot customize how he wants to display/handle the errors) but I feel SourceForge is really unfriendly in terms of source-code version managing, issues,...
Cleaning straight lines results in empty path
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/.
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.
This is great news, thanks a lot!!
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
Ok so I figured out that solution has to be converted to ExPolygons to get this information, ref https://sourceforge.net/p/jsclipper/wiki/ExPolygons%20and%20PolyTree%206/. :)
After looking some more at the main demo, it appears to me that the result actually is a polygon with hole and main demo is illustrating this correctly when clicking at solution's points cell. As the solution consists of two polygons, how does the demo know that the second subpolygon is a hole and not an ordinar polygon next to the other one?
After looking some more at the main demo, it appears to me that the result actually is a polygon with hole and main demo is illustrating this correctly when clicking at solution's points cell. Guess I have to interpret the solution differently.
I hoped for a similar demo in C# Clipper where I could just put in custom samples, but it seems to only provide random-generating shapes. Guess I have to figure out how to write a demo myself then. The workaround did it by using offset -0.006 in this specific case, but Im not comfortable using this offset in all similar cases.
I hoped for a similar demo in C# Clipper where I could just put in custom samples, but it seems to only provide random-generating shapes. Guess I have to figure out how to write a demo myself then. I was not able to fix the problem by setting the offset as suggested. Did you verify that in the main demo app?
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.
Incorrect result from edge-case with clip type Difference
Thanks for interest, Javier! I assume that after summer I have time to make the update.
update to 6.4.2
Working with existing svg paths
Undesired zero width bridge when performing difference operation
Oh, I hadn't been logged in. Sorry. Post is by me.
ir is not defined
TypeError: this.ParseFirstLeft is not a function
Hi Timo, I'm sorry this issue was a mistake on my part. The npm clone of this project...
ClipperLib.JS.Lighten always returns a Paths
^ Timo, I created this ticket, apparently I forgot to log in before creating it.
horizontal end segment of an open path gets reversed.
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
IntPoint's Z values not preserved
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
ZFillFunction broken in 6.2.1.0