tem_createPlane Subroutine

public subroutine tem_createPlane(me, origin, vecA, vecB)

This routine creates plane definition from given origin and two vectors \verbatim vecB______ /\ | | | | | | | | | |-------------->| origin vecA \endverbatim

Arguments

Type IntentOptional Attributes Name
type(tem_plane_type), intent(out) :: me
real(kind=rk), intent(in) :: origin(3)
real(kind=rk), intent(in) :: vecA(3)
real(kind=rk), intent(in) :: vecB(3)

Calls

proc~~tem_createplane~2~~CallsGraph proc~tem_createplane~2 tem_createPlane proc~cross_product3d cross_product3D proc~tem_createplane~2->proc~cross_product3d

Contents

Source Code


Source Code

  subroutine tem_createPlane(me, origin, vecA, vecB)
    !--------------------------------------------------------------------------!
    type(tem_plane_type), intent(out) :: me !< plane to return
    real(kind=rk), intent(in) :: origin(3) !< plane origin
    real(kind=rk), intent(in) :: vecA(3) !< 1st vector
    real(kind=rk), intent(in) :: vecB(3) !< 2nd vector
    !--------------------------------------------------------------------------!
    integer :: iTri
    !--------------------------------------------------------------------------!
    me%origin = origin
    me%vec(:,1) = vecA
    me%vec(:,2) = vecB
    ! convert plane into triangle
    do iTri = 1,2
      me%triangle(iTri)%nodes(1:3,1) = me%origin
      me%triangle(iTri)%nodes(1:3,2) = me%origin + me%vec(:,iTri)
      me%triangle(iTri)%nodes(1:3,3) = me%origin + me%vec(:,1) + me%vec(:,2)
    end do

    ! normal direction = crossproduct(vecA, vecB)
    me%unitNormal = cross_product3D(vecA, vecB)
    me%unitNormal = me%unitNormal                       &
      & / sqrt(dot_product(me%unitNormal, me%unitNormal))

  end subroutine tem_createPlane