octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #39370] contourc adds duplicates to the start


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #39370] contourc adds duplicates to the start and end of the 1st level
Date: Tue, 26 Jul 2022 10:34:25 -0400 (EDT)

Follow-up Comment #12, bug #39370 (project octave):

thanks for the quick followup.  I realize that there's no difference when
plotting, but I have seen some use cases where people use contourc to generate
a level contour for computation not plotting, and I assume the idea with the
revised contourc is to clean up the redundancy for things like that. may also
explain why it keeps things like the lev=0 case in the original set that gets
thrown out for plotting.

checking in matlab for something similar to your sombrero plot (using peaks
instead), it looks like their algorithm in both contour and contourc keep both
endpoints for closed contours, and they are 'exact'. so, yes, octave applying
a blind 'unique' trim postprocess may be a problem there as you'd lose the
closing point to the contour. In general keeping them with O(eps) differences
are likely irrelevant for plotting, but i guess it could create a leaky
contour if it was used to define a boundary in a numerical analysis that
assumed it didn't need to correct for it. can the contour algo produce
intersecting/branching contours with similar issues or are they necessarily
single paths?


>> [xx,yy,zz] = peaks();
>> a = contour(xx,yy,zz,[6 7 8])
a =
  Columns 1 through 14
    6.0000   -0.2668   -0.2500   -0.1250         0    0.1250    0.2244   
0.2500    0.3750    0.4600    0.5000    0.5417    0.5488    0.5000
   31.0000    1.2500    1.2433    1.2169    1.2127    1.2266    1.2500   
1.2580    1.3176    1.3750    1.4296    1.5000    1.6250    1.7446
  Columns 15 through 28
    0.4974    0.3750    0.3695    0.2500    0.1250         0   -0.1250  
-0.2500   -0.3714   -0.3750   -0.4930   -0.5000   -0.5382   -0.5276
    1.7500    1.8711    1.8750    1.9349    1.9708    1.9829    1.9719   
1.9366    1.8750    1.8725    1.7500    1.7337    1.6250    1.5000
  Columns 29 through 42
   -0.5000   -0.4536   -0.3750   -0.2668    7.0000   -0.2515   -0.2500  
-0.1250         0    0.1250    0.2202    0.2500    0.3591    0.3750
    1.4476    1.3750    1.3095    1.2500   23.0000    1.3750    1.3741   
1.3335    1.3246    1.3425    1.3750    1.3934    1.5000    1.6176
  Columns 43 through 56
    0.3758    0.3750    0.2953    0.2500    0.1250         0   -0.1250  
-0.2500   -0.3000   -0.3750   -0.3789   -0.3750   -0.3664   -0.2515
    1.6250    1.6266    1.7500    1.7831    1.8383    1.8570    1.8405   
1.7870    1.7500    1.6333    1.6250    1.5788    1.5000    1.3750
  Columns 57 through 62
    8.0000   -0.0849         0    0.0670         0   -0.0849
    5.0000    1.6250    1.5054    1.6250    1.6483    1.6250
>> b = contourc(xx(1,:),yy(:,1),zz,[6 7 8])
b =
  Columns 1 through 14
    6.0000   -0.5000   -0.4930   -0.3750   -0.3714   -0.2500   -0.1250        
0    0.1250    0.2500    0.3695    0.3750    0.4974    0.5000
   31.0000    1.7337    1.7500    1.8725    1.8750    1.9366    1.9719   
1.9829    1.9708    1.9349    1.8750    1.8711    1.7500    1.7446
  Columns 15 through 28
    0.5488    0.5417    0.5000    0.4600    0.3750    0.2500    0.2244   
0.1250         0   -0.1250   -0.2500   -0.2668   -0.3750   -0.4536
    1.6250    1.5000    1.4296    1.3750    1.3176    1.2580    1.2500   
1.2266    1.2127    1.2169    1.2433    1.2500    1.3095    1.3750
  Columns 29 through 42
   -0.5000   -0.5276   -0.5382   -0.5000    7.0000   -0.3750   -0.3000  
-0.2500   -0.1250         0    0.1250    0.2500    0.2953    0.3750
    1.4476    1.5000    1.6250    1.7337   23.0000    1.6333    1.7500   
1.7870    1.8405    1.8570    1.8383    1.7831    1.7500    1.6266
  Columns 43 through 56
    0.3758    0.3750    0.3591    0.2500    0.2202    0.1250         0  
-0.1250   -0.2500   -0.2515   -0.3664   -0.3750   -0.3789   -0.3750
    1.6250    1.6176    1.5000    1.3934    1.3750    1.3425    1.3246   
1.3335    1.3741    1.3750    1.5000    1.5788    1.6250    1.6333
  Columns 57 through 62
    8.0000         0    0.0670         0   -0.0849         0
    5.0000    1.6483    1.6250    1.5054    1.6250    1.6483

>> a(:,2)-a(:,32)
ans =
     0
     0
>> a(:,56)-a(:,34)
ans =
     0
     0
>> a(:,58)-a(:,62)
ans =
     0
     0
>> b(:,2)-b(:,32)
ans =
     0
     0
>> b(:,56)-b(:,34)
ans =
     0
     0
>> b(:,58)-b(:,62)
ans =
     0
     0




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?39370>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]