Index: /trunk/tools/nautical.py
===================================================================
--- /trunk/tools/nautical.py	(revision 2646)
+++ /trunk/tools/nautical.py	(revision 2647)
@@ -57,7 +57,10 @@
 
 # FROM: http://www.photographers1.com/Sailing/NauticalTerms&Nomenclature.html
-def yboat(length=10., flength=0.7, freeboard=2., hskeg=2.,fskeg=0.2,  N=200):
+def yboat(length=10., fcab=0.3, hcab=0.5, flength=0.7, freeboard=2., hskeg=2.,       \
+  fskeg=0.2, N=200):
     """ Function to define an schematic boat from the y-plane
       length: length of the boat (without stern, default, 10)
+      fcab: length of the cabin as percentage of length (default, 0.3)
+      hcab: height of the cabin (default, 0.5)
       flength: floating length of the boat as percentage of length (defatult, 0.7)
       freeboard: height above the water (default, 2)
@@ -70,9 +73,16 @@
     lflength = length*flength
     ilf3 = length*(1.-flength)/3
+    lcab = length*fcab
+    ilcab3 = length*(1.-fcab)/4.
 
     bow = np.array([length, freeboard])
     hbow = np.array([lflength + ilf3, 0.])
+    icab = np.array([ilcab3, freeboard])
+    ihcab = np.array([ilcab3, freeboard+hcab])
+    ecab = np.array([ilcab3+lcab, freeboard])
     sternp = np.array([0., freeboard])
     sternlp = np.array([0., freeboard*0.8])
+
+    print 'hbow', hbow, 'bow', bow, 'icab', icab, 'ihcab', ihcab, 'ecab', ecab, 'sternp', sternp, 'sternlp', sternlp
 
     boat = np.zeros((N,2), dtype=np.float)
@@ -83,6 +93,6 @@
     N14 = N1/4
     stern = np.zeros((N14,2), dtype=np.float)
-    ipt = hbow
-    ept = bow
+    ipt = sternlp
+    ept = sternp
     dy = (ept[0] - ipt[0])/(N14-1)
     dz = (ept[1] - ipt[1])/(N14-1)
@@ -92,15 +102,32 @@
     # deck
     deck = np.zeros((N14,2), dtype=np.float)
-    ipt = bow
-    ept = sternp
-    dy = (ept[0] - ipt[0])/(N14-1)
-    dz = (ept[1] - ipt[1])/(N14-1)
-    for ip in range(N14):
+    N144 = int(N14/4.)
+
+    ipt = sternp
+    ept = icab
+    dy = (ept[0] - ipt[0])/(N144-1)
+    dz = (ept[1] - ipt[1])/(N144-1)
+    for ip in range(N144):
         deck[ip,:] = ipt + [dy*ip, dz*ip]
+    ipt = icab
+    ept = ihcab
+    dy = (ept[0] - ipt[0])/(N144-1)
+    dz = (ept[1] - ipt[1])/(N144-1)
+    for ip in range(N144):
+        deck[N144:2*N144,:] = ipt + [dy*ip, dz*ip]
+    deck[2*N144:3*N144,:] = geo.circ_sec(ihcab, ecab, 2*lcab, arc='short',           \
+      pos='right', Nang=N144)
+    N1442 = N14 - 3*N144
+    ipt = ecab
+    ept = bow
+    dy = (ept[0] - ipt[0])/(N144-1)
+    dz = (ept[1] - ipt[1])/(N144-1)
+    for ip in range(N144):
+        deck[3*N144:N14,:] = ipt + [dy*ip, dz*ip]
 
     # sternl
     sternl = np.zeros((N14,2), dtype=np.float)
-    ipt = sternp
-    ept = sternlp
+    ipt = bow
+    ept = hbow
     dy = (ept[0] - ipt[0])/(N14-1)
     dz = (ept[1] - ipt[1])/(N14-1)
@@ -110,5 +137,5 @@
     # keel
     N12 = N1 - 3*N14
-    keel = geo.circ_sec(sternlp, hbow, length, arc='short', pos='left', Nang=N12)
+    keel = geo.circ_sec(hbow, sternlp, length, arc='short', pos='right', Nang=N12)
 
     # skeg
@@ -1386,5 +1413,5 @@
       zn: minimum length on z-axis (draught)
       zx: maximum length on z-axis (draught)
-      zlf: freeboard line
+      zlf: water line
     """
     fname = 'boatnames'
@@ -1411,13 +1438,16 @@
       'port': ['port', 'babor', np.array([xn,y0,zx])],                               \
       'waterline': ['waterline', 'l'+unichr(237)+'nea de flotaci'+ unichr(243)+'n',  \
-        np.array([xn,zlf,0.])],                                                      \
-      'keel': ['keel', 'quillote', np.array([xn,yn,zn])],                            \
+        np.array([xn,y0,zlf])],                                                      \
+      'keel': ['keel', 'quillote', np.array([xn,y0,zn])],                            \
       }
 
     # Dimensions
     boatls = {
-      'length': ['length', 'eslora', np.array([x0,yn,zx], [x0,yx,zx])],              \
-      'beam': ['beam', 'manga', np.array([xn,y0,zx], [xx,y0,zx])],                   \
-      'draught': ['draught', 'calado', np.array([xn,y0,zlf], [xn,y0,zn])],           \
+      'length': ['length', 'eslora', np.array([[x0,yn,zx], [x0,yx,zx]])],            \
+      'beam': ['beam', 'manga', np.array([[xn,y0,zx], [xx,y0,zx]])],                 \
+      'freeboard': ['freeboard (air \ndraught)', 'francobordo (obra \nviva)',        \
+        np.array([[xn,yn,zlf], [xn,yn,zx]])],                                        \
+      'draught': ['draught', 'calado (obra \nmuerta)',                               \
+        np.array([[xn,yx,zlf],[xn,yx,zn]])],                                         \
       }
 
