Serializing JSON code for drawable objects (and some documentation) (#222)

* some comments and starting serializing comments. on plane w/o formatter

* fixing pylint and black

* removed changes in file

* revert file

* addressing comments

* remove abstract

Co-authored-by: Ethan Weber <ethanweber@Ethans-MacBook-Pro.local>
This commit is contained in:
Ethan WeberandEthan Weber authored and GitHub committed 2022-07-28 13:55:58 -05:00
1 parent 44a7fa288c
commit d13a766b9e
13 files changed
+240 -106

No files matched your search

+21 -1
View File
@@ -14,6 +14,11 @@
"""
Visualization code for plotly.
The function use prefix conventions in the following way:
- 'get_*' functions (e.g., 'get_camera_frustums')
return data that can be ploted with plotly
- 'vis_*' functions (e.g., 'vis_camera_rays')
return 'go.Figure' objects which are the plots. Go Figure! :')
"""
from typing import List, Union
@@ -93,7 +98,7 @@ def get_line_segments_from_lines(
return data
def visualize_dataset(camera_origins: TensorType["num_cameras", 3], ray_bundle: RayBundle) -> go.FigureWidget:
def vis_dataset(camera_origins: TensorType["num_cameras", 3], ray_bundle: RayBundle) -> go.FigureWidget:
"""Visualize a dataset with plotly using our cameras and generated rays.
Args:
@@ -490,3 +495,18 @@ def vis_camera_rays(camera: Camera) -> go.Figure:
)
return fig
def get_camera_frustums(cameras: List[Camera]):
"""Returns the camera frustums for the cameras that we are using.
Args:
cameras: The cameras that we want to plot.
Returns:
A plotly scatter that can be plotted.
"""
for camera in cameras:
json_ = camera.to_json()
print(json_)
raise NotImplementedError