pose_format.torch.representation.point_line_distance module
Classes:
Class computing distance between a point and a line segment. |
- class pose_format.torch.representation.point_line_distance.PointLineDistanceRepresentation[source]
Bases:
ModuleClass computing distance between a point and a line segment.
- Parameters:
distance (
DistanceRepresentation) – Instance of theDistanceRepresentationclass to compute the Euclidean distance.
Methods:
forward(p1s, p2s, p3s)Computes distance from the point
p1sto the line formed by pointsp2sandp3s.Attributes:
- forward(p1s, p2s, p3s)[source]
Computes distance from the point
p1sto the line formed by pointsp2sandp3s.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
p1sto 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
p1sto 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