Hi
I have read through many of the posts on here but I am struggling to find a solution wherby I need to offset the centre line coordinates of a track. As the race circuit is a closed system, typical ways of offsetting a curve seems to create cross over of the inner and outer circuit parameters.
I have the centre line of the race track (attached file) that has been extracted from the race vehicle at 20Hz, so quite a large data set. I do have 5 and 2 Hz if it is easier. I need to create an inner and outer circuit limit that contains the same amount of points but with an offset of 7.5m either side of the centre line, to make the overall track width 15m from inner to outer. This data is set with global coordinates so the 0,0 is based at the centre of the overall track architeture. The first x,y coordinates can be set to 0,0 (centre of start/finish line) if that also helps with the solution.
I have tried this code but potentially messed it up so it so did not work for my coordinates: https://uk.mathworks.com/matlabcentral/answers/427870-i-have-one-curve-i-want-to-create-another-curve-offset-to-that-one-at-right-angle
Can anybody help in creating the 2 additional (inner and outer) plots that have the 7.5m offset from the centre line?
Regards
Kieran

 Akzeptierte Antwort

darova
darova am 20 Mai 2020

2 Stimmen

Try the attached script. It's pretty simple. I leaved some comments so all should be clear
There is a function self_inter inside the script. It calculates points where a curve is intersecting itself. You can cancel/remove it if you don't need it
Result

3 Kommentare

Kieran Reeves
Kieran Reeves am 20 Mai 2020
Thankyou so much Darova. Your help is greatly appreciated.
I tweaked the offset slightly too to stop the self intersecting areas. Your code is fantastic and easy to understand with your comments so thankyou.
Kieran
darova
darova am 20 Mai 2020
My pleasure
Furkan Bek
Furkan Bek am 26 Nov. 2021
This was very helpful, thank you for sharing this.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by