Re: Spline through points
Posted by
pavel on
Jul 23, 2014; 8:23pm
URL: https://forum.librecad.org/Spline-through-points-tp5710167p5710210.html
I have added also spline-spline intersection, so intersection is also finished.
Regarding the DXF spline entity, I don't think there is any danger. The old spline implementation allows to draw B-splines of degree 1, 2 and 3. The default is 3. I can store my spline through points the same way, the fit points are not used at all. I basically reuse the filter code for old splines. The only interaction with the old code is, that if the DXF file contains a spline of degree 2, it is read as SplinePoints entity now. Splines of degree 1 and 3 are left for the old spline implementation.
I tried to catch you on IRC, without success so far. So I try to explain few things here.
My spline goes through the defined points, it is possible to edit the points and move them to modify the spline shape. But this functionality ends as soon as the spline is either cut, or re-read from the DXF file. Then it starts to behave as an ordinary B-spline of degree 2, so we can move the control points to modify the shape, the original "through" points are lost.
The reason for this - perhaps odd - behavior is, that after the spline is cut, I could not guarantee that the remaining shape remains the same if the cut point is added to the "through" points. So we must swap to the "control point" mode, then we can easily trim the spline. Actually, the splitted spline parts do not exactly correspond to the original spline, but the difference is negligible, and the tanget at the split point is preserved.
Please review the code and the functionality. I will be off for the rest of this week and the whole next week, so you have plenty of time. I might be on IRC this Friday.
dxli wrote
I haven't tested your latest code yet, but I can see you are doing very interesting stuff there.
one DXF support, I need more understanding here. Using "Degree 2" seems to be risky to me.
http://www.autodesk.com/techpubs/autocad/acad2000/dxf/spline_dxf_06.htmLet's try to understand the group codes:
74 Number of fit points (if any)
11 Fit points (in WCS), one entry per fit point DXF: X value; APP: 3D point
pavel wrote
reading/writing into DXF is now implemented. It stores the data as spline of degree 2. When reading, it reads the spline when degree is 2, even if the spline has been created by the original spline tool.