Spline through points

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Spline through points

pavel
Hello, so I've made some progress with the interpolating spline implementation. It is far from finished, however, it is possible to draw splines through points and patterned styles can also be applied. There is still a lot to do, however, if someone would be interested in seeing what I have so far, what is the best way to submit the source code for review?

Thanks, Pavel
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

dxli
It's great!

I would like to work with you to complete the implementation.

We are releasing 2.0.5 soon. I think we should include your new interpolation spline in 2.0.6

Another exciting feature I would like to add is to find area of selected close contours. Currently we only calculate area for polygons.

pavel wrote
Hello, so I've made some progress with the interpolating spline implementation. It is far from finished, however, it is possible to draw splines through points and patterned styles can also be applied. There is still a lot to do, however, if someone would be interested in seeing what I have so far, what is the best way to submit the source code for review?

Thanks, Pavel
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

pavel
OK, so what is the easiest way to share the updates? I know that there are some functions like "diff" in git and other source control systems, which I am not very familiar with. Or I can just sent you the files zipped by e-mail. Pavel

dxli wrote
It's great!

I would like to work with you to complete the implementation.

We are releasing 2.0.5 soon. I think we should include your new interpolation spline in 2.0.6

Another exciting feature I would like to add is to find area of selected close contours. Currently we only calculate area for polygons.

pavel wrote
Hello, so I've made some progress with the interpolating spline implementation. It is far from finished, however, it is possible to draw splines through points and patterned styles can also be applied. There is still a lot to do, however, if someone would be interested in seeing what I have so far, what is the best way to submit the source code for review?

Thanks, Pavel
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

dxli
The easiest way is by github.

pavel wrote
OK, so what is the easiest way to share the updates? I know that there are some functions like "diff" in git and other source control systems, which I am not very familiar with. Or I can just sent you the files zipped by e-mail. Pavel
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

dxli
We can talk on IRC in #librecad at freenode
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

pavel
OK, let's try it tomorrow, I will be off-line in a while.
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

dxli
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

pavel
So it is almost ready. The splines allow:
- snap to intersection with line and any quadratics
- snap to tangent point
- draw paralel line (pseud paralel, of course)
- to be cut

There are few thigs left:
- intersection with another spline
- create dialog or reuse the one for B-splines to toggle closed on and off
- and finally a small detail - store it in DXF
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

pavel
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.
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

dxli
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.htm

Let'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.
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

pavel
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.htm

Let'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.
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

dxli
merged to official repository.

hide input option for degrees in case  spline points.
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

dxli
This post was updated on .
TODO:

1, draw tangent line of a given quadratic and spline;
2, hatch support
3, area calculation with quadratic spline contour
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

dxli
Area calculation for second order spline

The goal is to be able to find the enclosed area by a contour with a spline border.

Motivation:
Area enclosed in a contour

Initial implementation for other entity types:

https://github.com/LibreCAD/LibreCAD/commit/5d78874c9a78b70212ecb3086cd37e469d40f615





Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

beachp6
When I create a spline, I can't get the display to stop showing the spline as 'filled in'.  It doesn't matter if I make an open spline or a closed spline they are always shaded in.  When I open the DXF file in other programs the splines show correctly.  How can I get splines to stop showing the area as filled in?

Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

dxli
are you running an old version?

this bug should have been fixed for a while:

https://sourceforge.net/p/librecad/bugs/474/?page=0

and this fix is in

https://github.com/LibreCAD/LibreCAD/commit/0d07caa065ce4a214bb202ec3e8cffee033ef201

beachp6 wrote
When I create a spline, I can't get the display to stop showing the spline as 'filled in'.  It doesn't matter if I make an open spline or a closed spline they are always shaded in.  When I open the DXF file in other programs the splines show correctly.  How can I get splines to stop showing the area as filled in?
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

beachp6
No not old version... I am using the latest 2.0.6 complied Oct 20th and it is not fixed.  

slide.dxf 

cad.PNG




Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

dxli
pushed a fix in master branch:

https://github.com/LibreCAD/LibreCAD/commit/7d7acfcd3eb3943109ac7341fbb2500996049fdc

need a code review on all qpen and qbrush side effects:

changing one entity's color/solid filling, should be followed by restoring the original pen/brush

beachp6 wrote
No not old version... I am using the latest 2.0.6 complied Oct 20th and it is not fixed.  

slide.dxf 

cad.PNG
Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

beachp6
When I copy and paste the URLs you are posting they work but if I click on them I get a 404.  
I saw on https://github.com/LibreCAD/LibreCAD instructions for compiling.  I'm assuming if I want the latest changes I compile myself.  Nice to know this is supported in both Linux and Windows.  

Reply | Threaded
Open this post in threaded view
|

Re: Spline through points

beachp6
Where in the forum do I ask about a bug in the forum? (Not a bug in librecad).  

When a URL is posed in comments it does this:

"https://github.com/LibreCAD/LibreCAD;cid=1416236357352-352"

When it should do:

"https://github.com/LibreCAD/LibreCAD"

Is this a problem with just this forum or maybe the problem is in Nabble?

Is there a place in the forum to post about problems using the forum?

12