Open StarsoftAnalysis opened 5 years ago
My initial thoughts, I could be mistaken....
"math domain error" must be from math.acos(), which requires its argument to be in a certain range -1, 1 ? (Read about atan2() and atan(), one is more lenient. Maybe pyeuclid is using too restrictive a function acos().)
Does a line segment define one vector? In other words, are you accessing a private attribute "v" of the line segment "seg" when you use "seg.v". I started by looking at the readme for pyeuclid, and it doesn't describe a method of accessing the vector of a segment. It seems to me that a line segment does NOT uniquely describe a vector.
Yes, it's an arccos vs. floating point thing: it's trying to evaluate math.acos(1.00000002)
.
I've fixed it by using math.atan2()
instead, and could do a patch or pull request if required.
I've stumbled upon a bug in the otherwise-wonderful Python euclid library. It initially occurred with the Arch Linux package python-euclid3, and I've just reproduced it with the latest Git-cloned version from here.
Here's the problem reduced to a few lines in the interpreter. I'm not sure if there's anything special about the values 114,96 etc. -- when I tried it with simpler lines in the same directions, the problem went away.
I'm using Python 3.7.2 on up-to-date 64-bit Arch Linux.