Spaces:
Running
Running
Add 2 files
Browse files- index.html +389 -45
- prompts.txt +2 -1
index.html
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<title>Lunar Celestial Viewer</title>
|
7 |
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
9 |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/controls/OrbitControls.min.js"></script>
|
@@ -128,6 +128,20 @@
|
|
128 |
background: linear-gradient(90deg, #333 50%, #eee 50%);
|
129 |
margin-right: 10px;
|
130 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
</style>
|
132 |
</head>
|
133 |
<body class="bg-gray-900">
|
@@ -153,12 +167,19 @@
|
|
153 |
<div class="celestial-value" id="azimuth">214° 22'</div>
|
154 |
<div>Altitude:</div>
|
155 |
<div class="celestial-value" id="altitude">+32° 47'</div>
|
|
|
|
|
|
|
|
|
156 |
</div>
|
157 |
</div>
|
158 |
|
159 |
<!-- VRML 3D Renderer Canvas -->
|
160 |
<div id="renderCanvas"></div>
|
161 |
|
|
|
|
|
|
|
162 |
<!-- Control Panel -->
|
163 |
<div class="control-panel">
|
164 |
<div class="flex items-center justify-between mb-4">
|
@@ -175,6 +196,7 @@
|
|
175 |
<option value="2">Moon with Craters</option>
|
176 |
<option value="3">Earth-Moon System</option>
|
177 |
<option value="4">Lunar Landing Site</option>
|
|
|
178 |
</select>
|
179 |
|
180 |
<div class="flex flex-wrap gap-2 mt-4">
|
@@ -190,12 +212,19 @@
|
|
190 |
<button id="toggleCoordinates" class="control-btn bg-yellow-600 hover:bg-yellow-700 text-white">
|
191 |
Toggle Coordinates
|
192 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
</div>
|
194 |
|
195 |
<div class="mt-4 text-xs text-gray-400">
|
196 |
<p>• Drag to rotate view | Scroll to zoom | Right-drag to pan</p>
|
197 |
<p>• Current moon phase: <span id="moonPhaseText">Waning Gibbous</span></p>
|
198 |
<p>• Coordinates updated in real-time</p>
|
|
|
199 |
</div>
|
200 |
</div>
|
201 |
|
@@ -206,6 +235,10 @@
|
|
206 |
let isStarsVisible = true;
|
207 |
let isGridVisible = true;
|
208 |
let isCoordinatesVisible = true;
|
|
|
|
|
|
|
|
|
209 |
|
210 |
// Current moon coordinates (from TheSkyLive)
|
211 |
const moonCoords = {
|
@@ -214,9 +247,25 @@
|
|
214 |
hourAngle: { hours: 14, minutes: 55, seconds: 53 },
|
215 |
siderealTime: { hours: 13, minutes: 49, seconds: 9 },
|
216 |
azimuth: 214.3667,
|
217 |
-
altitude: 32.7833
|
|
|
|
|
218 |
};
|
219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
// Space and lunar models with celestial coordinates
|
221 |
const spaceModels = [
|
222 |
// Celestial Moon
|
@@ -496,52 +545,50 @@
|
|
496 |
translation -1 0 0.5
|
497 |
children [
|
498 |
Shape {
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
}
|
503 |
-
}
|
504 |
-
geometry Cylinder {
|
505 |
-
radius 0.3
|
506 |
-
height 0.1
|
507 |
-
top FALSE
|
508 |
-
}
|
509 |
}
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
}
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
}
|
544 |
-
|
|
|
|
|
|
|
|
|
|
|
545 |
}
|
546 |
]
|
547 |
}
|
@@ -818,6 +865,71 @@
|
|
818 |
]
|
819 |
}
|
820 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
821 |
}`
|
822 |
];
|
823 |
|
@@ -858,6 +970,12 @@
|
|
858 |
// Load initial model
|
859 |
loadVRMLModel(spaceModels[0]);
|
860 |
|
|
|
|
|
|
|
|
|
|
|
|
|
861 |
// Update moon phase display
|
862 |
updateMoonPhase();
|
863 |
|
@@ -872,6 +990,149 @@
|
|
872 |
|
873 |
// Update coordinates periodically to simulate real-time
|
874 |
setInterval(updateMoonCoordinates, 1000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
875 |
}
|
876 |
|
877 |
// Create starfield background
|
@@ -1001,6 +1262,8 @@
|
|
1001 |
camera.position.z = 8;
|
1002 |
} else if (selectedModel === "3") {
|
1003 |
camera.position.z = 10;
|
|
|
|
|
1004 |
} else {
|
1005 |
camera.position.z = 5;
|
1006 |
}
|
@@ -1177,6 +1440,12 @@
|
|
1177 |
|
1178 |
document.getElementById('altitude').textContent =
|
1179 |
`${moonCoords.altitude >= 0 ? '+' : ''}${Math.floor(moonCoords.altitude)}° ${Math.floor((moonCoords.altitude % 1) * 60)}'`;
|
|
|
|
|
|
|
|
|
|
|
|
|
1180 |
}
|
1181 |
|
1182 |
// Update moon phase display
|
@@ -1190,6 +1459,58 @@
|
|
1190 |
moonPhaseTextElement.textContent = 'Waning Gibbous (70%)';
|
1191 |
}
|
1192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1193 |
// Animation loop
|
1194 |
function animate() {
|
1195 |
requestAnimationFrame(animate);
|
@@ -1228,6 +1549,8 @@
|
|
1228 |
camera.position.z = 8;
|
1229 |
} else if (selectedModel === "3") {
|
1230 |
camera.position.z = 10;
|
|
|
|
|
1231 |
} else {
|
1232 |
camera.position.z = 5;
|
1233 |
}
|
@@ -1252,10 +1575,31 @@
|
|
1252 |
document.getElementById('celestialDisplay').style.display = isCoordinatesVisible ? 'block' : 'none';
|
1253 |
});
|
1254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1255 |
// Model selector
|
1256 |
document.getElementById('modelSelector').addEventListener('change', function() {
|
1257 |
const modelIndex = parseInt(this.value);
|
1258 |
loadVRMLModel(spaceModels[modelIndex]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1259 |
});
|
1260 |
|
1261 |
// Initialize the scene when the page loads
|
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Lunar Celestial Viewer with Magnetic Field</title>
|
7 |
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
9 |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/controls/OrbitControls.min.js"></script>
|
|
|
128 |
background: linear-gradient(90deg, #333 50%, #eee 50%);
|
129 |
margin-right: 10px;
|
130 |
}
|
131 |
+
|
132 |
+
/* Pin info window */
|
133 |
+
.pin-info {
|
134 |
+
position: absolute;
|
135 |
+
background: rgba(0, 0, 0, 0.8);
|
136 |
+
color: white;
|
137 |
+
padding: 10px;
|
138 |
+
border-radius: 5px;
|
139 |
+
font-size: 12px;
|
140 |
+
pointer-events: none;
|
141 |
+
z-index: 200;
|
142 |
+
max-width: 200px;
|
143 |
+
display: none;
|
144 |
+
}
|
145 |
</style>
|
146 |
</head>
|
147 |
<body class="bg-gray-900">
|
|
|
167 |
<div class="celestial-value" id="azimuth">214° 22'</div>
|
168 |
<div>Altitude:</div>
|
169 |
<div class="celestial-value" id="altitude">+32° 47'</div>
|
170 |
+
<div>Gravity:</div>
|
171 |
+
<div class="celestial-value" id="gravity">1.62 m/s²</div>
|
172 |
+
<div>Magnetic Field:</div>
|
173 |
+
<div class="celestial-value" id="magneticField">~1-100 nT</div>
|
174 |
</div>
|
175 |
</div>
|
176 |
|
177 |
<!-- VRML 3D Renderer Canvas -->
|
178 |
<div id="renderCanvas"></div>
|
179 |
|
180 |
+
<!-- Pin info window -->
|
181 |
+
<div id="pinInfo" class="pin-info"></div>
|
182 |
+
|
183 |
<!-- Control Panel -->
|
184 |
<div class="control-panel">
|
185 |
<div class="flex items-center justify-between mb-4">
|
|
|
196 |
<option value="2">Moon with Craters</option>
|
197 |
<option value="3">Earth-Moon System</option>
|
198 |
<option value="4">Lunar Landing Site</option>
|
199 |
+
<option value="5">Magnetic Field View</option>
|
200 |
</select>
|
201 |
|
202 |
<div class="flex flex-wrap gap-2 mt-4">
|
|
|
212 |
<button id="toggleCoordinates" class="control-btn bg-yellow-600 hover:bg-yellow-700 text-white">
|
213 |
Toggle Coordinates
|
214 |
</button>
|
215 |
+
<button id="togglePins" class="control-btn bg-red-600 hover:bg-red-700 text-white">
|
216 |
+
Toggle Site Pins
|
217 |
+
</button>
|
218 |
+
<button id="toggleMagnetic" class="control-btn bg-indigo-600 hover:bg-indigo-700 text-white">
|
219 |
+
Toggle Magnetic Field
|
220 |
+
</button>
|
221 |
</div>
|
222 |
|
223 |
<div class="mt-4 text-xs text-gray-400">
|
224 |
<p>• Drag to rotate view | Scroll to zoom | Right-drag to pan</p>
|
225 |
<p>• Current moon phase: <span id="moonPhaseText">Waning Gibbous</span></p>
|
226 |
<p>• Coordinates updated in real-time</p>
|
227 |
+
<p>• Click on pins for site information</p>
|
228 |
</div>
|
229 |
</div>
|
230 |
|
|
|
235 |
let isStarsVisible = true;
|
236 |
let isGridVisible = true;
|
237 |
let isCoordinatesVisible = true;
|
238 |
+
let isPinsVisible = true;
|
239 |
+
let isMagneticVisible = false;
|
240 |
+
let pins = [];
|
241 |
+
let magneticFieldLines = [];
|
242 |
|
243 |
// Current moon coordinates (from TheSkyLive)
|
244 |
const moonCoords = {
|
|
|
247 |
hourAngle: { hours: 14, minutes: 55, seconds: 53 },
|
248 |
siderealTime: { hours: 13, minutes: 49, seconds: 9 },
|
249 |
azimuth: 214.3667,
|
250 |
+
altitude: 32.7833,
|
251 |
+
gravity: 1.62,
|
252 |
+
magneticField: "~1-100 nT"
|
253 |
};
|
254 |
|
255 |
+
// Known lunar sites with coordinates (latitude, longitude)
|
256 |
+
const lunarSites = [
|
257 |
+
{ name: "Volcano Prime", lat: 16.84, long: -21.22, type: "colony", description: "Primary lunar colony located in volcanic highlands" },
|
258 |
+
{ name: "Apollo 11", lat: 0.6741, long: 23.4731, type: "landing", description: "First human landing site (1969)" },
|
259 |
+
{ name: "Apollo 17", lat: 20.1919, long: 30.7717, type: "landing", description: "Last Apollo mission landing site (1972)" },
|
260 |
+
{ name: "Tycho Crater", lat: -43.31, long: -11.36, type: "feature", description: "Prominent impact crater with ray system" },
|
261 |
+
{ name: "Mare Tranquillitatis", lat: 8.5, long: 31.4, type: "feature", description: "Sea of Tranquility - dark volcanic plain" },
|
262 |
+
{ name: "Shackleton Crater", lat: -89.9, long: 0, type: "feature", description: "South pole crater with potential water ice" },
|
263 |
+
{ name: "Luna 2", lat: 29.1, long: 0, type: "impact", description: "First human-made object to reach the Moon (1959)" },
|
264 |
+
{ name: "Chang'e 4", lat: -45.5, long: 177.6, type: "lander", description: "First spacecraft to land on far side (2019)" },
|
265 |
+
{ name: "Mons Hadley", lat: 26.5, long: 3.7, type: "feature", description: "Mountain near Apollo 15 landing site" },
|
266 |
+
{ name: "Oceanus Procellarum", lat: 18.4, long: -57.4, type: "feature", description: "Largest lunar mare (Ocean of Storms)" }
|
267 |
+
];
|
268 |
+
|
269 |
// Space and lunar models with celestial coordinates
|
270 |
const spaceModels = [
|
271 |
// Celestial Moon
|
|
|
545 |
translation -1 0 0.5
|
546 |
children [
|
547 |
Shape {
|
548 |
+
appearance Appearance {
|
549 |
+
material Material {
|
550 |
+
diffuseColor 0.5 0.5 0.5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
551 |
}
|
552 |
+
}
|
553 |
+
geometry Cylinder {
|
554 |
+
radius 0.3
|
555 |
+
height 0.1
|
556 |
+
top FALSE
|
557 |
+
}
|
558 |
+
}
|
559 |
+
]
|
560 |
+
},
|
561 |
+
Transform {
|
562 |
+
translation 0.8 0 -0.8
|
563 |
+
children [
|
564 |
+
Shape {
|
565 |
+
appearance Appearance {
|
566 |
+
material Material {
|
567 |
+
diffuseColor 0.5 0.5 0.5
|
568 |
}
|
569 |
+
}
|
570 |
+
geometry Cylinder {
|
571 |
+
radius 0.5
|
572 |
+
height 0.15
|
573 |
+
top FALSE
|
574 |
+
}
|
575 |
+
}
|
576 |
+
]
|
577 |
+
},
|
578 |
+
Transform {
|
579 |
+
translation 0.5 0 1
|
580 |
+
children [
|
581 |
+
Shape {
|
582 |
+
appearance Appearance {
|
583 |
+
material Material {
|
584 |
+
diffuseColor 0.5 0.5 0.5
|
585 |
}
|
586 |
+
}
|
587 |
+
geometry Cylinder {
|
588 |
+
radius 0.4
|
589 |
+
height 0.12
|
590 |
+
top FALSE
|
591 |
+
}
|
592 |
}
|
593 |
]
|
594 |
}
|
|
|
865 |
]
|
866 |
}
|
867 |
]
|
868 |
+
}`,
|
869 |
+
|
870 |
+
// Magnetic Field View
|
871 |
+
`#VRML V2.0 utf8
|
872 |
+
|
873 |
+
Group {
|
874 |
+
children [
|
875 |
+
# Moon positioned at current celestial coordinates
|
876 |
+
Transform {
|
877 |
+
rotation 0 1 0 ${(moonCoords.hourAngle.hours / 24) * Math.PI * 2}
|
878 |
+
children [
|
879 |
+
Transform {
|
880 |
+
rotation 1 0 0 ${moonCoords.declination.degrees * Math.PI / 180}
|
881 |
+
children [
|
882 |
+
# Moon with transparent surface
|
883 |
+
Shape {
|
884 |
+
appearance Appearance {
|
885 |
+
material Material {
|
886 |
+
diffuseColor 0.8 0.8 0.8
|
887 |
+
transparency 0.7
|
888 |
+
}
|
889 |
+
}
|
890 |
+
geometry Sphere {
|
891 |
+
radius 1.5
|
892 |
+
}
|
893 |
+
},
|
894 |
+
|
895 |
+
# Magnetic poles (north and south)
|
896 |
+
Transform {
|
897 |
+
translation 0 1.5 0
|
898 |
+
children [
|
899 |
+
Shape {
|
900 |
+
appearance Appearance {
|
901 |
+
material Material {
|
902 |
+
diffuseColor 1.0 0.0 0.0
|
903 |
+
emissiveColor 1.0 0.3 0.3
|
904 |
+
}
|
905 |
+
}
|
906 |
+
geometry Sphere {
|
907 |
+
radius 0.15
|
908 |
+
}
|
909 |
+
}
|
910 |
+
]
|
911 |
+
},
|
912 |
+
Transform {
|
913 |
+
translation 0 -1.5 0
|
914 |
+
children [
|
915 |
+
Shape {
|
916 |
+
appearance Appearance {
|
917 |
+
material Material {
|
918 |
+
diffuseColor 0.0 0.0 1.0
|
919 |
+
emissiveColor 0.3 0.3 1.0
|
920 |
+
}
|
921 |
+
}
|
922 |
+
geometry Sphere {
|
923 |
+
radius 0.15
|
924 |
+
}
|
925 |
+
}
|
926 |
+
]
|
927 |
+
}
|
928 |
+
]
|
929 |
+
}
|
930 |
+
]
|
931 |
+
}
|
932 |
+
]
|
933 |
}`
|
934 |
];
|
935 |
|
|
|
970 |
// Load initial model
|
971 |
loadVRMLModel(spaceModels[0]);
|
972 |
|
973 |
+
// Add lunar site pins
|
974 |
+
createLunarSitePins();
|
975 |
+
|
976 |
+
// Create magnetic field visualization
|
977 |
+
createMagneticField();
|
978 |
+
|
979 |
// Update moon phase display
|
980 |
updateMoonPhase();
|
981 |
|
|
|
990 |
|
991 |
// Update coordinates periodically to simulate real-time
|
992 |
setInterval(updateMoonCoordinates, 1000);
|
993 |
+
|
994 |
+
// Set up pin click handler
|
995 |
+
document.getElementById('renderCanvas').addEventListener('click', onCanvasClick, false);
|
996 |
+
}
|
997 |
+
|
998 |
+
// Create lunar site pins
|
999 |
+
function createLunarSitePins() {
|
1000 |
+
// Remove existing pins
|
1001 |
+
pins.forEach(pin => scene.remove(pin));
|
1002 |
+
pins = [];
|
1003 |
+
|
1004 |
+
lunarSites.forEach(site => {
|
1005 |
+
// Convert lat/long to 3D position on sphere
|
1006 |
+
const latRad = site.lat * Math.PI / 180;
|
1007 |
+
const longRad = site.long * Math.PI / 180;
|
1008 |
+
const radius = 1.52; // Slightly larger than moon radius
|
1009 |
+
|
1010 |
+
const x = radius * Math.cos(latRad) * Math.cos(longRad);
|
1011 |
+
const y = radius * Math.sin(latRad);
|
1012 |
+
const z = radius * Math.cos(latRad) * Math.sin(longRad);
|
1013 |
+
|
1014 |
+
// Create pin based on site type
|
1015 |
+
let pinMaterial, pinHeight;
|
1016 |
+
if (site.type === "colony") {
|
1017 |
+
pinMaterial = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
|
1018 |
+
pinHeight = 0.3;
|
1019 |
+
} else if (site.type === "landing") {
|
1020 |
+
pinMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000 });
|
1021 |
+
pinHeight = 0.25;
|
1022 |
+
} else if (site.type === "impact") {
|
1023 |
+
pinMaterial = new THREE.MeshBasicMaterial({ color: 0xffff00 });
|
1024 |
+
pinHeight = 0.2;
|
1025 |
+
} else {
|
1026 |
+
pinMaterial = new THREE.MeshBasicMaterial({ color: 0x00ffff });
|
1027 |
+
pinHeight = 0.15;
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
// Create pin (cone on top of a cylinder)
|
1031 |
+
const pinGroup = new THREE.Group();
|
1032 |
+
|
1033 |
+
// Pin base (cylinder)
|
1034 |
+
const pinBaseGeometry = new THREE.CylinderGeometry(0.03, 0.03, pinHeight, 8);
|
1035 |
+
const pinBase = new THREE.Mesh(pinBaseGeometry, pinMaterial);
|
1036 |
+
pinBase.position.y = pinHeight / 2;
|
1037 |
+
pinGroup.add(pinBase);
|
1038 |
+
|
1039 |
+
// Pin tip (cone)
|
1040 |
+
const pinTipGeometry = new THREE.ConeGeometry(0.05, 0.1, 8);
|
1041 |
+
const pinTip = new THREE.Mesh(pinTipGeometry, pinMaterial);
|
1042 |
+
pinTip.position.y = pinHeight + 0.05;
|
1043 |
+
pinGroup.add(pinTip);
|
1044 |
+
|
1045 |
+
// Position the pin on the moon's surface
|
1046 |
+
pinGroup.position.set(x, y, z);
|
1047 |
+
|
1048 |
+
// Make pin point outward from moon's center
|
1049 |
+
pinGroup.lookAt(new THREE.Vector3(0, 0, 0));
|
1050 |
+
pinGroup.rotateX(Math.PI / 2);
|
1051 |
+
|
1052 |
+
// Store site data for click handling
|
1053 |
+
pinGroup.userData = {
|
1054 |
+
isPin: true,
|
1055 |
+
siteInfo: site
|
1056 |
+
};
|
1057 |
+
|
1058 |
+
scene.add(pinGroup);
|
1059 |
+
pins.push(pinGroup);
|
1060 |
+
});
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
// Create magnetic field visualization
|
1064 |
+
function createMagneticField() {
|
1065 |
+
// Remove existing field lines
|
1066 |
+
magneticFieldLines.forEach(line => scene.remove(line));
|
1067 |
+
magneticFieldLines = [];
|
1068 |
+
|
1069 |
+
// Moon's magnetic field is weak and localized, so we'll visualize it with field lines
|
1070 |
+
// emanating from the poles (simplified representation)
|
1071 |
+
|
1072 |
+
// North pole position
|
1073 |
+
const northPole = new THREE.Vector3(0, 1.5, 0);
|
1074 |
+
// South pole position
|
1075 |
+
const southPole = new THREE.Vector3(0, -1.5, 0);
|
1076 |
+
|
1077 |
+
// Create field lines (simplified dipole field)
|
1078 |
+
const segments = 12;
|
1079 |
+
const steps = 20;
|
1080 |
+
const material = new THREE.LineBasicMaterial({
|
1081 |
+
color: 0xff5555,
|
1082 |
+
transparent: true,
|
1083 |
+
opacity: 0.7
|
1084 |
+
});
|
1085 |
+
|
1086 |
+
for (let i = 0; i < segments; i++) {
|
1087 |
+
// Field lines from north pole
|
1088 |
+
const northGeometry = new THREE.BufferGeometry();
|
1089 |
+
const northVertices = [];
|
1090 |
+
const angle = (i / segments) * Math.PI * 2;
|
1091 |
+
|
1092 |
+
for (let j = 0; j <= steps; j++) {
|
1093 |
+
const t = j / steps;
|
1094 |
+
const theta = angle;
|
1095 |
+
const phi = t * Math.PI;
|
1096 |
+
|
1097 |
+
// Simplified dipole field line path
|
1098 |
+
const r = 1.5 * Math.sin(phi) * Math.sin(phi);
|
1099 |
+
const x = r * Math.cos(theta);
|
1100 |
+
const y = 1.5 * Math.cos(phi);
|
1101 |
+
const z = r * Math.sin(theta);
|
1102 |
+
|
1103 |
+
northVertices.push(x, y, z);
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
northGeometry.setAttribute('position', new THREE.Float32BufferAttribute(northVertices, 3));
|
1107 |
+
const northLine = new THREE.Line(northGeometry, material);
|
1108 |
+
magneticFieldLines.push(northLine);
|
1109 |
+
scene.add(northLine);
|
1110 |
+
|
1111 |
+
// Field lines from south pole (same but inverted)
|
1112 |
+
const southGeometry = new THREE.BufferGeometry();
|
1113 |
+
const southVertices = [];
|
1114 |
+
|
1115 |
+
for (let j = 0; j <= steps; j++) {
|
1116 |
+
const t = j / steps;
|
1117 |
+
const theta = angle + Math.PI;
|
1118 |
+
const phi = t * Math.PI;
|
1119 |
+
|
1120 |
+
const r = 1.5 * Math.sin(phi) * Math.sin(phi);
|
1121 |
+
const x = r * Math.cos(theta);
|
1122 |
+
const y = -1.5 * Math.cos(phi);
|
1123 |
+
const z = r * Math.sin(theta);
|
1124 |
+
|
1125 |
+
southVertices.push(x, y, z);
|
1126 |
+
}
|
1127 |
+
|
1128 |
+
southGeometry.setAttribute('position', new THREE.Float32BufferAttribute(southVertices, 3));
|
1129 |
+
const southLine = new THREE.Line(southGeometry, material);
|
1130 |
+
magneticFieldLines.push(southLine);
|
1131 |
+
scene.add(southLine);
|
1132 |
+
}
|
1133 |
+
|
1134 |
+
// Set initial visibility
|
1135 |
+
magneticFieldLines.forEach(line => line.visible = isMagneticVisible);
|
1136 |
}
|
1137 |
|
1138 |
// Create starfield background
|
|
|
1262 |
camera.position.z = 8;
|
1263 |
} else if (selectedModel === "3") {
|
1264 |
camera.position.z = 10;
|
1265 |
+
} else if (selectedModel === "5") {
|
1266 |
+
camera.position.z = 7;
|
1267 |
} else {
|
1268 |
camera.position.z = 5;
|
1269 |
}
|
|
|
1440 |
|
1441 |
document.getElementById('altitude').textContent =
|
1442 |
`${moonCoords.altitude >= 0 ? '+' : ''}${Math.floor(moonCoords.altitude)}° ${Math.floor((moonCoords.altitude % 1) * 60)}'`;
|
1443 |
+
|
1444 |
+
document.getElementById('gravity').textContent =
|
1445 |
+
`${moonCoords.gravity.toFixed(2)} m/s²`;
|
1446 |
+
|
1447 |
+
document.getElementById('magneticField').textContent =
|
1448 |
+
moonCoords.magneticField;
|
1449 |
}
|
1450 |
|
1451 |
// Update moon phase display
|
|
|
1459 |
moonPhaseTextElement.textContent = 'Waning Gibbous (70%)';
|
1460 |
}
|
1461 |
|
1462 |
+
// Handle canvas clicks for pin selection
|
1463 |
+
function onCanvasClick(event) {
|
1464 |
+
if (!isPinsVisible) return;
|
1465 |
+
|
1466 |
+
// Calculate mouse position in normalized device coordinates
|
1467 |
+
const mouse = new THREE.Vector2();
|
1468 |
+
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
|
1469 |
+
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
1470 |
+
|
1471 |
+
// Set up raycaster
|
1472 |
+
const raycaster = new THREE.Raycaster();
|
1473 |
+
raycaster.setFromCamera(mouse, camera);
|
1474 |
+
|
1475 |
+
// Calculate objects intersecting the ray
|
1476 |
+
const intersects = raycaster.intersectObjects(pins);
|
1477 |
+
|
1478 |
+
if (intersects.length > 0) {
|
1479 |
+
const clickedPin = intersects[0].object;
|
1480 |
+
if (clickedPin.userData.isPin) {
|
1481 |
+
const site = clickedPin.userData.siteInfo;
|
1482 |
+
const pinInfo = document.getElementById('pinInfo');
|
1483 |
+
|
1484 |
+
// Position the info window near the pin
|
1485 |
+
const pinPosition = clickedPin.position.clone().project(camera);
|
1486 |
+
pinInfo.style.left = `${(pinPosition.x * 0.5 + 0.5) * window.innerWidth}px`;
|
1487 |
+
pinInfo.style.top = `${(-(pinPosition.y * 0.5 - 0.5)) * window.innerHeight}px`;
|
1488 |
+
|
1489 |
+
// Set content based on site type
|
1490 |
+
let typeColor;
|
1491 |
+
switch(site.type) {
|
1492 |
+
case 'colony': typeColor = 'text-green-400'; break;
|
1493 |
+
case 'landing': typeColor = 'text-red-400'; break;
|
1494 |
+
case 'impact': typeColor = 'text-yellow-400'; break;
|
1495 |
+
default: typeColor = 'text-cyan-400';
|
1496 |
+
}
|
1497 |
+
|
1498 |
+
pinInfo.innerHTML = `
|
1499 |
+
<div class="font-bold ${typeColor}">${site.name}</div>
|
1500 |
+
<div>Lat: ${site.lat}° | Long: ${site.long}°</div>
|
1501 |
+
<div class="mt-1">${site.description}</div>
|
1502 |
+
`;
|
1503 |
+
|
1504 |
+
pinInfo.style.display = 'block';
|
1505 |
+
|
1506 |
+
// Hide after 5 seconds
|
1507 |
+
setTimeout(() => {
|
1508 |
+
pinInfo.style.display = 'none';
|
1509 |
+
}, 5000);
|
1510 |
+
}
|
1511 |
+
}
|
1512 |
+
}
|
1513 |
+
|
1514 |
// Animation loop
|
1515 |
function animate() {
|
1516 |
requestAnimationFrame(animate);
|
|
|
1549 |
camera.position.z = 8;
|
1550 |
} else if (selectedModel === "3") {
|
1551 |
camera.position.z = 10;
|
1552 |
+
} else if (selectedModel === "5") {
|
1553 |
+
camera.position.z = 7;
|
1554 |
} else {
|
1555 |
camera.position.z = 5;
|
1556 |
}
|
|
|
1575 |
document.getElementById('celestialDisplay').style.display = isCoordinatesVisible ? 'block' : 'none';
|
1576 |
});
|
1577 |
|
1578 |
+
// Toggle site pins
|
1579 |
+
document.getElementById('togglePins').addEventListener('click', function() {
|
1580 |
+
isPinsVisible = !isPinsVisible;
|
1581 |
+
pins.forEach(pin => pin.visible = isPinsVisible);
|
1582 |
+
});
|
1583 |
+
|
1584 |
+
// Toggle magnetic field
|
1585 |
+
document.getElementById('toggleMagnetic').addEventListener('click', function() {
|
1586 |
+
isMagneticVisible = !isMagneticVisible;
|
1587 |
+
magneticFieldLines.forEach(line => line.visible = isMagneticVisible);
|
1588 |
+
});
|
1589 |
+
|
1590 |
// Model selector
|
1591 |
document.getElementById('modelSelector').addEventListener('change', function() {
|
1592 |
const modelIndex = parseInt(this.value);
|
1593 |
loadVRMLModel(spaceModels[modelIndex]);
|
1594 |
+
|
1595 |
+
// Special handling for magnetic field view
|
1596 |
+
if (modelIndex === 5) {
|
1597 |
+
isMagneticVisible = true;
|
1598 |
+
magneticFieldLines.forEach(line => line.visible = true);
|
1599 |
+
} else {
|
1600 |
+
isMagneticVisible = false;
|
1601 |
+
magneticFieldLines.forEach(line => line.visible = false);
|
1602 |
+
}
|
1603 |
});
|
1604 |
|
1605 |
// Initialize the scene when the page loads
|
prompts.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
Create a full screen VRML 3D site with toggle on off switch
|
2 |
Add a few space scenes like the moon and lunar surface render in geometry with coordinates to points on the moon
|
3 |
-
Modify and use real time moon location coordinates reference Celestial Coordinates Apparent Right Ascension22h 53m 16s Declination-09° 30’ 48” Hour Angle14h 55m 53s Sidereal Time https://theskylive.com/moon-info and position the grid in those coordinates
|
|
|
|
1 |
Create a full screen VRML 3D site with toggle on off switch
|
2 |
Add a few space scenes like the moon and lunar surface render in geometry with coordinates to points on the moon
|
3 |
+
Modify and use real time moon location coordinates reference Celestial Coordinates Apparent Right Ascension22h 53m 16s Declination-09° 30’ 48” Hour Angle14h 55m 53s Sidereal Time https://theskylive.com/moon-info and position the grid in those coordinates
|
4 |
+
Add a magnetic field and corresponding poles also add appropriate gravity add a moon colony pin named Volcano Prime and also add all known site locations as pins with a corresponding name
|