Debian Codegraph @

packages/seacas/applications/blot/zaway.f

raw
1 C Copyright(C) 1999-2020 National Technology & Engineering Solutions
2 C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 C NTESS, the U.S. Government retains certain rights in this software.
4 C
5 C See packages/seacas/LICENSE for details
6
7 C=======================================================================
8 LOGICAL FUNCTION ZAWAY (NLNKF, LINKF1, XN, YN, ZN, HIDENP)
9 C=======================================================================
10
11 C --*** ZAWAY *** (MESH) Determine if face is hidden
12 C -- Written by Amy Gilkey - revised 10/22/87
13 C -- Sam Key, 03/01/85
14 C --
15 C --ZAWAY determines if a face on a 3D surface is hidden.
16 C --It is hidden if and only if its outward normal points "into" the
17 C --plotting surface. Nodes within the face are marked as
18 C --visible if the face is visible.
19 C --
20 C --Parameters:
21 C -- NLNKF - IN - the number of nodes per face
22 C -- LINKF1 - IN - the connectivity for the face
23 C -- XN, YN, ZN - IN - the nodal coordinates; the Z-coordinate is
24 C -- pointing towards the viewer (out of the plotting plane)
25 C -- HIDENP - IN/OUT - node status (as in HIDDEN)
26
27 PARAMETER (KNVIS=0, KNFOVR=10, KNHID=100)
28
29 INTEGER LINKF1(NLNKF)
30 REAL XN(*), YN(*), ZN(*)
31 INTEGER HIDENP(*)
32
33 C --Form X and Y components of diagonal vectors of face
34 C --(calculate from midpoint of each side)
35
36 AX = (XN(LINKF1(3)) + XN(LINKF1(4)))
37 & - (XN(LINKF1(1)) + XN(LINKF1(2)))
38 BX = (XN(LINKF1(4)) + XN(LINKF1(1)))
39 & - (XN(LINKF1(2)) + XN(LINKF1(3)))
40 AY = (YN(LINKF1(3)) + YN(LINKF1(4)))
41 & - (YN(LINKF1(1)) + YN(LINKF1(2)))
42 BY = (YN(LINKF1(4)) + YN(LINKF1(1)))
43 & - (YN(LINKF1(2)) + YN(LINKF1(3)))
44
45 C --Form Z component of normal vector to corner, and make node
46 C --visible if normal points forward
47
48 ZAWAY = (AX*BY .LE. BX*AY)
49
50 IF (.NOT. ZAWAY) THEN
51 DO 100 ILINK = 1, 4
52 HIDENP(LINKF1(ILINK)) = KNVIS
53 100 CONTINUE
54 END IF
55
56 RETURN
57 END