Reputation: 3
I have got a list of an axes list of an AutoCad Drawing. Something Like:
[Line3D(Point3D(1647113117371448512892615841780535357281063/737059219536588389452555455100000000000,
1366943276273750947371820063466288403112033/737059219536588389452555455100000000000,0),
Point3D(26100284670260312636891118431/12305005361967700000000000,
1189236919681/781250000, 0)), ...]
When I try to plot them, lines that should be distinct are plotting as the same line. So instead of this I get this. Here are some example lines:
[Line3D(Point3D(1647113117371448512892615841780535357281063/737059219536588389452555455100000000000,
1366943276273750947371820063466288403112033/737059219536588389452555455100000000000, 0),
Point3D(26100284670260312636891118431/12305005361967700000000000,1189236919681/781250000, 0)),
Line3D(Point3D(26100284670260312636891118431/12305005361967700000000000, 1189236919681/781250000, 0),
Point3D(25165031213118241584901717751/12305005361967700000000000, 32496091107827/25000000000, 0)),
Line3D(Point3D(41101789294162424289223442852282888370853/12972516184739051605249750292000000000,
6691132495400952526204407114066106055714449/3567441950803239191443681330300000000000, 0),
Point3D(1428208758971484993356170173/478363263194784800000000, 1189236919681/781250000, 0)),
Line3D(Point3D(1428208758971484993356170173/478363263194784800000000, 1189236919681/781250000, 0),
Point3D(6865969238483742249815501841/2391816315973924000000000, 32496091107827/25000000000, 0)),
Line3D(Point3D(1647113117371448512892615841780535357281063/737059219536588389452555455100000000000,
1366943276273750947371820063466288403112033/737059219536588389452555455100000000000, 0),
Point3D(41101789294162424289223442852282888370853/12972516184739051605249750292000000000,
6691132495400952526204407114066106055714449/3567441950803239191443681330300000000000, 0)),
Line3D(Point3D(41101789294162424289223442852282888370853/12972516184739051605249750292000000000,
6691132495400952526204407114066106055714449/3567441950803239191443681330300000000000, 0),
Point3D(42856219552476685009520165509926367369987/21754044541659661721907121840000000000,
1105918704715895215440142199637240956944223/598236224895640697352445850600000000000, 0)),
Line3D(Point3D(26100284670260312636891118431/12305005361967700000000000, 1189236919681/781250000, 0),
Point3D(1428208758971484993356170173/478363263194784800000000, 1189236919681/781250000, 0)),
Line3D(Point3D(1428208758971484993356170173/478363263194784800000000, 1189236919681/781250000, 0),
Point3D(3662923296227402176907170887/2001416543837740000000000, 1189236919681/781250000, 0)),
Line3D(Point3D(25165031213118241584901717751/12305005361967700000000000, 32496091107827/25000000000, 0),
Point3D(6865969238483742249815501841/2391816315973924000000000, 32496091107827/25000000000, 0)),
Line3D(Point3D(6865969238483742249815501841/2391816315973924000000000, 32496091107827/25000000000, 0),
Point3D(3472204942560698802701958357/2001416543837740000000000, 32496091107827/25000000000, 0)),
Line3D(Point3D(42856219552476685009520165509926367369987/21754044541659661721907121840000000000,
1105918704715895215440142199637240956944223/598236224895640697352445850600000000000, 0),
Point3D(3662923296227402176907170887/2001416543837740000000000, 1189236919681/781250000, 0)),
Line3D(Point3D(3662923296227402176907170887/2001416543837740000000000, 1189236919681/781250000, 0),
Point3D(3472204942560698802701958357/2001416543837740000000000, 32496091107827/25000000000, 0))
]
Upvotes: 0
Views: 50
Reputation: 19093
Although Python has support for integers of arbitrary size, the division of two high-precision integers gives a finite precision float. So let's consider two of your integers
>>> n,d=1647113117371448512892615841780535357281063,737059219536588389452555455100000000000
And let's compare the ratios of n/d
and n/(d+10^20)
:
>>> n/d == n/(d + 10**20)
True
So even though the example you gave doesn't have this problem, maybe some of those in the '50-60' line case do. The simplest fix is to sympify a string of the lines you are dealing with, e.g. lines = sympify('''[Line3D(Point3D(1/2, ...))]'''). This will convert the integer ratios to Rationals of arbitrary precision and hopefully not lose precision for you when plotting.
Upvotes: 1