pose_format.torch.representation.point_line_distance module

Classes:

PointLineDistanceRepresentation()

Class computing distance between a point and a line segment.

class pose_format.torch.representation.point_line_distance.PointLineDistanceRepresentation[source]

Bases: Module

Class computing distance between a point and a line segment.

Parameters:

distance (DistanceRepresentation) – Instance of the DistanceRepresentation class to compute the Euclidean distance.

Methods:

forward(p1s, p2s, p3s)

Computes distance from the point p1s to the line formed by points p2s and p3s.

Attributes:

training

forward(p1s, p2s, p3s)[source]

Computes distance from the point p1s to the line formed by points p2s and p3s.

The method uses Heron’s Formula to find the area of the triangle formed by the three points and then calculates the height of the triangle to determine the distance from the point p1s to the line <p2s, p3s>.

Parameters:
  • p1s (MaskedTensor) – Tensor representing the point for which the distance to the line is calculated. Shape: (Points, Batch, Len, Dims).

  • p2s (MaskedTensor) – Tensor representing one end-point of the line. Shape: (Points, Batch, Len, Dims).

  • p3s (MaskedTensor) – Tensor representing the other end-point of the line. Shape: (Points, Batch, Len, Dims).

Returns:

Tensor representing the distances from the point p1s to the line <p2s, p3s>. Shape: (Points, Batch, Len).

Return type:

torch.Tensor

Note

This is following Heron’s Formula: https://en.wikipedia.org/wiki/Heron%27s_formula.

training: bool