microscope-ring-light/pcb/generate-led-coords.py

20 lines
630 B
Python
Raw Normal View History

#!/bin/python
import numpy as np
import pandas as pd
led_count = 32
ring_diameter = 93
hole_center_coords = (70, 70)
led_footprint_rotation = 90
df = pd.DataFrame({'x': [], 'y': [], 'angle': []})
pd.set_option('display.float_format', lambda x: '%.3f' % x)
for led in range(led_count):
led_angle = led / led_count * 2 * np.pi
x_coord = np.cos(led_angle) * ring_diameter / 2 + hole_center_coords[0]
y_coord = -np.sin(led_angle) * ring_diameter / 2 + hole_center_coords[1]
df = df.append({'x': x_coord, 'y':y_coord, 'angle': (led_angle / np.pi * 180 + led_footprint_rotation) % 360}, ignore_index=True)
print(df)