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

Function create_eye_trajectory_shake

src/sharp/utils/camera.py:124–152  ·  view source on GitHub ↗

Create a left right shake followed by an up down shake trajectory.

(
    offset_xyz_m: np.ndarray,
    distance_m: float,
    num_steps: int,
    num_repeats: int,
)

Source from the content-addressed store, hash-verified

122
123
124def create_eye_trajectory_shake(
125 offset_xyz_m: np.ndarray,
126 distance_m: float,
127 num_steps: int,
128 num_repeats: int,
129) -> list[torch.Tensor]:
130 """Create a left right shake followed by an up down shake trajectory."""
131 num_steps_total = num_steps * num_repeats
132 num_steps_horizontal = num_steps_total // 2
133 num_steps_vertical = num_steps_total - num_steps_horizontal
134
135 offset_x_m, offset_y_m, _ = offset_xyz_m
136 eye_positions: list[torch.Tensor] = []
137 eye_positions.extend(
138 torch.tensor(
139 [offset_x_m * np.sin(2 * np.pi * t), 0.0, distance_m],
140 dtype=torch.float32,
141 )
142 for t in np.linspace(0, num_repeats, num_steps_horizontal)
143 )
144 eye_positions.extend(
145 torch.tensor(
146 [0.0, offset_y_m * np.sin(2 * np.pi * t), distance_m],
147 dtype=torch.float32,
148 )
149 for t in np.linspace(0, num_repeats, num_steps_vertical)
150 )
151
152 return eye_positions
153
154
155def create_eye_trajectory_rotate(

Callers 1

create_eye_trajectoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected