Skip to content

Commit

Permalink
"Auto commit number 29"
Browse files Browse the repository at this point in the history
  • Loading branch information
lat-murmeldjur committed Mar 24, 2024
1 parent fc8ef0f commit fab287a
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 68 deletions.
2 changes: 1 addition & 1 deletion chronicl.dt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
28
29
2 changes: 1 addition & 1 deletion featuring.dt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
28
29
1 change: 1 addition & 0 deletions ohio.note
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ Year::2024::|::Month::03::|::Day::19::|::Hour::19::|::Minute::40::|::Second::53:
Year::2024::|::Month::03::|::Day::20::|::Hour::17::|::Minute::16::|::Second::54::
Year::2024::|::Month::03::|::Day::21::|::Hour::14::|::Minute::51::|::Second::35::
Year::2024::|::Month::03::|::Day::22::|::Hour::16::|::Minute::32::|::Second::41::
Year::2024::|::Month::03::|::Day::24::|::Hour::19::|::Minute::16::|::Second::53::
12 changes: 11 additions & 1 deletion src/f32_3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ pub fn dot_product(a: [f32; 3], b: [f32; 3]) -> f32 {
pub fn angle_of(c: [f32; 3], x: [f32; 3], r: [f32; 3]) -> f32 {
// angle of point x compared to center and common random comparison vector
let vector = find_points_normal(x, c);
let mut angle_of = (dot_product(vector, r) / (vector_length(vector) * vector_length(r)));
let vl = vector_length(vector);

if vl == 0.0 {
return 0.0;
}

let mut angle_of = (dot_product(vector, r) / (vl * vector_length(r)));

if angle_of > 1.0 {
angle_of = 1.0;
Expand All @@ -114,6 +120,10 @@ pub fn angle_of(c: [f32; 3], x: [f32; 3], r: [f32; 3]) -> f32 {

pub fn angle_360_of(c: [f32; 3], x: [f32; 3], r: [f32; 3], norm: [f32; 3]) -> f32 {
let diff = sbtr_f32_3(c, x);
if vector_length(diff) == 0.0 {
return 0.0;
}

let vector = nrmlz_f32_3(diff);
let mut angle_of = (dot_product(vector, r) / (vector_length(vector) * vector_length(r)));

Expand Down
79 changes: 41 additions & 38 deletions src/magma_ocean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::f32_3::{
mltply_f32_3, nrmlz_f32_3, sbtr_f32_3, vector_length,
};

use crate::shapes::{f32_3_dots_collinear, rotational_distance_function_sine};
use crate::shapes::{f32_3_dots_collinear, rotational_distance_function_sine, spherical_progress};

use crate::u_modular::{
modular_difference, modular_difference_in_range, modular_offset, modular_offset_in_range,
Expand Down Expand Up @@ -102,11 +102,12 @@ pub fn petrify(flow: Magma) -> Stone {
// println!("plane: {:#?}", plane_point);
// vector_length(points_diff) / 2.0 * (PI * pln as f32 / planes_points.len() as f32).sin()

let d = (vector_length(points_diff) / 2.0)
* (pln as f32 - planes_points.len() as f32 / 2.0).abs()
/ (planes_points.len() as f32 / 2.0);
let rotational_arguments_vector = vec![
((vector_length(points_diff) / 2.0).powi(2) - d.powi(2)).sqrt(),
spherical_progress(
vector_length(points_diff),
pln as f32,
planes_number as f32 - 1.0,
),
0.0,
0.0,
0.0,
Expand All @@ -131,6 +132,8 @@ pub fn petrify(flow: Magma) -> Stone {
&mut rng,
);

points_of_plane = plane.positions.len() as u32;

sort_positions_by_angle(
*plane_point,
reference_orthogonal,
Expand Down Expand Up @@ -261,6 +264,7 @@ pub fn find_indices_double_circle(
let mut a_min = f32::MAX;
let mut a_min_dex = 0;
let mut k = 0;
let mut pointlike = false;

for i in double_vertex_plane[0]..=double_vertex_plane[1] + 1 {
a_min = f32::MAX;
Expand All @@ -270,7 +274,6 @@ pub fn find_indices_double_circle(
if k > double_vertex_plane[1] {
k = double_vertex_plane[0];
}

// take the points,
// get their vector from the circle's average point
// translate this distance to the plane point on the interplane-axis ("normal" points)
Expand Down Expand Up @@ -321,6 +324,7 @@ pub fn find_indices_double_circle(
planes_normal,
),
);

if dist < a_min {
a_min = dist;
a_min_dex = j;
Expand All @@ -332,36 +336,43 @@ pub fn find_indices_double_circle(
triangle_counter = triangle_counter + 1;
} else {
a_min_dex = first_single_index;
if a_min_dex == index_single_saved && triangle_counter == points_of_double_plane {
pointlike = true;
}
}

if index_set {
let mut running_index = index_single_saved;

if index_single_saved != a_min_dex {
for l in 1..=modular_difference_in_range(
index_single_saved,
a_min_dex,
let mut loop_for = modular_difference_in_range(
index_single_saved,
a_min_dex,
single_vertex_plane[0],
single_vertex_plane[1],
);

if pointlike {
loop_for = single_vertex_plane[1] - single_vertex_plane[0] + 1;
}

for l in 1..=loop_for {
stone.indices.push(index_double_saved);
stone.indices.push(running_index);
stone.indices.push(modular_offset_in_range(
running_index,
1,
single_vertex_plane[0],
single_vertex_plane[1],
) {
stone.indices.push(index_double_saved);
stone.indices.push(running_index);
stone.indices.push(modular_offset_in_range(
running_index,
1,
single_vertex_plane[0],
single_vertex_plane[1],
));

triangle_counter = triangle_counter + 1;

running_index = modular_offset_in_range(
running_index,
1,
single_vertex_plane[0],
single_vertex_plane[1],
);
}
));

triangle_counter = triangle_counter + 1;

running_index = modular_offset_in_range(
running_index,
1,
single_vertex_plane[0],
single_vertex_plane[1],
);
}
} else {
first_single_index = a_min_dex;
Expand Down Expand Up @@ -397,14 +408,6 @@ pub fn find_indices_double_circle(
if debug {
println!("Further Info 1{:#?}", single_vertex_plane,);

println!("Further Info 2{:#?}", single_plane_point,);

println!("Further Info 3{:#?}", double_vertex_plane,);

println!("Further Info 4{:#?}", double_plane_point,);

println!("Further Info 5{:#?}", reference_orthogonal,);

println!("Further Info 6{:#?}", planes_normal,);
println!("Further Info 2{:#?}", double_vertex_plane,);
}
}
31 changes: 4 additions & 27 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ fn main() {
//\\\|||///
//\\\|||///\\\|||///\\\|||///\\\|||///\\\|||///[ the end of setup ]\\\|||///\\\|||///\\\|||///\\\|||///\\\|||///\\\|||///

let mut rot_static = false;
let mut rot_static = true;

let mut view_point = Position {
position: [0.0, -1.0, 1.0],
Expand Down Expand Up @@ -513,23 +513,9 @@ fn main() {

// simulation

move_positions(
&mut pebble.positions,
[
rng.gen_range(-100.6..100.6),
rng.gen_range(-100.6..100.6),
rng.gen_range(-100.6..100.6),
],
);

move_positions(
&mut stone.positions,
[
rng.gen_range(-1.6..1.6),
rng.gen_range(-1.6..1.6),
rng.gen_range(-1.6..1.6),
],
);
move_positions(&mut pebble.positions, [0.0, 0.0, 0.0]);

move_positions(&mut stone.positions, [0.0, 0.0, 0.0]);

let (vertex_buffer, normals_buffer, index_buffer) =
load_buffers_short(&mut stone, memory_allocator.clone());
Expand Down Expand Up @@ -608,15 +594,6 @@ fn main() {
proj: proj.into(),
};

let rec = record_nanos();

if (rec > duration_since_epoch_nanos + 1000000000) {
println!("uniform 0 : {:#?}", uniform_data.world);
println!("uniform 1 : {:#?}", uniform_data.view);
println!("uniform 2 : {:#?}", uniform_data.proj);
duration_since_epoch_nanos = rec;
}

let subbuffer = uniform_buffer.allocate_sized().unwrap();
*subbuffer.write().unwrap() = uniform_data;

Expand Down
6 changes: 6 additions & 0 deletions src/shapes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ pub fn rotational_distance_function_sine(
) -> f32 {
return c_arg[0] + c_arg[1] * (c_arg[2] + x * c_arg[3]).sin();
}

pub fn spherical_progress(points_diff: f32, pln: f32, planes_points: f32) -> f32 {
let d = (points_diff / 2.0) * (pln - planes_points / 2.0).abs() / (planes_points / 2.0);
let f = ((points_diff / 2.0).powi(2) - d.powi(2)).sqrt();
return f;
}

0 comments on commit fab287a

Please sign in to comment.