This method seems to do the trick:
private void AlignRotatedNodes(
ShapeNode anchorNode, float nX, float nY,
ShapeNode attachNode, float tX, float tY)
{
// the absolute coordinates of the anchor node alignment point
RectangleF anchorRect = anchorNode.Bounds;
Matrix t = new Matrix();
PointF c = new PointF(
anchorRect.X + anchorRect.Width / 2,
anchorRect.Y + anchorRect.Height / 2);
t.RotateAt(anchorNode.RotationAngle, c);
PointF[] n = new PointF[] { new PointF(
anchorRect.X + nX * anchorRect.Width,
anchorRect.Y + nY * anchorRect.Height) };
t.TransformPoints(n);
float nx = n[0].X;
float ny = n[0].Y;
// the absolute coordinates of the attached node alignment point
RectangleF attachRect = attachNode.Bounds;
float tx = attachRect.X + tX * attachRect.Width;
float ty = attachRect.Y + tY * attachRect.Height;
// this transform moves and rotates the attached node to align the specified points
Matrix m = new Matrix();
m.RotateAt(anchorNode.RotationAngle, new PointF(tx, ty));
m.Translate(nx - tx, ny - ty, MatrixOrder.Append);
// find the new position of the attached node center
float cx = attachRect.X + attachRect.Width / 2;
float cy = attachRect.Y + attachRect.Height / 2;
PointF[] newCenterT = new PointF[] { new PointF(cx, cy) };
m.TransformPoints(newCenterT);
// move the node
float newX = newCenterT[0].X - attachRect.Width / 2;
float newY = newCenterT[0].Y - attachRect.Height / 2;
attachNode.Move(newX, newY);
attachNode.RotationAngle = anchorNode.RotationAngle;
}
ShapeNode n1 = diagram.Factory.CreateShapeNode(50, 50, 30, 40);
n1.RotationAngle = 120;
ShapeNode n2 = diagram.Factory.CreateShapeNode(130, 60, 20, 30);
AlignRotatedNodes(n1, 0, 0.5f, n2, 1, 0.5f);
The float arguments specify relative point coordinates for the node points that should be aligned, expressed as fraction of the nodes' width and height. If you already know the points absolute coordinates, you can skip the part of the method that calculates nx,ny and tx,ty and pass them as arguments instead.
I hope that helps,
Stoyan