Formatting
This commit is contained in:
parent
0dc2911a79
commit
5ff1afc26b
14
src/input.rs
14
src/input.rs
@ -40,12 +40,7 @@ fn read_stdin() -> InputData {
|
||||
let corner_count = numbers[0];
|
||||
polygons.push(Polygon::new(
|
||||
(0..corner_count)
|
||||
.map(|idx| {
|
||||
(
|
||||
numbers[idx * 2 + 1] as f32,
|
||||
numbers[idx * 2 + 2] as f32,
|
||||
)
|
||||
})
|
||||
.map(|idx| (numbers[idx * 2 + 1] as f32, numbers[idx * 2 + 2] as f32))
|
||||
.collect::<Vec<_>>()
|
||||
.into(),
|
||||
vec![],
|
||||
@ -71,7 +66,7 @@ fn read_svg(input: &str) -> Result<InputData, Box<Error>> {
|
||||
let svg = svg.svg_element().unwrap();
|
||||
let svg_height = match svg.attributes().get_value(AttributeId::Height).unwrap() {
|
||||
AttributeValue::Length(l) => l.num as f32,
|
||||
_ => -42.0
|
||||
_ => -42.0,
|
||||
};
|
||||
let mut house = None;
|
||||
let mut polys = Vec::new();
|
||||
@ -95,7 +90,10 @@ fn read_svg(input: &str) -> Result<InputData, Box<Error>> {
|
||||
points.push(Point::new(*x as f32, svg_height - *y as f32));
|
||||
}
|
||||
PathSegment::VerticalLineTo { y, .. } => {
|
||||
points.push(Point::new(points.last().unwrap().x(), svg_height-*y as f32));
|
||||
points.push(Point::new(
|
||||
points.last().unwrap().x(),
|
||||
svg_height - *y as f32,
|
||||
));
|
||||
}
|
||||
PathSegment::HorizontalLineTo { x, .. } => {
|
||||
points.push(Point::new(*x as f32, points.last().unwrap().y()));
|
||||
|
Loading…
Reference in New Issue
Block a user