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
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
\return True if the boxes (defined by the bounding box) intersect.
\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.
This is the implementation of get_connector_location for box-like shapes.
‘See get_connector_location’ for details.
This is the implementation of get_connector_location for circle-like shapes.
‘See get_connector_location’ for details.
Estimate the bounding box of some rendered text.
\return true if \p x is in the inclusive range P.x .. P.y.
Perform linear interpolation of the vectors v0 and v1, using the
ratio w which is assumed to be between 0..1.
Make the shape have the same X and Y values.
Return the normalized vector \p v multiplied by the scalar \p s.
Increase the size of X and Y by \p s.
\return True if the segment intersects the rect.
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.