Changeset 2653 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Jun 30, 2019, 4:58:23 PM (6 years ago)
Author:
lfita
Message:

Adding:

  • `displace_objdic_2D': Function to displace 2D plain the vertices of all polygons of an object
Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/geometry_tools.py

    r2652 r2653  
    2828# cut_[x/y]polygon: Function to cut a polygon from a given value of the [x/y]-axis
    2929# deg_deci: Function to pass from degrees [deg, minute, sec] to decimal angles [rad]
     30# displace_objdic_2D: Function to displace 2D plain the vertices of all polygons of an object
    3031# dist_points: Function to provide the distance between two points
    3132# join_circ_sec: Function to join aa series of points by circular segments
     
    184185
    185186    return rotvecs
     187
     188def displace_objdic_2D(objdic, distance):
     189    """ Function to displace 2D plain the vertices of all polygons of an object
     190      objdic= dictionary with all the polygons of the object
     191      distance= distance to displace [ydist, xdist]
     192    """
     193    fname = 'displace_objdic_2D'
     194
     195    disobjdic = dict(objdic)
     196
     197    for secn in objdic.keys():
     198        objv = objdic[secn]
     199        vectors = objv[0]
     200        lt = objv[1]
     201        lc = objv[2]
     202        lw = objv[3]
     203
     204        disvecs = np.zeros(vectors.shape, dtype=np.float)   
     205        disvecs = vectors + distance
     206        disobjdic[secn] = [disvecs, lt, lc, lw]
     207
     208    return disobjdic
    186209
    187210def rotate_objdic_2D(objdic, angle):
  • trunk/tools/nautical.py

    r2651 r2653  
    14531453      'length': ['length', 'eslora', np.array([[x0,yn,zx], [x0,yx,zx]])],            \
    14541454      'beam': ['beam', 'manga', np.array([[xn,y0,zx], [xx,y0,zx]])],                 \
    1455       'freeboard': ['freeboard (air \ndraught)', 'francobordo (obra \nviva)',        \
     1455      'freeboard': ['freeboard (air \ndraught)', 'francobordo (obra \nviva)\n carena', \
    14561456        np.array([[xn,yn,zlf], [xn,yn,zx]])],                                        \
    14571457      'draught': ['draught', 'calado (obra \nmuerta)',                               \
Note: See TracChangeset for help on using the changeset viewer.