Generating way points based on other waypoints

Hej guys am trying to generate (x1,y1) based on other (x,y).Imagine these points as a waypoints for a car1 and car2.I want to make the way points parallel to each other.Giving a constant offset between two waypoints is not changing.How to make them parallel in whatever direction the frst way point goes.
I have attached the image .Red is the default waypoints and blue is the waypoint am trying to make it parallel in wwhatever direction it goes.This is what i got when i tried with a contant offset.

Answers (1)

If you have the mapping toolbox, you could adapt bufferm to your needs.
Otherwise, there are options in the file exchange, best summarized here.

1 Comment

Hej thank you for your suggestion. I was working on this
vec.x = B.x - A.x;
vec.y = B.y - A.y;
To rotate a 2d vector by 90 degrees, switch the components and negate one. So you could create:
rightVec.x = vec.y;
rightVex.y = -vec.x;
And then position C at :
C = A + t*rightVec;
This seems to work well :D

Sign in to comment.

Categories

Find more on Sparse Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!