4

Is there a way to draw a path that was defined by relationships between pairs centered around a specific point?

I basically want to create a path that I can translate anywhere I want in my image.

Thank you!

4
  • 1
    path mypath; mypath=<instructions>; draw mypath shifted (3,5);
    – egreg
    May 9, 2014 at 14:13
  • That works provided you know the coordinates that the path is drawn So is there a way to define a starting point for your path? May 9, 2014 at 14:48
  • Doesn't my example below help? With <instructions> I mean any path creation commands.
    – egreg
    May 9, 2014 at 14:52
  • And if it did help, don't forget to mark his answer as "accepted" :-) May 12, 2014 at 9:34

1 Answer 1

9

You can save the path in a variable and transform it. Example:

path mypath;

beginfig(1);
z1=(10,-10);
x1=-x4; y1=y4;
x2=x1; y2=-y1;
z3=-z1;

mypath = z1--z3--z2--z4--cycle;

draw mypath;

draw mypath shifted z2;
endfig;

end

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .