Skip to content

# `typerig.core.func.geometry`

## typerig.core.func.geometry (version 0.26.2)

    # MODULE: TypeRig / Core / Analytic geometry (Functions)
    # -----------------------------------------------------------
    # (C) Vassil Kateliev, 2015-2020        (http://www.kateliev.com)
    # (C) Karandash Type Foundry            (http://www.karandash.eu)
    #------------------------------------------------------------
    # www.typerig.com

### Modules

- math

### Functions

ccw(A, B, C)

      Tests whether the turn formed by points A, B, and C is Counter clock wise (CCW)

checkInnerOuter(firstAngle, lastAngle)

      Check if connection is inner or outer.
      Adapted from RoboFont pens. (NOTE: To be deleted)

checkSmooth(firstAngle, lastAngle, error=4)

      Check if connection is smooth within error margin.
      Adapted from RoboFont pens. (NOTE: To be deleted)

get_angle(x, y, degrees=True)

      Return angle for given X,Y displacement from origin

intersect(A, B, C, D)

      Tests whether A,B and C,D intersect

line_angle(p0, p1, degrees=True)

      Find angle between two points forming a line
      Args:
              p0, p1 -> tuple(x, y);
              degrees -> bool

      Returns:
              radians or degrees

line_intersect(a0, a1, b0, b1)

      Find intersection between two lines
      Args:
              a0, a1, b0, b1 -> tuple(x, y);
      Returns:
              intersect node -> tuple(x,y)

line_slope(p0, p1)

      Find slope between two points forming a line
      Args:
              p0, p1 -> tuple(x, y)

      Returns:
              float or NAN

line_solve_x(p0, p1, y)

      Solve line equation for X coordinate by given Y.

line_solve_y(p0, p1, x)

      Solve line equation for Y coordinate by given X.

line_y_intercept(p0, p1)

      Find Y intercept of line equation for line formed by two points
      Args:
              p0, p1 -> tuple(x, y)

      Returns:
              intercept node -> tuple(x,y)

point_in_polygon(point, polygon)

      Point in Polygon test
      Args:
              point -> tuple(x, y);
              polygon -> tuple(tuple(x0, y1)...tuple(xn, yn));

      Returns:
              Bool

point_in_triangle(point, triangle)

      Point in triangle test
      Args:
              point -> tuple(x, y);
              triangle -> tuple(tuple(x0, y0), tuple(x1, y1), tuple(x2, y2))

      Returns:
              Bool

point_rotate(center, point, angle)

      Rotate point around center point with angle (in degrees)
      Args:
              center, point -> tuple(x, y);
              angle -> float;

      Returns:
              new point coordinates -> tuple(x,y)

## `get_angle`

typerig.core.func.geometry.get_angle = get_angle(x, y, degrees=True)

      Return angle for given X,Y displacement from origin

## `ccw`

typerig.core.func.geometry.ccw = ccw(A, B, C)

      Tests whether the turn formed by points A, B, and C is Counter clock wise (CCW)

## `intersect`

typerig.core.func.geometry.intersect = intersect(A, B, C, D)

      Tests whether A,B and C,D intersect

## `point_in_triangle`

typerig.core.func.geometry.point_in_triangle = point_in_triangle(point, triangle)

      Point in triangle test
      Args:
              point -> tuple(x, y);
              triangle -> tuple(tuple(x0, y0), tuple(x1, y1), tuple(x2, y2))

      Returns:
              Bool

## `point_in_polygon`

typerig.core.func.geometry.point_in_polygon = point_in_polygon(point, polygon)

      Point in Polygon test
      Args:
              point -> tuple(x, y);
              polygon -> tuple(tuple(x0, y1)...tuple(xn, yn));

      Returns:
              Bool

## `point_rotate`

typerig.core.func.geometry.point_rotate = point_rotate(center, point, angle)

      Rotate point around center point with angle (in degrees)
      Args:
              center, point -> tuple(x, y);
              angle -> float;

      Returns:
              new point coordinates -> tuple(x,y)

## `line_slope`

typerig.core.func.geometry.line_slope = line_slope(p0, p1)

      Find slope between two points forming a line
      Args:
              p0, p1 -> tuple(x, y)

      Returns:
              float or NAN

## `line_angle`

typerig.core.func.geometry.line_angle = line_angle(p0, p1, degrees=True)

      Find angle between two points forming a line
      Args:
              p0, p1 -> tuple(x, y);
              degrees -> bool

      Returns:
              radians or degrees

## `line_y_intercept`

typerig.core.func.geometry.line_y_intercept = line_y_intercept(p0, p1)

      Find Y intercept of line equation for line formed by two points
      Args:
              p0, p1 -> tuple(x, y)

      Returns:
              intercept node -> tuple(x,y)

## `line_solve_y`

typerig.core.func.geometry.line_solve_y = line_solve_y(p0, p1, x)

      Solve line equation for Y coordinate by given X.

## `line_solve_x`

typerig.core.func.geometry.line_solve_x = line_solve_x(p0, p1, y)

      Solve line equation for X coordinate by given Y.

## `line_intersect`

typerig.core.func.geometry.line_intersect = line_intersect(a0, a1, b0, b1)

      Find intersection between two lines
      Args:
              a0, a1, b0, b1 -> tuple(x, y);
      Returns:
              intersect node -> tuple(x,y)

## `checkSmooth`

typerig.core.func.geometry.checkSmooth = checkSmooth(firstAngle, lastAngle, error=4)

      Check if connection is smooth within error margin.
      Adapted from RoboFont pens. (NOTE: To be deleted)

## `checkInnerOuter`

typerig.core.func.geometry.checkInnerOuter = checkInnerOuter(firstAngle, lastAngle)

      Check if connection is inner or outer.
      Adapted from RoboFont pens. (NOTE: To be deleted)