gdsestimating / three-dxf

A dxf viewer for the browser using three.js
MIT License
538 stars 171 forks source link

Stange circles in dxf line work #64

Open katSchmid opened 3 years ago

katSchmid commented 3 years ago

hi, Unfortunately i cannot share the file but we have some linework showing strange circles instead of buldges (left: ours, right three-dxf) image and qgis for comparison image

Serthys commented 3 years ago

Can you copy a small portion of that file containing one of those buldges into a new file and share that?

katSchmid commented 3 years ago

i will try, has three-dxf an easy way to split out curves?

Serthys commented 3 years ago

I did a quick test with Splines and there are some strange things, I'm not sure if it's related to your problems. Sample file: spline test.zip This is how it should look like: image This is how it looks: image

The odd curves are not drawn correctly and where the spline has an odd number or points it joins the last one with 0,0,0.

katSchmid commented 3 years ago

I dont have a real dxf editor, can i just dm you the file?

bzuillsmith commented 3 years ago

@Serthys yeah, I didn't really know what I was doing when I implemented splines and I didn't have a good program to test things with at the time. It looks like you created a nice test for those. Would love a PR, even if it's just to add a failing test.

The issues here definitely look like issues with bulges. Also all the bulges seem to be originating from the end of a line so perhaps we aren't handling some edge condition for bulges? We'll definitely need at least a portion of the file to diagnose. Are you able to open the file and remove most of it but leave part of what is broken? Then you would just be posting a very tiny piece. Otherwise I suppose a DM will do.

bzuillsmith commented 3 years ago

@Serthys I just pushed a partial fix for splines. It will now draw simple ones, but can't handle more that 4 control points. Three.js doesn't have an algorithm for more than that. I understand the fundamentals of splines much better now, but not well enough to write code that can handle any number of control points. From what I understand, it becomes a recursive computation as you add more points.

I plan to take a look at the bulge problem soon. Sorry, been getting reoriented with everything. It's been a while!