OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
seg_intersect.F File Reference
#include "implicit_f.inc"

Go to the source code of this file.

Functions/Subroutines

integer function seg_intersect (x1, y1, x2, y2, x3, y3, x4, y4, xint, yint, idebug)

Function/Subroutine Documentation

◆ seg_intersect()

integer function seg_intersect ( x1,
y1,
x2,
y2,
x3,
y3,
x4,
y4,
xint,
yint,
integer idebug )

Definition at line 29 of file seg_intersect.F.

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
#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)