GetEdgeEndpoint
(
Point otherEndpoint,
out Point edgeEndpoint
)
{
AssertValid();
Point oVertexLocation = this.VertexLocation;
// A diamond is just a rotated square, so the
// VertexDrawingHistory.GetEdgePointOnRectangle() can be used if the
// diamond and the other vertex location are first rotated 45 degrees
// about the diamond's center.
Double dHalfSquareWidth = m_dHalfWidth / Math.Sqrt(2.0);
Rect oRotatedDiamond = new Rect(
oVertexLocation.X - dHalfSquareWidth,
oVertexLocation.Y - dHalfSquareWidth,
2.0 * dHalfSquareWidth,
2.0 * dHalfSquareWidth
);
Matrix oMatrix = WpfGraphicsUtil.GetRotatedMatrix(oVertexLocation, 45);
Point oRotatedOtherVertexLocation = oMatrix.Transform(otherEndpoint);
Point oRotatedEdgeEndpoint;
GetEdgeEndpointOnRectangle(oVertexLocation, oRotatedDiamond,
oRotatedOtherVertexLocation, out oRotatedEdgeEndpoint);
// Now rotate the computed edge endpoint in the other direction.
oMatrix = WpfGraphicsUtil.GetRotatedMatrix(oVertexLocation, -45);
edgeEndpoint = oMatrix.Transform(oRotatedEdgeEndpoint);
}