-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add constructors for Python, that don't work
- Loading branch information
Showing
8 changed files
with
115 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import rerun as rr | ||
import rerun.blueprint as rrb | ||
|
||
rr.init("rerun_example_annotation_context_rects", spawn=True) | ||
blueprint = rrb.Spatial2DView(background=[128, 0, 0], visual_bounds=rrb.VisualBounds(min=[-4.5, -2.5], max=[2.5, 2.5])) | ||
rr.init("rerun_example_annotation_context_rects", spawn=True, default_blueprint=blueprint) | ||
|
||
# Log an annotation context to assign a label and color to each class | ||
rr.log("/", rr.AnnotationContext([(1, "red", (255, 0, 0)), (2, "green", (0, 255, 0))]), static=True) | ||
|
||
# Log a batch of 2 rectangles with different `class_ids` | ||
rr.log("detections", rr.Boxes2D(mins=[[-2, -2], [0, 0]], sizes=[[3, 3], [2, 2]], class_ids=[1, 2])) | ||
|
||
# Log an extra rect to set the view bounds | ||
rr.log("bounds", rr.Boxes2D(half_sizes=[2.5, 2.5])) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
28 changes: 4 additions & 24 deletions
28
rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds.py
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds_ext.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
from ... import components, datatypes | ||
from ...error_utils import catch_and_log_exceptions | ||
|
||
|
||
class VisualBoundsExt: | ||
"""Extension for [VisualBounds][rerun.blueprint.archetypes.VisualBounds].""" | ||
|
||
def __init__( | ||
self: Any, | ||
*, | ||
min: datatypes.Vec2DLike, | ||
max: datatypes.Vec2DLike, | ||
): | ||
""" | ||
Create a new instance of the VisualBounds archetype. | ||
Parameters | ||
---------- | ||
min: | ||
The minimum point of the visible parts of a 2D space view, in the coordinate space of the scene. | ||
Usually the left-top corner. | ||
max: | ||
The maximum point of the visible parts of a 2D space view, in the coordinate space of the scene. | ||
Usually the right-bottom corner. | ||
""" | ||
|
||
with catch_and_log_exceptions(context=self.__class__.__name__): | ||
self.__attrs_init__(visual_bounds=components.AABB2D(min=min, max=max)) | ||
return | ||
self.__attrs_clear__() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
from ..datatypes import AABB2D, Vec2DLike | ||
|
||
|
||
class AABB2DExt: | ||
"""Extension for [AABB2D][rerun.blueprint.components.AABB2D].""" | ||
|
||
def __init__( | ||
self: Any, | ||
*, | ||
min: Vec2DLike, | ||
max: Vec2DLike, | ||
): | ||
""" | ||
Create a new instance of the AABB2D component. | ||
Parameters | ||
---------- | ||
min: | ||
The minimum point of the visible parts of a 2D space view, in the coordinate space of the scene. | ||
Usually the left-top corner. | ||
max: | ||
The maximum point of the visible parts of a 2D space view, in the coordinate space of the scene. | ||
Usually the right-bottom corner. | ||
""" | ||
|
||
self.__attrs_init__(AABB2D(min=min, max=max)) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING, Any | ||
|
||
import numpy as np | ||
|
||
if TYPE_CHECKING: | ||
from . import Vec2DLike | ||
|
||
|
||
class AABB2DExt: | ||
"""Extension for [AABB2D][rerun.blueprint.datatypes.AABB2D].""" | ||
|
||
def __init__( | ||
self: Any, | ||
min: Vec2DLike, | ||
max: Vec2DLike, | ||
): | ||
""" | ||
Create a new instance of the AABB2D datatype. | ||
Parameters | ||
---------- | ||
min: | ||
The minimum point of the visible parts of a 2D space view, in the coordinate space of the scene. | ||
Usually the left-top corner. | ||
max: | ||
The maximum point of the visible parts of a 2D space view, in the coordinate space of the scene. | ||
Usually the right-bottom corner. | ||
""" | ||
|
||
self.min_xy = np.array(min, np.float64) | ||
self.max_xy = np.array(max, np.float64) |