neuron_morphology.transforms.geometry

Some handy utilities for working with vector geometries

Module Contents

Functions

get_ccw_vertices_from_two_lines(line1: List[Tuple], line2: List[Tuple]) Convenience method two do both get_vertices_from_two_lines()
prune_two_lines(line1: List[Tuple], line2: List[Tuple]) check the boundary to avoid intersections with side lines
get_vertices_from_two_lines(line1: List[Tuple], line2: List[Tuple]) Generates circular vertices from two lines
get_ccw_vertices(vertices: List[Tuple]) Generates counter clockwise vertices from vertices describing
neuron_morphology.transforms.geometry.get_ccw_vertices_from_two_lines(line1: List[Tuple], line2: List[Tuple])

Convenience method two do both get_vertices_from_two_lines() and get_ccw_vertices()

neuron_morphology.transforms.geometry.prune_two_lines(line1: List[Tuple], line2: List[Tuple])

check the boundary to avoid intersections with side lines

Parameters:
line1, line2: List of coordinates describing two lines
Returns:
line1, line2: boundary pruned if needed
neuron_morphology.transforms.geometry.get_vertices_from_two_lines(line1: List[Tuple], line2: List[Tuple])

Generates circular vertices from two lines

Parameters:
line1, line2: List of coordinates describing two lines
Returns:
vertices of the simple polygon created from line 1 and 2
(first vertex = last vertex)
1-2-3-4
5-6-7-8 -> [1-2-3-4-8-7-6-5-1]
neuron_morphology.transforms.geometry.get_ccw_vertices(vertices: List[Tuple])

Generates counter clockwise vertices from vertices describing a simple polygon

Method: Simplification of the shoelace formula, which calculates area of a simple polygon by integrating the area under each line segment of the polygon. If the total area is positive, the vertices were traversed in clockwise order, and if it is negative, they were traversed in counterclockwise order.

Parameters:
vertices: vertices describing a convex polygon

(vertices[0] = vertices[-1])

Returns:
vertices in counter clockwise order