tensorbay.geometry.point_list

PointList2D, MultiPointList2D.

PointList2D contains a list of 2D points.

MultiPointList2D contains multiple 2D point lists.

class tensorbay.geometry.point_list.PointList2D(points: Optional[Iterable[Iterable[float]]] = None)[source]

Bases: tensorbay.utility.user.UserMutableSequence[tensorbay.geometry.point_list._T]

This class defines the concept of PointList2D.

PointList2D contains a list of 2D points.

Parameters

points – A list of 2D points.

classmethod loads(contents: List[Dict[str, float]]) tensorbay.geometry.point_list._P[source]

Load a PointList2D from a list of dictionaries.

Parameters

contents

A list of dictionaries containing the coordinates of the vertexes of the point list:

[
    {
        "x": ...
        "y": ...
    },
    ...
]

Returns

The loaded PointList2D object.

dumps() List[Dict[str, float]][source]

Dumps a PointList2D into a point list.

Returns

A list of dictionaries containing the coordinates of the vertexes of the polygon within the point list.

bounds() tensorbay.geometry.box.Box2D[source]

Calculate the bounds of point list.

Returns

The bounds of point list.

class tensorbay.geometry.point_list.MultiPointList2D(point_lists: Optional[Iterable[Iterable[Iterable[float]]]] = None)[source]

Bases: tensorbay.utility.user.UserMutableSequence[tensorbay.geometry.point_list._L]

This class defines the concept of MultiPointList2D.

MultiPointList2D contains multiple 2D point lists.

Parameters

point_lists – A list of 2D point list.

classmethod loads(contents: List[List[Dict[str, float]]]) tensorbay.geometry.point_list._P[source]

Loads a MultiPointList2D from the given contents.

Parameters

contents

A list of dictionary lists containing the coordinates of the vertexes of the multiple point lists:

[
    [
        {
            "x": ...
            "y": ...
        },
        ...
    ]
    ...
]

Returns

The loaded MultiPointList2D object.

dumps() List[List[Dict[str, float]]][source]

Dumps all the information of the MultiPointList2D.

Returns

All the information of the MultiPointList2D.

bounds() tensorbay.geometry.box.Box2D[source]

Calculate the bounds of multiple point lists.

Returns

The bounds of multiple point lists.