View Issue Details

IDProjectCategoryView StatusLast Update
0004275FreeCADBugpublic2022-01-24 19:16
ReporterHakanseven12 Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status confirmedResolutionopen 
Target Version0.20 
Summary0004275: [OCC/Coin] Rendering issue with large coordinate values
DescriptionWhen I created an object(wire,point,mesh etc.) at large coordinate values(eight or nine orders of magnitude), object look vawy. When zoom in or zoom out objects change their positions.

I think OCC uses 32bit float variables and it dont work properly at large coordinates. FreeCAD need a general solution that works for every workbench at large coordinates.

In the script below, I create a list with several points with the larger values, then re-reference those points w.r.t the start to 'normalize' them and get the values into a smaller range. The difference is obvious when it gets rendered.
Steps To ReproduceRun this macro

from FreeCAD import Vector
import Part

points = [
    Vector (4275011518.128912, 507510589.4751387, 0.0),
    Vector (4275011717.0043764, 507511569.4996429, 0.0),
    Vector (4275011913.4291606, 507512550.0182727, 0.0),
    Vector (4275012107.4020367, 507513531.0248998, 0.0),
    Vector (4275012298.921793, 507514512.5133929, 0.0),
    Vector (4275012487.987232, 507515494.4776178, 0.0),
    Vector (4275012674.5971723, 507516476.91143715, 0.0),
    Vector (4275012858.7504473, 507517459.80871075, 0.0),
    Vector (4275013040.445906, 507518443.1632955, 0.0),
    Vector (4275013219.6824136, 507519426.96904546, 0.0),
    Vector (4275013396.4588485, 507520411.21981186, 0.0),
    Vector (4275013570.774107, 507521395.9094431, 0.0),
    Vector (4275013742.6270995, 507522381.0317848, 0.0),
    Vector (4275013912.0167513, 507523366.5806801, 0.0),
    Vector (4275014078.942004, 507524352.5499692, 0.0),
    Vector (4275014243.401815, 507525338.93348986, 0.0),
    Vector (4275014405.3951554, 507526325.72507715, 0.0),
    Vector (4275014564.9210134, 507527312.9185637, 0.0),
    Vector (4275014721.9783916, 507528300.5077795, 0.0),
    Vector (4275014876.5663085, 507529288.48655206, 0.0),
    Vector (4275015028.6837983, 507530276.8487066, 0.0),
    Vector (4275015178.3299093, 507531265.58806586, 0.0),
    Vector (4275015325.5037074, 507532254.6984502, 0.0),
    Vector (4275015470.204272, 507533244.1736777, 0.0),
    Vector (4275015612.430699, 507534234.00756407, 0.0),
    Vector (4275015752.1820993, 507535224.19392294, 0.0),
    Vector (4275015889.4575996, 507536214.7265656, 0.0),
    Vector (4275016024.256342, 507537205.5993012, 0.0),
    Vector (4275016156.5774837, 507538196.80593693, 0.0),
    Vector (4275016286.420198, 507539188.3402776, 0.0),
    Vector (4275016413.783673, 507540180.19612616, 0.0),
    Vector (4275016538.6671133, 507541172.3672835, 0.0),
    Vector (4275016661.069738, 507542164.84754866, 0.0),
    Vector (4275016780.990782, 507543157.6307185, 0.0),
    Vector (4275016898.429496, 507544150.7105882, 0.0),
    Vector (4275017013.3851457, 507545144.08095104, 0.0),
    Vector (4275017125.857013, 507546137.7355984, 0.0),
    Vector (4275017235.8443947, 507547131.66832, 0.0),
    Vector (4275017343.346604, 507548125.8729037, 0.0),
    Vector (4275017448.362968, 507549120.3431357, 0.0),
    Vector (4275017550.892831, 507550115.0728007, 0.0),
    Vector (4275017650.9355516, 507551110.0556815, 0.0),
    Vector (4275017748.4905057, 507552105.2855596, 0.0),
    Vector (4275017843.557082, 507553100.7562147, 0.0),
    Vector (4275017936.134688, 507554096.4614251, 0.0),
    Vector (4275018026.222744, 507555092.39496773, 0.0),
    Vector (4275018113.820687, 507556088.550618, 0.0),
    Vector (4275018198.92797, 507557084.9221499, 0.0),
    Vector (4275018281.5440607, 507558081.50333613, 0.0),
    Vector (4275018361.6684427, 507559078.287948, 0.0),
    Vector (4275018439.3006153, 507560075.2697558, 0.0),
    Vector (4275018514.4400935, 507561072.4425281, 0.0),
    Vector (4275018587.0864077, 507562069.80003285, 0.0),
    Vector (4275018657.239104, 507563067.3360364, 0.0),
    Vector (4275018724.897743, 507564065.04430425, 0.0),
    Vector (4275018790.061903, 507565062.9186007, 0.0),
    Vector (4275018852.731176, 507566060.95268893, 0.0),
    Vector (4275018912.905171, 507567059.1403314, 0.0),
    Vector (4275018970.583511, 507568057.47528934, 0.0),
    Vector (4275019025.765836, 507569055.95132315, 0.0),
    Vector (4275019078.451801, 507570054.56219244, 0.0),
    Vector (4275019128.6410766, 507571053.3016559, 0.0),
    Vector (4275019176.3333497, 507572052.1634713, 0.0),
    Vector (4275019221.5283217, 507573051.14139575, 0.0),
    Vector (4275019264.2257104, 507574050.2291858, 0.0),
    Vector (4275019304.4252486, 507575049.420597, 0.0),
    Vector (4275019342.1266856, 507576048.70938456, 0.0),
    Vector (4275019377.329785, 507577048.0893028, 0.0),
    Vector (4275019410.0343275, 507578047.5541056, 0.0),
    Vector (4275019440.240108, 507579047.09754634, 0.0),
    Vector (4275019467.9469385, 507580046.7133779, 0.0),
    Vector (4275019493.1546454, 507581046.39535266, 0.0),
    Vector (4275019515.863071, 507582046.13722265, 0.0),
    Vector (4275019536.072074, 507583045.93273944, 0.0),
    Vector (4275019553.781527, 507584045.7756543, 0.0),
    Vector (4275019568.9913206, 507585045.6597183, 0.0),
    Vector (4275019581.701359, 507586045.578682, 0.0),
    Vector (4275019591.9115624, 507587045.52629614, 0.0),
    Vector (4275019599.6218677, 507588045.49631083, 0.0),
    Vector (4275019604.8322268, 507589045.4824764, 0.0),
    Vector (4275019607.5426064, 507590045.4785429, 0.0),
    Vector (4275019607.7529902, 507591045.47826034, 0.0),
    Vector (4275019605.4633765, 507592045.47537875, 0.0),
    Vector (4275019600.67378, 507593045.46364814, 0.0),
    Vector (4275019593.3842306, 507594045.4368186, 0.0),
    Vector (4275019583.5947733, 507595045.3886403, 0.0),
    Vector (4275019571.3054695, 507596045.3128635, 0.0),
    Vector (4275019556.5163965, 507597045.2032388, 0.0),
    Vector (4275019539.2276464, 507598045.0535167, 0.0),
    Vector (4275019519.439327, 507599044.8574483, 0.0),
    Vector (4275019497.151562, 507600044.60878474, 0.0),
    Vector (4275019472.3644915, 507601044.3012776, 0.0),
    Vector (4275019445.0782695, 507602043.9286788, 0.0),
    Vector (4275019415.293067, 507603043.4847407, 0.0),
    Vector (4275019402.2241297, 507603457.47993255, 0.0)
]

points_2 = []

for _pt in points:
    points_2.append(_pt.sub(points[0]))

curve_1 = Part.makePolygon(points)
curve_2 = Part.makePolygon(points_2)

curve_1.Placement.Base = Vector(points[0]).multiply(-1.0)
curve_1.Placement.Base.x += 1000.0

Part.show(curve_1)
Part.show(curve_2)
Additional InformationTracking this via OCC bugs in the bugtracker forum thread
Tags#ready-for-migration, Coin3d, OCC Bug
FreeCAD InformationOS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19697 (Git)
Build type: Release
Branch: master
Hash: 8832356802011bf5d70e9d6f0efa89c47bc70a91
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Turkish/Turkey (tr_TR)

Activities

Hakanseven12

2020-03-01 10:17

reporter  

OCC Bug.png (9,239 bytes)   
OCC Bug.png (9,239 bytes)   

wmayer

2020-03-01 11:49

administrator   ~0014191

The problem is that the internal view and model matrices of Coin3d causes quite big round-off errors when multiplying with huge coordinate values.

Kunda1

2020-03-01 12:17

administrator   ~0014192

OP, please link back to forum thread discussions when you open a ticket, it makes tracking convenient for devs and triaging, thanks!

https://forum.freecadweb.org/viewtopic.php?f=10&t=35935
https://forum.freecadweb.org/viewtopic.php?f=3&t=36362

Kunda1

2020-03-01 12:18

administrator   ~0014193

Is anyone going to check and if need be open a ticket on the coin3d bugtracker ?
https://github.com/coin3d/coin

Hakanseven12

2020-03-02 10:07

reporter   ~0014196

Last edited: 2020-03-02 10:08

I opened a ticket and got this answer:
https://github.com/coin3d/coin/issues/371

Hakanseven12

2020-03-03 20:19

reporter   ~0014203

Last edited: 2020-03-03 20:20

I think core implementation of this Coin class can solve problem
https://coin3d.github.io/Coin/html/classSoGeoOrigin.html#details

Hakanseven12

2020-04-04 23:52

reporter   ~0014319

Is there any interest for this or is it postponed to 0.20?

Kunda1

2020-04-05 13:15

administrator   ~0014322

Last edited: 2020-04-05 13:15

@Hakanseven12 Can you write-up a proposal, perhaps a dev will read it and take it on ?

Hakanseven12

2020-05-11 21:46

reporter   ~0014415

Last edited: 2020-05-11 21:49

We are start to working on something. https://forum.freecadweb.org/viewtopic.php?f=8&t=22277&start=980#p395784

Also I created a guide to use SoGeo classes. https://forum.freecadweb.org/viewtopic.php?f=3&t=36362

I hope the other FreeCAD workbenches will be start to integrate SoGeo objects.

Kunda1

2020-12-31 12:28

administrator   ~0015186

@Hakanseven12 is this also an upstream OCC bug ?

Kunda1

2020-12-31 13:07

administrator   ~0015193

Tracking this via OCC bugs in the bugtracker forum thread

yorik

2022-03-03 13:55

administrator   ~0016870

This ticket has been migrated to GitHub as issue 6036.

Issue History

Date Modified Username Field Change
2020-03-01 10:17 Hakanseven12 New Issue
2020-03-01 10:17 Hakanseven12 File Added: OCC Bug.png
2020-03-01 11:49 wmayer Note Added: 0014191
2020-03-01 12:17 Kunda1 Note Added: 0014192
2020-03-01 12:18 Kunda1 Status new => confirmed
2020-03-01 12:18 Kunda1 Description Updated
2020-03-01 12:18 Kunda1 Steps to Reproduce Updated
2020-03-01 12:18 Kunda1 FreeCAD Information OS: Windows 10 (10.0) Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.19.19697 (Git) Build type: Release Branch: master Hash: 8832356802011bf5d70e9d6f0efa89c47bc70a91 Python version: 3.7.3 Qt version: 5.12.5 Coin version: 4.0.0a OCC ver... => OS: Windows 10 (10.0) Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.19.19697 (Git) Build type: Release Branch: master Hash: 8832356802011bf5d70e9d6f0efa89c47bc70a91 Python version: 3.7.3 Qt version: 5.12.5 Coin version: 4.0.0...
2020-03-01 12:18 Kunda1 Note Added: 0014193
2020-03-01 12:26 Hakanseven12 Tag Attached: Coin3d
2020-03-01 12:26 Hakanseven12 Tag Attached: OCC Bug
2020-03-02 10:07 Hakanseven12 Note Added: 0014196
2020-03-02 10:08 Hakanseven12 Note Edited: 0014196
2020-03-03 20:19 Hakanseven12 Note Added: 0014203
2020-03-03 20:20 Hakanseven12 Note Edited: 0014203
2020-04-04 23:52 Hakanseven12 Note Added: 0014319
2020-04-05 13:15 Kunda1 Note Added: 0014322
2020-04-05 13:15 Kunda1 Note Edited: 0014322
2020-05-11 21:46 Hakanseven12 Note Added: 0014415
2020-05-11 21:46 Hakanseven12 Note Edited: 0014415
2020-05-11 21:49 Hakanseven12 Note Edited: 0014415
2020-12-31 12:28 Kunda1 Note Added: 0015186
2020-12-31 13:07 Kunda1 Additional Information Updated
2020-12-31 13:07 Kunda1 Note Added: 0015193
2021-02-06 06:49 abdullah Target Version => 0.20
2022-01-24 19:16 Kunda1 Tag Attached: #ready-for-migration