Civil engineering feature implementation (Transportation Engineering)

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by microelly2 »

Joel_graff wrote: Tue Apr 10, 2018 11:01 am
microelly2 wrote: Tue Apr 10, 2018 7:24 am it looks interesting. Do you have some theory behind or is it an experimentical result?
Mostly intuition. I applied constraints which are geometric properties of a simple arc, just to see what the result is. No matter how I moved or oriented it, visually, it appears to match a simple arc exactly. I suspect this is a known property of splines and can be proved mathematically, but I can't prove it. :)
Here is the theory ...
http://spencermortensen.com/articles/bezier-circle/
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by Joel_graff »

microelly2 wrote: Mon Apr 23, 2018 9:00 am Here is the theory ...
http://spencermortensen.com/articles/bezier-circle/
That looks like something I can sink my teeth into. :)

I've been wondering, though, why the focus on bezier curves? In the transportation workbench case, wouldn't it be better to simply use b-splines instead? I see the two primary advantages being that the curve is tied directly to it's end points and the outer control points always fall on a line tangent to the ends of the curve... The only other approach would be to implement NURBS curves in sketcher :)

I could be wrong - I'm sure I've missed the long-term goals you have in mind, and while I understand the basics of bezier / bspline / NURBS, it's not something I have a great deal of experience with...
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by microelly2 »

Joel_graff wrote: Mon Apr 23, 2018 10:59 am I've been wondering, though, why the focus on bezier curves? In the transportation workbench case, wouldn't it be better to simply use b-splines instead? I see the two primary advantages being that the curve is tied directly to it's end points and the outer control points always fall on a line tangent to the ends of the curve... The only other approach would be to implement NURBS curves in sketcher :)

I could be wrong - I'm sure I've missed the long-term goals you have in mind, and while I understand the basics of bezier / bspline / NURBS, it's not something I have a great deal of experience with...
The Bezier impulse comes from the shoe design.
There is a common way to layout in Inkscape with Bezier curves.
If we can support Bezier curves in FreeCAD we do not need switch between the products.
Another reason is that I want a easy way to do the last step of approximation after scan, smooth and complextiy reduction by hand.
When I use Bezier curves the control points can be moved to the origin curve and than only the tangent force and the tangent direction must be adapted. With my concept we are comfortable to change the layout of the curve. If Bezier is not general enough we can delete the constraints step by step to fall back to the great power of BSplines because all in background is already BSpline. Some Constraints will be deleted and other ones become visible and changeable. So the sketch is always readable.
We started our ribs as BSplines with 16 poles, now we will use Bezier with 7 - 9 poles (this are hidden 21 - 27 poles). The result is a simpler sketch with more opportunities. When I deactivate the "Bezier Constraints" I have the functionality of a 7 * 5 poles BSpline.
So my questions was how I can reuse the ideas in our project too. Working on different problems opens the viewpoint and all problems can benefit.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by Joel_graff »

microelly2 wrote: Mon Apr 23, 2018 12:25 pm So my questions was how I can reuse the ideas in our project too. Working on different problems opens the viewpoint and all problems can benefit.
Gotcha. I didn't realize that your bezier implementation was basically just wrapping b-splines (though it makes obvious sense).

I don't really know what to say, though. The need in transportation engineering is for precise and highly-constrained curves which are always reducible to simple arcs - never more than three in series. At this point, (now that I have some free time again) I'm working directly with sketcher b-splines to see what I can come up with for two / three-center curves (as I was doing in my previous posts). I don't think I'm wasting effort to do it - it seems as though what you're conceiving should accommodate whatever workflow I manage to develop.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by Joel_graff »

Figured out that the curves can be defined using only three control points on a b-spline. It's not quite done, though. I need to be able to either constrain a point to the spline object itself, or define constraints using expressions based on reference constraints.
two-center-curve.FCStd
(6.17 KiB) Downloaded 37 times
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by microelly2 »

found a way to bind a sketcher geometry to an external curve.
phpBB [video]

from here it's not to far to bind with a tangent constraint for the connected line too.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by Joel_graff »

microelly2 wrote: Mon Apr 23, 2018 2:25 pm found a way to bind a sketcher geometry to an external curve.
Cool!... now if we could just get it to work on a b-spline in the same sketch....
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by microelly2 »

Joel_graff wrote: Mon Apr 23, 2018 2:33 pm now if we could just get it to work on a b-spline in the same sketch....
We can define a feedback sketch to avoid deadlocks or recursive crashes.
Putting to much into the same sketch is risky.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by Joel_graff »

microelly2 wrote: Mon Apr 23, 2018 9:00 am Here is the theory ...
http://spencermortensen.com/articles/bezier-circle/
Essentially, the inner control points need to be offset from the outer control points along the tangent lines by a distance that is equal to:

radius * (4/3) * tan(delta / 4)

Where:

radius = curve radius
delta = inner angle of the curve

Unfortunately, setting the control points this way requires the radius and inner angle to be set using locking constraints, which makes graphical updates impossible.

Of course, that can be fixed if the values are updated using python and no constraints are set for the radius or angle... but I can't seem to make dragging in python work...
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil Engineering Design functions

Post by microelly2 »

I applied my idea to calculate bezier curves from a sketcher skeleton to our problem
it seems to work
here the two arc connection
there helper sketch only uses tangent lines
and the result sketch holds the arcs.
phpBB [video]

for the alignment I use the sketcher but for the arcs I calculate it by a special python method to avoid sketcher flipping.
Post Reply