# Trajectory¶

class pyscan.Trajectory(pts)

This object represents a trajectory.

Parameters: pts – List containing Point objects
Trajectory.point_dist(pt)

Computes the minimum distance from this point to the trajectory.

Parameters: pt – Point double
Trajectory.get_weight()

Computes the weight of the trajectory. By default this will be 1 unless you create a weighted trajectory.

Return type: double
Trajectory.get_length()

Computes the weight of the trajectory. By default this will be 1 unless you create a weighted trajectory.

Return type: double
Trajectory.get_pts()

Returns the trajectories internal point list.

Return type: List containing Point objects
class pyscan.WTrajectory(weight, pts)

This object represents a weighted trajectory.

Parameters: weight – double pts – List containing Point objects

# Trajectory Simplification¶

These methods can be used to take get spatial approximations for trajectories to allow for the full scanning model to be applied.

pyscan.dp_compress(traj, alpha)

Douglas-Peuker trajectory simplification method [Ram72].

Parameters: traj – List of points. alpha – The pruning distance in the DP algorithm. A list of points corresponding to the simplified trajectory.
pyscan.grid_kernel(traj, alpha)

Grids the trajectory using a $$1/\alpha \times 1/\alpha$$ grid and picks the center point of each cell the trajectory crosses.

Parameters: traj – List of points. alpha – double A list of points corresponding to the simplified trajectory.
pyscan.grid_trajectory(traj, alpha)

Grids the trajectory using a $$1/\alpha \times 1/\alpha$$ grid and picks the points where the trajectory crosses the boundaries of the cell.

Parameters: traj – List of points. alpha – double A list of points corresponding to the simplified trajectory.
pyscan.grid_direc_kernel(traj, r, alpha)

Grids the trajectory using a $$1/r \times 1/r$$ grid and then applies a directional kernel to each cell with $$\alpha$$ error. This simplification get error of $$\alpha$$ for disks with radii greater than $$r$$.

Parameters: traj – List of points. r – double alpha – double A list of points corresponding to the simplified trajectory.
pyscan.halfplane_kernel(traj, alpha)

Applies a directional kernel with $$\alpha$$ error. This simplification get error of $$\alpha$$ for halfplanes.

Parameters: traj – List of points. alpha – double A list of points corresponding to the simplified trajectory.
pyscan.hull(traj)

Takes the convex hull of the trajectory. This simplification has zero error for halfplanes and can significantly speed up scanning for labeled data.

Parameters: traj – List of points. A list of points corresponding to the simplified trajectory.
pyscan.lifting_kernel(traj, alpha)

Takes the convex hull of the trajectory lifted to a 3d paraboloid. This simplification has $$alpha$$ error for disks, but currently has stability issues.

Parameters: traj – List of points. alpha – double A list of points corresponding to the simplified trajectory.
pyscan.uniform_sample_error(traj, alpha, endpoints)

Chooses uniformly randomly $$L/\alpha$$ points on the trajectory where $$L$$ is the arc length. If the endpoint variable is true then this method also takes the endpoints of the trajectory.

Parameters: traj – List of points. alpha – double endpoints – boolean A list of points corresponding to the simplified trajectory.
pyscan.even_sample_error(traj, alpha, endpoints)

Chooses a point ever $$\alpha$$ distance apart. If the endpoint variable is true then this method also takes the endpoints of the trajectory.

Parameters: traj – List of points. alpha – double endpoints – boolean A list of points corresponding to the simplified trajectory.

# Trajectories to Points¶

These algorithms can be used to convert the trajectory to a point set that can then be fed into one of the approximate scanning methods.

pyscan.block_sample(trajectories, s, endpoints)

Chooses s points such that one point is chosen at random inside of each arc length segment of length $$L/s$$ where L is the summed length of all the trajectories in trajectories. If the endpoint variable is true then this method also takes the endpoints of the trajectory.

Parameters: trajectories – A list of Trajectories alpha – integer endpoints – boolean A list of weighted points
pyscan.uniform_sample(trajectories, s, endpoints)

Uniformly samples $$s$$ points on the trajectories. If the endpoint variable is true then this method also takes the endpoints of the trajectory.

Parameters: traj – A list of Trajectories alpha – integer endpoints – boolean A list of weighted points
pyscan.even_sample(trajectories, s, endpoints)

Chooses $$s$$ points such that one point is every arc length segment of length $$L/s$$ where L is the summed length of all the trajectories in trajectories. If the endpoint variable is true then this method also takes the endpoints of the trajectory.

Parameters: traj – A list of Trajectories alpha – integer endpoints – boolean A list of weighted points