dynamics_geometry Module



Contents


Interfaces

public interface assignment(=)

  • private pure elemental subroutine plane_assign(x, y)

    Assigns a plane to another.

    Arguments

    Type IntentOptional Attributes Name
    type(plane), intent(out) :: x

    The resulting plane.

    type(plane), intent(in) :: y

    The source plane

  • private pure elemental subroutine line_assign(x, y)

    Assigns a line to another.

    Arguments

    Type IntentOptional Attributes Name
    type(line), intent(out) :: x

    The resulting line.

    type(line), intent(in) :: y

    The source line

  • private pure elemental subroutine pl_assign(x, y)

    Assigns a plucker_line to another.

    Arguments

    Type IntentOptional Attributes Name
    type(plucker_line), intent(out) :: x

    The resulting plucker_line.

    type(plucker_line), intent(in) :: y

    The source plucker_line.

  • private pure elemental subroutine pl_assign_line(x, y)

    Assigns a line to a plucker_line.

    Arguments

    Type IntentOptional Attributes Name
    type(plucker_line), intent(out) :: x

    The resulting plucker_line.

    type(line), intent(in) :: y

    The source line.

public interface is_parallel

  • private pure function is_parallel_vectors(x, y, tol) result(rst)

    Tests to see if two vectors are parallel.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:) :: x

    The first vector.

    real(kind=real64), intent(in), dimension(size(x)) :: y

    The second vector.

    real(kind=real64), intent(in), optional :: tol

    The tolerance to use when testing for parallelism. The default tolerance is 10x machine epsilon.

    Return Value logical

    Returns true if the vectors are parallel; else, false.

  • private pure function is_parallel_lines(x, y, tol) result(rst)

    Tests to see if two lines are parallel.

    Arguments

    Type IntentOptional Attributes Name
    class(line), intent(in) :: x

    The first line.

    class(line), intent(in) :: y

    The second line.

    real(kind=real64), intent(in), optional :: tol

    The tolerance to use when testing for parallelism. The default tolerance is 10x machine epsilon.

    Return Value logical

    Returns true if the lines are parallel; else, false.

  • private pure function is_parallel_planes(x, y, tol) result(rst)

    Tests to see if two planes are parallel.

    Arguments

    Type IntentOptional Attributes Name
    class(plane), intent(in) :: x

    The first plane.

    class(plane), intent(in) :: y

    The second plane.

    real(kind=real64), intent(in), optional :: tol

    The tolerance to use when testing for parallelism. The default tolerance is 10x machine epsilon.

    Return Value logical

    Returns true if the planes are parallel; else, false.

public interface line

  • private pure function line_from_2pts(pt1, pt2) result(rst)

    Constructs a line from two points.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: pt1(3)

    The first point. This point will act as the initial point along the line such that in the equation of the line .

    real(kind=real64), intent(in) :: pt2(3)

    The second point.

    Return Value type(line)

    The resulting line.

  • private pure function line_from_2_planes(p1, p2) result(rst)

    Constructs a line from the intersection of two planes.

    Arguments

    Type IntentOptional Attributes Name
    class(plane), intent(in) :: p1

    The first plane.

    class(plane), intent(in) :: p2

    The second plane.

    Return Value type(line)

    The resulting line. NaN's are returned in the event that the two planes are parallel.

  • private pure function line_from_many_points(pts) result(rst)

    Constructs the line that best fits the supplied set of points in a least-squares sense.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:,:) :: pts

    An N-by-3 matrix where N is at least 2, but typically much larger.

    Return Value type(line)

    The resulting line.

public interface matmul

  • private pure function pl_matmul(x, y) result(rst)

    Overloads the matmul routine to allow for multiplication of the Plücker line coordinate vector with a matrix.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:,:) :: x

    The N-by-6 matrix.

    type(plucker_line), intent(in) :: y

    The plucker_line object.

    Return Value real(kind=real64), allocatable, dimension(:)

    The resulting N-element array.

public interface plane

  • private pure function plane_from_3pts(pt1, pt2, pt3) result(rst)

    Constructs a plane from 3 points. The 3 points must not be colinear.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: pt1(3)

    The first point.

    real(kind=real64), intent(in) :: pt2(3)

    The second point.

    real(kind=real64), intent(in) :: pt3(3)

    The third point.

    Return Value type(plane)

    The resulting plane.

  • private pure function plane_from_point_and_normal(pt, nrm) result(rst)

    Constructs a plane from a point which lies on the plane, and a unit vector normal to the plane.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: pt(3)

    The point that lies on the plane.

    real(kind=real64), intent(in) :: nrm(3)

    The normal unit vector.

    Return Value type(plane)

    The resulting plane.

  • private pure function plane_from_many_points(pts) result(rst)

    Constructs the plane that best fits a cloud of points in a least-squares sense.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:,:) :: pts

    The N-by-3 matrix containing the N points to fit. N must be at least 3, but is typically much larger.

    Return Value type(plane)

    The resulting plane.

public interface plucker_line

  • private pure function pl_from_2pts(pt1, pt2) result(rst)

    Constructs a new plucker_line from two points.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: pt1(3)

    The first point.

    real(kind=real64), intent(in) :: pt2(3)

    The second point.

    Return Value type(plucker_line)

    The resulting line.

  • private pure function pl_from_line(ln) result(rst)

    Constructs a new plucker_line from a line object.

    Arguments

    Type IntentOptional Attributes Name
    class(line), intent(in) :: ln

    The line.

    Return Value type(plucker_line)

    The equivalent plucker_line.

  • private pure function pl_from_2_planes(p1, p2) result(rst)

    Constructs a new plucker_line from the intersection of two planes.

    Arguments

    Type IntentOptional Attributes Name
    class(plane), intent(in) :: p1

    The first plane.

    class(plane), intent(in) :: p2

    The second plane.

    Return Value type(plucker_line)

    The resulting line. NaN's are returned in the event that the two planes are parallel.

  • private pure function pl_from_array(x, nrm) result(rst)

    Constructs a new plucker_line from the supplied array.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: x(6)

    A 6-element array containing the Plücker coordinates.

    logical, intent(in), optional :: nrm

    An optional input that specifies if the first three coordinates (the unit vector) should be normalized (true), or left as-is (false). The default is true such that the vector is normalized.

    Return Value type(plucker_line)

    The resulting line.


Derived Types

type, public ::  line

Defines the parametric form of a line .

Components

Type Visibility Attributes Name Initial
real(kind=real64), public :: r0(3)

The coordinates of the initial point .

real(kind=real64), public :: v(3)

The vector defining the orientation of the line.

Constructor

private pure function line_from_2pts (pt1, pt2)

Constructs a line from two points.

private pure function line_from_2_planes (p1, p2)

Constructs a line from the intersection of two planes.

private pure function line_from_many_points (pts)

Constructs the line that best fits the supplied set of points in a least-squares sense.

Type-Bound Procedures

procedure , public :: evaluate => line_eval Function

type, public ::  plane

Defines a plane as .

Components

Type Visibility Attributes Name Initial
real(kind=real64), public :: a

The x-component of the plane normal vector.

real(kind=real64), public :: b

The y-component of the plane normal vector.

real(kind=real64), public :: c

The z-component of the plane normal vector.

real(kind=real64), public :: d

The offset from the origin.

Constructor

private pure function plane_from_3pts (pt1, pt2, pt3)

Constructs a plane from 3 points. The 3 points must not be colinear.

private pure function plane_from_point_and_normal (pt, nrm)

Constructs a plane from a point which lies on the plane, and a unit vector normal to the plane.

private pure function plane_from_many_points (pts)

Constructs the plane that best fits a cloud of points in a least-squares sense.

Type-Bound Procedures

procedure , public :: flip_normal => plane_flip_normal Subroutine

type, public ::  plucker_line

Defines a line in 3D Euclidean space using Plücker coordinates.

Components

Type Visibility Attributes Name Initial
real(kind=real64), public :: v(6)

The 6-element array containing the Plücker coordinates. The first 3 elements contain the unit vector and the last 3 elements contain the moment vector.

Constructor

private pure function pl_from_2pts (pt1, pt2)

Constructs a new plucker_line from two points.

private pure function pl_from_line (ln)

Constructs a new plucker_line from a line object.

private pure function pl_from_2_planes (p1, p2)

Constructs a new plucker_line from the intersection of two planes.

private pure function pl_from_array (x, nrm)

Constructs a new plucker_line from the supplied array.

Type-Bound Procedures

procedure , public :: m => pl_m Function
procedure , public :: to_array => pl_to_array Function
procedure , public :: u => pl_u Function

Functions

public pure function is_point_on_line(pt, ln, tol) result(rst)

Tests to see if a point lies on a line.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point.

class(line), intent(in) :: ln

The line.

real(kind=real64), intent(in), optional :: tol

The tolerance to use when testing. The default tolerance is 10x machine epsilon.

Return Value logical

Returns true if the point lies on the line; else, false.

public pure function is_point_on_plane(pt, pln, tol) result(rst)

Tests to see if a point lies on a plane.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point.

class(plane), intent(in) :: pln

The plane.

real(kind=real64), intent(in), optional :: tol

The tolerance to use when testing. The default tolerance is 10x machine epsilon.

Return Value logical

Returns true if the point lies on the plane; else, false.

public pure function line_common_normal(ln1, ln2) result(rst)

Returns the common normal line between two lines pointing from ln1 to ln2. In the event that the two lines are parallel within the specified tolerance, there exist an infinite number of common normals; therefore, a line will be chosen that runs from ln1 to ln2 with the point at t = 0 coincident with the point at t = 0 on ln1.

Arguments

Type IntentOptional Attributes Name
class(line), intent(in) :: ln1

The first line.

class(line), intent(in) :: ln2

The second line.

Return Value type(line)

The common normal line. The distance along this line between t = 0 and t = 1 defines the length of the common normal connecting ln1 to ln2. In the event that ln1 and ln2 intersect, the length of this line is zero.

public pure function line_from_point_and_vector(pt, x, nx) result(rst)

Constructs a new line from a point (defines the point where t = 0) and a direction vector.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point at which t = 0 on the line.

real(kind=real64), intent(in) :: x(3)

The direction vector defining the orientation of the line.

logical, intent(in), optional :: nx

An optional parameter that defines if x should be normalized to a unit vector (true), or left as-is (false). The default is true such that x is normalized to a unit vector.

Return Value type(line)

The resulting line.

public pure function nearest_point_on_line(pt, ln) result(rst)

Gets the line parameter for the point on the line nearest the specified point.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point.

class(line), intent(in) :: ln

The line.

Return Value real(kind=real64)

The line parameteric variable defining the location of the point nearest along the line.

public pure function plane_normal(pln) result(rst)

Returns the normal vector of a plane.

Arguments

Type IntentOptional Attributes Name
type(plane), intent(in) :: pln

The plane.

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

The normal vector.

public pure function point_plane_projection(pt, pln) result(rst)

Projects a point onto a plane.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point.

class(plane), intent(in) :: pln

The plane onto which to project the point.

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

The projected point.

public pure function point_to_line_distance(pt, ln) result(rst)

Computes the shortest distance between a point and a line.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point.

class(line), intent(in) :: ln

The line.

Return Value real(kind=real64)

The shortest distance between the point and line.

public pure function point_to_plane_distance(pt, pln) result(rst)

Computes the shortest distance between a point and a plane.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point.

class(plane), intent(in) :: pln

The plane.

Return Value real(kind=real64)

The shortest distance between the point and plane.

public pure function vector_plane_projection(x, pln) result(rst)

Projects a vector onto a plane.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: x(3)

The vector to project.

class(plane), intent(in) :: pln

The plane onto which to project the vector.

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

The projected vector.


Subroutines

public pure subroutine do_lines_intersect(ln1, ln2, intersect, t1, t2, tol)

Tests to see if two lines intersect.

Arguments

Type IntentOptional Attributes Name
class(line), intent(in) :: ln1

The first line.

class(line), intent(in) :: ln2

The second line.

logical, intent(out) :: intersect

True if the two lines intersect within the specified tolerance; else, false if they do not intersect.

real(kind=real64), intent(out), optional :: t1

The parametric value associate with ln1 defining the intersection point.

real(kind=real64), intent(out), optional :: t2

The parametric value associate with ln2 defining the intersection point.

real(kind=real64), intent(in), optional :: tol

The intersection tolerance. If not supplied, the default value is 10x machine epsilon.