create point betweem two points

5 ビュー (過去 30 日間)
Majid Al-Sirafi
Majid Al-Sirafi 2012 年 7 月 15 日
編集済み: Walter Roberson 2018 年 1 月 28 日
Hi every one
I have two points, for example
(2,5)-(10,15)... how can I create a new point between them???
thanks a loot
majid

採用された回答

Walter Roberson
Walter Roberson 2012 年 7 月 15 日
NumberNewPoints = 3;
xvals = linspace(2, 10, NumberNewPoints+2);
yvals = linspace(5, 15, NumberNewPoints+2);
pts = [xvals(:), yvals(:)];
Now the points are the rows.
  11 件のコメント
Majid Al-Sirafi
Majid Al-Sirafi 2012 年 7 月 16 日
dear watler according to your code
NumberNewPoints = 3;
xvals = linspace(2, 10, NumberNewPoints+2);
yvals = linspace(5, 15, NumberNewPoints+2);
pts = [xvals(:), yvals(:)];
but I choose NumberNewPoints = 1;
so, the new created point is (6,10) how can I move this created point between p1(2,5) and p2(10,5).. that means i want to move this created point to p1 at first state , and move the created point to p2 at a second state,and the movement time is 2. But this movement do not exceed P1 and p2
thanks a lot
Walter Roberson
Walter Roberson 2012 年 7 月 16 日
編集済み: Walter Roberson 2018 年 1 月 28 日
pts(1,:) %x,y for starting point
pts(2,:) %x,y for intermediate point
pts(3,:) %x,y for final point

サインインしてコメントする。

その他の回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2012 年 7 月 16 日
out = ([10,15]-[2,5])*(2*rand-1)+[2,5]

カテゴリ

Help Center および File ExchangePolygons についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by