mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-08 13:33:42 +08:00
a82935f326
Integrate onroad views, configurable widgets, local settings, steering-profile contracts, Bluetooth and Android Auto with their device and runtime services. Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Daniel Koepping <elkoled@gmail.com> Co-authored-by: Danny <dannyirwin31@yahoo.com> Co-authored-by: DimitriChrysafis <Dimitri.chrysafis@gmail.com> Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com> Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com> Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu> Co-authored-by: Shane Smiskol <shane@smiskol.com> Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com> Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Co-authored-by: stef <19478336+stefpi@users.noreply.github.com> Co-authored-by: whoisdomi <dcantu83@gmail.com> Co-authored-by: Intelli <contact@intelli.software> Co-authored-by: pharmacomaniac <blittle65@gmail.com> Co-authored-by: prabhaavp <prabhaav@msu.edu>
24 lines
938 B
Python
24 lines
938 B
Python
"""Frozen torque arc dimensions and cap-inclusive logical-pixel bounds."""
|
|
|
|
import math
|
|
|
|
TORQUE_ANGLE_SPAN = 12.7
|
|
RADIUS = 1200
|
|
MIN_HEIGHT, MAX_HEIGHT = 14, 56
|
|
MIN_OFFSET, MAX_OFFSET = 22, 26
|
|
CAP_RADIUS = 7
|
|
LARGE_CAP_RADIUS = 3 * CAP_RADIUS
|
|
|
|
|
|
def maximum_footprint(x, y, width, height, screen_width):
|
|
scale = height / 240 * (width / screen_width)
|
|
cap_radius = LARGE_CAP_RADIUS if screen_width == 2160 else CAP_RADIUS
|
|
half_angle = math.radians(TORQUE_ANGLE_SPAN / 2)
|
|
radius = RADIUS * scale
|
|
center_x = x + width / 2 + 8
|
|
extent_x = (radius + MAX_HEIGHT * scale) * math.sin(half_angle) + cap_radius * (1 - math.sin(half_angle))
|
|
left, right = math.floor(center_x - extent_x), math.ceil(center_x + extent_x)
|
|
top = math.floor(y + height - (MAX_OFFSET + MAX_HEIGHT) * scale)
|
|
bottom = math.ceil(y + height - MIN_OFFSET * scale + (radius + cap_radius) * (1 - math.cos(half_angle)))
|
|
return left, top, right - left, bottom - top
|