paralleldomain.model.annotation.polyline_2d¶
- class Line2D(start, end, class_id, directed=False, instance_id=-1, attributes=<factory>)¶
Represents a 2D Line.
- Parameters:
start (
Point2DBaseGeometry[TypeVar(T,int,float)]) –Line2D.startend (
Point2DBaseGeometry[TypeVar(T,int,float)]) –Line2D.endclass_id (
int) –Line2D.class_idinstance_id (
int) –Line2D.instance_idattributes (
Dict[str,Any]) –Line2D.attributesdirected (
bool) –Line2D.directed
- start¶
the 2D start point of the line in image coordinates
- end¶
the 2D end point of the line in image coordinates
- directed¶
whether the line is directed from start to end (if False the line is bi-directional)
- class_id¶
Class ID of the line. Can be used to lookup more details in
ClassMap.
- instance_id¶
Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g.,
InstanceSegmentation2DorInstanceSegmentation3D. If unknown defaults to -1.
- attributes¶
Dictionary of arbitrary object attributes.
- intersects_at(other)¶
Returns the point at which the two lines intersect and a bool value that indicated if the intersection point is within the line segments. Returns None if the lines are parallel. See: https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect
- Return type:
Tuple[Optional[Point2DBaseGeometry[TypeVar(T,int,float)]],bool,bool]- Parameters:
other (Line2DBaseGeometry[T]) –
- to_numpy()¶
Returns the start and end coordinates as a numpy array with shape (2 x 2).
- Return type:
- property direction: Point2DBaseGeometry[T]¶
Returns the directional vector of the line.
- class Polyline2D(lines, class_id, instance_id=-1, attributes=<factory>)¶
A polyline made of a collection of 2D Lines
- Parameters:
lines (
List[Line2DBaseGeometry[TypeVar(T,int,float)]]) –Polyline2D.linesclass_id (
int) –Polyline2D.class_idinstance_id (
int) –Polyline2D.instance_idattributes (
Dict[str,Any]) –Polyline2D.attributes
- class_id¶
Class ID of the polyline. Can be used to lookup more details in
ClassMap.
- instance_id¶
Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g.,
InstanceSegmentation2DorInstanceSegmentation3D. If unknown defaults to -1.
- attributes¶
Dictionary of arbitrary object attributes.
- to_numpy()¶
Returns all ordered vertices as a numpy array of shape (N x 2).
- property length¶
Returns the length of the line.
- class Polylines2D(polylines)¶
Collection of 2D Polylines
- Parameters:
polylines (
List[Polyline2D]) –Polylines2D.polylines
- polylines¶
Ordered list of
Polyline2Dinstances