Geometry#

class wattson.analysis.visualization.power_grid.geometry.Geometry#

Bases: object

Methods

abs_point_on_line

Calculates a point on the line from a towards b, where offset defines the absolute distance from a.

add

Sums two vectors

center

degrees

distance

length

normalize

Normalizes the vector such that its length is 1.

point_on_line

Calculates a point on the line between a and b, where offset defines the distance from a in relation to the length of the line between a and b.

radians

rotate

rotate_90_degrees

scale

Scales the vector by the given scalar

subtract

Subtracts b from a (i.e., a - b)

vectorize_angle

vectorize_line

Returns the vector between origin and target, i.e., shifts the line between origin and target to (0, 0).

static abs_point_on_line(a, b, abs_offset)#

Calculates a point on the line from a towards b, where offset defines the absolute distance from a.

Parameters:
  • a

  • b

  • abs_offset

static add(a, b)#

Sums two vectors

Parameters:
  • a

  • b

static normalize(vector)#

Normalizes the vector such that its length is 1.

Parameters:

vector

static point_on_line(a, b, offset)#

Calculates a point on the line between a and b, where offset defines the distance from a in relation to the length of the line between a and b. With offset=0.5, the center point is returned, offset=0 returns a and offset=1 returns b

Parameters:
  • a

  • b

  • offset

static scale(vector, scalar)#

Scales the vector by the given scalar

Parameters:
  • vector

  • scalar

static subtract(a, b)#

Subtracts b from a (i.e., a - b)

Parameters:
  • a

  • b

static vectorize_line(origin, target)#

Returns the vector between origin and target, i.e., shifts the line between origin and target to (0, 0).

Parameters:
  • origin

  • target