Skip to content

Commit

Permalink
remove body rotation for now
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-tennert committed Oct 6, 2024
1 parent 89820ef commit b606ad3
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
Binary file added scenarios/Test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions scenarios/Test.sim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"bodies":[],"data_sets":[],"starting_time_millis":0,"title":"test","description":"test","scale":1e-7,"timestep":900}
2 changes: 1 addition & 1 deletion scenarios/earth_satellites.sim
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"bodies":[{"children":[{"children":[{"children":[],"data":{"mass":450000.0,"starting_position":{"x":139697751.6768489,"y":-55457691.56188262,"z":26726.49883086234},"starting_velocity":{"x":8.512277308736511,"y":20.73621312430883,"z":-2.743211831320219},"name":"ISS","model_path":"iss.glb","diameter":0.1,"rotation_speed":0.0,"simulate":true,"naif_id":-1,"fixed_body_frame":{"target_id":-1,"orientation_id":-1},"ellipsoid":{"semi_major_equatorial_radius_km":1.0,"semi_minor_equatorial_radius_km":1.0,"polar_radius_km":1.0},"light_source":null,"rotation_matrix":{"x":{"x":1.0,"y":0.0,"z":0.0},"y":{"x":0.0,"y":1.0,"z":0.0},"z":{"x":0.0,"y":0.0,"z":1.0}}}},{"children":[],"data":{"mass":10800.0,"starting_position":{"x":139708447.6237727,"y":-55461983.31379145,"z":33786.01008588448},"starting_velocity":{"x":13.95250317957649,"y":32.23801340370306,"z":-4.892445364940268},"name":"Hubble","model_path":"hubble.glb","diameter":0.01,"rotation_speed":0.0,"simulate":true,"naif_id":-1,"fixed_body_frame":{"target_id":-1,"orientation_id":-1},"ellipsoid":{"semi_major_equatorial_radius_km":1.0,"semi_minor_equatorial_radius_km":1.0,"polar_radius_km":1.0},"light_source":null,"rotation_matrix":{"x":{"x":1.0,"y":0.0,"z":0.0},"y":{"x":0.0,"y":1.0,"z":0.0},"z":{"x":0.0,"y":0.0,"z":1.0}}}}],"data":{"mass":5.972e24,"starting_position":{"x":139703169.6031987,"y":-50894516.80238317,"z":-22031976.570581574},"starting_velocity":{"x":10.34755584668519,"y":25.363844384635943,"z":10.995351298282669},"name":"Earth","model_path":"earth.glb","diameter":12742.0,"rotation_speed":1436.0,"simulate":true,"naif_id":399,"fixed_body_frame":{"target_id":399,"orientation_id":399},"ellipsoid":{"semi_major_equatorial_radius_km":6378.1366,"semi_minor_equatorial_radius_km":6378.1366,"polar_radius_km":6356.7519},"light_source":null,"rotation_matrix":{"x":{"x":0.9411901831626892,"y":0.3378687798976898,"z":0.0023979549296200275},"y":{"x":-0.3378697335720062,"y":0.9411928653717041,"z":-6.617409326281631e-6},"z":{"x":-0.002259173896163702,"y":-0.000803968112450093,"z":0.9999971389770508}}}}],"data":{"mass":1.9885e30,"starting_position":{"x":-982171.6832391358,"y":-655394.8782055749,"z":28787.74341113935},"starting_velocity":{"x":0.01127558914848326,"y":-0.008532815916463004,"z":-0.0001656555243002107},"name":"Sun","model_path":"sun.glb","diameter":1392700.032,"rotation_speed":0.0,"simulate":true,"naif_id":-1,"fixed_body_frame":{"target_id":-1,"orientation_id":-1},"ellipsoid":{"semi_major_equatorial_radius_km":1.0,"semi_minor_equatorial_radius_km":1.0,"polar_radius_km":1.0},"light_source":{"intensity":3.75e28,"range":9e30,"color":"#FFFFFF","enabled":true},"rotation_matrix":{"x":{"x":1.0,"y":0.0,"z":0.0},"y":{"x":0.0,"y":1.0,"z":0.0},"z":{"x":0.0,"y":0.0,"z":1.0}}}}],"data_sets":["pck11.pca","de440s.bsp"],"starting_time_millis":1725148800000,"title":"Earth Satellites","description":"A scenario with all major satellites orbiting the Earth.","scale":1e-7,"timestep":150}
{"bodies":[{"children":[{"children":[{"children":[],"data":{"mass":450000.0,"starting_position":{"x":139697751.6768489,"y":-55457691.56188262,"z":26726.49883086234},"starting_velocity":{"x":8.512277308736511,"y":20.73621312430883,"z":-2.743211831320219},"name":"ISS","model_path":"iss.glb","diameter":0.1,"rotation_speed":0.0,"simulate":true,"naif_id":-1,"fixed_body_frame":{"target_id":-1,"orientation_id":-1},"ellipsoid":{"semi_major_equatorial_radius_km":1.0,"semi_minor_equatorial_radius_km":1.0,"polar_radius_km":1.0},"light_source":null,"rotation_matrix":{"x":{"x":1.0,"y":0.0,"z":0.0},"y":{"x":0.0,"y":1.0,"z":0.0},"z":{"x":0.0,"y":0.0,"z":1.0}}}},{"children":[],"data":{"mass":10800.0,"starting_position":{"x":139708447.6237727,"y":-55461983.31379145,"z":33786.01008588448},"starting_velocity":{"x":13.95250317957649,"y":32.23801340370306,"z":-4.892445364940268},"name":"Hubble","model_path":"hubble.glb","diameter":0.01,"rotation_speed":0.0,"simulate":true,"naif_id":-1,"fixed_body_frame":{"target_id":-1,"orientation_id":-1},"ellipsoid":{"semi_major_equatorial_radius_km":1.0,"semi_minor_equatorial_radius_km":1.0,"polar_radius_km":1.0},"light_source":null,"rotation_matrix":{"x":{"x":1.0,"y":0.0,"z":0.0},"y":{"x":0.0,"y":1.0,"z":0.0},"z":{"x":0.0,"y":0.0,"z":1.0}}}}],"data":{"mass":5.972e24,"starting_position":{"x":139703169.6031987,"y":-50894516.80238317,"z":-22031976.570581578},"starting_velocity":{"x":10.34755584668519,"y":25.363844384635943,"z":10.995351298282667},"name":"Earth","model_path":"earth.glb","diameter":12742.0,"rotation_speed":1436.0,"simulate":true,"naif_id":399,"fixed_body_frame":{"target_id":399,"orientation_id":399},"ellipsoid":{"semi_major_equatorial_radius_km":6378.1366,"semi_minor_equatorial_radius_km":6378.1366,"polar_radius_km":6356.7519},"light_source":null,"rotation_matrix":{"x":{"x":0.9411901831626892,"y":0.3378687798976898,"z":0.0023979549296200275},"y":{"x":-0.3378697335720062,"y":0.9411928653717041,"z":-6.617409326281631e-6},"z":{"x":-0.002259173896163702,"y":-0.000803968112450093,"z":0.9999971389770508}}}},{"children":[],"data":{"mass":0.0,"starting_position":{"x":0.0,"y":0.0,"z":0.0},"starting_velocity":{"x":0.0,"y":0.0,"z":0.0},"name":"Mars","model_path":"earth.glb","diameter":0.0,"rotation_speed":0.0,"simulate":true,"naif_id":499,"fixed_body_frame":{"target_id":499,"orientation_id":499},"ellipsoid":{"semi_major_equatorial_radius_km":1.0,"semi_minor_equatorial_radius_km":1.0,"polar_radius_km":1.0},"light_source":null,"rotation_matrix":{"x":{"x":1.0,"y":0.0,"z":0.0},"y":{"x":0.0,"y":1.0,"z":0.0},"z":{"x":0.0,"y":0.0,"z":1.0}}}}],"data":{"mass":1.9885e30,"starting_position":{"x":-982171.6832391358,"y":-655394.8782055749,"z":28787.74341113935},"starting_velocity":{"x":0.01127558914848326,"y":-0.008532815916463004,"z":-0.0001656555243002107},"name":"Sun","model_path":"sun.glb","diameter":1392700.032,"rotation_speed":0.0,"simulate":true,"naif_id":-1,"fixed_body_frame":{"target_id":-1,"orientation_id":-1},"ellipsoid":{"semi_major_equatorial_radius_km":1.0,"semi_minor_equatorial_radius_km":1.0,"polar_radius_km":1.0},"light_source":{"intensity":3.75e28,"range":9e30,"color":"#FFFFFF","enabled":true},"rotation_matrix":{"x":{"x":1.0,"y":0.0,"z":0.0},"y":{"x":0.0,"y":1.0,"z":0.0},"z":{"x":0.0,"y":0.0,"z":1.0}}}}],"data_sets":["pck11.pca","de440s.bsp"],"starting_time_millis":1725148800000,"title":"Earth Satellites","description":"A scenario with all major satellites orbiting the Earth.","scale":1e-7,"timestep":150}
2 changes: 1 addition & 1 deletion scenarios/solar_system.sim

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/simulation/components/anise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ pub fn retrieve_starting_data(
toasts.0.add(error_toast(format!("Error: {:?}", state.unwrap_err()).as_str()));
}

let full_frame = almanac.0.frame_from_uid(Frame::new(metadata.target_id, metadata.orientation_id));
let fixed_frame = Frame::new(metadata.target_id, metadata.orientation_id);
let full_frame = almanac.0.frame_from_uid(fixed_frame);

if let Ok(f) = full_frame {
e_state.ellipsoid = f.shape.unwrap_or(e_state.ellipsoid);
} else {
toasts.0.add(error_toast(format!("Error: {:?}", full_frame.unwrap_err()).as_str()));
}

let dcm = almanac.0.rotation_to_parent(Frame::new(metadata.target_id, metadata.orientation_id), epoch);
let dcm = almanac.0.rotation_to_parent(fixed_frame, epoch);

if let Ok(d) = dcm {
e_state.rotation_matrix = matrix3_to_mat3(d.rot_mat);
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/components/rotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn rotate_bodies(
for child in children.iter() {
if let Ok(mut transform) = scenes.get_mut(*child) {
// transform.rotate_z(2.0 * PI * (rotations_per_day * time.delta_seconds() * speed_modifier));
transform.rotate(Quat::from_axis_angle(tilt.axis, 2.0 * PI * (rotations_per_day * time.delta_seconds() * speed_modifier)));
// transform.rotate(Quat::from_axis_angle(tilt.axis, 2.0 * PI * (rotations_per_day * time.delta_seconds() * speed_modifier)));
}
}

Expand Down

0 comments on commit b606ad3

Please sign in to comment.