Skip to content

Commit

Permalink
Add chip that indicates if T CrB is below the horizon.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carifio24 committed Aug 5, 2024
1 parent fab595b commit d73b929
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions src/BlazeStarNova.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
<div id="center-buttons">
</div>
<div id="right-buttons">
<v-chip
v-if="crbBelowHorizon"
>
Corona Borealis is Set
</v-chip>
</div>
</div>

Expand Down Expand Up @@ -233,6 +238,7 @@ const showHorizon = ref(true);
const showAltAzGrid = ref(true);
const showControls = ref(false);
const showConstellations = ref(true);
const crbBelowHorizon = ref(true);
const sunPlace = new Place();
sunPlace.set_names(["Sun"]);
Expand Down Expand Up @@ -303,6 +309,7 @@ onMounted(() => {
setInterval(() => {
if (timePlaying.value) {
updateHorizonAndSky(store.currentTime);
updateCrbBelowHorizon(store.currentTime);
}
}, 100);
Expand Down Expand Up @@ -338,6 +345,18 @@ function getSunPosition(when: Date | null): EquatorialRad & HorizontalRad {
};
}
function getCrbAlt(when: Date | null = null) {
const location = getWWTLocation();
const crbAltAz = equatorialToHorizontal(
crbPlace.get_RA() * 15 * D2R,
crbPlace.get_dec() * D2R,
location.latitudeRad,
location.longitudeRad,
when ?? store.currentTime);
return crbAltAz.altRad;
}
/* Properties related to device/screen characteristics */
// TODO: This seems to be giving the wrong value? Investigate why
// const smallSize = computed(() => smAndDown);
Expand Down Expand Up @@ -410,7 +429,7 @@ function updateHorizonAndSky(when: Date | null = null) {
} finally {
const location = getWWTLocation();
if (showHorizon.value) {
const time = when || store.currentTime;
const time = when ?? store.currentTime;
createHorizon({ location, when: time });
const sunPosition = getSunPosition(time);
const opacity = skyOpacityForSunAlt(sunPosition.altRad);
Expand All @@ -420,6 +439,11 @@ function updateHorizonAndSky(when: Date | null = null) {
}
}
function updateCrbBelowHorizon(when: Date | null = null) {
const alt = getCrbAlt(when);
crbBelowHorizon.value = alt <= 0;
}
function skyOpacityForSunAlt(sunAltRad: number) {
const civilTwilight = -6 * D2R;
const astronomicalTwilight = 3 * civilTwilight;
Expand Down Expand Up @@ -560,9 +584,9 @@ body {
width: calc(100% - 2rem);
pointer-events: none;
display: flex;
flex-direction: column;
justify-content: space-around;
justify-content: space-between;
align-items: flex-start;
gap: 10px;
}
#left-buttons {
Expand Down Expand Up @@ -752,6 +776,13 @@ video {
z-index: 10;
}
#left-buttons, #right-buttons {
display: flex;
flex-direction: column;
gap: 10px;
pointer-events: auto;
}
.bottom-sheet {
.v-overlay__content {
align-self: flex-end;
Expand Down

0 comments on commit d73b929

Please sign in to comment.