Skip to content

Commit

Permalink
"Auto commit number 39"
Browse files Browse the repository at this point in the history
  • Loading branch information
lat-murmeldjur committed Mar 31, 2024
1 parent bb321a0 commit e66ac90
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 11 deletions.
2 changes: 1 addition & 1 deletion chronicl.dt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
38
39
2 changes: 1 addition & 1 deletion featuring.dt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
38
39
1 change: 1 addition & 0 deletions ohio.note
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ Year::2024::|::Month::03::|::Day::27::|::Hour::16::|::Minute::33::|::Second::15:
Year::2024::|::Month::03::|::Day::27::|::Hour::16::|::Minute::56::|::Second::43::
Year::2024::|::Month::03::|::Day::27::|::Hour::17::|::Minute::33::|::Second::51::
Year::2024::|::Month::03::|::Day::28::|::Hour::14::|::Minute::38::|::Second::10::
Year::2024::|::Month::03::|::Day::31::|::Hour::16::|::Minute::02::|::Second::32::
135 changes: 131 additions & 4 deletions src/anomaly.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// experimental generic composite reductive approximation outline
use rand::rngs::ThreadRng;
use std::sync::mpsc;
use std::thread;

use crate::f32_3::dd_f32_3;
use crate::f64_3::mltply_f64_3;
use crate::gen_f64_3;
use crate::magma_ocean::{magma, petrify, Stone};
use crate::nrmlz_f64_3;
use crate::positions::move_positions;

pub static TS_F64: f64 = 5.391247 * 1e-44;
Expand Down Expand Up @@ -50,13 +53,102 @@ pub fn interact(anom: &mut Anomaly) {
}
});

component_interact(anom);
let mut rng = rand::thread_rng();

for i in 0..anom.anomaly.len() {
for j in 0..anom.anomaly.len() {
let (e, f) = if i < j {
// `i` is in the left half
let (left, right) = anom.anomaly.split_at_mut(j);
(&mut left[i], &mut right[0])
} else if i == j {
// cannot obtain two mutable references to the
// same element
continue;
} else {
// `i` is in the right half
let (left, right) = anom.anomaly.split_at_mut(i);
(&mut right[0], &mut left[j])
};
anomaly_2_interact(e, f, &mut rng);
}
}

component_interact(anom, &mut rng);
}

pub fn anomaly_2_interact(a: &mut Anomaly, b: &mut Anomaly, mut rng: &mut ThreadRng) {
for i in a.anomaly.iter_mut() {
for j in b.anomaly.iter_mut() {
anomaly_2_interact(i, j, &mut rng);
}
}

for df in &a.force {
for i in 0..a.component.len() {
for j in 0..b.component.len() {
component_2_interact(df, &mut a.component[i], &mut b.component[j], &mut rng);
}
}
}
}

pub fn component_interact(_anom: &mut Anomaly, rng: &mut ThreadRng) {
for df in &_anom.force {
for i in 0.._anom.component.len() {
for j in 0.._anom.component.len() {
let (e, f) = if i < j {
// `i` is in the left half
let (left, right) = _anom.component.split_at_mut(j);
(&mut left[i], &mut right[0])
} else if i == j {
// cannot obtain two mutable references to the
// same element
continue;
} else {
// `i` is in the right half
let (left, right) = _anom.component.split_at_mut(i);
(&mut right[0], &mut left[j])
};
component_2_interact(df, e, f, rng);
}
}
}
}

pub fn component_2_interact(
df: &Force,
a: &mut Component,
b: &mut Component,
mut rng: &mut ThreadRng,
) {
for i in a.component.iter_mut() {
for j in b.component.iter_mut() {
component_2_interact(df, i, j, &mut rng);
}
}

force_apply(df, a, b, &mut rng);
}

pub fn component_interact(_anom: &mut Anomaly) {
// for f in &anom.force {
pub fn force_apply(_f: &Force, a: &mut Component, b: &mut Component, mut rng: &mut ThreadRng) {
// a1 = component_property(a, IN0);
// a2 = component_property(a, IN1);
// a3 = component_property(a, IN2);
//
// }
// b1 = component_property(b, IN0);
// b2 = component_property(b, IN1);
// b3 = component_property(b, IN2);

set_inertia(
mltply_f64_3(nrmlz_f64_3(gen_f64_3(0.0, 10.0, &mut rng)), LS_F64),
a,
);

set_inertia(
mltply_f64_3(nrmlz_f64_3(gen_f64_3(0.0, 10.0, &mut rng)), LS_F64),
b,
);
}

pub fn progress(anom: &mut Anomaly, time: f64) {
Expand All @@ -74,6 +166,27 @@ pub fn progress(anom: &mut Anomaly, time: f64) {
}
});

let mut rng = rand::thread_rng();

for i in 0..anom.anomaly.len() {
for j in 0..anom.anomaly.len() {
let (e, f) = if i < j {
// `i` is in the left half
let (left, right) = anom.anomaly.split_at_mut(j);
(&mut left[i], &mut right[0])
} else if i == j {
// cannot obtain two mutable references to the
// same element
continue;
} else {
// `i` is in the right half
let (left, right) = anom.anomaly.split_at_mut(i);
(&mut right[0], &mut left[j])
};
anomaly_2_interact(e, f, &mut rng);
}
}

let steps = (time / TS_F64) as u64;
for _ in 0..steps {
thread::scope(|s| {
Expand Down Expand Up @@ -101,6 +214,14 @@ pub fn component_property(component: &mut Component, name: f64) -> f64 {
return prop[0].value;
}

pub fn set_component_property(n: f64, s: f64, component: &mut Component) {
for p in component.property.iter_mut() {
if n == p.name {
*p = Property { name: n, value: s };
}
}
}

pub fn component_progress(component: &mut Component, time: f64) {
for mut c in component.component.iter_mut() {
component_progress(&mut c, time);
Expand Down Expand Up @@ -195,6 +316,12 @@ pub fn particle(position: [f32; 3], properties: Vec<Property>) -> Anomaly {

// future ref example

pub fn set_inertia(in0: [f64; 3], c: &mut Component) {
set_component_property(IN0, in0[0], c);
set_component_property(IN1, in0[1], c);
set_component_property(IN2, in0[2], c);
}

static EC: f64 = 313.0;
static SP: f64 = 591.0;
static MS: f64 = 343.0;
Expand Down
4 changes: 2 additions & 2 deletions src/magma_ocean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ pub fn petrify(flow: Magma) -> Stone {
let mut rng = rand::thread_rng();
let points_diff = sbtr_f32_3(flow.positions[1].position, flow.positions[0].position);
let planes_normal: [f32; 3] = nrmlz_f32_3(points_diff);
let planes_number = rng.gen_range(4..32);
let max_points = rng.gen_range(4.0..32.0);
let planes_number = 24; // rng.gen_range(40..42);
let max_points = 24.0; // rng.gen_range(40.0..42.0);

let mut points_of_plane: u32 = 3;
let reference_orthogonal = gen_rthgnl_f32_3(planes_normal, &mut rng);
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
//#![allow(warnings)] // not today, erosion
// #![allow(warnings)] // not today, erosion

mod display_mods;
use display_mods::{oclock, record_nanos, Groupable};
Expand Down Expand Up @@ -120,7 +120,7 @@ fn main() {
force: vec![],
};

let k = 8;
let k = 20;

for _ in 0..k {
add_particle_by(
Expand Down Expand Up @@ -356,7 +356,7 @@ fn main() {
let query_pool = QueryPool::new(
device.clone(),
QueryPoolCreateInfo {
query_count: 3,
query_count: 60,
..QueryPoolCreateInfo::query_type(QueryType::Occlusion)
},
)
Expand Down

0 comments on commit e66ac90

Please sign in to comment.