Skip to content

Instantly share code, notes, and snippets.

View joelgraff's full-sized avatar

Joel Graff joelgraff

View GitHub Profile
Sub GenerateCalendarDaysCSV()
Dim ws As Worksheet
Dim startDate As Date
Dim currentDate As Date
Dim i As Long
Dim totalDays As Long
Dim holidays As Collection
Dim holidayWeekFridays As Collection
Dim isIncluded As Boolean
Dim weekStart As Date
# source_screen_ui.py: UI setup for SourceScreen
#
# Overview:
# Defines the setup_ui function for the Local Files screen.
# Sets up file list, USB/Internal toggles, TV output toggles, Play/Stop/Schedule buttons, Back button, and playback state label.
#
# Recent Changes (as of June 2025):
# - Fixed 'setAlignment' error on Back button using QHBoxLayout.
# - Extracted hardcoded values to config.py.
# - Updated filepaths to use /home/admin/kiosk/ project root (except VIDEO_DIR).
import numpy as np
from shapely.geometry import Polygon, Point
from geometry_utils import is_inside_polygon
def parameterize_boundary(poly, min_points=50):
"""Parameterize a polygon boundary by arc length, ensuring sufficient points."""
if not poly.is_valid:
raise ValueError("Invalid polygon provided for parameterization.")
coords = list(poly.exterior.coords)[:-1]
if len(coords) < 3:
import numpy as np
from shapely.geometry import Polygon
from shapely.affinity import scale
def generate_elliptical_core(a=8, b=8):
return {'type': 'ellipse', 'a': a, 'b': b}
def generate_core_polygon(core_shape, scale_factor=1.0, min_points=87): # Reduced to match
"""Generate a Shapely polygon for the core with at least min_points."""
if core_shape['type'] != 'ellipse':
Yes, it is possible to shape the grid edges to follow the hull’s shape and interpolate between the outer and inner hulls, rather than simply laying a regular grid over the deck and trimming it. This can be achieved by using a mapped grid that adapts to the deck’s geometry while maintaining a structured layout. Below, I’ll explain how this works and why it’s a great fit for your procedural starship deck layout generator.
What Does This Mean?
When you talk about shaping the grid edges to follow the hull and interpolating between the outer hull (the perimeter) and the inner hull (the core), you’re asking for a grid that:
• Conforms to the hull’s shape at the boundary.
• Transitions smoothly from the core to the hull.
• Avoids the irregular or partial cells that result from trimming a regular grid.
Instead of starting with a rigid, square grid and cutting it to fit, we can design a grid that naturally molds to the deck’s contours while still being usable for room placement.
How It Works: The Mapped Grid Appr