Angles on drawn road with touch

I have a game, where player can draw a road by moving finger on screen (android - touch generated). Angles between each point can`t be too sharp, so I check angle between last two points and current drawn points. But this is also relation to distance between those two points, which why it makes me so trouble.

So I cannot check only angle between two last points - if someone draw fast on screen, points between each touch input refresh are more distant, same angle can draw different curve in this case.

So now I have no idea how to create a relation between distance and angle… I will be greateful on any help.

That’s an interesting problem.

Just brainstorming here… I assume you want to adjust the path so that it’s drivable, but stays as close as possible to what the user drew.

So, you could do that by using a chase mechanic. Have an imaginary road-paver that starts at the user’s first point, and then proceeds towards the next point at a steady pace, but can only turn so much on each step. So if the user’s path turns too sharply, the paver will go wide and make a gentler curve.

The tricky bit here is knowing when to abandon the current target point and head for the next one. And this is very important, otherwise your paver could end up circling around a sharp turn forever! To decide that, compute the time it will take to turn to face that point (based on the angle between the paver’s current forward and the angle to the point); and compute time it will take to cover the distance to the point (based on the angle’s speed). If it would take longer to turn than it would to reach it, abandon that point and head for the next one.

It is amaizing how different people have different approach to subjects :slight_smile: Thank You for Your answer, after night of thinking, I finally got it - it is a relation bettween angle and sin of this angle. So, all I need is to count an angle between last section and current section - if sin of distance of current section is shorter than section distance, than curve is lighter than a circle of r = 1 :slight_smile: