foreng_math_geom Module



Contents


Interfaces

public interface cross_product

  • public function cross_product_r32(v1, v2) result(normal)

    Arguments

    Type IntentOptional AttributesName
    real, intent(in), dimension(3):: v1

    Vectors to cross multiply

    real, intent(in), dimension(3):: v2

    Vectors to cross multiply

    Return Value real, dimension(3)

    Normal vector that is the output

  • public function cross_product_r64(v1, v2) result(normal)

    Arguments

    Type IntentOptional AttributesName
    real(kind=real64), intent(in), dimension(3):: v1

    Vectors to cross multiply

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

    Vectors to cross multiply

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

    Normal vector that is the output

public interface operator(*)

  • public function scalar_times_vector3_r32(k, v1) result(v2)

    Arguments

    Type IntentOptional AttributesName
    real(kind=real32), intent(in) :: k
    class(vector3), intent(in) :: v1

    Return Value type(vector3)

  • public function scalar_times_vector3_r64(k, v1) result(v2)

    Arguments

    Type IntentOptional AttributesName
    real(kind=real64), intent(in) :: k
    class(vector3), intent(in) :: v1

    Return Value type(vector3)

  • public function scalar_times_vector3_int(k, v1) result(v2)

    Arguments

    Type IntentOptional AttributesName
    integer, intent(in) :: k
    class(vector3), intent(in) :: v1

    Return Value type(vector3)


Derived Types

type, public :: point2

A point object with coordinates stored in cartesian coordinates

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
procedure, public :: rho => point2_rho
procedure, public :: theta => point2_theta
procedure, public :: to_array => point2_to_array
procedure, public :: dist => point2_distance_between_point2
generic, public :: from_pol => from_pol_r32, from_pol_r64, from_pol_int

This is the comment for a generic function

generic, public :: assignment(=) => from_array_r32, from_array_r64, from_array_int
generic, public :: operator(+) => add
generic, public :: operator(-) => subtract_point2, unary_minus
procedure, public :: add => point2_plus_point2
procedure, public :: subtract_point2 => point2_minus_point2
procedure, public :: unary_minus => point2_unary_minus
procedure, public, nopass :: from_pol_r32 => point2_from_polar_r32
procedure, public, nopass :: from_pol_r64 => point2_from_polar_r64
procedure, public, nopass :: from_pol_int => point2_from_polar_int
procedure, public :: from_array_r32 => point2_from_array_r32
procedure, public :: from_array_r64 => point2_from_array_r64
procedure, public :: from_array_int => point2_from_array_int

type, public :: point3

Components

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

Type-Bound Procedures

procedure, public :: print => point3_print_cartesian
procedure, public :: print_sph => point3_print_spherical
procedure, public :: rho => point3_rho
procedure, public :: theta => point3_theta
procedure, public :: phi => point3_phi
procedure, public :: to_array => point3_to_array
procedure, public :: dist => point3_distance_between_point3
generic, public :: from_sph => from_sph_r32, from_sph_r64, from_sph_int

This is the comment for a generic function

generic, public :: operator(+) => add
generic, public :: assignment(=) => from_array_r32, from_array_r64, from_array_int
generic, public :: operator(-) => subtract
procedure, public :: add => point3_plus_point3
procedure, public :: point3_unary_minus
procedure, public :: subtract => point3_minus_point3
procedure, public, nopass :: from_sph_r32 => point3_from_spherical_r32
procedure, public, nopass :: from_sph_r64 => point3_from_spherical_r64
procedure, public, nopass :: from_sph_int => point3_from_spherical_int
procedure, public :: from_array_r32 => point3_from_array_r32
procedure, public :: from_array_r64 => point3_from_array_r64
procedure, public :: from_array_int => point3_from_array_int

type, public :: vector3

Components

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

Type-Bound Procedures

procedure, public :: print => vector3_print
procedure, public :: length => vector3_magnitude
procedure, public :: to_array => vector3_to_array
generic, public :: from_array => from_array_r32, from_array_r64, from_array_int
generic, public :: operator(+) => add_vector3
generic, public :: operator(-) => subtract_vector3, unary_minus
generic, public :: operator(*) => multiply_scalar_r32, multiply_scalar_r64, multiply_scalar_int
generic, public :: operator(.dot.) => dot
generic, public :: operator(.cross.) => cross
generic, public :: operator(.angle.) => angle_between
generic, public :: assignment(=) => from_array_r32, from_array_r64, from_array_int
procedure, public :: from_array_r32 => vector3_from_array_r32
procedure, public :: from_array_r64 => vector3_from_array_r64
procedure, public :: from_array_int => vector3_from_array_int
procedure, public :: add_vector3 => vector3_plus_vector3
procedure, public :: multiply_scalar_r32 => vector3_times_scalar_r32
procedure, public :: multiply_scalar_r64 => vector3_times_scalar_r64
procedure, public :: multiply_scalar_int => vector3_times_scalar_int
procedure, public :: dot => vector3_dot_vector3
procedure, public :: cross => vector3_cross_vector3
procedure, public :: angle_between => vector3_angle_between_vector3
procedure, public :: subtract_vector3 => vector3_minus_vector3
procedure, public :: unary_minus => vector3_unary_minus

type, public :: line2

Components

TypeVisibility AttributesNameInitial
real(kind=real64), public :: m
real(kind=real64), public :: b

Type-Bound Procedures

procedure, public :: atx => line2_atx

Evaluate y = mx + b for a given x

procedure, public :: aty => line2_aty

Evaluate y = mx + b for a given y

procedure, public :: print => line2_print
generic, public :: assignment(=) => from_two_points
procedure, public :: from_two_points => line2_from_two_point2

Functions

public function point2_to_array(self) result(array)

Arguments

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

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

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)

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)

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)

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)

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)

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)

public function point3_to_array(self) result(array)

Arguments

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

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

public function point3_from_spherical_r32(rho, theta, phi) result(point)

Arguments

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

Return Value type(point3)

public function point3_from_spherical_r64(rho, theta, phi) result(point)

Arguments

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

Return Value type(point3)

public function point3_from_spherical_int(rho, theta, phi) result(point)

Arguments

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

Return Value type(point3)

public function point3_rho(self) result(rho)

Calculate the magnitude (distance from the origin) of

Arguments

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

Return Value real(kind=real64)

public function point3_theta(self) result(theta)

Return the inlination theta

Arguments

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

Return Value real(kind=real64)

public function point3_phi(self) result(phi)

return the azimuth phi

Arguments

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

Return Value real(kind=real64)

public function point3_plus_point3(self, p2) result(p3)

Arguments

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

Return Value type(point3)

public function point3_minus_point3(self, p2) result(p3)

Arguments

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

Return Value type(point3)

public function point3_unary_minus(self) result(p3)

Arguments

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

Return Value type(point3)

public function point3_dot_point3(self, p2) result(dot)

Arguments

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

Return Value real(kind=real64)

public function point3_cross_point3(self, p2) result(p3)

Arguments

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

Return Value type(point3)

public function point3_distance_between_point3(self, p2) result(dist)

Arguments

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

Return Value real(kind=real64)

public function vector3_magnitude(self) result(length)

Arguments

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

Return Value real(kind=real64)

public function vector3_to_array(self) result(array)

Arguments

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

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

public function vector3_plus_vector3(self, v2) result(v3)

Arguments

Type IntentOptional AttributesName
class(vector3), intent(in) :: self
class(vector3), intent(in) :: v2

Return Value type(vector3)

public function vector3_minus_vector3(self, v2) result(v3)

Arguments

Type IntentOptional AttributesName
class(vector3), intent(in) :: self
class(vector3), intent(in) :: v2

Return Value type(vector3)

public function vector3_unary_minus(self) result(v3)

Arguments

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

Return Value type(vector3)

public function vector3_times_scalar_r32(self, k) result(v2)

Arguments

Type IntentOptional AttributesName
class(vector3), intent(in) :: self
real(kind=real32), intent(in) :: k

Return Value type(vector3)

public function vector3_times_scalar_r64(self, k) result(v2)

Arguments

Type IntentOptional AttributesName
class(vector3), intent(in) :: self
real(kind=real64), intent(in) :: k

Return Value type(vector3)

public function vector3_times_scalar_int(self, k) result(v2)

Arguments

Type IntentOptional AttributesName
class(vector3), intent(in) :: self
integer, intent(in) :: k

Return Value type(vector3)

public function scalar_times_vector3_r32(k, v1) result(v2)

Arguments

Type IntentOptional AttributesName
real(kind=real32), intent(in) :: k
class(vector3), intent(in) :: v1

Return Value type(vector3)

public function scalar_times_vector3_r64(k, v1) result(v2)

Arguments

Type IntentOptional AttributesName
real(kind=real64), intent(in) :: k
class(vector3), intent(in) :: v1

Return Value type(vector3)

public function scalar_times_vector3_int(k, v1) result(v2)

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: k
class(vector3), intent(in) :: v1

Return Value type(vector3)

public function vector3_dot_vector3(self, v2) result(dot)

Arguments

Type IntentOptional AttributesName
class(vector3), intent(in) :: self
class(vector3), intent(in) :: v2

Return Value real(kind=real64)

public function vector3_cross_vector3(self, v2) result(normal)

Arguments

Type IntentOptional AttributesName
class(vector3), intent(in) :: self
class(vector3), intent(in) :: v2

Return Value type(vector3)

public function vector3_angle_between_vector3(self, v2) result(theta)

Return angle between vectors in degrees

Arguments

Type IntentOptional AttributesName
class(vector3), intent(in) :: self
class(vector3), intent(in) :: v2

Return Value real(kind=real64)

public function cross_product_r32(v1, v2) result(normal)

Arguments

Type IntentOptional AttributesName
real, intent(in), dimension(3):: v1

Vectors to cross multiply

real, intent(in), dimension(3):: v2

Vectors to cross multiply

Return Value real, dimension(3)

Normal vector that is the output

public function cross_product_r64(v1, v2) result(normal)

Arguments

Type IntentOptional AttributesName
real(kind=real64), intent(in), dimension(3):: v1

Vectors to cross multiply

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

Vectors to cross multiply

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

Normal vector that is the output

public function distance(p1, p2) result(d1)

Arguments

Type IntentOptional AttributesName
real, intent(in), dimension(3):: p1

Points to calculate distance between

real, intent(in), dimension(3):: p2

Points to calculate distance between

Return Value real

public function line2_atx(self, x) result(y)

Arguments

Type IntentOptional AttributesName
class(line2), intent(in) :: self
real(kind=real64), intent(in) :: x

Return Value real(kind=real64)

public function line2_aty(self, y) result(x)

Arguments

Type IntentOptional AttributesName
class(line2), intent(in) :: self
real(kind=real64), intent(in) :: y

Return Value real(kind=real64)


Subroutines

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

public subroutine point2_print_cartesian(self)

Arguments

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

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

public subroutine point3_from_array_r32(point, array)

Arguments

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

public subroutine point3_from_array_r64(point, array)

Arguments

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

public subroutine point3_from_array_int(point, array)

Arguments

Type IntentOptional AttributesName
class(point3), intent(out) :: point
integer, intent(in), dimension(3):: array

public subroutine point3_print_cartesian(self)

Arguments

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

public subroutine point3_print_spherical(self)

Print the polar coordinates of a point in this form

Arguments

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

public subroutine vector3_print(self)

Arguments

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

public subroutine vector3_from_array_r32(vector, array)

Arguments

Type IntentOptional AttributesName
class(vector3), intent(out) :: vector
real(kind=real32), intent(in), dimension(3):: array

public subroutine vector3_from_array_r64(vector, array)

Arguments

Type IntentOptional AttributesName
class(vector3), intent(out) :: vector
real(kind=real64), intent(in), dimension(3):: array

public subroutine vector3_from_array_int(vector, array)

Arguments

Type IntentOptional AttributesName
class(vector3), intent(out) :: vector
integer, intent(in), dimension(3):: array

public subroutine line2_from_two_point2(line, two_points)

Arguments

Type IntentOptional AttributesName
class(line2), intent(out) :: line
class(point2), intent(in), dimension(2), target:: two_points

public subroutine line2_print(self)

Arguments

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