computes the cross product of to 3 dimensional vectors: cross=v1 x v2
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | v1(3) |
first input vector |
||
| real(kind=wp), | intent(in) | :: | v2(3) |
second input vector |
result v1 x v2
PURE FUNCTION CROSS(v1,v2) ! MODULES IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES REAL(wp),INTENT(IN) :: v1(3) !! first input vector REAL(wp),INTENT(IN) :: v2(3) !! second input vector !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES REAL(wp) :: cross(3) !! result v1 x v2 !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES !=================================================================================================================================== cross=(/v1(2)*v2(3)-v1(3)*v2(2),v1(3)*v2(1)-v1(1)*v2(3),v1(1)*v2(2)-v1(2)*v2(1)/) END FUNCTION CROSS