posted 34 months ago (Wednesday, February 5) by jne4sl

I find that compass() is prone to causing system errors without explanation. It seems to me that there are some inconsistencies if the call includes referenced points. If I go back and give each point referenced an explicit name, the system error will go away. In particular, a radius I specify is likely to be the length of some other object or the distance between two points [p1:p2].l, so that may be what does it. But I don't get a syntax error, just a system error. (I haven't tried to replicate the problem in a small program, but I've bumped up against it for a while now.)

posted 34 months ago (Wednesday, February 5) by jne4sl

Actually scratch that, it's when the points are a reference that there's a problem. E.g.:

p1 = point(0,0)

p2 = point(10,0)

p3 = point(15,10)

l1 = [p1:p2]

l2 = [p1:p3]

p4 = compass(p1, [p1:p2].l, p3, [p1:p3].l/2)

//p4 = compass(l1.p1, [p1:p2].l, p3, [p1:p3].l/2)

//p4 = compass(p1, [p1:p2].l, l2.p2, [p1:p3].l/2)

I'd expect the last three lines to all do the same thing, but only the first works. The second causes a system error, the third NaN.

posted 34 months ago (Thursday, February 6) by Sewist

The syntax l1 = [p1:p2] is not actually documented.

It should be l1=line(p1,p2) and then you can refer to p1 as l1.p1

p1 = point(0,0)

p2 = point(10,0)

p3 = point(15,10)

l1 = line(p1,p2)

l2 = line(p1,p3)

p4 = compass(p1, [p1:p2].l, p3, [p1:p3].l/2)

doesn't return a system error.

posted 34 months ago (Thursday, February 6) by jne4sl

I went back and changed the definitions of l1 and l2 to use line(), but I'm still getting errors. Maybe it's an abuse of notation, but most functions can take explicit points or referenced points. Checking a little more, I find a problem with Compass() and Intercept(). The other ones I tried work the way I expect. The lines that are commented out cause errors, or mistakes, but I think they should work, e.g. the three lines should create the same p4, or the same p7.

p1 = point(0,0)

p2 = point(10,0)

p3 = point(15,10)

l1 = line(p1,p2)

l2 = line(p1,p3)

p4 = compass(p1,[p1:p2].l,p3,[p1:p3].l/2)

//p4 = compass(l1.p1,[p1:p2].l,p3,[p1:p3].l/2)

//p4 = compass(p1,[p1:p2].l,l2.p2,[p1:p3].l/2)

p5 = apply(p1,l1.l,l2.a1)

p5 = apply(l1.p1,l1.l,l2.a1)

a1 = arc(p1,p3,[p1:p4].a1,[p4:p3].a2)

a1 = arc(l2.p1,l2.p2,[l1.p1:p4].a1,[p4:l2.p2].a2)

p6 = meet(p1,l2.a1+5,p3,l2.a2-15)

p6 = meet(l2.p1,l2.a1+5,l2.p2,l2.a2-15)

p7 = intercept(p1,l1.l/2,p3,l2.a2,1)

//p7 = intercept(l2.p1,l1.l/2,p3,l2.a2,1)

//p7 = intercept(p1,l1.l/2,l2.p2,l2.a2,1)

p8 = adjacent(p1, p3, [p1:p3].l/5, 2)

p8 = adjacent(l2.p1,l2.p2, [p1:p3].l/5, 2)

p9 = midpoint(p1,p2)

p9 = midpoint(l1.p1,l1.p2)

This post has replies: ( #7 )