| 61 | #[derive(Debug, Parser)] |
| 62 | #[clap(name = "grid", verbatim_doc_comment)] |
| 63 | struct CmdlineOptions { |
| 64 | /// The log level |
| 65 | #[clap(short, long, default_value_t = tracing::Level::INFO)] |
| 66 | log_level: tracing::Level, |
| 67 | |
| 68 | /// Output file to write result to. Defaults to stdout. |
| 69 | #[clap(short, long)] |
| 70 | output: Option<PathBuf>, |
| 71 | |
| 72 | /// Output geometry format. |
| 73 | #[clap(short = 'O', long, default_value_t = GridFormat::Points)] |
| 74 | output_format: GridFormat, |
| 75 | |
| 76 | /// The type of grid to generate |
| 77 | #[clap(short, long, default_value_t = GridType::Quad)] |
| 78 | grid_type: GridType, |
| 79 | |
| 80 | /// The number of cells along the x-axis, or angular division if using radial grids. |
| 81 | #[clap(short = 'W', long, default_value_t = 5)] |
| 82 | width: usize, |
| 83 | |
| 84 | /// The number of cells along the y-axis, or radius if using radial grids. |
| 85 | #[clap(short = 'H', long, default_value_t = 5)] |
| 86 | height: usize, |
| 87 | |
| 88 | /// The size of each grid cell. Use --size-x or --size-y to specify the size for the different axes |
| 89 | #[clap(short = 's', long)] |
| 90 | size: Option<f64>, |
| 91 | |
| 92 | /// The width of each grid cell. Ignored for radial grids. |
| 93 | #[clap(long)] |
| 94 | size_x: Option<f64>, |
| 95 | |
| 96 | /// The height of each grid cell. The radius for radial grids. Ignored for hex grids. |
| 97 | #[clap(long)] |
| 98 | size_y: Option<f64>, |
| 99 | |
| 100 | /// How many points to fill in on the rings in between radial spokes |
| 101 | /// |
| 102 | /// Only used for radial grids |
| 103 | #[clap(long, conflicts_with = "ring_fill_ratio")] |
| 104 | ring_fill_points: Option<usize>, |
| 105 | |
| 106 | /// Desired point spacing between points as a ratio of the radius (--size-y) |
| 107 | /// |
| 108 | /// A value of 0.5 will use 0.5 * --size-y as the point spacing when filling points in the |
| 109 | /// concentric rings. |
| 110 | /// |
| 111 | /// Only used for radial grids |
| 112 | #[clap(long, conflicts_with = "ring_fill_points")] |
| 113 | ring_fill_ratio: Option<f64>, |
| 114 | } |
| 115 | |
| 116 | #[derive(Debug, Clone, Copy, PartialEq)] |
| 117 | enum FillStrategy { |
nothing calls this directly
no outgoing calls
no test coverage detected