Skip to content

Commit

Permalink
🤷‍♂️ (#19)
Browse files Browse the repository at this point in the history
* start replacing nbody with almanac

* more design docs

* checkpoint

* tinker with coordinate frames

* MPL license, anise, and big_space

* arch design

* tidy up

* directly transform from almanac

* i have a habit of renaming things

* checkpoint
  • Loading branch information
philiplinden committed Jun 30, 2024
1 parent 5e34d6c commit 80e267f
Show file tree
Hide file tree
Showing 24 changed files with 193 additions and 228 deletions.
13 changes: 11 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = [
"spacetime-core",
"spacetime-bridge",
"spacetime-engine",
"spacetime-galley",
]
resolver = "2"
10 changes: 4 additions & 6 deletions spacetime-bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ homepage = "https://philiplinden.github.io/clocss-abm/"
repository = "https://github.com/philiplinden/clocss-abm"

[dependencies]
spacetime-core = { path = "../spacetime-core" }
bevy = { version = "0.12.0", features = [
"dynamic_linking",
"multi-threaded",
] }
spacetime-engine = { path = "../spacetime-engine" }
spacetime-galley = { path = "../spacetime-galley" }
big_space = "0.4.0"
bevy = { version = "0.12.0", features = ["dynamic_linking", "multi-threaded"] }
bevy_egui = "0.24.0"
humantime = "2.1.0"
crossbeam-channel = "0.5.11"
particular = { version = "0.6.1", features = ["gpu", "parallel"] }
big_space = "0.4.0"

# Enable a small amount of optimization in debug mode
[profile.dev]
Expand Down
2 changes: 1 addition & 1 deletion spacetime-bridge/src/gui/hud.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::time::Duration;

use spacetime_core::physics::{PhysicsTime, ElapsedPhysicsTime, PhysicsSettings};
use spacetime_core::{PhysicsTime, ElapsedPhysicsTime, PhysicsSettings};
use crate::gui::{
format_duration,
orbit_prediction::{ComputePredictionEvent, PredictionDraw, PredictionState, ResetPredictionEvent},
Expand Down
11 changes: 6 additions & 5 deletions spacetime-bridge/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use bevy::prelude::*;
mod gui;
mod orbit_prediction;
mod scenario;
mod scene;

use scene::{body, camera};
use spacetime_core::{physics, DT};
use spacetime_core::{kinematics, schedule, PhysicsSettings, G, SCALE};

use gui::select::{Followed, Selected};

fn main() {
App::new()
Expand All @@ -25,8 +26,8 @@ fn main() {
gui::GuiPlugin,
camera::CameraPlugin,
// Physics
physics::PhysicsSchedulePlugin,
physics::GravityPlugin,
schedule::PhysicsSchedulePlugin,
kinematics::GravityPlugin,
// Scene
scenario::ScenarioPlugin,
))
Expand All @@ -36,7 +37,7 @@ fn main() {
color: Color::WHITE,
brightness: 0.5,
})
.insert_resource(physics::PhysicsSettings::delta_time(DT))
.insert_resource(PhysicsSettings::delta_time(DT))
.add_systems(First, body::add_materials)
.run();
}
144 changes: 0 additions & 144 deletions spacetime-bridge/src/scenario.rs

This file was deleted.

6 changes: 3 additions & 3 deletions spacetime-bridge/src/scene/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use crate::gui::{
label::Labelled,
select::{CanFollow, CanSelect},
};
use crate::orbit_prediction::{PredictionBundle, PredictionDraw};
use spacetime_core::{
physics::{Acceleration, Interpolated, Mass, Position, Velocity},
SCALE,
kinematics::{Acceleration, Mass, Position, Velocity},
Interpolated, SCALE,
orbit_prediction::{PredictionBundle, PredictionDraw},
};

// Planetoids, stars, and other natural bodies are called CELESTIALS
Expand Down
2 changes: 0 additions & 2 deletions spacetime-core/README.md

This file was deleted.

16 changes: 0 additions & 16 deletions spacetime-core/src/almanac.rs

This file was deleted.

30 changes: 0 additions & 30 deletions spacetime-core/src/lib.rs

This file was deleted.

1 change: 0 additions & 1 deletion spacetime-core/src/physics/constants.rs

This file was deleted.

10 changes: 0 additions & 10 deletions spacetime-core/src/physics/mod.rs

This file was deleted.

6 changes: 3 additions & 3 deletions spacetime-core/Cargo.toml → spacetime-engine/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "spacetime-core"
name = "spacetime-engine"
version = "0.1.0"
edition = "2021"
license = "MPL-2.0"
readme = "README.md"
description = "Run a Simulation of Heterogeneous Networked Lunar Clocks"
authors = ["Philip Linden <lindenphilipj@gmail.com>"]
homepage = "https://philiplinden.github.io/clocss-abm/"
repository = "https://github.com/philiplinden/clocss-abm"
homepage = "https://philiplinden.github.io/spacetime/"
repository = "https://github.com/philiplinden/spacetime"

[dependencies]
anise = "0.3.0"
Expand Down
2 changes: 2 additions & 0 deletions spacetime-engine/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# spacetime_core
Drive the simulation along with the engine.
28 changes: 28 additions & 0 deletions spacetime-engine/src/celestials.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use anise::constants::frames::{EARTH_J2000, MOON_J2000};
use anise::math::cartesian::CartesianState;
use anise::prelude::*;
use bevy::prelude::*;

use crate::sim::SimulationSpace;

Check failure on line 6 in spacetime-engine/src/celestials.rs

View workflow job for this annotation

GitHub Actions / build

struct `SimulationSpace` is private

trait Lookup {
fn true_state(&self, sim: Res<SimulationSpace>, coordinate_frame: Frame) -> CartesianState {
sim.almanac
.transform(self.own_frame, coordinate_frame, sim.epoch, None)
.unwrap()
}
}

struct CelestialBody {
own_frame: Frame,
}

impl Lookup for CelestialBody {}

pub static EARTH: CelestialBody = CelestialBody {
own_frame: EARTH_J2000,
};

pub static LUNA: CelestialBody = CelestialBody {
own_frame: MOON_J2000,
};
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* This module handles the warping of spacetime. This includes gravity and time dilation.
* This module establishes types and functions for kinematics calculations.
*
*/

use bevy::prelude::*;
use particular::prelude::*;

use crate::physics::schedule::{PhysicsSchedule, PhysicsSet};
use crate::schedule::{PhysicsSchedule, PhysicsSet};

// from particular::prelude
pub const NBODY_COMPUTE_METHOD: sequential::BruteForcePairs = sequential::BruteForcePairs;
Expand Down
Loading

0 comments on commit 80e267f

Please sign in to comment.