Expand description
Contains functions that are related to the geometry of shapes and their interaction. This includes things like intersection of shapes and length of vectors.
Structs§
- Point
- Position
- Represents the size, location and centerpoint of a shape. We align shapes along their center points, and have edges directed at the center. Shapes like Box and Circle have their center point in the middle, but labels have their center point in one of the sides to make sure that edges don’t obscure the text. The halo is the gap around the shape where nothing can be placed and it is applied symmetrically to the sides.
Functions§
- create_
vector_ of_ length - do_
boxes_ intersect - \return True if the boxes (defined by the bounding box) intersect.
- ellipse_
line_ intersection - \returns the intersection point for a line with slope \p m with an ellipse with the formula. 1 = (x^2 / a^2) + (y^2 / b^2). Replace Y with the line equation and isolate x and solve to get the intersection point with the ellipse. Notice that a line has two intersection points with a circle, so users need to figure out which of the two values (+X, +Y) or (-X, -Y) is relevant.
- get_
connection_ point_ for_ box - This is the implementation of get_connector_location for box-like shapes. ‘See get_connector_location’ for details.
- get_
connection_ point_ for_ circle - This is the implementation of get_connector_location for circle-like shapes. ‘See get_connector_location’ for details.
- get_
passthrough_ path_ invisible - get_
size_ for_ str - Estimate the bounding box of some rendered text.
- in_
range - \return true if \p x is in the inclusive range P.x .. P.y.
- interpolate
- Perform linear interpolation of the vectors v0 and v1, using the ratio w which is assumed to be between 0..1.
- make_
size_ square - Make the shape have the same X and Y values.
- normalize_
scale_ vector - Return the normalized vector \p v multiplied by the scalar \p s.
- pad_
shape_ scalar - Increase the size of X and Y by \p s.
- segment_
rect_ intersection - \return True if the segment intersects the rect.
- weighted_
median - Return the weighted median for \p vec. This is the method that’s described in “DAG - A Program that Draws Directed Graphs” Gansner, North, Vo 1989. Pg 10.