View Issue Details

IDProjectCategoryView StatusLast Update
0030365Open CASCADEOCCT:Modeling Algorithmspublic2021-11-27 15:04
ReporternbvAssigned Tosmoskvin  
PrioritynormalSeverityintegration request 
Status verifiedResolutionfixed 
Target Version7.7.0 
Summary0030365: Modeling Algorithms - Create tool to compute deviation between any 2D-curve and some its segment
DescriptionSee the message 0029203:0071647.

Namely

<< 3. Improve the algorithm of computation of deflection between discrete polygon and source curve (see method BRepTopAdaptor_FClass2d::Init()). Currently, the computed deflection is equal to the length of projection of middle-point of arc to the chord. New algorithm can be based on GCPnts_DistFunction2d class or can use simple iteration formula (obtained if we apply Newton-algorithm to GCPnts_DistFunction2d function):

                    U(n+1)=U(n)-(C'(Un).Crossed(D))/(C''(U(n)).Crossed(D))

where C' and C'' are 1st and 2nd derivative of the curve, obtained in the point U(n), D - direction of the segment of the polygon.

Please note that this formula is satisfied for 2D-space only. For 3D-algorithm it will look more complexly.
Steps To ReproduceAll necessary test cases have already been created and pushed to the branch.
TagsNo tags attached.
Test case numberlowalgos/2ddeviation/A1, A2, A3

Relationships

related to 0029203 feedbackmsv Ambiguous behavior of Point-Face-classification algorithms: shall it return ON-status? 
related to 0029421 feedbackmsv Make face classifier algorithm stable and robust 

Activities

git

2018-11-12 17:02

administrator   ~0081063

Branch CR30365 has been created by nbv.

SHA-1: ee7f6f2b73926ff91d2f109f8c8ad78503365f22


Detailed log of new commits:

Author: nbv
Date: Mon Nov 12 17:00:06 2018 +0300

    0030365: Create tool to compute deviation between any 2D-curve and some its segment
    
    The tool, DRAW-command for its check and corresponding test cases have been created.
    
    See documentation about new tool in GeomLib_Tool.hxx file.

nbv

2018-11-13 09:28

developer   ~0081065

Dear Mikhail,

Please review CR30365 branch.

Test results: http://jenkins-test-12.nnov.opencascade.com/view/CR30365-master_NBV/

git

2018-11-19 10:04

administrator   ~0081162

Branch CR30365 has been updated forcibly by nbv.

SHA-1: 426649480dc1abc50e5ec1f1ea1e2b1c43b9f83c

nbv

2018-11-19 10:43

developer   ~0081163

Branch has been rebased on current MASTER.

msv

2018-12-03 16:27

developer   ~0081366

src/GeomliteTest/GeomliteTest_API2dCommands.cxx
- 560: incorrect usage string, does not correspond to help.

git

2018-12-04 10:07

administrator   ~0081378

Branch CR30365 has been updated forcibly by nbv.

SHA-1: 2a5e819d71838ad1b3869e48400cfcd7cc6ee587

nbv

2018-12-04 10:07

developer   ~0081379

Last edited: 2018-12-04 10:08

Done.

The branch CR30365 has been rebased on current MASTER.

git

2021-11-15 14:30

administrator   ~0105195

Branch CR30365_1 has been created by asuraven.

SHA-1: 43bb59f4e0d2ca998a975c76a7842cd7aeaa8b86


Detailed log of new commits:

Author: nbv
Date: Mon Nov 12 17:00:06 2018 +0300

    0030365: Create tool to compute deviation between any 2D-curve and some its segment
    
    The tool, DRAW-command for its check and corresponding test cases have been created.
    
    See documentation about new tool in GeomLib_Tool.hxx file.

git

2021-11-15 14:31

administrator   ~0105196

Branch CR30365_1 has been updated forcibly by asuraven.

SHA-1: 7ff8caf8ef6d9fed923a1da1e151b71d0492eca9

asuraven

2021-11-15 17:52

reporter   ~0105199

Issue has been rebased on current master in branch CR30365_1
Tests results: http://jenkins-test-occt/view/CR30365_1-master-ASURAVEN/view/COMPARE/

msv

2021-11-16 10:38

developer   ~0105205

It is needed to check why the test has failed:
sat read_parallel_1 C8

msv

2021-11-16 10:40

developer   ~0105206

Also, the difference in images seems to be something new:
IMAGE sat doc_6 D5: D5.png differs [2002 different pixels]

kgv

2021-11-16 11:07

developer   ~0105207

Last edited: 2021-11-16 11:07

> Also, the difference in images seems to be something new:
> IMAGE sat doc_6 D5: D5.png differs [2002 different pixels]
I guess this one is an artifact of Jenkins preparation to OCCT 7.6.0 release (reference version is not master).

msv

2021-11-16 12:32

developer   ~0105210

The new method is named ComputeDevation. Please remane it to ComputeDeviation.

The help of the command 2ddeviation has no description of options. This description is available when the command is run with less than 2 arguments. This logic is strange. It is better to extend the help, and output an error message if the arguments number is not enough.

In the command 2ddeviation the parameter theNbIters in calls to the computation methods is hard-coded as 10 and 100. It is better to add new cmd parameters for that.

asuraven

2021-11-18 18:28

reporter   ~0105246

git

2021-11-22 14:01

administrator   ~0105350

Branch CR30365_1 has been updated forcibly by asuraven.

SHA-1: 6d6678fe170161b839f6b06d7c3eeb6c3e8aa1ac

git

2021-11-22 16:41

administrator   ~0105357

Branch CR30365_1 has been updated forcibly by asuraven.

SHA-1: 05ba967fac8243b75a26d584035d9346920d4e9e

asuraven

2021-11-23 13:11

reporter   ~0105370

Dear Michael, please review branch CR30365_1
Tests results are here: http://jenkins-test-occt.nnov.opencascade.com/view/CR30365_1-master-ASURAVEN/view/COMPARE/

kgv

2021-11-23 15:16

developer   ~0105372

--- a/src/GeomLib/GeomLib_Tool.cxx
+++ b/src/GeomLib/GeomLib_Tool.cxx
+class FuncSolveDeviation : public math_MultipleVarFunction

Though unlikely, such definition might create name collisions in application symbols.
Please put internal classes into nameless namespace.

 protected:
 
-
-
-
-
 private:

While cleaning up the header - please remove redundant empty "protected" scope.

+  //!     - theLine - the linear segment joining the point of theCurve having parameters
+  //!                 theFPar and theLPar.
+  Standard_EXPORT static
+    Standard_Real ComputeDeviation(const Geom2dAdaptor_Curve& theCurve,

Please use Doxygen tags `@param` to document function parameters.

-    if (n == 2)
+    if (n == 2) .
...
-
+    .

Unrelated and undesired changes adding redundant trailing spaces.

   switch (T2)
   {
-    case GeomAbs_Line:
-    {
+  case GeomAbs_Line:
+  {

Please revert.

+  theCommands.Add("2ddeviation", "deviation2d result curve [-i U0] [-d N] [-Napprox N] [-Nexact N] [-approxOnly]\n"

Command names in description do not match.

+//
+//            math_PSO Algorithm is used.
+//
+//           ATTENTION!!!
+//            The main idea of this method is to obtain rough value of returned
+//            parameter (fast but not precisely). The found value can be precised
+//            by 2nd method GeomLib_Tool::ComputeDevation(...) (see above).
+//=======================================================================
+Standard_Real GeomLib_Tool::ComputeDeviation(const Geom2dAdaptor_Curve& theCurve,

Please avoid duplication of method description - move details to .hxx.

+  inline void GetLine(gp_Lin2d* const theLine) const
+  {

Redundant "inline".

msv

2021-11-23 23:07

developer   ~0105384

src/GeomliteTest/GeomliteTest_API2dCommands.cxx
- misprint "deviation compiting", "mathod"
- In the command help, it is not needed to put options in quotes.

git

2021-11-24 18:36

administrator   ~0105395

Branch CR30365_2 has been created by asuraven.

SHA-1: 1f74dad55ecfea6a19c1e5746b2b0bffed22c09e


Detailed log of new commits:

Author: nbv
Date: Mon Nov 12 17:00:06 2018 +0300

    0030365: Modeling Algorithms - Create tool to compute deviation between any 2D-curve and some its segment
    
    The tool, DRAW-command for its check and corresponding test cases have been created.
    
    See documentation about new tool in GeomLib_Tool.hxx file.

asuraven

2021-11-24 18:40

reporter   ~0105396

Remarks fixed in new branch CR30365_2
Tests are running now

msv

2021-11-24 19:20

developer   ~0105397

Last edited: 2021-11-24 19:21

When using @param there is no sense in spaces and '-', e.g. change
  //!     - @param thePtOnCurve - the point on curve where maximal deviation is achieved;

to
  //! @param thePtOnCurve - the point on curve where maximal deviation is achieved;


About moving details into header, I think it is better to leave the low-level description where local function FuncSolveDeviation is mentioned in the cxx file. Leave in the header only information that is needed to know to use this method. And please avoid duplication here. E.g., I see several duplications:
  //! Iterative method is used for computation. So, theStartParameter is
  //! needed to be set. Recommend value of theStartParameter can be found with
  //! the overloaded method.

and
  //! 1. The computed value is heavily dependent on the theStartParameter.
  //!  E.g. the method can reach a minimal value of the function instead of its
  //!  maximal value. Or it can reach some local (not global) maximum.
  //! 2. Recommend value of theStartParameter can be found with 
  //!  2nd method GeomLib_Tool::ComputeDevation (see below).


  //! The main idea of this method is to obtain rough value of returned
  //! parameter (fast but not precisely). The found value can be precised
  // !by 2nd method GeomLib_Tool::ComputeDevation(...) (see above).

and
  //! This algorithm cannot compute deviation precisely (so, there is no point in
  //! setting big value of theNbIters). But it can give some start point for
  //! the overloaded method.


  // !by 2nd method GeomLib_Tool::ComputeDevation(...) (see above).

Violation of doxygen syntax: "// !"

asuraven

2021-11-24 20:16

reporter   ~0105402

remarks for comments fixed in same branch

git

2021-11-24 20:17

administrator   ~0105404

Branch CR30365_2 has been updated forcibly by asuraven.

SHA-1: 2a817dd3526277cf04e49b6e9aaeeb24be3ee596

kgv

2021-11-24 21:20

developer   ~0105406

+//function : ComputeDevation
...
+Standard_Real GeomLib_Tool::ComputeDeviation(const Geom2dAdaptor_Curve& theCurve,

Name mismatch.

+    else if (!strcmp(theArgv[aCurrArg], "-Nexact"))

It is not nice to perform case-sensitive comparison of such arguments.

+  char aBuff[1000];
+  theDI << "Computed value is: " << aDefl << "\n";
+
+  Sprintf(aBuff, "%s_pnt", theArgv[1]);

Please avoid fixed-size buffers - just use TCollection_AsciiString.

+  return  Sqrt(Abs(aSqDefl));

Unexpected double space.

+  Standard_Real aSqDefl = -1.0;
...
+    return aSqDefl;
...
+  aSqDefl = RealLast();
+  aMPSO.Perform(aStep, aSqDefl, anOutputPnt, theNbIters);

What is the point initializing variable to -1.0 and then overriding it with RealLast()?
Please just put "return -1.0;" instead.

+  const math_Vector aFPar(1, 1, theFPar);


+//! Target function to compute deviation of the source
+//! 2D-curve. It is one-variate function. Its parameter
+//! is a parameter on the curve. Deviation is a maximal

It looks nicer when line is interrupted at the end of sentence rather than one word before the end.

msv

2021-11-24 23:28

developer   ~0105407

Please consider remarks of Kirill.

git

2021-11-25 14:21

administrator   ~0105419

Branch CR30365_2 has been updated forcibly by asuraven.

SHA-1: eeb8d7b0718815fa4ead0f549744b2cd3995a287

asuraven

2021-11-25 14:22

reporter   ~0105420

Kirill's remarks fixed in CR30365_2 branch

msv

2021-11-25 18:42

developer   ~0105428

For integration:
occt - CR30365_2
products - none

kgv

2021-11-25 20:41

developer   ~0105436

Last edited: 2021-11-25 20:41

Andrey,

current git commit description:
0030365: Modeling Algorithms - Create tool to compute deviation between any 2D-curve and some its segment

The tool, DRAW-command for its check and corresponding test cases have been created.

See documentation about new tool in GeomLib_Tool.hxx file.

leaves reader in frustration as it teases with some new tool, some new command, but mentions neither of them!
Could you please update issue title and git commit to mention clearly names of new method(s) and draw command(s)?

git

2021-11-26 11:31

administrator   ~0105445

Branch CR30365_2 has been updated forcibly by asuraven.

SHA-1: 235fe0a5c5f6557f5095cfe5a378707609f8f888

asuraven

2021-11-26 11:32

reporter   ~0105446

commit description fixed

smoskvin

2021-11-27 14:25

reporter   ~0105470

Combination -
OCCT branch : IR-2021-11-26
master SHA - 4a837ecec21bfe24d9c224c4b59aa9779156f297
49e51745631c52b6c452c65adae4d6dfa21a1b1e
Products branch : IR-2021-11-26 SHA - 5da5872bffc6c1fa745ee5e33ac09c4fffd349b4
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18390.380000000398 / 18549.650000000624 [-0.86%]
Products
Total CPU difference: 11648.280000000103 / 11661.570000000122 [-0.11%]
Windows-64-VC14:
OCCT
Total CPU difference: 19927.859375 / 19945.046875 [-0.09%]
Products
Total CPU difference: 13059.03125 / 13091.625 [-0.25%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2021-11-27 15:04

administrator   ~0105478

Branch CR30365 has been deleted by mnt.

SHA-1: 2a5e819d71838ad1b3869e48400cfcd7cc6ee587

git

2021-11-27 15:04

administrator   ~0105479

Branch CR30365_1 has been deleted by mnt.

SHA-1: 05ba967fac8243b75a26d584035d9346920d4e9e

git

2021-11-27 15:04

administrator   ~0105480

Branch CR30365_2 has been deleted by mnt.

SHA-1: 235fe0a5c5f6557f5095cfe5a378707609f8f888

Related Changesets

occt: master 323e88ad

2018-11-12 14:00:06

nbv


Committer: smoskvin Details Diff
0030365: Modeling Algorithms - Create tool to compute deviation between any 2D-curve and some its segment

Adds two new overloaded 'ComputeDeviation()' function (approx & exact) to GeomLib_Tool class to calculates the parameter in the curve where the maximum deviation is obtained between the curve and the line segment connecting its points with the specified parameters

Adds new '2ddeviation' DRAW command for 'ComputeDeviation()' functional testing
Affected Issues
0030365
mod - src/GeomLib/GeomLib_Tool.cxx Diff File
mod - src/GeomLib/GeomLib_Tool.hxx Diff File
mod - src/GeomliteTest/GeomliteTest_API2dCommands.cxx Diff File
add - tests/lowalgos/2ddeviation/A1 Diff File
add - tests/lowalgos/2ddeviation/A2 Diff File
add - tests/lowalgos/2ddeviation/A3 Diff File
mod - tests/lowalgos/grids.list Diff File

Issue History

Date Modified Username Field Change
2018-11-12 16:48 nbv New Issue
2018-11-12 16:48 nbv Assigned To => msv
2018-11-12 16:48 nbv Assigned To msv => nbv
2018-11-12 16:48 nbv Status new => assigned
2018-11-12 16:51 nbv Severity minor => integration request
2018-11-12 16:52 nbv Relationship added related to 0029203
2018-11-12 17:02 git Note Added: 0081063
2018-11-13 09:28 nbv Note Added: 0081065
2018-11-13 09:28 nbv Assigned To nbv => msv
2018-11-13 09:28 nbv Status assigned => resolved
2018-11-13 09:28 nbv Steps to Reproduce Updated
2018-11-19 10:04 git Note Added: 0081162
2018-11-19 10:43 nbv Note Added: 0081163
2018-11-23 12:57 nbv Relationship added related to 0029421
2018-12-03 16:27 msv Note Added: 0081366
2018-12-04 10:07 git Note Added: 0081378
2018-12-04 10:07 nbv Note Added: 0081379
2018-12-04 10:08 nbv Note Edited: 0081379
2019-07-18 12:34 msv Target Version 7.4.0 => 7.5.0
2020-09-14 23:03 msv Status resolved => feedback
2020-09-14 23:03 msv Target Version 7.5.0 => 7.6.0
2021-08-29 18:24 msv Target Version 7.6.0 => 7.7.0
2021-08-29 18:26 msv Status feedback => resolved
2021-11-15 12:55 szy Assigned To msv => asuraven
2021-11-15 13:58 kgv Summary Create tool to compute deviation between any 2D-curve and some its segment => Modeling Algorithms - Create tool to compute deviation between any 2D-curve and some its segment
2021-11-15 14:30 git Note Added: 0105195
2021-11-15 14:31 git Note Added: 0105196
2021-11-15 17:50 asuraven Assigned To asuraven => msv
2021-11-15 17:52 asuraven Note Added: 0105199
2021-11-16 10:38 msv Note Added: 0105205
2021-11-16 10:40 msv Note Added: 0105206
2021-11-16 11:07 kgv Note Added: 0105207
2021-11-16 11:07 kgv Note Edited: 0105207
2021-11-16 12:32 msv Note Added: 0105210
2021-11-16 12:33 msv Assigned To msv => asuraven
2021-11-16 12:33 msv Status resolved => assigned
2021-11-18 18:28 asuraven Note Added: 0105246
2021-11-22 14:01 git Note Added: 0105350
2021-11-22 16:41 git Note Added: 0105357
2021-11-23 13:11 asuraven Note Added: 0105370
2021-11-23 13:11 asuraven Assigned To asuraven => msv
2021-11-23 13:11 asuraven Status assigned => resolved
2021-11-23 15:16 kgv Note Added: 0105372
2021-11-23 23:07 msv Note Added: 0105384
2021-11-23 23:07 msv Assigned To msv => asuraven
2021-11-23 23:07 msv Status resolved => assigned
2021-11-24 18:36 git Note Added: 0105395
2021-11-24 18:40 asuraven Note Added: 0105396
2021-11-24 18:40 asuraven Assigned To asuraven => msv
2021-11-24 18:40 asuraven Status assigned => resolved
2021-11-24 19:20 msv Note Added: 0105397
2021-11-24 19:21 msv Note Edited: 0105397
2021-11-24 19:22 msv Assigned To msv => asuraven
2021-11-24 19:22 msv Status resolved => assigned
2021-11-24 20:16 asuraven Note Added: 0105402
2021-11-24 20:16 asuraven Assigned To asuraven => msv
2021-11-24 20:16 asuraven Status assigned => resolved
2021-11-24 20:17 git Note Added: 0105404
2021-11-24 21:20 kgv Note Added: 0105406
2021-11-24 23:28 msv Note Added: 0105407
2021-11-24 23:28 msv Assigned To msv => asuraven
2021-11-24 23:28 msv Status resolved => assigned
2021-11-25 14:21 git Note Added: 0105419
2021-11-25 14:22 asuraven Note Added: 0105420
2021-11-25 14:22 asuraven Assigned To asuraven => msv
2021-11-25 14:22 asuraven Status assigned => resolved
2021-11-25 18:42 msv Note Added: 0105428
2021-11-25 18:42 msv Assigned To msv => bugmaster
2021-11-25 18:42 msv Status resolved => reviewed
2021-11-25 20:41 kgv Note Added: 0105436
2021-11-25 20:41 kgv Assigned To bugmaster => asuraven
2021-11-25 20:41 kgv Status reviewed => feedback
2021-11-25 20:41 kgv Note Edited: 0105436
2021-11-26 11:31 git Note Added: 0105445
2021-11-26 11:32 asuraven Note Added: 0105446
2021-11-26 11:32 asuraven Assigned To asuraven => msv
2021-11-26 11:32 asuraven Status feedback => resolved
2021-11-26 12:21 msv Assigned To msv => kgv
2021-11-26 12:26 kgv Assigned To kgv => bugmaster
2021-11-26 12:26 kgv Status resolved => reviewed
2021-11-27 14:25 smoskvin Note Added: 0105470
2021-11-27 14:25 smoskvin Status reviewed => tested
2021-11-27 14:28 smoskvin Test case number => lowalgos/2ddeviation/A1, A2, A3
2021-11-27 14:52 smoskvin Changeset attached => occt master 323e88ad
2021-11-27 14:52 smoskvin Assigned To bugmaster => smoskvin
2021-11-27 14:52 smoskvin Status tested => verified
2021-11-27 14:52 smoskvin Resolution open => fixed
2021-11-27 15:04 git Note Added: 0105478
2021-11-27 15:04 git Note Added: 0105479
2021-11-27 15:04 git Note Added: 0105480