organoid_tracker.imaging.angles module

Some helper function for calculations with angles.

organoid_tracker.imaging.angles.angle_between_vectors(vector1: Vector3, vector2: Vector3) float

Returns the angle between the two vectors. Will be between 0 and 180.

organoid_tracker.imaging.angles.difference(angle1: float, angle2: float) float

Gets the difference between two angles. The number returned is always between 0 inclusive and 180 exclusive.

See also direction_change, which goes from -180 to 180 degrees, and direction_change_of_line, from 0 to 90 degrees.

organoid_tracker.imaging.angles.direction_2d(position1: Union[Position, Vector3], position2: Union[Position, Vector3]) float

Gets the direction from the given position to the given position, with 0* pointing upwards.

organoid_tracker.imaging.angles.direction_change(angle1: float, angle2: float) float

Gets how many degrees you need to turn to reach angle2, starting from angle1. The result will be from -180 to +180.

organoid_tracker.imaging.angles.direction_change_of_line(angle1: float, angle2: float) float

Returns a value from 0 to 90 to how much the direction needs to change to go from angle1 to angle2. Flipped angles are considered equal, so 10 degrees is equal to 190 degrees. To go from 5 degrees to 190 degrees, you therefore need to turn only 5 degrees.

organoid_tracker.imaging.angles.flipped(angle: float) float

Gets the direction flipped 180*, so exactly in the opposite direction. The returned direction is from 0 (inclusive) to 360 (exclusive).

organoid_tracker.imaging.angles.mirrored(angle: float, mirror_angle: float) float

Mirrors the angle against the given plane. See the example for a 0* mirror plane:

Old New ^ | ^

| /
| /

|/

A 0* mirror is equivalent to a 180* mirror. (Same for any other angle.) The returned direction is from 0 (inclusive) to 360 (exclusive).

organoid_tracker.imaging.angles.right_hand_rule(a: Vector3, b: Vector3, c: Vector3) float

Returns the angle formed by A -> B -> C using the ‘right-hand rule’ from B. Based on https://math.stackexchange.com/questions/361412/finding-the-angle-between-three-points . The result is equal to angle_between_vectors(b - a, c - b).