- Timestamp:
- Jun 29, 2019, 10:30:42 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nautical.py
r2646 r2647 57 57 58 58 # FROM: http://www.photographers1.com/Sailing/NauticalTerms&Nomenclature.html 59 def yboat(length=10., flength=0.7, freeboard=2., hskeg=2.,fskeg=0.2, N=200): 59 def yboat(length=10., fcab=0.3, hcab=0.5, flength=0.7, freeboard=2., hskeg=2., \ 60 fskeg=0.2, N=200): 60 61 """ Function to define an schematic boat from the y-plane 61 62 length: length of the boat (without stern, default, 10) 63 fcab: length of the cabin as percentage of length (default, 0.3) 64 hcab: height of the cabin (default, 0.5) 62 65 flength: floating length of the boat as percentage of length (defatult, 0.7) 63 66 freeboard: height above the water (default, 2) … … 70 73 lflength = length*flength 71 74 ilf3 = length*(1.-flength)/3 75 lcab = length*fcab 76 ilcab3 = length*(1.-fcab)/4. 72 77 73 78 bow = np.array([length, freeboard]) 74 79 hbow = np.array([lflength + ilf3, 0.]) 80 icab = np.array([ilcab3, freeboard]) 81 ihcab = np.array([ilcab3, freeboard+hcab]) 82 ecab = np.array([ilcab3+lcab, freeboard]) 75 83 sternp = np.array([0., freeboard]) 76 84 sternlp = np.array([0., freeboard*0.8]) 85 86 print 'hbow', hbow, 'bow', bow, 'icab', icab, 'ihcab', ihcab, 'ecab', ecab, 'sternp', sternp, 'sternlp', sternlp 77 87 78 88 boat = np.zeros((N,2), dtype=np.float) … … 83 93 N14 = N1/4 84 94 stern = np.zeros((N14,2), dtype=np.float) 85 ipt = hbow86 ept = bow95 ipt = sternlp 96 ept = sternp 87 97 dy = (ept[0] - ipt[0])/(N14-1) 88 98 dz = (ept[1] - ipt[1])/(N14-1) … … 92 102 # deck 93 103 deck = np.zeros((N14,2), dtype=np.float) 94 ipt = bow 95 ept = sternp 96 dy = (ept[0] - ipt[0])/(N14-1) 97 dz = (ept[1] - ipt[1])/(N14-1) 98 for ip in range(N14): 104 N144 = int(N14/4.) 105 106 ipt = sternp 107 ept = icab 108 dy = (ept[0] - ipt[0])/(N144-1) 109 dz = (ept[1] - ipt[1])/(N144-1) 110 for ip in range(N144): 99 111 deck[ip,:] = ipt + [dy*ip, dz*ip] 112 ipt = icab 113 ept = ihcab 114 dy = (ept[0] - ipt[0])/(N144-1) 115 dz = (ept[1] - ipt[1])/(N144-1) 116 for ip in range(N144): 117 deck[N144:2*N144,:] = ipt + [dy*ip, dz*ip] 118 deck[2*N144:3*N144,:] = geo.circ_sec(ihcab, ecab, 2*lcab, arc='short', \ 119 pos='right', Nang=N144) 120 N1442 = N14 - 3*N144 121 ipt = ecab 122 ept = bow 123 dy = (ept[0] - ipt[0])/(N144-1) 124 dz = (ept[1] - ipt[1])/(N144-1) 125 for ip in range(N144): 126 deck[3*N144:N14,:] = ipt + [dy*ip, dz*ip] 100 127 101 128 # sternl 102 129 sternl = np.zeros((N14,2), dtype=np.float) 103 ipt = sternp104 ept = sternlp130 ipt = bow 131 ept = hbow 105 132 dy = (ept[0] - ipt[0])/(N14-1) 106 133 dz = (ept[1] - ipt[1])/(N14-1) … … 110 137 # keel 111 138 N12 = N1 - 3*N14 112 keel = geo.circ_sec( sternlp, hbow, length, arc='short', pos='left', Nang=N12)139 keel = geo.circ_sec(hbow, sternlp, length, arc='short', pos='right', Nang=N12) 113 140 114 141 # skeg … … 1386 1413 zn: minimum length on z-axis (draught) 1387 1414 zx: maximum length on z-axis (draught) 1388 zlf: freeboardline1415 zlf: water line 1389 1416 """ 1390 1417 fname = 'boatnames' … … 1411 1438 'port': ['port', 'babor', np.array([xn,y0,zx])], \ 1412 1439 'waterline': ['waterline', 'l'+unichr(237)+'nea de flotaci'+ unichr(243)+'n', \ 1413 np.array([xn, zlf,0.])], \1414 'keel': ['keel', 'quillote', np.array([xn,y n,zn])], \1440 np.array([xn,y0,zlf])], \ 1441 'keel': ['keel', 'quillote', np.array([xn,y0,zn])], \ 1415 1442 } 1416 1443 1417 1444 # Dimensions 1418 1445 boatls = { 1419 'length': ['length', 'eslora', np.array([x0,yn,zx], [x0,yx,zx])], \ 1420 'beam': ['beam', 'manga', np.array([xn,y0,zx], [xx,y0,zx])], \ 1421 'draught': ['draught', 'calado', np.array([xn,y0,zlf], [xn,y0,zn])], \ 1446 'length': ['length', 'eslora', np.array([[x0,yn,zx], [x0,yx,zx]])], \ 1447 'beam': ['beam', 'manga', np.array([[xn,y0,zx], [xx,y0,zx]])], \ 1448 'freeboard': ['freeboard (air \ndraught)', 'francobordo (obra \nviva)', \ 1449 np.array([[xn,yn,zlf], [xn,yn,zx]])], \ 1450 'draught': ['draught', 'calado (obra \nmuerta)', \ 1451 np.array([[xn,yx,zlf],[xn,yx,zn]])], \ 1422 1452 } 1423 1453
Note: See TracChangeset
for help on using the changeset viewer.