Browse Source

Add better star factor

main
raffitz 2 years ago
parent
commit
b2ccb7bc67
Signed by: raffitz
GPG Key ID: BB3596BD0A31252D
  1. 2
      Cargo.lock
  2. 2
      Cargo.toml
  3. 8
      src/star.rs

2
Cargo.lock generated

@ -311,7 +311,7 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" @@ -311,7 +311,7 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "voxelmap"
version = "0.6.0"
version = "0.6.1"
dependencies = [
"clap",
"lodepng",

2
Cargo.toml

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
[package]
name = "voxelmap"
version = "0.6.0"
version = "0.6.1"
authors = ["raffitz <raf.a.m.c.gon@gmail.com>"]
edition = "2018"
description = "Creates voxel maps to build voxelised objects"

8
src/star.rs

@ -58,7 +58,13 @@ pub fn generate<T: Into<String> + Clone, S: Into<f64> + Copy>( @@ -58,7 +58,13 @@ pub fn generate<T: Into<String> + Clone, S: Into<f64> + Copy>(
let angle_offset_label = format!("@{}innernangle0", prefix);
let outer_prefix = format!("{}outer", prefix);
let outer_scale = star_scale.map(|s| s.into()).unwrap_or(2_f64) * new_scale.unwrap_or(1_f64);
let recip_n: f64 = (n as f64).recip();
let scale_angle = recip_n * std::f64::consts::PI;
let double_scale_angle = scale_angle + scale_angle;
let default_scale = scale_angle.sin() * double_scale_angle.tan() + scale_angle.cos();
let outer_scale =
star_scale.map(|s| s.into()).unwrap_or(default_scale) * new_scale.unwrap_or(1_f64);
let (definitive_labels, boundaries, _) = ngon::generate(
n,

Loading…
Cancel
Save