Comments (32)
The algorithm ran in my WebCAD project, and the performance was very good.
11-05-14.mp4
from cavalier_contours.
I don't have any plans currently to work on and maintain a wasm API but Rust supports wasm directly, see the web demo project here. The example file that creates an FFI for wasm is here.
from cavalier_contours.
vers: [0, 0, 0, -600, 0, 0, -600, -18, 0, -18, -18, 0, -18, -600.0000000000005, 0, 0, -600.0000000000005, 0]
close:false
There is a problem with this result
from cavalier_contours.
Yeah the wasm performance is quite good, the the interactive web demo app for cavalier contours is here.
Can you give me the minimum reproducible data for the problem you found (vertexes, is_closed, offset value)?
from cavalier_contours.
I figured it out from your post + video, I'll look into it. Here it is in the cavalier contours web demo app:
{
"isClosed": false,
"vertexes": [
[0, 0, 0],
[-600, 0, 0],
[-600, -18, 0],
[-18, -18, 0],
[-18, -600.0000000000005, 0],
[0, -600.0000000000005, 0]
]
}
from cavalier_contours.
This fillet is sometimes not needed.
AutoCAD's offset does not handle this.
Can you add a control field to control whether or not to chamfer?
from cavalier_contours.
Possibly, I don't currently have a use for that so I'm not sure when I'll get around to it. The algorithm performs distance checks between the offset segments and the original polyline to to prune collapsed regions, this may get falsely triggered in some cases if the lines are extended out rather than rounded (if the lines are truncated with a straight edge this wouldn't falsely trigger). I'd have to look into it more.
Is there a hosted interactive page for the CAD tool you're creating?
from cavalier_contours.
Page never finishes loading - download rate seems to be getting throttled/cut, I just see the loading screen and animation but it's stuck at 99%.
from cavalier_contours.
Our server is in China, and foreign access may be slower.
What chat software do you use, or can you use teamview to remotely assist?
Or open f12 to see if the js resource can be loaded normally
The progress bar is not accurate.
Are you using chrome browser?
We also don't support mobile devices.
from cavalier_contours.
I'm in US California, I think it's just blocking traffic from where I am, when I look at task manager network activity is always less than 0.1Mbps. I tried both Firefox and Microsoft Edge.
from cavalier_contours.
I looked into the issue you reported, I don't see any problems. The polyline you posted seems to offset correctly when either open or closed. What offset value are you using? In the video it looks like it's collapsed to a coincident segment (offset = 9) and everything looks correct in the cavalier contours web demo (the algorithm always keeps coincident/overlapping results).
from cavalier_contours.
{"vertexes":[[0,0,0],[-600,0,0],[-600,-18,0],[-18,-18,0],[-18,-600.0000000000005,0],[0,-600.0000000000005,0],[0,0,0]],"isClosed":false}
offset = 9
from cavalier_contours.
When isClosed=true, the result is correct.
from cavalier_contours.
So isClose
does not seem to be a closed mark closeMark
The behavior is different from autocad.
from cavalier_contours.
Even when open it produces the correct result when I tested it. The vertical edge just lines up with the origin axis line so it looks wrong visually in the screenshot, but it's an open polyline so the part sticking out past the arc should be there.
How do you expect the the result should be different?
from cavalier_contours.
I thought their behavior should be consistent.
Because the contour is the same when isClose=true or IsClose=false.
So their offset result should be the same.
from cavalier_contours.
{"vertexes":[[0,0,0],[100,0,0],[100,100,0],[0,100,0]],"isClosed":true}
{"vertexes":[[0,0,0],[100,0,0],[100,100,0],[0,100,0],[0,0,0]],"isClosed":false}
I think their offset results should be the same, But the offset result is different.
from cavalier_contours.
But this is not a problem, I can adapt this by changing the code
from cavalier_contours.
Pasting those examples into the cavalier contours web demo produces the same result... Am I missing something?
from cavalier_contours.
Oh are you saying the "isClosed" property isn't set to true in the result? Yes if the input is an open polyline then it returns it as an open polyline. If you want to close it you can test if polyline.firstVertexPosition == polyline.lastVertexPosition
.
from cavalier_contours.
Oh, it looks right, I did it wrong, I'm very sorry
from cavalier_contours.
Pasting those examples into the cavalier contours web demo produces the same result... Am I missing something?
What is this url address
from cavalier_contours.
{"vertexes":[[0,0,0],[100,0,0],[100,100,0],[0,100,0],[0,0,0]],"isClosed":true}
This doesn't look great
from cavalier_contours.
{"vertexes":[[12423.122820176195,3528.5133862542775,0],[12423.122820176195,3510.5133862542775,0],[12837.342864924894,3510.5133862542775,0],[12837.342864924894,2907.7942631500323,0],[12855.342864924894,2907.7942631500323,0],[12855.342864924894,3528.5133862542775,0]],"isClosed":true}
It should be better to return one line in this case
from cavalier_contours.
https://jbuckmccready.github.io/cavalier_contours_web_demo_page/ for the web demo page.
from cavalier_contours.
{"vertexes":[[0,0,0],[100,0,0],[100,100,0],[0,100,0],[0,0,0]],"isClosed":true}
...image removed for readability...
This doesn't look great
The offset algorithm does not test for/handle repeat position vertexes (here x=0, y=0 is repeated). You can use the remove_repeat_pos
polyline method to clean it up before performing the offset. Method is here: https://github.com/jbuckmccready/cavalier_contours/blob/master/cavalier_contours/src/polyline/pline.rs#L409
I plan to add a offset options flag that will cause the function to clean things up as best it can before performing the offset, currently it doesn't do it for performance reasons. Note it does have a debug assert to catch this case, I recommend compiling with debug asserts enabled for testing.
from cavalier_contours.
...image removed for readability...
{"vertexes":[[12423.122820176195,3528.5133862542775,0],[12423.122820176195,3510.5133862542775,0],[12837.342864924894,3510.5133862542775,0],[12837.342864924894,2907.7942631500323,0],[12855.342864924894,2907.7942631500323,0],[12855.342864924894,3528.5133862542775,0]],"isClosed":true}
It should be better to return one line in this case
The algorithm tries to join the longest connected sequence when overlapping is involved. Can you create a simpler example that is smaller and has the problem you describe?
from cavalier_contours.
{"vertexes":[[0,0,0],[432.22004474869937,0,0],[432.22004474869937,-620.7191231042452,0],[414.22004474869937,-620.7191231042452,0],[414.22004474869937,-18,0],[0,-18,0]],"isClosed":true}
There is no way to simplify the 6-point outline, it is already very simple
It looks like the results overlap
14-34-13.mp4
from cavalier_contours.
I think I found the overlap join bug and I have a fix working. I will try to review and commit it tomorrow, and add the case to the automated tests.
from cavalier_contours.
https://github.com/jbuckmccready/CavalierContours/blob/master/include/cavc/polylineoffsetislands.hpp
It seems that this feature has not been implemented in rust, and I haven't found this method.
from cavalier_contours.
09-49-57.mp4
This polyline cannot be offset outside
{"vertexes":[[0,0,2.9239855509708432],[422.7001801508977,-2181.678349165927,0.21373279590439873],[1217.850643134374,-1733.2038795014323,4.472986753391631],[961.0754444813574,-155.87051634718955,0.22947158823257166]],"isClosed":true}
from cavalier_contours.
I committed fix and added test case for issue you had with overlapping result, test it and let know how it goes.
I'm closing this issue, please make a new issues for each bug report, it's easier for me to track things
from cavalier_contours.
Related Issues (20)
- Look into different offset join types
- [Bug]This polyline cannot be offset outside HOT 11
- [Feat] transplant: polyline offset islands HOT 2
- Look into supporting bulge values greater than 1
- Overlapping lines appear in the offset result HOT 3
- Add polyline offset option to choose whether to keep or discard overlapping results
- Support polyline with multiple offsets HOT 5
- Arc overlap intersect not detected HOT 1
- Review intersect functions to minimize error and maximize consistency HOT 1
- Incorrect combining result (using C) HOT 26
- c# Bindings for Rust FFI HOT 2
- Failing test case from the web version HOT 2
- Problems with debug asserts HOT 13
- Offset failed, result not closed HOT 4
- API (and C FFI) for Multi Polyline Offset HOT 2
- offset vs. boolean op inconsistency? HOT 2
- corner cases result HOT 2
- Hatching a polygon HOT 1
- Cut not worked HOT 2
- C FFI: Shouldn't counts be size_t? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cavalier_contours.