Your diagram looks correct.
Your x-values appear to be correct.
Edit: My initial values were:
30, 30
120, 30
75, 107
25, 69
89, 5
112, 92
Here are my values for all six points:
55.9606 93.2372
120.0000 30.0000
33.8773 6.8293
25.0000 69.0000
115.5079 69.5705
70.7442 -8.4950
MATLAB plots the 0,0 origin at left,bottom corner. The figure is flipped to match yours.
Here is the MATLAB code using matrix arithmetic:
Your x-values appear to be correct.
Edit: My initial values were:
30, 30
120, 30
75, 107
25, 69
89, 5
112, 92
Here are my values for all six points:
55.9606 93.2372
120.0000 30.0000
33.8773 6.8293
25.0000 69.0000
115.5079 69.5705
70.7442 -8.4950
MATLAB plots the 0,0 origin at left,bottom corner. The figure is flipped to match yours.
Here is the MATLAB code using matrix arithmetic:
Code:
% 2017.04.28 - MrChips
% define points of two triangles p and q
p1 = [ 30 30];
p2 = [120 30];
p3 = [ 75 107];
q1 = [ 25 69];
q2 = [ 89 5];
q3 = [112 92];
p = [p1;p2;p3];
q = [q1;q2;q3];
all = [p;q]; % all points
% shift
[nrows, ncols] = size(all);
Shift = ones(nrows,1) * q1;
all = -Shift + all;
% rotate
a = atan((p2(2)-q1(2))/(p2(1)-q1(1)));
Rotate = [[cos(a) -sin(a)]; [sin(a) cos(a)]];
all = all * Rotate;
% reflect about p2-q1 line
Reflect = ones(nrows,2);
Reflect(:,2) = -Reflect(:,2);
all = Reflect .* all;
% rotate back
a = -a;
Rotate = [[cos(a) -sin(a)]; [sin(a) cos(a)]];
all = all * Rotate;
% shift back
all = Shift + all
Last edited: