normal Function

private pure function normal(v1, v2, v3) result(n)

Normal vector for the plate (computed using right hand rule).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), dimension(3) :: v1

first vertex of the triangle [x,y,z]

real(kind=wp), intent(in), dimension(3) :: v2

second vertex of the triangle [x,y,z]

real(kind=wp), intent(in), dimension(3) :: v3

third vertex of the triangle [x,y,z]

Return Value real(kind=wp), dimension(3)

surface normal vector


Calls

proc~~normal~~CallsGraph proc~normal normal proc~cross cross proc~normal->proc~cross proc~unit unit proc~normal->proc~unit

Called by

proc~~normal~~CalledByGraph proc~normal normal proc~write_ascii_stl_file stl_file%write_ascii_stl_file proc~write_ascii_stl_file->proc~normal proc~write_binary_stl_file stl_file%write_binary_stl_file proc~write_binary_stl_file->proc~normal

Source Code

    pure function normal(v1,v2,v3) result(n)

    implicit none

    real(wp),dimension(3),intent(in) :: v1  !! first vertex of the triangle [x,y,z]
    real(wp),dimension(3),intent(in) :: v2  !! second vertex of the triangle [x,y,z]
    real(wp),dimension(3),intent(in) :: v3  !! third vertex of the triangle [x,y,z]
    real(wp),dimension(3) :: n  !! surface normal vector

    n = unit( cross( v2-v1, v3-v1 ) )

    end function normal