Skip to content

Commit

Permalink
contoninue work
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirabellensaft committed Dec 29, 2023
1 parent 4f89edb commit 948a6a2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 39 deletions.
50 changes: 25 additions & 25 deletions output/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@ fn main() {

// voronoi::form_group();

if let Some(exclusion) = exclusion::Exclusion::make_exclusion(path, &mut content) {
for i in 0..10 {
// let parameters = Parameters{ height: 1200, width: 600, margin: 2, rows: 0, columns: 0, layout_type: LayoutType::VoronoiBased(VoronoiType::Uniform(50)) };
let parameters = Parameters {
height: 2400,
width: 1200,
margin: 2,
rows: 20,
columns: 10,
layout_type: LayoutType::VoronoiBased(VoronoiType::Uniform(200)),
};

match layout::voronoi::VoronoiDiagram::new(parameters) {
Ok(mut work) => {
let document = Document::new()
.set("viewBox", (0, 0, work.get_width(), work.get_height()))
.add(work.background())
.add(voronated_star_burst::form_group(&mut work));

let local_time = Local::now();
let path = format!("nr_{:03}_{}.svg", i, local_time.format("%Y%m%d_%H%M%S"));
svg::save(path, &document).unwrap();
}
Err(err) => panic!("{:?}", err),
// if let Some(exclusion) = exclusion::Exclusion::make_exclusion(path, &mut content) {
for i in 0..1 {
// let parameters = Parameters{ height: 1200, width: 600, margin: 2, rows: 0, columns: 0, layout_type: LayoutType::VoronoiBased(VoronoiType::Uniform(50)) };
let parameters = Parameters {
height: 2400,
width: 1200,
margin: 2,
rows: 20,
columns: 10,
layout_type: LayoutType::VoronoiBased(VoronoiType::Uniform(200)),
};

match layout::voronoi::VoronoiDiagram::new(parameters) {
Ok(mut work) => {
let document = Document::new()
.set("viewBox", (0, 0, work.get_width(), work.get_height()))
.add(work.background())
.add(voronated_star_burst::form_group(work));

let local_time = Local::now();
let path = format!("nr_{:03}_{}.svg", i, local_time.format("%Y%m%d_%H%M%S"));
svg::save(path, &document).unwrap();
}
Err(err) => panic!("{:?}", err),
}
};
}
// };
println!("None!");
}
2 changes: 1 addition & 1 deletion output/src/work/star_burst_lib/grid_comp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl Composition for MyGrid {
fn add_center(&mut self, center: CompositionCenter) {
let multiplicator_rows = self.0.rows / 3;
let multiplicator_columns = self.0.columns / 3;
println!("{}, {}", multiplicator_columns, multiplicator_rows);
// println!("{}, {}", multiplicator_columns, multiplicator_rows);

// let _center_row = format.rows / 2;
// let _center_col = format.columns / 2;
Expand Down
6 changes: 3 additions & 3 deletions output/src/work/star_burst_lib/voronoi_comp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ impl Composition for MyVoronoiDiagram {
}

fn retro_composition(&mut self) {
println!("retro");
// println!("retro");
let clone_d = self.0.clone();
for cell in &mut self.0.cells {
match cell.density {
Density::Empty => {
let neighbors = cell.find_neighbors(&clone_d);
let number = neighbors.len();
let filled_neighbors = direction_of_contact(cell, neighbors);
println!("number {}, empty: {:?}", number, filled_neighbors.len());
// println!("number {}, empty: {:?}", number, filled_neighbors.len());
// missing case: both are the same
match (number, filled_neighbors.len()) {
(_, 0) => cell.set_density(Density::Empty),
(_, 1) => cell.set_density(Density::Edge(Lines(filled_neighbors))),
(_, 2) => {
cell.set_density(Density::Transition(Lines(filled_neighbors)));
println!("transition")
// println!("transition")
}

(_, 3) => cell.set_density(Density::ThreeWay(Lines(filled_neighbors))),
Expand Down
3 changes: 0 additions & 3 deletions sanguine_lib/src/resources/border_coordinates/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ impl AllBorderCoordinates {
cell_v.0.clear();
for line in &cell.border_lines {
let mut side = OneSide::new_random(*line, amount);
println!("sort");
side.sort_points_on_line();
cell_v.0.push(side);
}
Expand Down Expand Up @@ -104,5 +103,3 @@ impl AllBorderCoordinates {
}
}
}


14 changes: 7 additions & 7 deletions sanguine_lib/src/resources/layout/voronoi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,17 @@ impl Layout for VoronoiDiagram {
impl Cell {
pub fn find_neighbors(&self, diagram: &VoronoiDiagram) -> Vec<(Point, Density, Line)> {
let mut neighbors_centers = Vec::new();
println!("self center: {:?}", self.center);
// println!("self center: {:?}", self.center);
for side in &self.border_lines {
for cell in &diagram.get_points() {
for other_side in &cell.border_lines {
if side.equal(*other_side) && cell.center != self.center {
println!(
"center: {:?}, density: {:?}, side: {:?}",
cell.center,
cell.get_density(),
*side,
);
// println!(
// "center: {:?}, density: {:?}, side: {:?}",
// cell.center,
// cell.get_density(),
// *side,
// );
neighbors_centers.push((cell.center, cell.get_density(), *side));
}
}
Expand Down

0 comments on commit 948a6a2

Please sign in to comment.