- Timestamp:
- May 7, 2019, 5:42:58 AM (7 years ago)
- File:
-
- 1 edited
-
trunk/tools/geometry_tools.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/geometry_tools.py
r2512 r2513 884 884 885 885 # forward section 886 fportside = circ_sec( bow,maxportside, length*2)887 fstarboardside = circ_sec( maxstarboardside, bow, length*2)886 fportside = circ_sec(maxportside, bow, length*2) 887 fstarboardside = circ_sec(bow, maxstarboardside, length*2) 888 888 # aft section 889 aportside = circ_sec( maxportside,portside, length*2)890 astarboardside = circ_sec( starboardside, maxstarboardside, length*2)889 aportside = circ_sec(portside, maxportside, length*2) 890 astarboardside = circ_sec(maxstarboardside, starboardside, length*2) 891 891 # stern 892 stern = circ_sec( portside, starboardside, length*2)892 stern = circ_sec(starboardside, portside, length*2) 893 893 894 894 dpts = stern.shape[0] 895 895 boat = np.zeros((dpts*5,2), dtype=np.float) 896 896 897 boat[0:dpts,:] = fportside898 boat[dpts:2*dpts,:] = aportside899 boat[2*dpts:3*dpts,:] = stern897 boat[0:dpts,:] = aportside 898 boat[dpts:2*dpts,:] = fportside 899 boat[2*dpts:3*dpts,:] = fstarboardside 900 900 boat[3*dpts:4*dpts,:] = astarboardside 901 boat[4*dpts:5*dpts,:] = fstarboardside901 boat[4*dpts:5*dpts,:] = stern 902 902 903 903 fname = 'boat_L' + str(int(length*100.)) + '_B' + str(int(beam*100.)) + '_lb' + \ … … 915 915 of.close() 916 916 print fname + ": Successfull written '" + fname + "' !!" 917 918 return boat 917 918 919 # Center line extending [fcl] percentage from length on aft and stern 920 fcl = 0.15 921 centerline = np.zeros((dpts,2), dtype=np.float) 922 dl = length*(1.+fcl*2.)/(dpts-1) 923 centerline[:,0] = np.arange(-length*fcl, length*(1. + fcl)+dl, dl) 924 925 # correct order of sections 926 boatsecs = ['aportside', 'fportside', 'fstarboardside', 'astarboardside', \ 927 'stern', 'centerline'] 928 929 # dictionary with sections [polygon_vertices, line_type, line_color, line_width] 930 dicboat = {'fportside': [fportside, '-', '#8A5900', 2.], \ 931 'aportside': [aportside, '-', '#8A5900', 2.], \ 932 'stern': [stern, '-', '#8A5900', 2.], \ 933 'astarboardside': [astarboardside, '-', '#8A5900', 2.], \ 934 'fstarboardside': [fstarboardside, '-', '#8A5900', 2.], \ 935 'centerline': [centerline, '-.', '#AA6464', 1.5]} 936 937 fname = 'sailboat_L' + str(int(length*100.)) + '_B' + str(int(beam*100.)) + \ 938 '_lb' + str(int(lbeam*100.)) + '_sb' + str(int(sternbp*100.)) +'.dat' 939 if not os.path.isfile(fname): 940 print infmsg 941 print ' ' + fname + ": writting boat coordinates file '" + fname + "' !!" 942 of = open(fname, 'w') 943 of.write('# boat file with Length: ' + str(length) +' max_beam: '+str(beam)+ \ 944 'length_at_max_beam:' + str(lbeam) + '% beam at stern: ' +str(sternbp)+'\n') 945 for ip in range(dpts*5): 946 of.write(str(boat[ip,0]) + ' ' + str(boat[ip,1]) + '\n') 947 948 of.close() 949 print fname + ": Successfull written '" + fname + "' !!" 950 951 return boat, boatsecs, dicboat 919 952 920 953 def zsailing_boat(length=10., beam=1., lbeam=0.4, sternbp=0.5, lmast=0.6, wmast=0.1, \ … … 941 974 starboardside = np.array([0., beam*sternbp]) 942 975 976 aportside = circ_sec(portside, maxportside, length*2) 977 fportside = circ_sec(maxportside, bow, length*2) 978 fstarboardside = circ_sec(bow, maxstarboardside, length*2) 979 astarboardside = circ_sec(maxstarboardside, starboardside, length*2) 980 stern = circ_sec(starboardside, portside, length*2) 981 dpts = fportside.shape[0] 982 983 # correct order of sections 984 sailingboatsecs = ['aportside', 'fportside', 'fstarboardside', 'astarboardside', \ 985 'stern', 'mast', 'hsail', 'msail', 'centerline'] 986 943 987 # forward section 944 fportside = circ_sec(bow,maxportside, length*2)945 fstarboardside = circ_sec(maxstarboardside, bow, length*2)946 dpts = fportside.shape[0]947 988 948 989 # aft section 949 aportside = circ_sec(maxportside, portside, length*2)950 astarboardside = circ_sec(starboardside, maxstarboardside, length*2)951 990 # stern 952 stern = circ_sec(portside, starboardside, length*2)953 991 # mast 954 992 mast = p_circle(wmast,N=dpts) … … 960 998 endsail = np.array([lsail*np.sin(sailsa), lsail*np.cos(sailsa)]) 961 999 endsail[0] = length - endsail[0] 962 if bow[1] <endsail[1]:1000 if bow[1] > endsail[1]: 963 1001 hsail = circ_sec(endsail, bow, lsail*2.15) 964 1002 else: … … 978 1016 endsail = np.array([lsail*np.sin(sailsa), lsail*np.cos(sailsa)]) 979 1017 endsail[0] = length*lmast - endsail[0] 980 if endsail[1] <begsail[1]:1018 if endsail[1] > begsail[1]: 981 1019 msail = circ_sec(begsail, endsail, lsail*2.15) 982 1020 else: … … 991 1029 sailingboat = np.zeros((dpts*8+4,2), dtype=np.float) 992 1030 993 sailingboat[0:dpts,:] = fportside994 sailingboat[dpts:2*dpts,:] = aportside995 sailingboat[2*dpts:3*dpts,:] = stern1031 sailingboat[0:dpts,:] = aportside 1032 sailingboat[dpts:2*dpts,:] = fportside 1033 sailingboat[2*dpts:3*dpts,:] = fstarboardside 996 1034 sailingboat[3*dpts:4*dpts,:] = astarboardside 997 sailingboat[4*dpts:5*dpts,:] = fstarboardside1035 sailingboat[4*dpts:5*dpts,:] = stern 998 1036 sailingboat[5*dpts,:] = [gen.fillValueF, gen.fillValueF] 999 1037 sailingboat[5*dpts+1:6*dpts+1,:] = mast … … 1012 1050 centerline[:,0] = np.arange(-length*fcl, length*(1. + fcl)+dl, dl) 1013 1051 1014 # correct order of sections1015 sailingboatsecs = ['fportside', 'aportside', 'stern', 'astarboardside', \1016 'fstarboardside', 'mast', 'hsail', 'msail', 'centerline']1017 1052 # dictionary with sections [polygon_vertices, line_type, line_color, line_width] 1018 1053 dicsailingboat = {'fportside': [fportside, '-', '#8A5900', 2.], \
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/LMDZ_WRF/chrome/site/your_project_logo.png)