Menu

#104 maxtimes and mintimes problem

closed-fixed
nobody
Code (71)
5
2009-06-07
2009-06-07
No

maxtimes returns times which aren't the maximum point.

If I understand thier specification correctly, it is a bug.

% cat tst.asy
path p = (0,0)--(1,1);
write(point(p, 0));
write(point(p, 1));

real[] ts = maxtimes(p);

write(ts[0]);
write(ts[1]);
% asy tst.asy
(0,0)
(1,1)
0
0

I think ts[0] and ts[1] should be 1 because point(p, 1)=(1,1) is bigger than point(p, 0)=(0,0) in horizontal and vertical.

Similar problem exists with mintimes.

% cat tst2.asy
path p = (1,1)--(0,0);
write(point(p, 0));
write(point(p, 1));

real[] ts = mintimes(p);

write(ts[0]);
write(ts[1]);

% asy tst2.asy
(1,1)
(0,0)
0
0

I think ts[0] and ts[1] should be 1 because point(p, 1)=(0,0) is bigger than point(p, 0)=(1,1) in horizontal and vertical.

% asy --version
Asymptote version 1.76 [(C) 2004 Andy Hammerlindl, John C. Bowman, Tom Prince]

Discussion

  • John Bowman

    John Bowman - 2009-06-07

    Thanks; fixed in svn and upcoming release.

     
  • John Bowman

    John Bowman - 2009-06-07
    • status: open --> closed-fixed
     
  • Tanaka Akira

    Tanaka Akira - 2009-06-07

    Thank you for very quick response.

    I built asy from svn trunk.
    The exact problems I reported is fixed.

    But a similar problem remain.

    % cat tst.asy
    path p = (-1,1)--(-1,-1)--(1,-1)--(2,2)--(3,3);
    real[] ts = maxtimes(p);
    pair p0 = point(p, ts[0]);
    pair p1 = point(p, ts[1]);

    write(p);
    write(ts);
    write(p0);
    write(p1);

    size(10cm);
    draw(p);
    dot(p0, blue);
    dot(p1, red);
    label("0", p1, NE);
    label("1", p1, SW);
    % ./asy -V tst.asy
    (-1,1)--(-1,-1)--(1,-1)--(2,2)--(3,3)
    0: 1
    1: 1
    (-1,-1)
    (-1,-1)

    (-1,-1) is not the maximum point.
    The maximum point is (3,3) for both horizontal and vertical.

     
  • John Bowman

    John Bowman - 2009-06-07

    Sorry, my first fix was correct only for paths of length 1. Try svn r4394.

     
  • Tanaka Akira

    Tanaka Akira - 2009-06-07

    Great. No problem now.