C++********************************************************************* C C VOIA.F NEW AUG 04 ARDEAN LEITH C USED surfrot.c C C ********************************************************************** C=* FROM: SPIDER - MODULAR IMAGE PROCESSING SYSTEM. AUTHOR: J.FRANK * C=* Copyright (C) 1985-2005 Health Research Inc. * C=* * C=* HEALTH RESEARCH INCORPORATED (HRI), * C=* ONE UNIVERSITY PLACE, RENSSELAER, NY 12144-3455. * C=* * C=* Email: spider@wadsworth.org * C=* * C=* This program is free software; you can redistribute it and/or * C=* modify it under the terms of the GNU General Public License as * C=* published by the Free Software Foundation; either version 2 of the * C=* License, or (at your option) any later version. * C=* * C=* This program is distributed in the hope that it will be useful, * C=* but WITHOUT ANY WARRANTY; without even the implied warranty of * C=* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * C=* General Public License for more details. * C=* * C=* You should have received a copy of the GNU General Public License * C=* along with this program; if not, write to the * C=* Free Software Foundation, Inc., * C=* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * C=* * C ********************************************************************** C C VOIA C C PURPOSE: DETERMINES INCLUDED ANGLE BETWEEEN 2 VECTORS C C23456789012345678901234567890123456789012345678901234567890123456789012 C--********************************************************************* SUBROUTINE VOIA INCLUDE 'CMBLOCK.INC' REAL, DIMENSION(3) :: VEC1,VEC2 CALL RDPRM3S(VEC1(1),VEC1(2),VEC1(3),NOT_USED, & 'FIRST VECTOR - X, Y & Z',IRTFLG) IF (IRTFLG .NE. 0) RETURN CALL RDPRM3S(VEC2(1),VEC2(2),VEC2(3),NOT_USED, & 'SECOND VECTOR - X, Y & Z',IRTFLG) IF (IRTFLG .NE. 0) RETURN CALL INCANGV(VEC1,VEC2,COSANG,ANG,IRTFLG) WRITE(6,90) ANG 90 FORMAT(' INCLUDED ANGLE: ',F7.2) CALL REG_SET_NSEL(1,1, ANG,0.0,0.0,0.0,0.0, IRTFLG) END SUBROUTINE INCANGV(VEC1,VEC2,COSANG,ANG,IRTFLG) DIMENSION VEC1(3),VEC2(3) DATA FLTZER/10E-30/ DIS1 = VEC1(1)*VEC1(1) + VEC1(2)*VEC1(2) + VEC1(3)*VEC1(3) DIS2 = VEC2(1)*VEC2(1) + VEC2(2)*VEC2(2) + VEC2(3)*VEC2(3) C FIND ANGLE BETWEEN LINES DIS13 = DIS1 * DIS2 IF (ABS(DIS13) .LT. FLTZER) THEN C REJECT DUPLICATED POINTS OR GET DIVISION BY ZERO! COSANG = 1.0 ANG = 0.0 IRTFLG = 1 ELSE C COSANG = DOT(VEC1,VEC2) / SQRT(DIS13) COSANG = (VEC1(1)*VEC2(1) + & VEC1(2)*VEC2(2) + & VEC1(3)*VEC2(3)) / SQRT(DIS13) ANG = ACOSD(COSANG) IRTFLG = 0 ENDIF RETURN END