(You could also use (x1, y1)
and (x3, y3)
.
The sum of the angles of a triangle is 180°, so each angle of an equilateral triangle is 60°
If a side the equilateral triangle is D, then the
height of the triangle (line triHi in the diagram) is D*cos( 30 )
.
cos( 30 )
is
√ 3 /2
Each side of the triangular bump is one-third the distance from (x0, y0)
and (x4, y4)
.
So the height of the triangle is (D/3)*cos( 30 )
= (dist/3)*√ 3 /2
= dist/(2√ 3 )
In Java, this is triHi = dist/(2*Math.sqrt(3));
What is the distance from (x0, y0)
and (x4, y4)
?
double dist = ;
(Mr. P. would be disappointed if you did not figure this out.)