plane_basis Subroutine

public subroutine plane_basis(center, redge, tedge, basis, inv_basis)

Calculates basis from 3 points on a plane with +z being the plane normal

Arguments

Type IntentOptional AttributesName
real(kind=Float64), intent(in), dimension(3):: center

Plane origin

real(kind=Float64), intent(in), dimension(3):: redge

Right edge of plane

real(kind=Float64), intent(in), dimension(3):: tedge

Top edge of plane

real(kind=Float64), intent(out), dimension(3,3):: basis

Basis for transforming from plane to cartesian coordinates

real(kind=Float64), intent(out), optional dimension(3,3):: inv_basis

Inverse basis for the reverse transformation cartesian to plane


Calls

proc~~plane_basis~~CallsGraph proc~plane_basis plane_basis proc~cross_product cross_product proc~plane_basis->proc~cross_product

Called by

proc~~plane_basis~~CalledByGraph proc~plane_basis plane_basis proc~track_cylindrical track_cylindrical proc~track_cylindrical->proc~plane_basis proc~read_npa read_npa proc~read_npa->proc~plane_basis proc~pfida_mc pfida_mc proc~pfida_mc->proc~track_cylindrical proc~pfida_f pfida_f proc~pfida_f->proc~track_cylindrical program~fidasim fidasim program~fidasim->proc~read_npa program~fidasim->proc~pfida_mc program~fidasim->proc~pfida_f proc~make_diagnostic_grids make_diagnostic_grids program~fidasim->proc~make_diagnostic_grids proc~make_diagnostic_grids->proc~track_cylindrical

Contents

Source Code


Source Code

subroutine plane_basis(center, redge, tedge, basis, inv_basis)
    !+ Calculates basis from 3 points on a plane with +z being the plane normal
    real(Float64), dimension(3), intent(in)              :: center
        !+ Plane origin
    real(Float64), dimension(3), intent(in)              :: redge
        !+ Right edge of plane
    real(Float64), dimension(3), intent(in)              :: tedge
        !+ Top edge of plane
    real(Float64), dimension(3,3), intent(out)           :: basis
        !+ Basis for transforming from plane to cartesian coordinates
    real(Float64), dimension(3,3), intent(out), optional :: inv_basis
        !+ Inverse basis for the reverse transformation cartesian to plane

    real(Float64), dimension(3) :: u1,u2,u3

    u1 = (redge - center)
    u1 = u1/norm2(u1)
    u2 = (tedge - center)
    u2 = u2/norm2(u2)
    u3 = cross_product(u1,u2)
    u3 = u3/norm2(u3)

    basis(:,1) = u1
    basis(:,2) = u2
    basis(:,3) = u3

    if(present(inv_basis)) inv_basis = transpose(basis)

end subroutine plane_basis