Archived issue #0026474
Wrong computation of the resolution value
Description
Wrong computation of the resolution value for the attached curve.
The problem can be reproduced with the new test command implemented in the attached *.cxx file.
The problem can be reproduced with the new test command implemented in the attached *.cxx file.
Steps to reproduce
restore curve c
cresolution c 1
# Resolution: 2.[revision removed]-022
cresolution c 5
# Resolution: 1.[revision removed]-021
cresolution c 10
# Resolution: 2.[revision removed]-021
cresolution c 100
# Resolution: 2.[revision removed]-020
cresolution c 500
# Resolution: 1.[revision removed]-019
length c
# The length c is 45.000000000010424
cresolution c 1
# Resolution: 2.[revision removed]-022
cresolution c 5
# Resolution: 1.[revision removed]-021
cresolution c 10
# Resolution: 2.[revision removed]-021
cresolution c 100
# Resolution: 2.[revision removed]-020
cresolution c 500
# Resolution: 1.[revision removed]-019
length c
# The length c is 45.000000000010424
Public activity
5 archived notes
Participants are labeled by their role within this record.
Calculation of resolution is not wrong.
2d resolution is estimatrd according to expression:
Res2d = Tol3d/(C'max)
C'max is majorizing estimation of curve first derivating.
Since some first curve knots are very small:
1 : 0 9
2 : 1.05755317956988e-022 7
3 : 1.78731240455025e-022 7
4 : 2.97759065402356e-022 7
5 : 3.73286165819553e-022 7
6 : 4.54736616300819e-022 7
7 : 5.82844651988856e-022 7
8 : 6.53579545489009e-020 7
9 : 2.1249198383615e-019 7
10 : 3.55638685921299e-019 7
11 : 1.00859242629379e-016 7
12 : 2.15539638728077e-016 7
13 : 3.14857393542064e-016 7
14 : 5.30298369824571e-016 7
15 : 8.08760874529295e-016 7
16 : 1.0849592894131e-015 7
17 : 1.49225488540852e-015 7
....
this value is ~ 10^22, for example:
Draw[12]> cvalue c 0 x y z dx dy dz
Draw[13]> dump dx dy dz
*********** Dump of dx *************
-1.77399180322545e+021
*********** Dump of dy *************
1.02421464513816e+021
*********** Dump of dz *************
10242208341509.6
So, this estimation is quite valid.
In my opinion, it is better to treat such value of resolution by correct way in application, then modify algorithm of calculation of resolution by any way.
2d resolution is estimatrd according to expression:
Res2d = Tol3d/(C'max)
C'max is majorizing estimation of curve first derivating.
Since some first curve knots are very small:
1 : 0 9
2 : 1.05755317956988e-022 7
3 : 1.78731240455025e-022 7
4 : 2.97759065402356e-022 7
5 : 3.73286165819553e-022 7
6 : 4.54736616300819e-022 7
7 : 5.82844651988856e-022 7
8 : 6.53579545489009e-020 7
9 : 2.1249198383615e-019 7
10 : 3.55638685921299e-019 7
11 : 1.00859242629379e-016 7
12 : 2.15539638728077e-016 7
13 : 3.14857393542064e-016 7
14 : 5.30298369824571e-016 7
15 : 8.08760874529295e-016 7
16 : 1.0849592894131e-015 7
17 : 1.49225488540852e-015 7
....
this value is ~ 10^22, for example:
Draw[12]> cvalue c 0 x y z dx dy dz
Draw[13]> dump dx dy dz
*********** Dump of dx *************
-1.77399180322545e+021
*********** Dump of dy *************
1.02421464513816e+021
*********** Dump of dz *************
10242208341509.6
So, this estimation is quite valid.
In my opinion, it is better to treat such value of resolution by correct way in application, then modify algorithm of calculation of resolution by any way.
What is your recommendation about how to treat such value of resolution by correct way in application?
As I understand, we can trust global resolution value only for well parameterized curves. If we cannot trust to computed global resolution on some curve, we should propose the alternative approach. E.g., if we want to know which parameter on curve corresponds to the farthest point reached from the start by the vertex tolerance, then we could use the algorithm GCPnts_AbscissaPoint. Can we propose an universal solution?
And the main question remains what criteria should we check to see that resolution is wrong in a particular case?
As I understand, we can trust global resolution value only for well parameterized curves. If we cannot trust to computed global resolution on some curve, we should propose the alternative approach. E.g., if we want to know which parameter on curve corresponds to the farthest point reached from the start by the vertex tolerance, then we could use the algorithm GCPnts_AbscissaPoint. Can we propose an universal solution?
And the main question remains what criteria should we check to see that resolution is wrong in a particular case?
The correct treatment of global resolution depends on given task in application, which uses global resolution. There is no universal solution. The global resolution is the lower bound of 2d tolerance along whole curve. I application needs this lower bound only, it is quite correct value. If application needs more precise estimation near point with parameter t (for example to find "real" 2d tolerance of vertex), it is better using "point" resolution ~Tol3d/|C'(t)|. As far as I know, resolution is used by EdgeEdge algo to define step along t for searching common parts of two curves. For this case it is better to set any tmin, for example tmin ~ 0.001*(l-f) and if res < tmin, then use any other algorithms to define step.
Answer on "main question":
resolution, calculated by current algorithm is never wrong, it corresponds knot distribution and other parameters of curve, it is only ~ 1/|C'max|. It only can be wrong for using in given task. The problem is that sometimes we cannot use global resolution and must use "point" resolution instead. To check this it is possible to calculate "point" resolution for some values of t and compare with global resolution. If difference is too large, it is most likely that we must use other approaches to solve given task.
Answer on "main question":
resolution, calculated by current algorithm is never wrong, it corresponds knot distribution and other parameters of curve, it is only ~ 1/|C'max|. It only can be wrong for using in given task. The problem is that sometimes we cannot use global resolution and must use "point" resolution instead. To check this it is possible to calculate "point" resolution for some values of t and compare with global resolution. If difference is too large, it is most likely that we must use other approaches to solve given task.
Nothing to change, nothing to test, no need to create test.
Dear Eugeny, please confirm to close this bug.
Dear Eugeny, please confirm to close this bug.
I confirm.
Dear Commenter 1, please close the issue.
Dear Commenter 1, please close the issue.
Related records