! ******************* zscale ******************************* ! +++ ! ! Definition of the Z scaling function for the profile ! ! --- ! ! ! Revision history ! _______________ ! ! Copyright 1997-05-04 Gunnar Liden, All Rights Reserved ! ! Released under the MIT License: ! ! Permission is hereby granted, free of charge, to any person ! obtaining a copy of this software and associated documentation ! files (the "Software"), to deal in the Software without ! restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell ! copies of the Software, and to permit persons to whom the ! Software is furnished to do so, subject to the following ! conditions: ! ! The above copyright notice and this permission notice shall be ! included in all copies or substantial portions of the Software. ! ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ! OTHER DEALINGS IN THE SOFTWARE. ! ! ************************************************************ !sdesce Definition of the Z scaling function for the profile !sdescs Definition av Z skalningsfunktion foer profilkurvan GLOBAL GEOMETRY MODULE zscale ( REF pla_id >"@t16384 Select plane shape"; FLOAT zs_0 := 15.00 >"Scale factor for top curve (Y=0)"; FLOAT zs_1 := 13.00 >"Scale factor mid section of fuselage"; FLOAT as_1 := 0.70 >"Slope in degrees for mid section"; FLOAT zs_2 := 4.00 >"Scale factor start of wing"; FLOAT zs_3 := 0.75 >"Scale factor end of wing"; STRING s_d*30 := "Zsca_1" >"Name / description"; INT graphic:= 1 >"=0: Show nothing =1: Scale crv =2: All"); ! Internal variables VECTOR p_0; ! Point 0 VECTOR tp_0; ! Tangent point 0 VECTOR p_1; ! Point 1 VECTOR tp_1; ! Tangent point 1 VECTOR p_2; ! Point 2 VECTOR p_3; ! Point 3 ! Attributes for plashape: FLOAT x_1; ! 1 Forward fuselage nose point X FLOAT pv1; ! 2 P-value forward fuselage FLOAT x_2; ! 3 Forward fuselage end point X FLOAT y_2; ! 4 Forward fuselage end point Y FLOAT x_3; ! 5 Wing leading edge start point X FLOAT y_3; ! 6 Wing Start station value Y FLOAT x_4; ! 7 Wing leading edge outer point X FLOAT y_4; ! 8 Wing end station value Y FLOAT x_5; ! 9 Wing trailing edge outer point X FLOAT x_6; ! 10 Wing trailing edge inner point X FLOAT x_7; ! 11 Rear fuselage end point X FLOAT y_7; ! 12 Rear fuselage end point Y INT b_val_c; ! Blank value for output curves INT b_val_a; ! Blank value all other entities BEGINMODULE ! +++ ! Algorithm ! _________ ! --- ! +++ ! 1. Checks and initializations ! --- ! +++ ! Check graphic variable ! --- IF graphic = 0 THEN b_val_c := 1; b_val_a := 1; ELIF graphic = 1 THEN b_val_c := 0; b_val_a := 1; ELIF graphic = 2 THEN b_val_c := 0; b_val_a := 0; ELSE PART(#51, inp_err (VEC(1000,-2000,0))); EXIT("zscale graphic is not 0, 1 or 2"); ENDIF; ! +++ ! 2. Retrieve Y values from the projected shape ! --- x_1 := GETFLT(pla_id, 1); y_2 := GETFLT(pla_id, 4); y_3 := GETFLT(pla_id, 6); y_4 := GETFLT(pla_id, 8); ! +++ ! Input data to local variables (type VECTOR) ! --- p_0 := VEC( 0, zs_0, 0); tp_0 := VEC( 1, zs_0, 0); p_1 := VEC(y_2, zs_1, 0); tp_1 := VEC(y_2+SIN(90+as_1),zs_1+COS(90+as_1),0); p_2 := VEC(y_3, zs_2, 0); p_3 := VEC(y_4, zs_3, 0); POI_FREE(#20, p_0:BLANK=b_val_a,PEN=2); POI_FREE(#21,tp_0:BLANK=b_val_a,PEN=3); POI_FREE(#22, p_1:BLANK=b_val_a,PEN=2); POI_FREE(#23,tp_1:BLANK=b_val_a,PEN=3); POI_FREE(#24, p_3:BLANK=b_val_a,PEN=2); ! +++ ! 2. Create zscale curve ! --- CUR_CONIC(#1, "FREE", p_0 , tp_0 , 0.5, p_1 , tp_1 , 0.5, p_2 , p_3 , 0.5, p_3 , p_2 , 0.5 :BLANK=b_val_a); ! +++ ! 3. Registration of zscale curve with GROUP name Profile ! --- GROUP(#2, "Zscale", GLOBAL_REF(#1)); ! +++ ! 4. Graphical representation of the curve ! --- TFORM_MOVE(#3, VEC(0,0,0), VEC(2*x_1,-7000,0), 1.0, 100, 1); TCOPY(#4, GLOBAL_REF(#1), GLOBAL_REF(#3), 1:BLANK=b_val_c,PEN=4); ENDMODULE