The original_rect instance of the PhRect class with its members modified by the amount of the translation_point.
This function allows users to create instances of the PhPoint class to act as modifiers to PhRect instances. Mathematically, the result of the function (result), in relation to the original PhRect instance (original) and the translation (point) is:
result.lr.x = original.lr.x + point.x
result.lr.y = original.lr.y + point.y
result.ul.x = original.ul.x + point.x
result.ul.y = original.ul.y + point.y
This output:
A rectangle:
{PhRect (lr . {PhPoint (x . 7) (y . 9)})
(ul . {PhPoint (x . 4) (y . 1)})}
A translation point:
{PhPoint (x . 20) (y . 30)}
The rectangle, translated:
{PhRect (lr . {PhPoint (x . 27) (y . 39)})
(ul . {PhPoint (x . 24) (y . 31)})}Was generated using this code:
#!/usr/cogent/bin/phgamma
require_lisp("PhotonWidgets");
PtInit(nil);
r1 = new(PhPoint);
r2 = new(PhPoint);
TransPoint = new(PhPoint);
r1.x = 4;
r1.y = 1;
r2.x = 7;
r2.y = 9;
TransPoint.x = 20;
TransPoint.y = 30;
RectOrig = new(PhRect);
RectOrig.ul = r1;
RectOrig.lr = r2;
princ("A rectangle:\n",RectOrig, "\n\n");
princ("A translation point:\n",TransPoint, "\n\n");
TransRect = PtTranslateRect(RectOrig, TransPoint);
princ("The rectangle, translated:\n", TransRect, "\n\n");