Quantcast
Channel: Latest Questions by The_Magical_Kiwi
Viewing all articles
Browse latest Browse all 22

Controlling the curvature of a Bézier curve

$
0
0
Hey guys, I've been working on a curve generator for my game. I'm using it to plot a course for a ship. First a little background; our ships have a maximum rotation of x and can move a maximum range of y per turn. They apply this range and rotation over a number of time segments, using either, neither or both types of transformation in each time segment. While they can turn on their centre, it is optimal if they move and rotate at the same time where ever possible, however moving and rotating enforces a turning circle. With that in mind, I would like to control the curvature of my Bézier curve in order to find the optimal route from A to B while maintaining a specfic heading at both the start and end of the route. ![alt text][1] I realised that the vector between the first point and the second point represents the starting heading and that the vector between the penultimate point and the last point control the end heading. I've also noticed that the distance between P0/P1 and P2/P3 controls the curvature (the closer the distance, the tighter the turn). Taking into account all of the above, I have created a generator which creates a path between two points forcing a specified start and end heading and which (by use of colour) tells me if the curvature is to steep for a particular ship's turn ratio. ![alt text][2] *In this case, both the start and end heading are 315 (or -45).* I've been experimenting with changing the curve by adding in extra control points in between P1 and p2. This allows me to manually widen the curve reducing the tightness of the turn but I need to find some formula/algorithm for placing these extra control points which allows these curves be loosened/tightened automatically. I was hoping someone could point me in the direction of some maths that might help? Thanks in advance. [1]: /storage/temp/16110-example.png [2]: /storage/temp/16121-imp2.png

Viewing all articles
Browse latest Browse all 22

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>