freneticlib.utils.catmull

Module Contents

Classes

ControlNodesGenerator

Generate random roads given the configuration parameters

Functions

catmull_rom_spline(p0, p1, p2, p3[, num_points])

p0, p1, p2, and p3 should be (x,y) point pairs that define the Catmull-Rom spline.

catmull_rom_chain(→ List)

Calculate Catmull-Rom for a chain of points and return the combined curve.

catmull_rom_2d(→ List[Tuple])

catmull_rom(→ List[Tuple])

Attributes

Tuple2F

freneticlib.utils.catmull.catmull_rom_spline(p0, p1, p2, p3, num_points=20)[source]

p0, p1, p2, and p3 should be (x,y) point pairs that define the Catmull-Rom spline. num_points is the number of points to include in this curve segment.

freneticlib.utils.catmull.catmull_rom_chain(points: List[Tuple], num_spline_points=20) List[source]

Calculate Catmull-Rom for a chain of points and return the combined curve.

freneticlib.utils.catmull.catmull_rom_2d(points: List[Tuple], num_points=20) List[Tuple][source]
freneticlib.utils.catmull.catmull_rom(points: List[Tuple], num_spline_points=20) List[Tuple][source]
freneticlib.utils.catmull.Tuple2F
class freneticlib.utils.catmull.ControlNodesGenerator(num_control_nodes: int = 15, max_angle: int = None, seg_length=None, num_spline_nodes: int = None, initial_node: Tuple2F = (10.0, 0.0))[source]

Generate random roads given the configuration parameters

NUM_INITIAL_SEGMENTS_THRESHOLD = 2
NUM_UNDO_ATTEMPTS = 20
generate_control_nodes(num_control_nodes: int = None) List[Tuple2F][source]
generate(num_control_nodes=None)[source]
generate_key_control_nodes(num_control_nodes)[source]
control_nodes_to_road(control_nodes)[source]
_get_initial_point() shapely.geometry.Point[source]
_get_initial_control_node() Tuple2F[source]
_get_next_node(first_node, second_node: Tuple2F, max_angle) Tuple2F[source]
_get_next_xy(x0: float, y0: float, angle: float) Tuple2F[source]
_get_next_max_angle(i: int, threshold=NUM_INITIAL_SEGMENTS_THRESHOLD) float[source]