Sei sulla pagina 1di 2

www.appliedmathematics.

info

Demonstration of 3D Vector Geometry Operations using Fortran


This document1 is a user-guide for the the set of open source Fortran codes for carrying out three-dimensional vector operations. The file
of vector operations can be downloaded from the link GEOM3D.FOR and the set of test problems can be downloaded from GEOM3D_T.FOR.
The functions of vector geometry that are demonstrated by the spreadsheet are introduced in the document Vector Geometry, using the
similar examples. An Excel spreadsheet GEOM.xlsm illustrates the test of the same operations (including in VBA) on the same test data.

Module

Interface components

Service

Test

SUBROUTINE
VEC3(PA,PB,VEC
)

REAL*8 PA(3), PB(3),


VEC(3)

Finds the 2-vector vec linking point


PA to point PB and stores the
resultin VEC.

FUNCTION
DOT3(VECA,VEC
B)
FUNCTION
SIZE3(VEC)

REAL*8 VECA(3), VECB(3),


DOT3

Returns the dot product of the two


3-vectors VECA and VECB

REAL*8 VEC(3), SIZE3

Returns the modulus of the 3-vector


VEC

FUNCTION
SSIZE3(VEC)

REAL*8 VEC(3), SSIZE3

Returns the modulus of the 3-vector


VEC

FUNCTION
DIST3(PA,PB,)
SUBROUTINE
CROSS3(VECA,
VECB, CROSS)
SUBROUTINE
NORM3(PA, PB,
PC,VECNOR)

REAL*8 PA(3), PB(3),


DIST3
REAL*8 VECA(3), VECB(3),
CROSS(3)

Returns the distance between two


points PA and PB
Finds the cross product of the
vectors VECA and VECB

2
1) PA=P1= (1,-3,2), PB=P2= (3,-5,7) , VECA=VEC=(2)
5
7
2) PA=P1= (1,-3,2), PB=P3= (8,-2,5) , VECB=VEC=(1)
3
2
7
VECA =(2), VECB =(1)DOT3=27
5
3
2
VECA =VEC=(2) SIZE3=33
5
7
VECB =VEC =(1) SSIZE3=59
3
PA=P1= (1,-3,2), PB=P2= (3,-5,7) , DIST3=33

REAL*8 PA(3), PB(3), PC(3),


VECNOR(3)

Finds the normal to the triangle with


vertices PA, PB and PC

FUNCTION
AREA(PA,PB,PC)

REAL*8 PA(3), PB(3), PC(3),


AREA

Returns the area of the triangle with


vertices PA, PB and PC

http://www.appliedmathematics.info/software/GEOM3D_FOR.htm

2
7
11
VECA =(2), VECB =(1) CROSS=( 29 )
5
3
16
PA=P1= (1,-3,2), PB=P2= (3,-5,7) , PC=P3= (8,-2,5)
11/1218
VECNOR=( 29/1218 )
16/1218
PA=P1= (1,-3,2), PB=P2= (3,-5,7) , PC=P3= (8,-2,5) AREA=1218/2

www.appliedmathematics.info

These codes are typically used in the boundary element method software www.boundary-element-method.com and a guide to Fortran 77
con be found here.

Potrebbero piacerti anche