I am not sure this is the right place to post questions about asymptote, but if not I can delete it later.

Here is the code I am playing with:


pair A=(0,0);
pair B=(3,0);
pair C=(2,1);
pair D, E, F, G, H, I, J, K;

F = rotate(90, A)*C;
G = C + F;
I = rotate(-90, B)*C;
H = (C-B) + I;
J = rotate(90, G)*H;
/*K = (H-G) + (J-G);*/
K = rotate(-90, H) * G;
D = rotate(-90, A) * B;
E = D + B;

picture sangaku;
path vierkantac=A--C--G--F--cycle;;
path vierkantbc=C--B--I--H--cycle;;
path vierkantgh=G--H--K--J--cycle;
path vierkantab=B--A--D--E--cycle;

path driehoekae=A--B--E--cycle;
path driehoekgh=G--H--K--cycle;

pen p1=orange;
pen p2=cyan;

filldraw (sangaku, vierkantac, p1);
filldraw (sangaku, vierkantbc, p1);
draw (sangaku, vierkantgh);
draw (sangaku, vierkantab);


pair positie=(2, 12);

The line K = (H-G) + (J-G);, which I have commented out, is giving me trouble:

enter image description here

With the rotate function I get the right result:

enter image description here

But why should they not be equivalent?

1 Answer 1


In this case a correct would be K = G+(H-G) + (J-G);. The error comes from common misconception that points an vectors are the same, while in fact they are not. It is easy to grasp the difference, with one more coordinate added to mark it: it is 0 for vectors, and 1 for a valid point. Then it is clear, that any sum (+/-) of vectors will result in a valid vector, the difference of two points is a vector, and to get a valid point, the vector has to be added to another point. (Sum of the points are only valid, if the mentioned extra coordinate of the result is also 1). In particular, in the commented line K clearly is a sum of two vectors (H-G) and (J-G), to make it a point, another proper point has to be added, in this case it is G.

  • I wonder why I didn't see that. Thanks!
    – qed
    Oct 28, 2013 at 17:50
  • @qed: Well, we humans, not octopuses, we all have a blind spot in the eye by design.
    – g.kov
    Oct 28, 2013 at 18:13
  • Adding on the extra coordinate to distinguish vectors from points is a neat trick! Oct 28, 2013 at 18:49
  • @Charles Staats: It is indeed. Unfortunately it is rarely found in geometry textbooks.
    – g.kov
    Oct 28, 2013 at 19:44

You must log in to answer this question.

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