Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rename FilterByPosition to FilterByArea #69

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions t4_devkit/filtering/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from typing import TYPE_CHECKING, Sequence

from .functional import (
FilterByArea,
FilterByDistance,
FilterByLabel,
FilterByNumPoints,
FilterByPosition,
FilterBySpeed,
FilterByUUID,
)
Expand All @@ -32,7 +32,7 @@ def __init__(self, params: FilterParams, tf_buffer: TransformBuffer) -> None:
FilterByLabel.from_params(params),
FilterByUUID.from_params(params),
FilterByDistance.from_params(params),
FilterByPosition.from_params(params),
FilterByArea.from_params(params),
FilterBySpeed.from_params(params),
FilterByNumPoints.from_params(params),
]
Expand Down
6 changes: 3 additions & 3 deletions t4_devkit/filtering/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"FilterByLabel",
"FilterByUUID",
"FilterByDistance",
"FilterByPosition",
"FilterByArea",
"BoxFilterFunction",
]

Expand Down Expand Up @@ -139,8 +139,8 @@ def __call__(self, box: BoxType, tf_matrix: HomogeneousMatrix) -> bool:
return self.min_distance < box_distance and box_distance < self.max_distance


class FilterByPosition(BaseBoxFilter):
"""Filter a box by checking if the box xy position is within the specified xy position.
class FilterByArea(BaseBoxFilter):
"""Filter a box by checking if the box xy position is within the specified xy area.

Note that, the type box is `Box2D` and its `position` is None,
these boxes pass through this filter.
Expand Down
6 changes: 3 additions & 3 deletions tests/fitering/test_filter_function.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from t4_devkit.filtering.functional import (
FilterByArea,
FilterByDistance,
FilterByLabel,
FilterByNumPoints,
FilterByPosition,
FilterBySpeed,
FilterByUUID,
)
Expand Down Expand Up @@ -67,14 +67,14 @@ def test_filter_by_distance(dummy_box3ds, dummy_box2ds, dummy_tf_buffer) -> None


def test_filter_by_position(dummy_box3ds, dummy_box2ds, dummy_tf_buffer) -> None:
"""Test `FilterByPosition`.
"""Test `FilterByArea`.

Args:
dummy_box3ds (list[Box3D]): List of 3D boxes.
dummy_box2ds (list[Box2D]): List of 2D boxes.
dummy_tf_buffer (TransformBuffer): Transformation buffer.
"""
box_filter = FilterByPosition(min_xy=(0.0, 0.0), max_xy=(10.0, 10.0))
box_filter = FilterByArea(min_xy=(0.0, 0.0), max_xy=(10.0, 10.0))

answer3d = [
box
Expand Down
Loading