Helper Functions

deg2slope(degree)

convert degrees to a slope (\(\Delta x / \Delta y\))

channel_end(r, end_degree)

get vertical end of the channel based on the radius of the channel and an end angle

Slope(slope[, unit])

get function/expression of a straight line with a given point which it intercepts

Vertical([y])

function of a vertical line

Horizontal([x])

function of a horizontal line

Circle(r[, x_m, y_m, clockwise])

function of a circle

ramer_douglas(line, dist)

Does Ramer-Douglas-Peucker simplification of a curve with dist threshold.

shape_generator.helpers.deg2slope(degree)[source]

convert degrees to a slope (\(\Delta x / \Delta y\))

Parameters

degree (float) – angle in degree

Returns

slope

Return type

float

slope

Slope

shape_generator.helpers.channel_end(r, end_degree)[source]

get vertical end of the channel based on the radius of the channel and an end angle

Parameters
  • r (float) – radius of the channel

  • end_degree (float) – end angle in degree (°)

Returns

height of the channel when the circle reaches a certain angle

Return type

float

channel end

Channel end

shape_generator.helpers.ramer_douglas(line, dist)[source]

Does Ramer-Douglas-Peucker simplification of a curve with dist threshold.

line is a list-of-tuples, where each tuple is a 2D coordinate

Usage is like so:

>>> myline = [(0.0, 0.0), (1.0, 2.0), (2.0, 1.0)]
>>> simplified = ramer_douglas(myline, dist = 1.0)

Class Functions

class shape_generator.helpers.Slope(slope, unit=None)[source]

get function/expression of a straight line with a given point which it intercepts

Parameters
  • slope (float) – slope

  • unit (str) – point as a set of a x and a y coordinate

Returns

linear function

Return type

sympy.core.expr.Expr

straight line

Straight line

__init__(slope, unit=None)[source]
expr(x)[source]

get sympy expression

solve_y(x)[source]

get y value

solve_x(y)[source]

get x value

length(i0, i1)[source]

get shape length between two values

area(x0, x1)[source]

get shape area between two values

class shape_generator.helpers.Vertical(y=None)[source]

function of a vertical line

for a shape curve this means a constant width

__init__(y=None)[source]
Parameters

y (float) – y value of the vertical line

class shape_generator.helpers.Horizontal(x=None)[source]

function of a horizontal line

__init__(x=None)[source]
class shape_generator.helpers.Circle(r, x_m=0, y_m=0, clockwise=False)[source]

function of a circle

circle

Circle

__init__(r, x_m=0, y_m=0, clockwise=False)[source]
Parameters
  • r (float) – radius

  • x_m (float) – x axis value of the mid point

  • y_m (float) – y axis value of the mid point

  • clockwise (bool) – whether the circle is clockwise or anticlockwise

expr(x)[source]

get function/expression of a circle with a given mid point

Returns

function of the circle

Return type

sympy.core.expr.Expr

get_points(step)[source]

get the point coordinates for the shape-generator