point2 Derived Type

type, public :: point2

A point object with coordinates stored in cartesian coordinates


Contents


Components

TypeVisibility AttributesNameInitial
real(kind=real64), public :: x
real(kind=real64), public :: y

Type-Bound Procedures

procedure, public :: print => point2_print_cartesian

procedure, public :: print_pol => point2_print_polar

  • public subroutine point2_print_polar(self)

    Print the polar coordinates of a point in this form

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(in) :: self

procedure, public :: rho => point2_rho

  • public function point2_rho(self) result(rho)

    Calculate the magnitude (distance from the origin) of

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(in) :: self

    Return Value real(kind=real64)

procedure, public :: theta => point2_theta

  • public function point2_theta(self) result(theta)

    Return the angle (in degrees) of the polar representation of a point

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(in) :: self

    Return Value real(kind=real64)

procedure, public :: to_array => point2_to_array

  • public function point2_to_array(self) result(array)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(in) :: self

    Return Value real(kind=real64), dimension(2)

procedure, public :: dist => point2_distance_between_point2

  • public function point2_distance_between_point2(self, p2) result(dist)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(in) :: self
    class(point2), intent(in) :: p2

    Return Value real(kind=real64)

generic, public :: from_pol => from_pol_r32, from_pol_r64, from_pol_int

This is the comment for a generic function

  • public function point2_from_polar_r32(rho, theta) result(point)

    Arguments

    Type IntentOptional AttributesName
    real(kind=real32), intent(in) :: rho
    real(kind=real32), intent(in) :: theta

    Return Value type(point2)

  • public function point2_from_polar_r64(rho, theta) result(point)

    Arguments

    Type IntentOptional AttributesName
    real(kind=real64), intent(in) :: rho
    real(kind=real64), intent(in) :: theta

    Return Value type(point2)

  • public function point2_from_polar_int(rho, theta) result(point)

    Arguments

    Type IntentOptional AttributesName
    integer, intent(in) :: rho
    integer, intent(in) :: theta

    Return Value type(point2)

generic, public :: assignment(=) => from_array_r32, from_array_r64, from_array_int

  • public subroutine point2_from_array_r32(point, array)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(out) :: point
    real(kind=real32), intent(in), dimension(2):: array
  • public subroutine point2_from_array_r64(point, array)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(out) :: point
    real(kind=real64), intent(in), dimension(2):: array
  • public subroutine point2_from_array_int(point, array)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(out) :: point
    integer, intent(in), dimension(2):: array

generic, public :: operator(+) => add

  • public function point2_plus_point2(self, p2) result(p3)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(in) :: self
    class(point2), intent(in) :: p2

    Return Value type(point2)

generic, public :: operator(-) => subtract_point2, unary_minus

  • public function point2_minus_point2(self, p2) result(p3)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(in) :: self
    class(point2), intent(in) :: p2

    Return Value type(point2)

  • public function point2_unary_minus(self) result(p3)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(in) :: self

    Return Value type(point2)

procedure, public :: add => point2_plus_point2

  • public function point2_plus_point2(self, p2) result(p3)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(in) :: self
    class(point2), intent(in) :: p2

    Return Value type(point2)

procedure, public :: subtract_point2 => point2_minus_point2

  • public function point2_minus_point2(self, p2) result(p3)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(in) :: self
    class(point2), intent(in) :: p2

    Return Value type(point2)

procedure, public :: unary_minus => point2_unary_minus

  • public function point2_unary_minus(self) result(p3)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(in) :: self

    Return Value type(point2)

procedure, public, nopass :: from_pol_r32 => point2_from_polar_r32

  • public function point2_from_polar_r32(rho, theta) result(point)

    Arguments

    Type IntentOptional AttributesName
    real(kind=real32), intent(in) :: rho
    real(kind=real32), intent(in) :: theta

    Return Value type(point2)

procedure, public, nopass :: from_pol_r64 => point2_from_polar_r64

  • public function point2_from_polar_r64(rho, theta) result(point)

    Arguments

    Type IntentOptional AttributesName
    real(kind=real64), intent(in) :: rho
    real(kind=real64), intent(in) :: theta

    Return Value type(point2)

procedure, public, nopass :: from_pol_int => point2_from_polar_int

  • public function point2_from_polar_int(rho, theta) result(point)

    Arguments

    Type IntentOptional AttributesName
    integer, intent(in) :: rho
    integer, intent(in) :: theta

    Return Value type(point2)

procedure, public :: from_array_r32 => point2_from_array_r32

  • public subroutine point2_from_array_r32(point, array)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(out) :: point
    real(kind=real32), intent(in), dimension(2):: array

procedure, public :: from_array_r64 => point2_from_array_r64

  • public subroutine point2_from_array_r64(point, array)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(out) :: point
    real(kind=real64), intent(in), dimension(2):: array

procedure, public :: from_array_int => point2_from_array_int

  • public subroutine point2_from_array_int(point, array)

    Arguments

    Type IntentOptional AttributesName
    class(point2), intent(out) :: point
    integer, intent(in), dimension(2):: array