OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
seg_intersect.F
Go to the documentation of this file.
1Copyright> OpenRadioss
2Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3Copyright>
4Copyright> This program is free software: you can redistribute it and/or modify
5Copyright> it under the terms of the GNU Affero General Public License as published by
6Copyright> the Free Software Foundation, either version 3 of the License, or
7Copyright> (at your option) any later version.
8Copyright>
9Copyright> This program is distributed in the hope that it will be useful,
10Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12Copyright> GNU Affero General Public License for more details.
13Copyright>
14Copyright> You should have received a copy of the GNU Affero General Public License
15Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16Copyright>
17Copyright>
18Copyright> Commercial Alternative: Altair Radioss Software
19Copyright>
20Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21Copyright> software under a commercial license. Contact Altair to discuss further if the
22Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23!||====================================================================
24!|| seg_intersect ../engine/source/materials/fail/failwave/seg_intersect.F
25!||--- called by ------------------------------------------------------
26!|| set_failwave_nod3 ../engine/source/materials/fail/failwave/set_failwave_nod3.F
27!|| set_failwave_nod4 ../engine/source/materials/fail/failwave/set_failwave_nod4.F
28!||====================================================================
29 INTEGER FUNCTION seg_intersect(X1 ,Y1 ,X2 ,Y2 ,X3 ,Y3 ,
30 . X4 ,Y4 ,XINT ,YINT ,IDEBUG )
31C-----------------------------------------------
32C I m p l i c i t T y p e s
33C-----------------------------------------------
34#include "implicit_f.inc"
35C-----------------------------------------------
36C D u m m y A r g u m e n t s
37C-----------------------------------------------
38 my_real :: x1,y1,x2,y2,x3,y3,x4,y4,xint,yint,ratio
39C-----------------------------------------------
40C L o c a l V a r i a b l e s
41C-----------------------------------------------
42 INTEGER :: ok,idebug
43 my_real :: ax,bx,ay,by,cx,cy,sy,sx,dm,alpha,beta,tol
44c----------------------------------------------------------
45c calcule intersection de deux segments en 2D : N1-N2 et N3-N4
46c intersection trouve => OK=1, sinon OK=0
47c alpha, beta = ratio du point intersection de chaque segment
48C=======================================================================
49 ok = 0
50 ax = x2 - x1
51 ay = y2 - y1
52 bx = x4 - x3
53 by = y4 - y3
54c
55 dm = ay*bx - ax*by
56 IF (dm /= zero) THEN ! les lignes ne sont pas paralleles
57 cx = x3 - x1
58 cy = y3 - y1
59c
60 alpha = (bx * cy - by * cx) / dm
61 beta = (ax * cy - ay * cx) / dm
62c
63 IF (alpha >= zero .and. alpha <= one .and.
64 . beta >= zero .and. beta <= one) THEN
65 ok = 1
66 xint = x1 + alpha * ax
67 yint = y1 + alpha * ay
68 ENDIF
69c IF (IDEBUG == 1) print*,'ALPHA,BETA=',ALPHA,BETA
70 ENDIF
71 seg_intersect = ok
72c-----------
73 RETURN
74 END
#define my_real
Definition cppsort.cpp:32
#define alpha
Definition eval.h:35
integer function seg_intersect(x1, y1, x2, y2, x3, y3, x4, y4, xint, yint, idebug)