Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional z-scale argument, default to unscaled #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions holocli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ pub struct Args {
/// The density of lines etched per mm. Defaults to 1.
#[arg(long, default_value_t = 1)]
pub stroke_density: usize,

/// The scaling factor for translating z coordinates to circle radius
#[arg(long, default_value_t = 1.0)]
pub z_scale: f32,
}

/// Represents a size in millimeters
Expand Down
2 changes: 1 addition & 1 deletion holocli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let user_defined_model = ObjInterpolator::from_file(args.input).unwrap();
let interpolated_points = user_defined_model.interpolate_edges(args.stroke_density);

let circle_strat = scriber::CircleScriber::new();
let circle_strat = scriber::CircleScriber::new(args.z_scale);
let scriber = scriber::Scriber::new(
circle_strat,
(args.canvas_size.width, args.canvas_size.height),
Expand Down
2 changes: 1 addition & 1 deletion holoscribe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod tests {
let model =
ObjInterpolator::from_file("tests/icosahedron.obj".to_string()).expect("invalid model");
let interpolated_points = model.interpolate_edges(100);
let circle_strat = scriber::CircleScriber::new();
let circle_strat = scriber::CircleScriber::new(1.0);
let scriber = scriber::Scriber::new(circle_strat, (100, 100));
b.iter(|| scriber.scribe(&interpolated_points));
}
Expand Down
4 changes: 2 additions & 2 deletions holoscribe/src/scriber/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ pub struct CircleScriber {
}

impl CircleScriber {
pub fn new() -> Self {
CircleScriber { z_scale_factor: 0.25 }
pub fn new(z_scale_factor: f32) -> Self {
CircleScriber { z_scale_factor }
}
}

Expand Down