# I am the Watcher. I am your guide through this vast new twtiverse.
# 
# Usage:
#     https://watcher.sour.is/api/plain/users              View list of users and latest twt date.
#     https://watcher.sour.is/api/plain/twt                View all twts.
#     https://watcher.sour.is/api/plain/mentions?uri=:uri  View all mentions for uri.
#     https://watcher.sour.is/api/plain/conv/:hash         View all twts for a conversation subject.
# 
# Options:
#     uri     Filter to show a specific users twts.
#     offset  Start index for quey.
#     limit   Count of items to return (going back in time).
# 
# twt range = 1 1
# self = https://watcher.sour.is/conv/115090245321498420
Interactive demo of #shapely's centroid for the triangle :)

n
import py5
from shapely import Polygon, Point

def setup():
    py5.size(400, 400)
    py5.stroke_join(py5.ROUND)
    
def draw():
    py5.background(200)
    pts = ((100, 100), (300, 100),
           (py5.mouse_x, py5.mouse_y))
    xs, ys = zip(*pts)
    cx = sum(xs) / len(xs)
    cy = sum(ys) / len(ys)
    tri = Polygon(pts)
    py5.no_fill()
    py5.stroke_weight(1)
    py5.stroke(0, 200, 0)
    py5.shape(Point(cx, cy).buffer(5))
    py5.stroke(0, 0, 200)
    py5.shape(tri.envelope.buffer(2))
    py5.shape(tri.envelope.centroid.buffer(5))
    py5.stroke_weight(3)
    py5.stroke(0)
    py5.shape(tri)
    py5.fill(0)
    py5.shape(tri.centroid.buffer(2))

py5.run_sketch(block=False)

#py5 #python #creativeCoding