-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#! /usr/bin/env python3 | ||
import numpy as np | ||
from com.dtmilano.android.viewclient import ViewClient | ||
|
||
def toint(n): | ||
return n.item() | ||
|
||
def npint(a): | ||
return np.round(a).astype(int) | ||
|
||
def spiral(t): | ||
a = 0.5 # Controls the tightness of the spiral | ||
b = 0.5 # Controls the spacing between turns | ||
g = 40 # Factor | ||
dx = 400 # Delta x | ||
dy = 600 # Delta y | ||
x = g * a * t * np.cos(t + b) + dx | ||
y = g * a * t * np.sin(t + b) + dy | ||
return list(zip(map(toint, npint(x)), map(toint, npint(y)))) | ||
|
||
# get helper | ||
helper = ViewClient.view_client_helper() | ||
|
||
# generate values for the parameter t | ||
t = np.linspace(0, 4 * np.pi, 100) | ||
|
||
# calculate (x, y) coordinates | ||
segments = spiral(t) | ||
|
||
# assume google keep is open so we can see it drawing | ||
# see spiral.gif | ||
helper.ui_device.swipe(segments=segments, segment_steps=3) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.