【发布时间】:2018-04-01 12:02:59
【问题描述】:
我有[x1,y1]、[x2,y2]和[x3,y3]三个点的坐标如下图。
它们定义了作为矩形一侧的线,以及位于矩形平行/相对侧的点。我想得到另外两个角的坐标。
如图所示,我如何计算点 [xa, ya] 和 [xb, yb]?
clc;
clear;
I = imread('peppers.png');
imshow(I);
h = imline;
lineEndPoints = wait(h);
x1 = round(lineEndPoints(1,1),2);
y1 = round(lineEndPoints(1,2),2);
x2 = round(lineEndPoints(2,1),2);
y2 = round(lineEndPoints(2,2),2);
hold on
[x3, y3] = ginput(1);
plot(x3, y3,'b*');
slope = (y2 - y1)/ (x2 - x1);
slopePerp = -1/slope;
【问题讨论】:
-
您是否考虑过将第三个点正交投影到Distance from reference line at right angle 线上。一旦你有了距离和交点,你就差不多完成了。
标签: matlab geometry coordinates