- Timestamp:
- Jun 30, 2019, 3:39:52 PM (5 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/geometry_tools.py
r2649 r2651 40 40 # rm_consecpt_polygon: Function to remove consecutive same point of a polygon 41 41 # rotate_2D: Function to rotate a vector by a certain angle in the plain 42 # rotate_objdic_2D: Function to rotate 2D plain the vertices of all polygons of an object 42 43 # rotate_polygon_2D: Function to rotate 2D plain the vertices of a polygon 43 44 # rotate_line2D: Function to rotate a line given by 2 pairs of x,y coordinates by a … … 183 184 184 185 return rotvecs 186 187 def rotate_objdic_2D(objdic, angle): 188 """ Function to rotate 2D plain the vertices of all polygons of an object 189 objdic= dictionary with all the polygons of the object 190 angle= angle to rotate [rad] 191 """ 192 fname = 'rotate_objdic_2D' 193 194 rotobjdic = dict(objdic) 195 196 for secn in objdic.keys(): 197 objv = objdic[secn] 198 vectors = objv[0] 199 rotvecs = np.zeros(vectors.shape, dtype=np.float) 200 201 Nvecs = vectors.shape[0] 202 for iv in range(Nvecs): 203 rotvecs[iv,:] = rotate_2D(vectors[iv,:], angle) 204 rotobjdic[secn] = rotvecs 205 206 return rotobjdic 185 207 186 208 def rotate_line2D(line, angle): … … 2519 2541 lw = secv[3] 2520 2542 2521 plt.plot(poly[:,1], poly[:,0], lt, color=lc, linew dith=lw)2543 plt.plot(poly[:,1], poly[:,0], lt, color=lc, linewidth=lw) 2522 2544 2523 2545 return -
trunk/tools/nautical.py
r2650 r2651 347 347 hsail = geo.circ_sec(bow, endsail, lsail*2.15) 348 348 else: 349 hsail0 =p_sinusiode(length=lsail, amp=0.2, lamb=0.75, N=dpts)349 hsail0, sailsec, saildic = geo.p_sinusiode(length=lsail, amp=0.2, lamb=0.75, N=dpts) 350 350 hsail = np.zeros((dpts,2), dtype=np.float) 351 351 hsail[:,0] = hsail0[:,1] … … 365 365 msail = geo.circ_sec(endsail, begsail, lsail*2.15) 366 366 else: 367 msail0 =p_sinusiode(length=lsail, amp=0.25, lamb=1., N=dpts)367 msail0, sailsec, saildic = geo.p_sinusiode(length=lsail, amp=0.25, lamb=1., N=dpts) 368 368 msail = np.zeros((dpts,2), dtype=np.float) 369 369 msail[:,0] = msail0[:,1]
Note: See TracChangeset
for help on using the changeset viewer.