News:

Due to heavy spamming attempts on this forum, automatic registration has been disabled. We will approve registration requests as quickly as possible (unless you're a spammer of course :) )

Main Menu

Why Doesn't Smooth Flex Default to the Largest Radius?

Started by TomB, January 16, 2024, 04:02:58 PM

Previous topic - Next topic

TomB

I've been working with AnyRail for over a couple of years, now. One thing that bugs the heck out of me is that AnyRail wonn't optimize a flex curve to the largest radius possible.

I can joint two points with flex, then click on Smooth Flex.  However, if I go back and adjust the sliding end point handles, I can watch the bottom readout for radius increase. I have to do this everytime to get the largest radius, because Smooth Flex won't do it.

Large, sweeping flex curves are even worse.  If I Cut Flex to add a point in the middle, I can manually adjust to a much larger radius than Smooth Flex will ever do.

It's not even arguable, either.  I can Smooth Flex and end up with 18 or even 15 inch radii, but then manually adjust the same piece of flex to 24 inch radius or larger sometimes.

It's frustrating and adds a great deal of extra work.  I wish Smooth Flex would smooth to the largest radius everytime.  Even if it would only do that on 3 foot sections (HO scale) and below, it would be a great help.

Maybe there's a constraint I'm missing.  I'm using the 3-part radius increments, but that only gives a color guide.  It doesn't actually make Smooth Flex default to the largest radius possible.

David

I can understand the frustration. The thing is that AnyRail tries to find an optimum between length and radius, and that for all situations: Arc, S-curve, 180 degree or more curve, etc.
David Hoogvorst. Founder and Owner of DRail Software. Creator of AnyRail.

ughcat35

The more you use the program the less frustration you will have. As for the smooth flex that's exactly how it works, finds the sweet spot between the two points you join so you still have a smooth transaction for the trains to navigate safely.

 I will glue down the original two points so I can use the handles to make slight adjustments if even needed. If I need a lager radius I will modify one or both the original points if I need a better transition. Everything has limitations and balances and Your off to a good start by using this forum. Many good minds in this group I have learned from. I will continue reading this forum and learning ways to avoid frustrations myself.

And Thank You David for this wonderful program and user group. You didn't just design the software and leave it at that. You make yourself very visible and active in the group I commend you for that. Thanks again, Don 

TomB

Maybe add some parameters you can set such as minimize length or maximize radius?

TomB

Quote from: ughcat35 on January 16, 2024, 07:17:40 PMThe more you use the program the less frustration you will have.

Not really.  The problem is that I go down a rabbit hole each time because of this and end up being very unproductive.
QuoteAs for the smooth flex that's exactly how it works, finds the sweet spot between the two points you join so you still have a smooth transaction for the trains to navigate safely.

Well yes, but if you're already holding to something like a 30 inch radius, having it optimize for length is exactly wrong.

QuoteI will glue down the original two points so I can use the handles to make slight adjustments if even needed.

Yes, if you dont freeze-flex the entrances and exits, you'll have a big mess.

QuoteIf I need a lager radius I will modify one or both the original points if I need a better transition. Everything has limitations and balances and Your off to a good start by using this forum. Many good minds in this group I have learned from. I will continue reading this forum and learning ways to avoid frustrations myself.

And Thank You David for this wonderful program and user group. You didn't just design the software and leave it at that. You make yourself very visible and active in the group I commend you for that. Thanks again, Don

I agree with all the above, but there need to be more parameters to control the outcomes.  It's more work than it should be.  In a lot of cases, I've had to go backwards and simply set a minimum radius and draw flex curves, which defeats the entire purpose, or find some combo of easements on both ends with fixed radius curves in-between.  That's not how the real flex or cork roadbed is going to behave.

Another example are "easements" out of a turnout in a yard ladder.  Smooth Flex will most often create a curve that blows the flex out of the ladder and at a tiny radius, whereas a manual tweak of the spline line from the initial flex off the turnout will result in a much greater radius and leave the rest of the flex parallel to the ladder.

ughcat35

Hi Tom, I didn't take into consideration you are more likely much busier than I am so your time is much more valuable than mine. I really do like the easement flex function. I just started using that a few months ago and didn't even think of using that function on my yard ladder. I just tried that right now and worked great. Quicker than the way I was doing it before. Thank You for getting my mind going!!! I take a straight flex eyeball the radius and angle and direction click right or left shape it near the location I'm going to insert connect to one end and drag it to the second. Hope that works for you? Or maybe you tried it like that already.

Don

TomB

Actually, adjusting the spline after simply stretching a piece of flex from the straight part of a yard ladder works well and is not too much work.  Using an easement also works, but it's probably over-thinking it.

The issue is with the specific Smooth Flex command.  Use that on a yard ladder and it's destructive, IMHO, not helpful.

Where things get most complicated are when you are trying to make wide, sweeping curves with large radii to turn a 90 degree corner.  Smooth Flex will default to shortest length between the corner ends, resulting in tiny radii at the corner connections and the flex drawn as a tangent cutting across the corner. even though the corner is 36 inches wide, for instance (imagine a quarter pie piece of 36 inch radii).

You can try adjusting the splines, but there's no longer enough arc length to work with.  So, you Cut Flex to add another point in the middle of the "smoothed" flex.  This gives you two additional splines to manipulate and the new point location as new variables.  That means 5 variables to manipulate to smooth out one track turn corner.  It's too much.

You can go back, start over, and create easements on both ends, but then you're left with a curve in the middle of more than 45-60 degrees and the same problem occurs - Smooth Flex won't fix it.

Don't get me wrong - I love how AnyRail manipulates and joins track, but it should be easier to generate free-flowing curves if you're using flex.  Again, unless I'm missing something ...

ughcat35

Tom, I do see it as you enjoy using AR or you wouldn't still be here just giving your ideas, that's how things get improved. In the mean time this is how I just started handling a 90 degree. For example if I had space for a 70" radius I create a 70 radius 45 angle to start then create say an easement flex of maybe 80 radius or more depending on space at a 22.5 angle Right and 90 radius 22.5 Left. I sandwich the 70r 45a between the two 80r 22.5a cut my straight track coming out of the 90's to fit or change the radius of the easement flex. Guess this will be best only if both ends coming out of the 90's are a nice straight section. For a 180 degree I make a 70r 67.5a copy and past once, make the 2 easements at 80r 22.5 Right and Left connect them all and connect to my points or make adjustments. Hope this help or doesn't make it worse. Sometimes I think way differently than others but I think that I may have something missing up there but it works for me.
Don

TomB

Don,
That's exactly the way to do it for a 90 deg. turn.  But that means Smooth Flex doesn't work.  It should, because as you note, if the ends are not straight or off from 90 deg, then it gets very complicated.

I actually use Smooth Flex every chance I get, because it cleans everything up and makes the track plan tidy.  It's just that in certain scenarios (mentioned above), it can blow things up if you aren't prepared.

If constraints could be set for Smooth Flex, like "default to large radius" or "default to shortest distance," then things would be fantastic.

ughcat35

Hi Tom, See you finally did get through my thick scull. Just have a couple boxes you could click to modify how radius works in Smooth Flex so you could set a limit to how much or how little the flex is smoothed. Maybe like a percentage box we could check and then enter 10% - 100% smoothing?
Don

ughcat35

 Hi David,

Would this be possible to do in the future to add an option where you can control the percentage of how Smooth Flex works?  Maybe like a percentage box we could check and then enter 10% - 100% smoothing? I'm not a programmer so just a thought. In some situations the optimum doesn't always work.


Quote from: David on January 16, 2024, 06:40:07 PMI can understand the frustration. The thing is that AnyRail tries to find an optimum between length and radius, and that for all situations: Arc, S-curve, 180 degree or more curve, etc.

David

Unfortunately, it's not always that simple. I've attached a file with some examples where it is not really possible to optimize for one or another.

The flex track, as it is, is a Bézier curve with nice mathematical characteristics, but also limitations. However, we wanted to make it easy to handle flex track with only a few control points.

One limitation of these Bézier curves is that when a curve needs to span more than 90 degrees, it becomes hard to make a circular arc. The alternative is having more control points, much like when you cut the flex now, and get mutiple separate areas to deal with. I don't think that makes it a lot easier to handle the track.

Another thought is that in the real world, there are not many circular arcs in the railways. Most often, easements will be used.
David Hoogvorst. Founder and Owner of DRail Software. Creator of AnyRail.

ughcat35

David,

I completely understand, was just a thought. I 100% enjoy the software, been using it off and on for the past several years can't remember how many. Started at version 5 I believe. Now have more free time on my hands so I have spent more time learning how to make it work for me. Too easy to learn. Interface is pretty self explanatory and easy to use. Learning new tricks every day since it's more powerful than it looks on the surface. Wonderful Program!!!
Thanks
Don

David

Perhaps we can think of some way to let 'Smooth Flex' work on two connected pieces of flex track to have more control over it. But for that we will have to dive into the math behind it.
David Hoogvorst. Founder and Owner of DRail Software. Creator of AnyRail.

BadBanana

I find that I often spend quite a bit of time trying to increase the radii in flex curves after smoothing, using an iterative process of moving each of the control points in turn, since the automatically generated curve is often a tighter radius than I would like, but the smoothing algorithm provides a good starting point.

David - this is just a suggestion based on my own usage, even if keeping the limit for smoothed curves to less than 90 degrees as at present...

I would like two options to be offered when using the Smooth Curve function. 

The first could be almost as it is now, but with a minimum curve radius setting.  Perhaps this could be a choice of the minimum radii used in the Show settings. 

The other would be simply to maximise the radii used without regard to the length. 

In both cases the current approach using Bézier curves would still give an attractive result that would give a visual approximation of an easement without actually following any specific style.

Of course, I have no idea whether this is easy or difficult - I don't have the mathematical background to consider this.  Thanks.