line Interface

public interface line

Contents


Module Procedures

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. For plane normals and , the intersection direction is

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. The fitted direction is the dominant right singular vector of the centered point matrix, i.e. the principal component of the cloud.

Return Value type(line)

The resulting line.