Skip to content

Question about behavior of transform of a point #5

@hpb-htw

Description

@hpb-htw

Given the following code:

import geometry;

unitsize(1cm);

coordsys gnd = cartesiansystem(
    (0, -1), i = (0, -1), j = (1, 0)
);
show("" , "$x$", "$y$", gnd, xpen=invisible);

pair A = (2, 3); // fixed
real c = 2;

transform shiftToA = shift(A.x, A.y);

point G = point(gnd, (0, 2)) ;
dot("", G);

point Gp = shiftToA * G; // expected result: (2, 5) in gnd
dot("", Gp, blue); //  (-3, 4) in gnd => not realy intuiv,

// to get my expected result:
point Gpp = point(gnd, shiftToA * (G.x, G.y));
dot("", Gpp, red); // (2, 5)

I expected, that the result of a translation is relative to the coordinate system of the translated point. In this example I intuitively expected that the transform of a point G (0, 2) by a vector (2, 3) is the point (2, 5) in the same coordinate system of the point (0, 2). To archive this result I have to put the x- and y- coordinates of the point G explicitly into a pair, as about. So my question is: is this behavior of the shift-transform the expected behavior (=your intention)? If so, what was the reason of your decision?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions