This routine creates plane definition from given origin and two vectors \verbatim vecB______ /\ | | | | | | | | | |-------------->| origin vecA \endverbatim
Type | Intent | Optional | 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) |
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