!******************************************** BASIC GEOMETRY MODULE shslope( REF s_id >"@t8 Select sheerline curve !"; VECTOR zlevel >"@a3 Lower level of diagram !"; FLOAT y1:=15 >"Bow angle !"; FLOAT x2:=5000 >"Intermediate station X-value !"; FLOAT y2:=0 >"Intermediate angle !"; FLOAT y3:=10 >"Stern angle !"; STRING name*132:="Topside angle"; FLOAT ysize:=4000); ! Actual size of diagram in Y-direction !* Creates the sheerline tangent curve #1. !* !* This program is free software; you can redistribute it and/or !* modify it under the terms of the GNU General Public License !* as published by the Free Software Foundation; either version 2 !* of the License, or (at your option) any later version. !* !* This program is distributed in the hope that it will be useful, !* but WITHOUT ANY WARRANTY; without even the implied warranty of !* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the !* GNU General Public License for more details. !* !* You should have received a copy of the GNU General Public License !* along with this program; if not, write to the Free Software !* Foundation, Inc., 59 Temple Place - Suite 330, Boston, !* MA 02111-1307, USA. !* !* (C)Microform AB 2000, J.Kjellander !* !* 2000-02-25 New csys, J.Kjellander !* !******************************************** INT i,font,ns_gra,ns_geo; FLOAT dl,v,ymin,ymax,yrange; REF sht_id,dc_id; VECTOR tmp,p(100); !string sjk*1; BEGINMODULE !* !***Check that a sheerline tangent is not already defined. !***2 calls to get_next_gm() is required beacuse 1:st call !***returns the ID of this call. !* set_root_gm(); sht_id:=get_next_gm(1,16384,"shslope"); sht_id:=get_next_gm(1,16384,"shslope"); if sht_id <> #0.1 then exit("Topside slopes are already defined !"); endif; !* !***Everything on level 10. !* set(LEVEL=10); if exestat() > 0 then unblank_lev(10); endif; !* !***Create the diagram. !* part(#2,diacur(s_id,zlevel,y1,x2,y2,y3,name,ysize)); !* !***Global ID of sheerline. !* s_id:=global_ref(s_id,1); !* !***ID of the curve in the diagram. !* dc_id:=#2#1; !* !***The max and min values in the Y-direction. !* ymax:=y1; if y2 > ymax then ymax:=y2; endif; if y3 > ymax then ymax:=y3; endif; ymin:=y1; if y2 < ymin then ymin:=y2; endif; if y3 < ymin then ymin:=y3; endif; !* !***The range in user Y that is mapped to ysize. !* yrange:=ymax-ymin; !* !***If the curve is near to a straight horisontal line !***set yrange = 0. !* if abs(yrange) < 0.01 then yrange:=0.0; endif; !* !***Create actual sheerline tangent curve. !* csys_1p(#25,"Dia-XY",vec(0,0,0),-90,0,0:BLANK=1); mode_local(#25); getcurh(s_id,font,dl,ns_geo,ns_gra); for i:=0 to ns_geo do lin_proj(#30,on(s_id,i),on(s_id,i)+vec(0,1000,0):BLANK=0); poi_proj(#31,intersect(dc_id,refc(30,i+1),-1):HIT=0); lin_proj(#32,on(s_id,i),on(refc(31,i+1)):HIT=0,LFONT=1,LDASHL=ysize/15); mode_global(); tmp:=on(refc(31,i+1)); mode_local(#25); if yrange = 0.0 then v:=y1; else v:=ymin+(zlevel.z-tmp.z)/ysize*yrange; endif; !sjk:=inpmt("v=",str(v)); lin_ang(#33,on(refc(31,i+1)),90-v,1000:HIT=0); mode_global(); p(i+1):=on(s_id,i)+100*vec(0,sin(v),1); mode_local(#25); endfor; mode_global(); cur_splarr(#1,"FREE",ns_geo+1,p:BLANK=1,PEN=3); ENDMODULE !********************************************