How would one find an expanding parallel line?

2 views (last 30 days)
If I have two arbitrarily defined points (x1,y1) and (x2,y2). I would like to move these two points in a perpindicular direction, perpindicular to the line made by these two points. The distance moved is also a changing value, increasing with time. What is the easiest way to program this? I have done a series of finding the slope, inverting the equation, calculation the new points in a symbolically solved equation. The problem is this is a time consuming process for the code.
  2 Comments
Bob Thompson
Bob Thompson on 24 Sep 2019
What part of the process is time consuming? I would think that finding slope and the inverted slope would be pretty simple. How are you calculating your new points? Can you just find all of the points at the same time in a matrix?
John D'Errico
John D'Errico on 24 Sep 2019
A long time for the code to run? Seriously? Why are you using symbolic computations at all?

Sign in to comment.

Answers (1)

David Hill
David Hill on 24 Sep 2019
rate=@(t)t^1.1;%make the rate what ever you desire with respect to time
function [e,f] = parallelExpansion(rate,t,a,b)%function provides points e,f that have been moved perpendicular to orginal points a,b with respect to rate and time
c=b-a;
m=-c(1)/c(2);
e=[a(1)+rate(t)*t,a(2)+m*rate(t)*t];
f=[b(1)+rate(t)*t,b(2)+m*rate(t)*t];
end

Community Treasure Hunt

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

Start Hunting!