!****h* General_VKN/Bez6 ! NAME ! Bez6 -- Module to produce bezier curves with 6 control points. ! [Bez6.MBS] ! DESCRIPTION ! The steps followed are: ! * Input the 6 3D coordinate locations for the nodes defining the curve. ! * Create points at each node location. ! * Connect the nodes with lines ! * Place points at each line mid-point & connect lines between mid-points. ! * Place points at quarter points & connect quarter point lines. ! * Place mid-points on each line defining tangent points at each curve ! connection node ! * Place the Bezier curve connecting all the tangent points using ! cur_conic(). ! * Get location of tangent point preceding point #1 for return ! SOURCE GLOBAL GEOMETRY MODULE Bez6( VECTOR pt1 >"Enter Pt #1", ! Starting (1st) Chord Point pt2 >"Enter Pt #2", ! 2nd, etc. pt3 >"Enter Pt #3", pt4 >"Enter Pt #4", pt5 >"Enter Pt #5", pt6 >"Enter Pt #6"; VAR VECTOR Tngt1); ! Returns tangent pt for pt1 !*** ! ! Copyright 2006, John J. Hughes (Email: n4yvt@arrl.net) ! ! This source code file is part of the 'NGBproject' files which ! execute interactively under the 'VARKON' program, which is ! distributed under the terms of the GNU General Public License. ! ! The 'NGBproject' files are also distributed under the terms of ! the GNU GeneralPublic License. See the GNU General Public License n ! included ithe file name "COPYING.txt" in the Varkon ./app/NGB/doc ! directory for more details. ! BEGINMODULE !*********************************************************************** ! ~ Create points at each node location. !----------------------------------------------------------------------- poi_free(#30,pt1:BLANK=0); poi_free(#40,pt2:BLANK=0); poi_free(#50,pt3:BLANK=0); poi_free(#60,pt4:BLANK=0); poi_free(#70,pt5:BLANK=0); poi_free(#80,pt6:BLANK=0); !*********************************************************************** ! ~ Connect the nodes with lines !----------------------------------------------------------------------- lin_free(#130,on(#30), on(#40):BLANK=0); lin_free(#150,on(#40), on(#50):BLANK=0); lin_free(#160,on(#50), on(#60):BLANK=0); lin_free(#170,on(#60), on(#70):BLANK=0); lin_free(#180,on(#70), on(#80):BLANK=0); !*********************************************************************** ! ~ Get location of tangent point preceding point #1 !----------------------------------------------------------------------- Tngt1:=pt1 - 0.25*tang(#130); poi_free(#184,Tngt1:BLANK=0); !*********************************************************************** ! ~ Place points at each line mid-point & connect lines ! ~ between mid-points. !----------------------------------------------------------------------- poi_free(#190,on(#130, 0.5):BLANK=1); poi_free(#200,on(#150, 0.5):BLANK=1); poi_free(#210,on(#160, 0.5):BLANK=1); poi_free(#220,on(#170, 0.5):BLANK=1); poi_free(#230,on(#180, 0.5):BLANK=1); lin_free(#240,on(#190), on(#200):BLANK=1); lin_free(#250,on(#200), on(#210):BLANK=1); lin_free(#260,on(#210), on(#220):BLANK=1); lin_free(#270,on(#220), on(#230):BLANK=1); !*********************************************************************** ! ~ Place points at quarter points & connect quarter oint lines. !----------------------------------------------------------------------- poi_free(#280,on(#130, 0.25):BLANK=1); poi_free(#290,on(#240, 0.25):BLANK=1); poi_free(#300,on(#250, 0.25):BLANK=1); poi_free(#310,on(#260, 0.25):BLANK=1); poi_free(#320,on(#270, 0.25):BLANK=1); poi_free(#330,on(#240, 0.75):BLANK=1); poi_free(#340,on(#250, 0.75):BLANK=1); poi_free(#350,on(#260, 0.75):BLANK=1); poi_free(#360,on(#270, 0.75):BLANK=1); poi_free(#370,on(#180, 0.75):BLANK=1); poi_free(#600,on(#180, 0.95):BLANK=1); lin_free(#380,on(#280), on(#290):BLANK=1); lin_free(#390,on(#330), on(#300):BLANK=1); lin_free(#400,on(#340), on(#310):BLANK=1); lin_free(#410,on(#350), on(#320):BLANK=1); lin_free(#420,on(#360), on(#370):BLANK=1); !*********************************************************************** ! ~ Place mid-points on each line defining tangent points at each ! ~ curve connection node !----------------------------------------------------------------------- poi_free(#430,on(#380, 0.5):BLANK=1); poi_free(#440,on(#240, 0.5):BLANK=1); poi_free(#450,on(#390, 0.5):BLANK=1); poi_free(#460,on(#250, 0.5):BLANK=1); poi_free(#470,on(#260, 0.5):BLANK=1); poi_free(#480,on(#410, 0.5):BLANK=1); poi_free(#490,on(#270, 0.5):BLANK=1); poi_free(#500,on(#420, 0.5):BLANK=1); poi_free(#510,on(#400, 0.5):BLANK=1); !*********************************************************************** ! ~ Place the Bezier curve connection all the tangent points. !----------------------------------------------------------------------- cur_conic(#530,"FREE", on(#30), on(#280),0.55, on(#430),on(#290),0.55, on(#440),on(#330),0.55, on(#450),on(#300),0.55, on(#460),on(#340),0.55, on(#510),on(#310),0.55, on(#470),on(#350),0.55, on(#480),on(#320),0.55, on(#490),on(#360),0.55, on(#500),on(#370),0.55, on(#600),on(#370),0.55); ENDMODULE