MCPcopy Create free account
hub / github.com/apple/ml-sharp / create_eye_trajectory

Function create_eye_trajectory

src/sharp/utils/camera.py:74–106  ·  view source on GitHub ↗

Create eye trajectory for trajectory type.

(
    scene: Gaussians3D,
    params: TrajectoryParams,
    resolution_px: tuple[int, int],
    f_px: float,
)

Source from the content-addressed store, hash-verified

72
73
74def create_eye_trajectory(
75 scene: Gaussians3D,
76 params: TrajectoryParams,
77 resolution_px: tuple[int, int],
78 f_px: float,
79) -> list[torch.Tensor]:
80 """Create eye trajectory for trajectory type."""
81 max_offset_xyz_m = compute_max_offset(
82 scene,
83 params,
84 resolution_px,
85 f_px,
86 )
87 # We place the eye trajectory at z=distance plane (default=0),
88 # assuming portal plane is placed at z=natural_distance.
89 if params.type == "swipe":
90 return create_eye_trajectory_swipe(
91 max_offset_xyz_m, params.distance_m, params.num_steps, params.num_repeats
92 )
93 elif params.type == "shake":
94 return create_eye_trajectory_shake(
95 max_offset_xyz_m, params.distance_m, params.num_steps, params.num_repeats
96 )
97 elif params.type == "rotate":
98 return create_eye_trajectory_rotate(
99 max_offset_xyz_m, params.distance_m, params.num_steps, params.num_repeats
100 )
101 elif params.type == "rotate_forward":
102 return create_eye_trajectory_rotate_forward(
103 max_offset_xyz_m, params.distance_m, params.num_steps, params.num_repeats
104 )
105 else:
106 raise ValueError(f"Invalid trajectory type {params.type}.")
107
108
109def create_eye_trajectory_swipe(

Callers

nothing calls this directly

Tested by

no test coverage detected