!****h* Main/ZPlanePt ! NAME ! ZPlanePt -- Return a new point on a specified Z-Plane which ! lies on a line which intersects the plane after passing through ! 2 specified points. [ZPlanePt.MBS] ! ! DESCRIPTION ! This module take the following steps to locate and return the ! new point: ! * Check to make sure a line passing through both points ! intersects the Z-Plane ! * Select as Point 'A' (PtA), the point fartherest to the plane ! * Set Point 'B' (PtB) to the unselected point ! * Generate a blanked line (Ln) from 'PtA' to 'PtB' ! * Obtain the direction Cosines vector (UnitVec) for 'Ln' ! using the Varkon tangt() function ! * Calculate the hypotenuse length (Hyp) for a line projecting ! from 'PtB' to the specified Z-Plane ! * Multiply 'hyp' x 'UnitVec' to obtain vector (DeltaVec) ! from 'PtB' to the Z-Plane ! * Sum DeltaVec + PtB vector to obtain new Z-Plane intersect ! point as return value ! * Close loop ! ! SOURCE GLOBAL GEOMETRY MODULE ZPlanePt( FLOAT ZCrd; ! Z-Coordinate of plane VECTOR Pt1, ! First Point Pt2; ! Second Point VAR VECTOR PtZ); ! Return point on Z-Plane !*** !*********************************************************************** ! 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. !----------------------------------------------------------------------- VECTOR PtA,PtB,UnitVec,DeltaVec; FLOAT Hyp; BEGINMODULE !*********************************************************************** ! * Check to make sure a line passing through both points ! intersects the Z-Plane !----------------------------------------------------------------------- IF (Pt1.z = Pt2.z) THEN PtZ:=vec(0,0,0); ELSE !*********************************************************************** ! * Select as Point 'A' (PtA), the point fartherest to the plane ! * Set Point 'B' (PtB) to the unselected point !----------------------------------------------------------------------- IF ZCrd-Pt1.z > ZCrd-Pt2.z THEN PtA:=Pt1; PtB:=Pt2; ELSE PtA:=Pt2; PtB:=Pt1; ENDIF; !*********************************************************************** ! * Generate a blanked line (Ln) from 'PtA' to 'PtB' !----------------------------------------------------------------------- lin_free(#10,PtA,PtB:BLANK=1); !*********************************************************************** ! * Obtain the direction Cosines vector (UnitVec) for 'Ln' ! using the Varkon tangt() function !----------------------------------------------------------------------- UnitVec:=tang(#10); !*********************************************************************** ! * Calculate the hypotenuse length (Hyp) for a line projecting ! from 'PtB' to the specified Z-Plane !----------------------------------------------------------------------- Hyp:=(ZCrd - PtB.z) / UnitVec.z; !*********************************************************************** ! * Multiply 'hyp' x 'UnitVec' to obtain vector (DeltaVec) ! from 'PtB' to the Z-Plane !----------------------------------------------------------------------- DeltaVec:=Hyp * UnitVec; !*********************************************************************** ! * Sum DeltaVec + PtB vector to obtain new Z-Plane intersect ! point as return value !----------------------------------------------------------------------- PtZ:=PtB + DeltaVec; !*********************************************************************** ! * Close loop !----------------------------------------------------------------------- ENDIF; ENDMODULE