import os ,math ,time ,cv2 #line:2
import numpy as np #line:4
import pickle #line:5
import urllib .request #line:6
import urllib .parse #line:7
from PIL import Image #line:8
import matplotlib .pyplot as plt #line:9
np .set_printoptions (threshold =np .inf ,precision =8 ,suppress =True ,floatmode ='maxprec')#line:11
file ='https://shoe-craft-terminal.s3.ap-northeast-1.amazonaws.com/サンプル太郎/sample.pckl'#line:15
s_quote =urllib .parse .quote (file )#line:16
print (s_quote )#line:17
class ft :#line:19
    def __init__ (O00O000OOOO0O0OOO ):#line:20
        pass #line:21
    def __del__ (O00O00O0OOOO00OOO ):#line:22
        pass #line:23
    def load_obj (OOOOOO0O0OO00O0O0 ):#line:26
        print ('file:\n{}'.format (OOOOOO0O0OO00O0O0 ))#line:27
        OOOOO0000000O0OO0 =[]#line:29
        O00O0OO0OO00O0O00 =[]#line:30
        OOO0OOOO0O000OO0O =[]#line:31
        with open (OOOOOO0O0OO00O0O0 ,"r")as OOO000OO000O00OOO :#line:32
            for O0OOO0O00000O0OOO in OOO000OO000O00OOO :#line:33
                OO00OO00O00O00000 =O0OOO0O00000O0OOO .split ()#line:34
                if len (OO00OO00O00O00000 )==0 :#line:36
                    continue #line:37
                if OO00OO00O00O00000 [0 ]=='v':#line:38
                    OO00OOO0O0O000OO0 =list (map (float ,OO00OO00O00O00000 [1 :4 ]))#line:40
                    OOOOO0000000O0OO0 .append (OO00OOO0O0O000OO0 )#line:41
                    if len (OO00OO00O00O00000 )==7 :#line:42
                        O00OO0OO00O00O0O0 =list (map (float ,OO00OO00O00O00000 [4 :7 ]))#line:44
                        O00O0OO0OO00O0O00 .append (O00OO0OO00O00O0O0 )#line:45
                if OO00OO00O00O00000 [0 ]=='f':#line:46
                    O0OOO0O0O0O0OOO00 =list (map (int ,OO00OO00O00O00000 [1 :4 ]))#line:48
                    OOO0OOOO0O000OO0O .append (O0OOO0O0O0O0OOO00 )#line:49
        OOOOO0000000O0OO0 =np .array (OOOOO0000000O0OO0 )#line:50
        O00O0OO0OO00O0O00 =np .array (O00O0OO0OO00O0O00 )#line:51
        OOO0OOOO0O000OO0O =np .array (OOO0OOOO0O000OO0O ,int )#line:52
        print ('vertices.shape:\n{}'.format (OOOOO0000000O0OO0 .shape ))#line:53
        print ('vertexColors.shape:\n{}'.format (O00O0OO0OO00O0O00 .shape ))#line:54
        print ('faces.shape:\n{}'.format (OOO0OOOO0O000OO0O .shape ))#line:55
        return OOOOO0000000O0OO0 ,O00O0OO0OO00O0O00 ,OOO0OOOO0O000OO0O #line:56
    def load_pckl (O0OO0O0OO0OOO0OOO ):#line:60
        print ('file:\n{}'.format (O0OO0O0OO0OOO0OOO ))#line:61
        with open (O0OO0O0OO0OOO0OOO ,'rb')as OOOO0OOOOOOO00OOO :#line:62
            OOO0O00O0OOO0000O ,O00O0OOO00000O00O ,O0OOOOOO0000000O0 =pickle .load (OOOO0OOOOOOO00OOO )#line:63
        print ('vertices.shape:\n{}'.format (OOO0O00O0OOO0000O .shape ))#line:65
        print ('vertexColors.shape:\n{}'.format (O00O0OOO00000O00O .shape ))#line:66
        print ('faces.shape:\n{}'.format (O0OOOOOO0000000O0 .shape ))#line:67
        return OOO0O00O0OOO0000O ,O00O0OOO00000O00O ,O0OOOOOO0000000O0 #line:68
    def load_pckl_url (O00000OOOOO0000OO ):#line:71
        print ('load from cloud')#line:72
        O0O0OOOOO0O0O00OO =O00000OOOOO0000OO .split ('//')[1 ]#line:74
        O0O0OOOOO0O0O00OO =urllib .parse .quote (O0O0OOOOO0O0O00OO )#line:75
        O00000OOOOO0000OO =O00000OOOOO0000OO .split ('//')[0 ]+'//'+O0O0OOOOO0O0O00OO #line:76
        O0O0O0O0O0OOO00O0 =urllib .request .Request (O00000OOOOO0000OO )#line:78
        with urllib .request .urlopen (O0O0O0O0O0OOO00O0 )as OO00O0O0OOOOO0OOO :#line:79
            OOOOO0OOOOOOOO00O ,O0O000OO0OOOO000O ,OO0OOO0OOO00O00O0 =pickle .load (OO00O0O0OOOOO0OOO )#line:80
        print ('vertices.shape:\n{}'.format (OOOOO0OOOOOOOO00O .shape ))#line:82
        print ('vertexColors.shape:\n{}'.format (O0O000OO0OOOO000O .shape ))#line:83
        print ('faces.shape:\n{}'.format (OO0OOO0OOO00O00O0 .shape ))#line:84
        return OOOOO0OOOOOOOO00O ,O0O000OO0OOOO000O ,OO0OOO0OOO00O00O0 #line:85
    def down_sample (OOO00OO00O000000O ,OO000O0O0OO0000OO ,O00OOO00O0OO0O0OO ):#line:89
        print ('v.shape:\n{} -> '.format (OOO00OO00O000000O .shape ),end ='')#line:90
        if len (OOO00OO00O000000O )>O00OOO00O0OO0O0OO :#line:91
            OOO00OO00O000000O =OOO00OO00O000000O [::len (OOO00OO00O000000O )//O00OOO00O0OO0O0OO ][:O00OOO00O0OO0O0OO ]#line:92
            OO000O0O0OO0000OO =OO000O0O0OO0000OO [::len (OO000O0O0OO0000OO )//O00OOO00O0OO0O0OO ][:O00OOO00O0OO0O0OO ]#line:93
        print ('{}'.format (OOO00OO00O000000O .shape ))#line:94
        return OOO00OO00O000000O ,OO000O0O0OO0000OO #line:95
    def rotate_3D_x (OO0O000O0O00O0000 ,theta =0 ):#line:100
        OO00O00OO0OO0O00O =-theta /57.2958 #line:101
        OO0OOOOOOO00O0O0O =np .array ([[1 ,0 ,0 ],[0 ,np .cos (OO00O00OO0OO0O00O ),-np .sin (OO00O00OO0OO0O00O )],[0 ,np .sin (OO00O00OO0OO0O00O ),np .cos (OO00O00OO0OO0O00O )]])#line:105
        return np .dot (OO0O000O0O00O0000 ,OO0OOOOOOO00O0O0O )#line:106
    def rotate_3D_y (O0OO0000OOO0O0O00 ,theta =0 ):#line:108
        OOOOOOOO0O0OOOOO0 =-theta /57.2958 #line:109
        OOO0O0O00000OO0O0 =np .array ([[np .cos (OOOOOOOO0O0OOOOO0 ),0 ,np .sin (OOOOOOOO0O0OOOOO0 )],[0 ,1 ,0 ],[-np .sin (OOOOOOOO0O0OOOOO0 ),0 ,np .cos (OOOOOOOO0O0OOOOO0 )]])#line:113
        return np .dot (O0OO0000OOO0O0O00 ,OOO0O0O00000OO0O0 )#line:114
    def rotate_3D_z (O00O000O0O0OOO000 ,theta =0 ):#line:116
        OO0O0O00000O00OO0 =-theta /57.2958 #line:117
        O0OOO0O0OO0O0OOOO =np .array ([[np .cos (OO0O0O00000O00OO0 ),-np .sin (OO0O0O00000O00OO0 ),0 ],[np .sin (OO0O0O00000O00OO0 ),np .cos (OO0O0O00000O00OO0 ),0 ],[0 ,0 ,1 ]])#line:121
        return np .dot (O00O000O0O0OOO000 ,O0OOO0O0OO0O0OOOO )#line:122
    def rotate_2D_z (O00O0O000OOO00000 ,theta =0 ):#line:125
        O00O0O0OOOOO0OOO0 =+theta /57.2958 #line:126
        O0OOOOO00OOOOO00O =np .array ([[np .cos (O00O0O0OOOOO0OOO0 ),-np .sin (O00O0O0OOOOO0OOO0 )],[np .sin (O00O0O0OOOOO0OOO0 ),np .cos (O00O0O0OOOOO0OOO0 )]])#line:129
        return np .dot (O00O0O000OOO00000 ,O0OOOOO00OOOOO00O )#line:130
    def show (O00O0O00000OOOO0O ,dim ='xy',*O0OO00000OOO00000 ,save =None ):#line:134
        plt .figure (figsize =(5 ,5 ))#line:135
        O000OO00OOO0O0OO0 ,OO00O00OOOO0O0O0O ,OOOOOO00O0O0000O0 =O00O0O00000OOOO0O [:,0 ],O00O0O00000OOOO0O [:,1 ],O00O0O00000OOOO0O [:,2 ]#line:137
        if dim =='xy':#line:138
            plt .scatter (O000OO00OOO0O0OO0 ,OO00O00OOOO0O0O0O ,c ='k',s =2 )#line:139
        elif dim =='xz':#line:140
            plt .scatter (O000OO00OOO0O0OO0 ,OOOOOO00O0O0000O0 ,c ='k',s =2 )#line:141
        elif dim =='yz':#line:142
            plt .scatter (OO00O00OOOO0O0O0O ,OOOOOO00O0O0000O0 ,c ='k',s =2 )#line:143
        plt .xlabel (dim [0 ]);plt .ylabel (dim [1 ])#line:145
        if len (O0OO00000OOO00000 )>0 :#line:147
            O0OO00000OOO00000 =np .array (O0OO00000OOO00000 )#line:148
            plt .plot (O0OO00000OOO00000 [:,0 ],O0OO00000OOO00000 [:,1 ],'ro',linewidth =1 )#line:149
        OOOO0OOOO0OOO00OO =np .max (np .array ([[np .max (O000OO00OOO0O0OO0 )-np .min (O000OO00OOO0O0OO0 )],[np .max (OO00O00OOOO0O0O0O )-np .min (OO00O00OOOO0O0O0O )],[np .max (OOOOOO00O0O0000O0 )-np .min (OOOOOO00O0O0000O0 )]]))#line:151
        if dim =='xy':#line:153
            plt .xlim (np .mean (O000OO00OOO0O0OO0 )-OOOO0OOOO0OOO00OO /1.8 ,np .mean (O000OO00OOO0O0OO0 )+OOOO0OOOO0OOO00OO /1.8 )#line:154
            plt .ylim (np .mean (OO00O00OOOO0O0O0O )-OOOO0OOOO0OOO00OO /1.8 ,np .mean (OO00O00OOOO0O0O0O )+OOOO0OOOO0OOO00OO /1.8 )#line:155
        elif dim =='xz':#line:156
            plt .xlim (np .mean (O000OO00OOO0O0OO0 )-OOOO0OOOO0OOO00OO /1.8 ,np .mean (O000OO00OOO0O0OO0 )+OOOO0OOOO0OOO00OO /1.8 )#line:157
            plt .ylim (np .mean (OOOOOO00O0O0000O0 )-OOOO0OOOO0OOO00OO /1.8 ,np .mean (OOOOOO00O0O0000O0 )+OOOO0OOOO0OOO00OO /1.8 )#line:158
        elif dim =='yz':#line:159
            plt .xlim (np .mean (OO00O00OOOO0O0O0O )-OOOO0OOOO0OOO00OO /1.8 ,np .mean (OO00O00OOOO0O0O0O )+OOOO0OOOO0OOO00OO /1.8 )#line:160
            plt .ylim (np .mean (OOOOOO00O0O0000O0 )-OOOO0OOOO0OOO00OO /1.8 ,np .mean (OOOOOO00O0O0000O0 )+OOOO0OOOO0OOO00OO /1.8 )#line:161
        if save !=None :#line:162
            plt .savefig (save )#line:163
        plt .show ()#line:164
        plt .close ()#line:165
    def showc (O0OOOO0O0O0O0O0O0 ,OOO00O0O0OOO00000 ,dim ='xy',*OOO00O0OO0O0OOO00 ,save =None ):#line:167
        plt .figure (figsize =(5 ,5 ))#line:168
        OOO000000000OO00O ,O00O00OO00OOOO00O ,OO00O0OO0O0O000OO =O0OOOO0O0O0O0O0O0 [:,0 ],O0OOOO0O0O0O0O0O0 [:,1 ],O0OOOO0O0O0O0O0O0 [:,2 ]#line:170
        if dim =='xy':#line:171
            plt .scatter (OOO000000000OO00O ,O00O00OO00OOOO00O ,c =OOO00O0O0OOO00000 /255.0 ,s =2 )#line:172
        elif dim =='xz':#line:173
            plt .scatter (OOO000000000OO00O ,OO00O0OO0O0O000OO ,c =OOO00O0O0OOO00000 /255.0 ,s =2 )#line:174
        elif dim =='yz':#line:175
            plt .scatter (O00O00OO00OOOO00O ,OO00O0OO0O0O000OO ,c =OOO00O0O0OOO00000 /255.0 ,s =2 )#line:176
        plt .xlabel (dim [0 ]);plt .ylabel (dim [1 ])#line:178
        if len (OOO00O0OO0O0OOO00 )>0 :#line:180
            OOO00O0OO0O0OOO00 =np .array (OOO00O0OO0O0OOO00 )#line:181
            plt .plot (OOO00O0OO0O0OOO00 [:,1 ],OOO00O0OO0O0OOO00 [:,0 ],'ro',linewidth =1 )#line:183
        OOOOO000O0OO0OOOO =np .max (np .array ([[np .max (OOO000000000OO00O )-np .min (OOO000000000OO00O )],[np .max (O00O00OO00OOOO00O )-np .min (O00O00OO00OOOO00O )],[np .max (OO00O0OO0O0O000OO )-np .min (OO00O0OO0O0O000OO )]]))#line:185
        if dim =='xy':#line:187
            plt .xlim (np .mean (OOO000000000OO00O )-OOOOO000O0OO0OOOO /1.8 ,np .mean (OOO000000000OO00O )+OOOOO000O0OO0OOOO /1.8 )#line:188
            plt .ylim (np .mean (O00O00OO00OOOO00O )-OOOOO000O0OO0OOOO /1.8 ,np .mean (O00O00OO00OOOO00O )+OOOOO000O0OO0OOOO /1.8 )#line:189
        elif dim =='xz':#line:190
            plt .xlim (np .mean (OOO000000000OO00O )-OOOOO000O0OO0OOOO /1.8 ,np .mean (OOO000000000OO00O )+OOOOO000O0OO0OOOO /1.8 )#line:191
            plt .ylim (np .mean (OO00O0OO0O0O000OO )-OOOOO000O0OO0OOOO /1.8 ,np .mean (OO00O0OO0O0O000OO )+OOOOO000O0OO0OOOO /1.8 )#line:192
        elif dim =='yz':#line:193
            plt .xlim (np .mean (O00O00OO00OOOO00O )-OOOOO000O0OO0OOOO /1.8 ,np .mean (O00O00OO00OOOO00O )+OOOOO000O0OO0OOOO /1.8 )#line:194
            plt .ylim (np .mean (OO00O0OO0O0O000OO )-OOOOO000O0OO0OOOO /1.8 ,np .mean (OO00O0OO0O0O000OO )+OOOOO000O0OO0OOOO /1.8 )#line:195
        if save !=None :#line:196
            plt .savefig (save )#line:197
        plt .show ()#line:198
        plt .close ()#line:199
class pl_class :#line:211
    def __init__ (O0O0O000OOOOOOOOO ,OOOOO000O0O0O000O ):#line:212
        O0O0O000OOOOOOOOO .npoints =OOOOO000O0O0O000O #line:213
        O0O0O000OOOOOOOOO .p =np .empty ((OOOOO000O0O0O000O ,2 ),dtype =int )#line:214
        O0O0O000OOOOOOOOO .count =0 #line:215
    def add (O000O0OOOOOO0OO00 ,O00OOOOOOOOOO000O ,O00OO00OO0OO0O0OO ):#line:217
        O000O0OOOOOO0OO00 .p [O000O0OOOOOO0OO00 .count ,:]=[O00OOOOOOOOOO000O ,O00OO00OO0OO0O0OO ]#line:218
        O000O0OOOOOO0OO00 .count +=1 #line:219
class cl_class :#line:222
    def __init__ (O0OOO0OO00OO0O0OO ,OO0O00OOOOO00OO00 ,O0O00000OOOOO0OO0 ,OOO000O0O00000OOO ,O0OO0O000OOOOO000 ,OOOOOOOO0000OOO00 ):#line:223
        O0OOO0OO00OO0O0OO .window_size =OO0O00OOOOO00OO00 #line:224
        O0OOO0OO00OO0O0OO .dot_size =O0O00000OOOOO0OO0 #line:225
        O0OOO0OO00OO0O0OO .h =OO0O00OOOOO00OO00 #line:226
        O0OOO0OO00OO0O0OO .w =OO0O00OOOOO00OO00 #line:227
        O0OOO0OO00OO0O0OO .paper_short =OOO000O0O00000OOO #line:228
        O0OOO0OO00OO0O0OO .paper_long =O0OO0O000OOOOO000 #line:229
        O0OOO0OO00OO0O0OO .rate1 =OOOOOOOO0000OOO00 #line:230
        O0OOO0OO00OO0O0OO .p ='a'#line:231
        O0OOO0OO00OO0O0OO .t =0 #line:232
        O0OOO0OO00OO0O0OO .qqq1 =0 #line:233
        O0OOO0OO00OO0O0OO .qqq2 =0 #line:234
    def __del__ (O000OOO00O00OOO00 ):#line:236
        pass #line:237
    def window_zoom (O0O0OOO0O0O000OO0 ,OOOOOOOOOO00OO000 ,OOO0OO00O000O00OO ):#line:239
        OOOOOOO0O00000O0O ,OOO00OOO0O00OOOO0 =OOOOOOOOOO00OO000 [:,0 ],OOOOOOOOOO00OO000 [:,1 ]#line:240
        O000O00OO00O0OOO0 =np .zeros ((O0O0OOO0O0O000OO0 .window_size ,O0O0OOO0O0O000OO0 .window_size ,3 ),int )#line:241
        OO0O0O0O0000O00OO =np .max (OOOOOOO0O00000O0O )#line:243
        O0O0OOOOOOO0000OO =np .max (OOO00OOO0O00OOOO0 )#line:244
        O0OO0O000OO0OO000 =min (O0O0OOO0O0O000OO0 .window_size /OO0O0O0O0000O00OO ,O0O0OOO0O0O000OO0 .window_size /O0O0OOOOOOO0000OO )#line:248
        O0OO0OOO00O0O000O ,O0000OOO00OO0OO00 =(OOOOOOO0O00000O0O *O0OO0O000OO0OO000 ).astype (int ),(OOO00OOO0O00OOOO0 *O0OO0O000OO0OO000 ).astype (int )#line:249
        OO00O0OO000O0000O =O0O0OOO0O0O000OO0 .dot_size #line:251
        for O00OOOO00OOO0O00O in range (len (OOOOOOOOOO00OO000 )):#line:252
            if O0OO0OOO00O0O000O [O00OOOO00OOO0O00O ]+OO00O0OO000O0000O <O0O0OOO0O0O000OO0 .window_size and O0000OOO00OO0OO00 [O00OOOO00OOO0O00O ]+OO00O0OO000O0000O <O0O0OOO0O0O000OO0 .window_size :#line:253
                O000O00OO00O0OOO0 [O0OO0OOO00O0O000O [O00OOOO00OOO0O00O ]-OO00O0OO000O0000O :O0OO0OOO00O0O000O [O00OOOO00OOO0O00O ]+OO00O0OO000O0000O ,O0000OOO00OO0OO00 [O00OOOO00OOO0O00O ]-OO00O0OO000O0000O :O0000OOO00OO0OO00 [O00OOOO00OOO0O00O ]+OO00O0OO000O0000O ]=OOO0OO00O000O00OO [O00OOOO00OOO0O00O ]#line:254
        O0OOO0OOOO000O0O0 =Image .fromarray (O000O00OO00O0OOO0 .astype (np .uint8 ))#line:257
        O0OOO0OOOO000O0O0 =np .array (O0OOO0OOOO000O0O0 ,dtype =np .uint8 )#line:259
        O0OOO0OOOO000O0O0 =cv2 .cvtColor (O0OOO0OOOO000O0O0 ,cv2 .COLOR_RGB2BGR )#line:260
        cv2 .rectangle (O0OOO0OOOO000O0O0 ,(O0O0OOO0O0O000OO0 .window_size *19 //20 ,0 ),(O0O0OOO0O0O000OO0 .window_size ,O0O0OOO0O0O000OO0 .window_size //20 ),(64 ,64 ,64 ),thickness =-1 )#line:263
        cv2 .putText (O0OOO0OOOO000O0O0 ,'Undo',(O0O0OOO0O0O000OO0 .window_size *19 //20 ,O0O0OOO0O0O000OO0 .window_size //20 ),cv2 .FONT_HERSHEY_PLAIN ,1.0 ,(255 ,255 ,255 ),1 )#line:264
        return O0OOO0OOOO000O0O0 ,O0OO0O000OO0OO000 #line:266
    def window_zoom_back (OOO0O0000OOOOOO00 ,OOOOOOO00OO0000O0 ,OOOOOOO0000O0OO00 ,OOO0O0000000O000O ,O0OOOOO0O0000OO0O ):#line:268
        OOOOOOO0OO00000O0 ,OOOO00OOO0OO000OO =OOOOOOO00OO0000O0 [:,1 ],OOOOOOO00OO0000O0 [:,2 ]#line:269
        OO0O0O000O0OO000O =np .zeros ((OOO0O0000OOOOOO00 .window_size ,OOO0O0000OOOOOO00 .window_size ,3 ),int )#line:270
        OO0OO0O0OO0000OOO =np .max (OOOOOOO0OO00000O0 )#line:272
        OO0OO0OO000O00OOO =OOO0O0000OOOOOO00 .window_size /OO0OO0O0OO0000OOO #line:275
        OO0O0O0O0OO00O0OO ,OOO0O0O0OO0OOOOOO =(OOOOOOO0OO00000O0 *OO0OO0OO000O00OOO ).astype (int ),(OOOO00OOO0OO000OO *OO0OO0OO000O00OOO ).astype (int )#line:276
        O00000OOOOO00OOO0 =int (OOO0O0000000O000O *OO0OO0OO000O00OOO )#line:277
        O0000O0000O00O0OO =int (O0OOOOO0O0000OO0O *OO0OO0OO000O00OOO )#line:278
        OOO0O0O0OO0OOOOOO =(OOO0O0O0OO0OOOOOO *-1 )+(OOO0O0000OOOOOO00 .window_size //2 )#line:281
        O0O0000O0OOOO0000 =OOO0O0000OOOOOO00 .dot_size #line:283
        for OO0OO00O00000000O in range (len (OOOOOOO00OO0000O0 )):#line:284
            if OO0O0O0O0OO00O0OO [OO0OO00O00000000O ]+O0O0000O0OOOO0000 <OOO0O0000OOOOOO00 .window_size and OOO0O0O0OO0OOOOOO [OO0OO00O00000000O ]+O0O0000O0OOOO0000 <OOO0O0000OOOOOO00 .window_size :#line:285
                OO0O0O000O0OO000O [OOO0O0O0OO0OOOOOO [OO0OO00O00000000O ]-O0O0000O0OOOO0000 :OOO0O0O0OO0OOOOOO [OO0OO00O00000000O ]+O0O0000O0OOOO0000 ,OO0O0O0O0OO00O0OO [OO0OO00O00000000O ]-O0O0000O0OOOO0000 :OO0O0O0O0OO00O0OO [OO0OO00O00000000O ]+O0O0000O0OOOO0000 ]=OOOOOOO0000O0OO00 [OO0OO00O00000000O ]#line:286
        OO0O0O000O0OO000O [:,O00000OOOOO00OOO0 ,:]=[0 ,255 ,255 ]#line:289
        OO0O0O000O0OO000O [:,O0000O0000O00O0OO ,:]=[0 ,255 ,255 ]#line:290
        OOOOOOOO0O00O00O0 =Image .fromarray (OO0O0O000O0OO000O .astype (np .uint8 ))#line:293
        OOOOOOOO0O00O00O0 =np .array (OOOOOOOO0O00O00O0 ,dtype =np .uint8 )#line:295
        OOOOOOOO0O00O00O0 =cv2 .cvtColor (OOOOOOOO0O00O00O0 ,cv2 .COLOR_RGB2BGR )#line:296
        cv2 .rectangle (OOOOOOOO0O00O00O0 ,(OOO0O0000OOOOOO00 .window_size *19 //20 ,0 ),(OOO0O0000OOOOOO00 .window_size ,OOO0O0000OOOOOO00 .window_size //20 ),(64 ,64 ,64 ),thickness =-1 )#line:299
        cv2 .putText (OOOOOOOO0O00O00O0 ,'Undo',(OOO0O0000OOOOOO00 .window_size *19 //20 ,OOO0O0000OOOOOO00 .window_size //20 ),cv2 .FONT_HERSHEY_PLAIN ,1.0 ,(255 ,255 ,255 ),1 )#line:300
        return OOOOOOOO0O00O00O0 ,OO0OO0OO000O00OOO #line:302
    def window_zoom_side (O00O0OOOOO0O0OO0O ,OO0000O0O00O0O0OO ,O00OOOOOOO00000O0 ):#line:304
        O00OOO0OOOO0O00OO ,OO000OOO0OOO0OO00 =OO0000O0O00O0O0OO [:,0 ],OO0000O0O00O0O0OO [:,2 ]#line:305
        O00OOO00OO0OOO00O =np .zeros ((O00O0OOOOO0O0OO0O .window_size ,O00O0OOOOO0O0OO0O .window_size ,3 ),int )#line:306
        O0OO0OOOOO00O00OO =np .max (O00OOO0OOOO0O00OO )#line:308
        OOOOO0OO00OOOOOO0 =O00O0OOOOO0O0OO0O .window_size /O0OO0OOOOO00O00OO #line:311
        O0O0OOOOO0OOO00OO ,O0OO0OO0O0O00OOOO =(O00OOO0OOOO0O00OO *OOOOO0OO00OOOOOO0 ).astype (int ),(OO000OOO0OOO0OO00 *OOOOO0OO00OOOOOO0 ).astype (int )#line:312
        O0OO0OO0O0O00OOOO =(O0OO0OO0O0O00OOOO *-1 )+(O00O0OOOOO0O0OO0O .window_size //2 )#line:315
        O00000OOOO0O000OO =O00O0OOOOO0O0OO0O .dot_size #line:317
        for OOOOOOOO0O0OOOO00 in range (len (OO0000O0O00O0O0OO )):#line:318
            if O0O0OOOOO0OOO00OO [OOOOOOOO0O0OOOO00 ]+O00000OOOO0O000OO <O00O0OOOOO0O0OO0O .window_size and O0OO0OO0O0O00OOOO [OOOOOOOO0O0OOOO00 ]+O00000OOOO0O000OO <O00O0OOOOO0O0OO0O .window_size :#line:319
                O00OOO00OO0OOO00O [O0OO0OO0O0O00OOOO [OOOOOOOO0O0OOOO00 ]-O00000OOOO0O000OO :O0OO0OO0O0O00OOOO [OOOOOOOO0O0OOOO00 ]+O00000OOOO0O000OO ,O0O0OOOOO0OOO00OO [OOOOOOOO0O0OOOO00 ]-O00000OOOO0O000OO :O0O0OOOOO0OOO00OO [OOOOOOOO0O0OOOO00 ]+O00000OOOO0O000OO ]=O00OOOOOOO00000O0 [OOOOOOOO0O0OOOO00 ]#line:320
        OOO0OOOOOO0O00000 =Image .fromarray (O00OOO00OO0OOO00O .astype (np .uint8 ))#line:323
        OOO0OOOOOO0O00000 =np .array (OOO0OOOOOO0O00000 ,dtype =np .uint8 )#line:325
        OOO0OOOOOO0O00000 =cv2 .cvtColor (OOO0OOOOOO0O00000 ,cv2 .COLOR_RGB2BGR )#line:326
        cv2 .rectangle (OOO0OOOOOO0O00000 ,(O00O0OOOOO0O0OO0O .window_size *19 //20 ,0 ),(O00O0OOOOO0O0OO0O .window_size ,O00O0OOOOO0O0OO0O .window_size //20 ),(64 ,64 ,64 ),thickness =-1 )#line:329
        cv2 .putText (OOO0OOOOOO0O00000 ,'Undo',(O00O0OOOOO0O0OO0O .window_size *19 //20 ,O00O0OOOOO0O0OO0O .window_size //20 ),cv2 .FONT_HERSHEY_PLAIN ,1.0 ,(255 ,255 ,255 ),1 )#line:330
        return OOO0OOOOOO0O00000 ,OOOOO0OO00OOOOOO0 #line:332
    def put_text (O00O0OO0O00O0O0OO ,OOO0O00O000OO000O ,OOOO0O0OOO0OOO00O ,right =False ):#line:335
        O0O0OOOOOOO000OOO =20 #line:336
        for OOO00O00000O00OO0 in range (len (OOOO0O0OOO0OOO00O )):#line:337
            if right :#line:338
                O00000OOO00OOOOO0 =int (OOO0O00O000OO000O .shape [1 ]/10 *7.5 )#line:339
                cv2 .putText (OOO0O00O000OO000O ,OOOO0O0OOO0OOO00O [OOO00O00000O00OO0 ],(O00000OOO00OOOOO0 ,O0O0OOOOOOO000OOO ),cv2 .FONT_HERSHEY_PLAIN ,1.0 ,(255 ,255 ,0 ),1 )#line:340
            else :#line:341
                cv2 .putText (OOO0O00O000OO000O ,OOOO0O0OOO0OOO00O [OOO00O00000O00OO0 ],(5 ,O0O0OOOOOOO000OOO ),cv2 .FONT_HERSHEY_PLAIN ,1.0 ,(255 ,255 ,0 ),1 )#line:342
            O0O0OOOOOOO000OOO +=20 #line:343
        return OOO0O00O000OO000O #line:344
    def gcross (OO00O000O0OO0000O ,O0OOO0O0O0OO0O000 ,OO0O00OO0O0O00OOO ,OOOOOO0000O0OOOOO ):#line:350
        cv2 .line (O0OOO0O0O0OO0O000 ,(OO0O00OO0O0O00OOO ,0 ),(OO0O00OO0O0O00OOO ,OO00O000O0OO0000O .h -1 ),(255 ,255 ,0 ))#line:351
        cv2 .line (O0OOO0O0O0OO0O000 ,(0 ,OOOOOO0000O0OOOOO ),(OO00O000O0OO0000O .w -1 ,OOOOOO0000O0OOOOO ),(255 ,255 ,0 ))#line:352
    def gsquare (OOO0OO0OO0OOO00O0 ,OOOOO0O0OO0O00OO0 ,OO0OO0O0O000O0000 ,O0OO00OO000OOO0O0 ,OO0O000O00OOO0O0O ):#line:354
        OO0O00O0OOOO0O0O0 ,O00O0OOO0O0O0O000 =OO0O000O00OOO0O0O #line:355
        OOOO00000OOO0O000 =max (abs (OO0OO0O0O000O0000 -OO0O00O0OOOO0O0O0 ),abs (O0OO00OO000OOO0O0 -O00O0OOO0O0O0O000 ))#line:356
        cv2 .rectangle (OOOOO0O0OO0O00OO0 ,(OO0O00O0OOOO0O0O0 -OOOO00000OOO0O000 ,O00O0OOO0O0O0O000 -OOOO00000OOO0O000 ),(OO0O00O0OOOO0O0O0 +OOOO00000OOO0O000 ,O00O0OOO0O0O0O000 +OOOO00000OOO0O000 ),(255 ,255 ,0 ))#line:357
    def gcircle (O0000O000O0000O00 ,OO0OOO00OOOOOO00O ,O0O0000OOOOOO0O00 ,OOOOOOO0000OO00OO ):#line:359
        cv2 .circle (OO0OOO00OOOOOO00O ,(O0O0000OOOOOO0O00 ,OOOOOOO0000OO00OO ),8 ,(255 ,255 ,0 ),1 )#line:360
    def gline (O0O0OOO00OOOOO00O ,O0O0O0O0OOOOOOOO0 ,O0O00OO0OOOO0O0OO ,OOO0000OOOOOOOOO0 ,O00OO00O00O0OO0O0 ):#line:362
        cv2 .line (O0O0O0O0OOOOOOOO0 ,tuple (O00OO00O00O0OO0O0 ),(O0O00OO0OOOO0O0OO ,OOO0000OOOOOOOOO0 ),(255 ,255 ,0 ))#line:363
    def ghline (O00OO00O00O0OOO0O ,O00OOOOO0OOO00O00 ,O0000OO0O000OO000 ,OO0O000OOOO0OO00O ):#line:365
        cv2 .line (O00OOOOO0OOO00O00 ,(0 ,OO0O000OOOO0OO00O ),(O00OO00O00O0OOO0O .w -1 ,OO0O000OOOO0OO00O ),(255 ,255 ,0 ))#line:366
    def g_heelhline (O00OO0OOOO0O00OO0 ,OOO0OO000O000O000 ,OO0OO0OO0000O0OO0 ,O00OO0O0OO0OOO0OO ,OOO00OO0O0OOOO00O ,O0OOO0O0O0000OOO0 ):#line:368
        OO0OOO000O0O000OO =int (OOO00OO0O0OOOO00O [1 ]*O00OO0OOOO0O00OO0 .rate1 +O0OOO0O0O0000OOO0 [1 ]*(1 -O00OO0OOOO0O00OO0 .rate1 ))#line:369
        cv2 .line (OOO0OO000O000O000 ,(0 ,OO0OOO000O0O000OO ),(O00OO0OOOO0O00OO0 .w -1 ,OO0OOO000O0O000OO ),(255 ,255 ,0 ))#line:370
    def gvline (OOO0O0O0OO0000000 ,O00OOO000OO0OOOOO ,OOO00O00000O0OO0O ,OO000O000O000000O ):#line:372
        cv2 .line (O00OOO000OO0OOOOO ,(OOO00O00000O0OO0O ,0 ),(OOO00O00000O0OO0O ,OOO0O0O0OO0000000 .h -1 ),(255 ,255 ,0 ))#line:373
    def gdiagonal (O000O0O0O0000O0O0 ,OO00O0OOO0O00OO0O ,OO0O00O00OOOOO00O ,OO0O00O0OO0O0OOOO ,OOO0000O0O0O0000O ):#line:375
        OO0O000000O0O0O0O ,O000OO0O00O00O0OO =OOO0000O0O0O0000O #line:376
        OO0O00O00OOOOO00O ,OO0O00O0OO0O0OOOO =OO0O00O0OO0O0OOOO ,OO0O00O00OOOOO00O #line:377
        OO0O0OOOO0OOOOO0O =math .atan2 (OO0O00O00OOOOO00O -O000OO0O00O00O0OO ,OO0O00O0OO0O0OOOO -OO0O000000O0O0O0O )#line:380
        OOOOO00O00OO0O0O0 =math .degrees (OO0O0OOOO0OOOOO0O )#line:382
        O0OO00OOOO0O0O000 =math .atan2 (O000O0O0O0000O0O0 .paper_short -0 ,O000O0O0O0000O0O0 .paper_long -0 )#line:386
        O000OO0OO0O0000O0 =math .degrees (O0OO00OOOO0O0O000 )#line:388
        OOO0O0O00OOOO0O0O =OOOOO00O00OO0O0O0 +O000OO0OO0O0000O0 #line:392
        if OOO0O0O00OOOO0O0O >180 :#line:393
            OOO0O0O00OOOO0O0O =-360 +OOO0O0O00OOOO0O0O #line:394
        O00OO000000OO0O00 =math .radians (OOO0O0O00OOOO0O0O )#line:397
        O00O000OO0OOO00O0 =((OO0O00O00OOOOO00O -O000OO0O00O00O0OO )**2 +(OO0O00O0OO0O0OOOO -OO0O000000O0O0O0O )**2 )**0.5 #line:400
        O00O00000O00O0O0O =(O000O0O0O0000O0O0 .paper_long **2 +O000O0O0O0000O0O0 .paper_short **2 )**0.5 #line:401
        O000OOOO0OOO000OO =O000O0O0O0000O0O0 .paper_long *(O00O000OO0OOO00O0 /O00O00000O00O0O0O )#line:403
        O0O00O00OOOO0O0OO =OO0O000000O0O0O0O +np .cos (O00OO000000OO0O00 )*O000OOOO0OOO000OO #line:405
        OO00OO0OOOOOO0OOO =O000OO0O00O00O0OO +np .sin (O00OO000000OO0O00 )*O000OOOO0OOO000OO #line:406
        cv2 .circle (OO00O0OOO0O00OO0O ,(int (O0O00O00OOOO0O0OO ),int (OO00OO0OOOOOO0OOO )),8 ,(255 ,255 ,0 ),1 )#line:409
        cv2 .circle (OO00O0OOO0O00OO0O ,(OO0O00O0OO0O0OOOO -int (O0O00O00OOOO0O0OO -OO0O000000O0O0O0O ),OO0O00O00OOOOO00O -int (OO00OO0OOOOOO0OOO -O000OO0O00O00O0OO )),8 ,(255 ,255 ,0 ),1 )#line:410
    def onMouse (O0O0O0O0OOO000O0O ,O0OOOOOOO00O000OO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 ,O0O0O0O0O0O0O0OO0 ,O000O00O000O00OO0 ):#line:413
        O0OOOOOO0OOOOO0O0 ,OO00O0O00OO000O00 ,OO00O00O00O0OO000 =O000O00O000O00OO0 #line:414
        if O0OOOOOOO00O000OO ==cv2 .EVENT_MOUSEMOVE :#line:417
            O0OO0O0OO000O0OOO =np .copy (OO00O0O00OO000O00 )#line:418
            if O0OOOOOO0OOOOO0O0 =='step1':#line:420
                if OO00O00O00O0OO000 .count ==0 :#line:421
                    O0O0O0O0OOO000O0O .gcross (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 )#line:422
                if OO00O00O00O0OO000 .count ==1 :#line:423
                    cv2 .circle (O0OO0O0OO000O0OOO ,tuple (OO00O00O00O0OO000 .p [0 ]),8 ,(0 ,0 ,255 ),1 )#line:424
                    O0O0O0O0OOO000O0O .gsquare (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 ,OO00O00O00O0OO000 .p [0 ])#line:425
            if O0OOOOOO0OOOOO0O0 =='step2':#line:427
                if OO00O00O00O0OO000 .count ==0 :#line:428
                    O0O0O0O0OOO000O0O .gcross (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 )#line:429
                if OO00O00O00O0OO000 .count ==1 :#line:430
                    cv2 .circle (O0OO0O0OO000O0OOO ,tuple (OO00O00O00O0OO000 .p [0 ]),8 ,(0 ,0 ,255 ),1 )#line:431
                    O0O0O0O0OOO000O0O .gcircle (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 )#line:432
                    O0O0O0O0OOO000O0O .gdiagonal (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 ,OO00O00O00O0OO000 .p [0 ])#line:433
            if O0OOOOOO0OOOOO0O0 =='step3':#line:435
                if OO00O00O00O0OO000 .count ==0 :#line:436
                    O0O0O0O0OOO000O0O .gcross (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 )#line:437
                if OO00O00O00O0OO000 .count ==1 :#line:438
                    cv2 .circle (O0OO0O0OO000O0OOO ,tuple (OO00O00O00O0OO000 .p [0 ]),8 ,(0 ,0 ,255 ),1 )#line:439
                    O0O0O0O0OOO000O0O .gline (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 ,OO00O00O00O0OO000 .p [0 ])#line:440
            if O0OOOOOO0OOOOO0O0 =='step4':#line:442
                if OO00O00O00O0OO000 .count ==0 :#line:443
                    O0O0O0O0OOO000O0O .ghline (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 )#line:444
                if OO00O00O00O0OO000 .count ==1 :#line:445
                    cv2 .line (O0OO0O0OO000O0OOO ,(0 ,OO00O00O00O0OO000 .p [0 ,1 ]),(O0O0O0O0OOO000O0O .w -1 ,OO00O00O00O0OO000 .p [0 ,1 ]),(0 ,0 ,255 ))#line:446
                    O0O0O0O0OOO000O0O .ghline (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 )#line:447
                if OO00O00O00O0OO000 .count ==2 :#line:448
                    cv2 .line (O0OO0O0OO000O0OOO ,(0 ,OO00O00O00O0OO000 .p [0 ,1 ]),(O0O0O0O0OOO000O0O .w -1 ,OO00O00O00O0OO000 .p [0 ,1 ]),(0 ,0 ,255 ))#line:449
                    cv2 .line (O0OO0O0OO000O0OOO ,(0 ,OO00O00O00O0OO000 .p [1 ,1 ]),(O0O0O0O0OOO000O0O .w -1 ,OO00O00O00O0OO000 .p [1 ,1 ]),(0 ,0 ,255 ))#line:450
                    O0O0O0O0OOO000O0O .g_heelhline (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 ,OO00O00O00O0OO000 .p [0 ],OO00O00O00O0OO000 .p [1 ])#line:451
                    O0O0O0O0OOO000O0O .gvline (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 )#line:452
                if OO00O00O00O0OO000 .count ==3 :#line:453
                    cv2 .line (O0OO0O0OO000O0OOO ,(0 ,OO00O00O00O0OO000 .p [0 ,1 ]),(O0O0O0O0OOO000O0O .w -1 ,OO00O00O00O0OO000 .p [0 ,1 ]),(0 ,0 ,255 ))#line:454
                    cv2 .line (O0OO0O0OO000O0OOO ,(0 ,OO00O00O00O0OO000 .p [1 ,1 ]),(O0O0O0O0OOO000O0O .w -1 ,OO00O00O00O0OO000 .p [1 ,1 ]),(0 ,0 ,255 ))#line:455
                    O00000O0O000OO0OO =int (OO00O00O00O0OO000 .p [0 ,1 ]*O0O0O0O0OOO000O0O .rate1 +OO00O00O00O0OO000 .p [1 ,1 ]*(1 -O0O0O0O0OOO000O0O .rate1 ))#line:456
                    cv2 .circle (O0OO0O0OO000O0OOO ,tuple ((OO00O00O00O0OO000 .p [2 ,0 ],O00000O0O000OO0OO )),8 ,(0 ,0 ,255 ),1 )#line:457
                    O0O0O0O0OOO000O0O .g_heelhline (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 ,OO00O00O00O0OO000 .p [0 ],OO00O00O00O0OO000 .p [1 ])#line:458
                    O0O0O0O0OOO000O0O .gvline (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 )#line:459
                if OO00O00O00O0OO000 .count ==4 :#line:460
                    cv2 .line (O0OO0O0OO000O0OOO ,(0 ,OO00O00O00O0OO000 .p [0 ,1 ]),(O0O0O0O0OOO000O0O .w -1 ,OO00O00O00O0OO000 .p [0 ,1 ]),(0 ,0 ,255 ))#line:461
                    cv2 .line (O0OO0O0OO000O0OOO ,(0 ,OO00O00O00O0OO000 .p [1 ,1 ]),(O0O0O0O0OOO000O0O .w -1 ,OO00O00O00O0OO000 .p [1 ,1 ]),(0 ,0 ,255 ))#line:462
                    O00000O0O000OO0OO =int (OO00O00O00O0OO000 .p [0 ,1 ]*O0O0O0O0OOO000O0O .rate1 +OO00O00O00O0OO000 .p [1 ,1 ]*(1 -O0O0O0O0OOO000O0O .rate1 ))#line:463
                    cv2 .circle (O0OO0O0OO000O0OOO ,tuple ((OO00O00O00O0OO000 .p [2 ,0 ],O00000O0O000OO0OO )),8 ,(0 ,0 ,255 ),1 )#line:464
                    cv2 .circle (O0OO0O0OO000O0OOO ,tuple ((OO00O00O00O0OO000 .p [3 ,0 ],O00000O0O000OO0OO )),8 ,(0 ,0 ,255 ),1 )#line:465
                    cv2 .line (O0OO0O0OO000O0OOO ,(OO00O00O00O0OO000 .p [2 ,0 ],O00000O0O000OO0OO ),(OO00O00O00O0OO000 .p [3 ,0 ],O00000O0O000OO0OO ),(0 ,0 ,255 ))#line:466
                    O0O0O0O0OOO000O0O .gcross (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 )#line:467
                if OO00O00O00O0OO000 .count ==5 :#line:468
                    cv2 .line (O0OO0O0OO000O0OOO ,(0 ,OO00O00O00O0OO000 .p [0 ,1 ]),(O0O0O0O0OOO000O0O .w -1 ,OO00O00O00O0OO000 .p [0 ,1 ]),(0 ,0 ,255 ))#line:469
                    cv2 .line (O0OO0O0OO000O0OOO ,(0 ,OO00O00O00O0OO000 .p [1 ,1 ]),(O0O0O0O0OOO000O0O .w -1 ,OO00O00O00O0OO000 .p [1 ,1 ]),(0 ,0 ,255 ))#line:470
                    O00000O0O000OO0OO =int (OO00O00O00O0OO000 .p [0 ,1 ]*O0O0O0O0OOO000O0O .rate1 +OO00O00O00O0OO000 .p [1 ,1 ]*(1 -O0O0O0O0OOO000O0O .rate1 ))#line:471
                    cv2 .circle (O0OO0O0OO000O0OOO ,tuple ((OO00O00O00O0OO000 .p [2 ,0 ],O00000O0O000OO0OO )),8 ,(0 ,0 ,255 ),1 )#line:472
                    cv2 .circle (O0OO0O0OO000O0OOO ,tuple ((OO00O00O00O0OO000 .p [3 ,0 ],O00000O0O000OO0OO )),8 ,(0 ,0 ,255 ),1 )#line:473
                    cv2 .line (O0OO0O0OO000O0OOO ,(OO00O00O00O0OO000 .p [2 ,0 ],O00000O0O000OO0OO ),(OO00O00O00O0OO000 .p [3 ,0 ],O00000O0O000OO0OO ),(0 ,0 ,255 ))#line:474
                    cv2 .circle (O0OO0O0OO000O0OOO ,tuple (OO00O00O00O0OO000 .p [4 ]),8 ,(0 ,0 ,255 ),1 )#line:475
                    O0O0O0O0OOO000O0O .gline (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 ,OO00O00O00O0OO000 .p [4 ])#line:476
            if O0OOOOOO0OOOOO0O0 in ['step5','step7']:#line:479
                cv2 .line (O0OO0O0OO000O0OOO ,(0 ,O0O0O0O0OOO000O0O .window_size //2 ),(O0O0O0O0OOO000O0O .w -1 ,O0O0O0O0OOO000O0O .window_size //2 ),(255 ,255 ,0 ))#line:480
                if O0O0O0O0OOO000O0O .t >0 :#line:482
                    cv2 .line (O0OO0O0OO000O0OOO ,tuple (OO00O00O00O0OO000 .p [0 ]),tuple (OO00O00O00O0OO000 .p [OO00O00O00O0OO000 .count -2 ]),(0 ,0 ,255 ))#line:483
                    OO00O00O00O0OO000 .npoints =OO00O00O00O0OO000 .count #line:484
                    time .sleep (1 )#line:485
                elif OO00O00O00O0OO000 .count >0 and O00OO00O000O00OO0 <=(O0O0O0O0OOO000O0O .window_size *2 //3 ):#line:487
                    cv2 .circle (O0OO0O0OO000O0OOO ,tuple (OO00O00O00O0OO000 .p [0 ]),8 ,(0 ,0 ,255 ),1 )#line:488
                    for OOO0OO00OO00O0OO0 in range (1 ,OO00O00O00O0OO000 .count ):#line:489
                        cv2 .line (O0OO0O0OO000O0OOO ,tuple (OO00O00O00O0OO000 .p [OOO0OO00OO00O0OO0 -1 ]),tuple (OO00O00O00O0OO000 .p [OOO0OO00OO00O0OO0 ]),(0 ,0 ,255 ))#line:490
                    O0O0O0O0OOO000O0O .gline (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 ,OO00O00O00O0OO000 .p [OO00O00O00O0OO000 .count -1 ])#line:491
                elif OO00O00O00O0OO000 .count >0 and O00OO00O000O00OO0 >(O0O0O0O0OOO000O0O .window_size *2 //3 ):#line:493
                    cv2 .circle (O0OO0O0OO000O0OOO ,tuple (OO00O00O00O0OO000 .p [0 ]),8 ,(0 ,0 ,255 ),1 )#line:494
                    for OOO0OO00OO00O0OO0 in range (1 ,OO00O00O00O0OO000 .count ):#line:495
                        cv2 .line (O0OO0O0OO000O0OOO ,tuple (OO00O00O00O0OO000 .p [OOO0OO00OO00O0OO0 -1 ]),tuple (OO00O00O00O0OO000 .p [OOO0OO00OO00O0OO0 ]),(0 ,0 ,255 ))#line:496
                    cv2 .line (O0OO0O0OO000O0OOO ,tuple (OO00O00O00O0OO000 .p [OO00O00O00O0OO000 .count -1 ]),tuple (OO00O00O00O0OO000 .p [0 ]),(255 ,255 ,0 ))#line:497
            if O0OOOOOO0OOOOO0O0 =='step6':#line:499
                if O0O0O0O0OOO000O0O .qqq1 ==0 :#line:500
                    for OOO0OO00OO00O0OO0 in range (O0O0O0O0OOO000O0O .w ):#line:502
                        if np .sum (np .abs (OO00O0O00OO000O00 [O00OO00O000O00OO0 ,OOO0OO00OO00O0OO0 ]-np .array ([255 ,255 ,0 ],int )))==0 :#line:503
                            O0O0O0O0OOO000O0O .qqq1 =OOO0OO00OO00O0OO0 #line:504
                            break #line:505
                    for OOO0OO00OO00O0OO0 in range (O0O0O0O0OOO000O0O .w ):#line:506
                        if np .sum (np .abs (OO00O0O00OO000O00 [O00OO00O000O00OO0 ,OOO0OO00OO00O0OO0 ]-np .array ([255 ,254 ,0 ],int )))==0 :#line:507
                            O0O0O0O0OOO000O0O .qqq2 =OOO0OO00OO00O0OO0 #line:508
                            break #line:509
                O0O0O0O0OOO000O0O .ghline (O0OO0O0OO000O0OOO ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 )#line:511
                cv2 .line (O0OO0O0OO000O0OOO ,(O0O0O0O0OOO000O0O .qqq1 ,O00OO00O000O00OO0 ),(O0O0O0O0OOO000O0O .qqq2 ,O0O0O0O0OOO000O0O .window_size //2 ),(255 ,255 ,0 ))#line:512
            cv2 .imshow (O0OOOOOO0OOOOO0O0 ,O0OO0O0OO000O0OOO )#line:514
        if O0OOOOOOO00O000OO ==cv2 .EVENT_LBUTTONDOWN :#line:517
            if O0O0O0O0OOO000O0O .window_size *19 //20 <OOO00O000OOOO00O0 <O0O0O0O0OOO000O0O .window_size and 0 <O00OO00O000O00OO0 <O0O0O0O0OOO000O0O .window_size //20 :#line:520
                if OO00O00O00O0OO000 .count ==0 :#line:521
                    pass #line:522
                else :#line:523
                    OO00O00O00O0OO000 .count -=1 #line:524
                    OO00O00O00O0OO000 .p [OO00O00O00O0OO000 .count ,:]==np .empty (2 ,dtype =int )#line:525
            else :#line:529
                OO00O00O00O0OO000 .add (OOO00O000OOOO00O0 ,O00OO00O000O00OO0 )#line:531
                print ('pointlist[{}] = ({}, {})'.format (OO00O00O00O0OO000 .count -1 ,OOO00O000OOOO00O0 ,O00OO00O000O00OO0 ))#line:532
                if O0OOOOOO0OOOOO0O0 in ['step5','step7']:#line:534
                    if O00OO00O000O00OO0 >(O0O0O0O0OOO000O0O .window_size *2 //3 ):#line:535
                        O0O0O0O0OOO000O0O .t =time .time ()#line:537
        if OO00O00O00O0OO000 .count ==OO00O00O00O0OO000 .npoints :#line:542
            cv2 .destroyWindow (O0OOOOOO0OOOOO0O0 )#line:543
            if O0OOOOOO0OOOOO0O0 in ['step5','step7']:#line:544
                O0O0O0O0OOO000O0O .p =OO00O00O00O0OO000 .p [:OO00O00O00O0OO000 .count -1 ]#line:545
            else :#line:546
                O0O0O0O0OOO000O0O .p =OO00O00O00O0OO000 .p #line:547
if __name__ =='__main__':#line:551
    pass #line:552
