Move uneeded function out of graph_tools
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: I11cee5ba22a42fc75c595c4d2b04ab2acead9557
diff --git a/y2023/control_loops/python/graph_edit.py b/y2023/control_loops/python/graph_edit.py
index 448103b..3ef9d07 100644
--- a/y2023/control_loops/python/graph_edit.py
+++ b/y2023/control_loops/python/graph_edit.py
@@ -11,17 +11,30 @@
gi.require_version('Gtk', '3.0')
from gi.repository import Gdk, Gtk
import cairo
-from graph_tools import XYSegment, AngleSegment, to_theta, to_xy, alpha_blend, draw_lines
-from graph_tools import back_to_xy_loop, subdivide_theta, to_theta_loop, px
+from graph_tools import XYSegment, AngleSegment, to_theta, to_xy, alpha_blend
+from graph_tools import back_to_xy_loop, subdivide_theta, to_theta_loop
from graph_tools import l1, l2, joint_center
import graph_paths
-from frc971.control_loops.python.basic_window import quit_main_loop, set_color
+from frc971.control_loops.python.basic_window import quit_main_loop, set_color, OverrideMatrix, identity
import shapely
from shapely.geometry import Polygon
+def px(cr):
+ return OverrideMatrix(cr, identity)
+
+
+# Draw lines to cr + stroke.
+def draw_lines(cr, lines):
+ cr.move_to(lines[0][0], lines[0][1])
+ for pt in lines[1:]:
+ cr.line_to(pt[0], pt[1])
+ with px(cr):
+ cr.stroke()
+
+
def draw_px_cross(cr, length_px):
"""Draws a cross with fixed dimensions in pixel space."""
with px(cr):
diff --git a/y2023/control_loops/python/graph_paths.py b/y2023/control_loops/python/graph_paths.py
index da0ad4f..6d8f489 100644
--- a/y2023/control_loops/python/graph_paths.py
+++ b/y2023/control_loops/python/graph_paths.py
@@ -17,6 +17,12 @@
circular_index=-1)
cone_perch_pos = to_theta_with_circular_index(1.0, 2.0, circular_index=-1)
+points = []
+front_points = []
+back_points = []
+unnamed_segments = []
+named_segments = []
+
segments = [
ThetaSplineSegment(neutral, neutral_to_cone_1, neutral_to_cone_2, cone_pos,
"NeutralToCone"),
diff --git a/y2023/control_loops/python/graph_tools.py b/y2023/control_loops/python/graph_tools.py
index 3ddfb37..dafa294 100644
--- a/y2023/control_loops/python/graph_tools.py
+++ b/y2023/control_loops/python/graph_tools.py
@@ -1,7 +1,4 @@
import numpy
-import cairo
-
-from frc971.control_loops.python.basic_window import OverrideMatrix, identity
# joint_center in x-y space.
joint_center = (-0.299, 0.299)
@@ -16,10 +13,6 @@
theta_end_circle_size = 0.07
-def px(cr):
- return OverrideMatrix(cr, identity)
-
-
# Convert from x-y coordinates to theta coordinates.
# orientation is a bool. This orientation is circular_index mod 2.
# where circular_index is the circular index, or the position in the
@@ -215,13 +208,11 @@
return (a[0], a[1], d1[0], d1[1], accel[0], accel[1])
-# Draw lines to cr + stroke.
+# Draw a list of lines to a cairo context.
def draw_lines(cr, lines):
cr.move_to(lines[0][0], lines[0][1])
for pt in lines[1:]:
cr.line_to(pt[0], pt[1])
- with px(cr):
- cr.stroke()
# Segment in angle space.