OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
i8_nearest_seg.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!|| i8_nearest_seg ../engine/source/interfaces/inter3d/i8_nearest_seg.F
25!||--- called by ------------------------------------------------------
26!|| i8msr3 ../engine/source/interfaces/inter3d/i8msr3.F
27!||====================================================================
28 SUBROUTINE i8_nearest_seg(X, IS, M1, M2, M3, BMIN)
29C
30C COMPUTE BARYCENTRIC COORDINATES OF PROJECTION OF NODE IS ON TRIANGLE M1 M2 M3
31C WOLFGANG HEIDRICH, 2005
32C-----------------------------------------------
33C I m p l i c i t T y p e s
34C-----------------------------------------------
35#include "implicit_f.inc"
36C-----------------------------------------------
37C D u m m y A r g u m e n t s
38C-----------------------------------------------
39 INTEGER, INTENT(IN) :: IS, M1, M2, M3
40 my_real, INTENT(IN) :: x(3,*)
41 my_real, INTENT(OUT) :: bmin
42C-----------------------------------------------
43C L o c a l V a r i a b l e s
44C-----------------------------------------------
45 my_real n(3), u(3), v(3), w(3), uw(3), wv(3)
46 my_real b0, b1, b2, fac
47C---------------------------------------------------
48 u(1)=x(1,m2)-x(1,m1)
49 u(2)=x(2,m2)-x(2,m1)
50 u(3)=x(3,m2)-x(3,m1)
51C
52 v(1)=x(1,m3)-x(1,m1)
53 v(2)=x(2,m3)-x(2,m1)
54 v(3)=x(3,m3)-x(3,m1)
55C
56 n(1)=u(2)*v(3)-u(3)*v(2)
57 n(2)=u(3)*v(1)-u(1)*v(3)
58 n(3)=u(1)*v(2)-u(2)*v(1)
59C
60 w(1)=x(1,is)-x(1,m1)
61 w(2)=x(2,is)-x(2,m1)
62 w(3)=x(3,is)-x(3,m1)
63C
64 uw(1)=u(2)*w(3)-u(3)*w(2)
65 uw(2)=u(3)*w(1)-u(1)*w(3)
66 uw(3)=u(1)*w(2)-u(2)*w(1)
67C
68 wv(1)=w(2)*v(3)-w(3)*v(2)
69 wv(2)=w(3)*v(1)-w(1)*v(3)
70 wv(3)=w(1)*v(2)-w(2)*v(1)
71C
72 fac=one/(n(1)*n(1)+n(2)*n(2)+n(3)*n(3))
73 b2 =(uw(1)*n(1)+uw(2)*n(2)+uw(3)*n(3))*fac
74 b1 =(wv(1)*n(1)+wv(2)*n(2)+wv(3)*n(3))*fac
75 b0 = one - b1 - b2
76 bmin=min(b0,b1,b2)
77C BMIN > 0 Projection est a l'interieur du triangle
78C BMIN = 0 Projection est sur un cote du triangle
79C BMIN < 0 Projection est a l'exterieur du triangle
80 RETURN
81 END
#define my_real
Definition cppsort.cpp:32
subroutine i8_nearest_seg(x, is, m1, m2, m3, bmin)
#define min(a, b)
Definition macros.h:20