3

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!

  • 1
    path mypath; mypath=<instructions>; draw mypath shifted (3,5); – egreg May 9 '14 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? – user2822693 May 9 '14 at 14:48
  • Doesn't my example below help? With <instructions> I mean any path creation commands. – egreg May 9 '14 at 14:52
  • And if it did help, don't forget to mark his answer as "accepted" :-) – Franck Pastor May 12 '14 at 9:34
8

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.