Skip to content

Commit

Permalink
Version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
hmeyer committed Dec 4, 2022
1 parent 80cce53 commit d45e12b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stl_io"
version = "0.6.0"
version = "0.7.0"
authors = ["Henning Meyer <[email protected]>"]
edition = "2018"

Expand All @@ -16,7 +16,7 @@ path = "src/lib.rs"

[dependencies]
byteorder = "1"
float-cmp = "0.8"
float-cmp = "0.9"

[badges]
travis-ci = { repository = "hmeyer/stl_io", branch = "master" }
Expand Down
2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
format_strings = false
#format_strings = false
reorder_imports = true
23 changes: 10 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
//extern crate byteorder;

use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use float_cmp::{ApproxEq, F32Margin};
use float_cmp::ApproxEq;
use std::collections::HashMap;
use std::io::{BufRead, BufReader, BufWriter};
use std::io::{Read, Result, Write};
use std::iter::Iterator;
use std::collections::HashMap;

/// Float Vector with approx_eq.
#[derive(Default, Clone, Copy, Debug, PartialEq, PartialOrd)]
Expand Down Expand Up @@ -134,10 +134,7 @@ impl IndexedMesh {
if area < f32::EPSILON {
return Err(::std::io::Error::new(
::std::io::ErrorKind::InvalidData,
format!(
"face #{} has a zero-area face",
fi
),
format!("face #{} has a zero-area face", fi),
));
}
}
Expand All @@ -159,9 +156,7 @@ impl IndexedMesh {
::std::io::ErrorKind::InvalidData,
format!(
"did not find facing edge for face #{}, edge #v{} -> #v{}",
fi,
i1,
i2
fi, i1, i2
),
))
} else {
Expand Down Expand Up @@ -260,7 +255,7 @@ where

/// Struct for binary STL reader.
pub struct BinaryStlReader<'a> {
reader: Box<dyn::std::io::Read + 'a>,
reader: Box<dyn ::std::io::Read + 'a>,
index: usize,
size: usize,
}
Expand Down Expand Up @@ -367,7 +362,7 @@ pub trait TriangleIterator: ::std::iter::Iterator<Item = Result<Triangle>> {

/// Struct for ascii STL reader.
pub struct AsciiStlReader<'a> {
lines: Box<dyn::std::iter::Iterator<Item = Result<Vec<String>>> + 'a>,
lines: Box<dyn ::std::iter::Iterator<Item = Result<Vec<String>>> + 'a>,
}

impl<'a> TriangleIterator for BinaryStlReader<'a> {}
Expand Down Expand Up @@ -543,6 +538,8 @@ fn tri_area(a: Vertex, b: Vertex, c: Vertex) -> f32 {
#[cfg(test)]
mod test {
use super::*;
use float_cmp::F32Margin;

const BUNNY_99: &[u8] = include_bytes!("testdata/bunny_99.stl");
const BUNNY_99_ASCII: &[u8] = include_bytes!("testdata/bunny_99_ascii.stl");

Expand Down Expand Up @@ -813,8 +810,8 @@ mod test {

#[test]
fn simple_tri_area() {
let a = Vector::new([-1.0, 1.0, 0.0]);
let b = Vector::new([ 1.0, -1.0, 0.0]);
let a = Vector::new([-1.0, 1.0, 0.0]);
let b = Vector::new([1.0, -1.0, 0.0]);
let c = Vector::new([-1.0, -1.0, 0.0]);
let area = tri_area(a, b, c);
assert_eq!(area, 2.0);
Expand Down

0 comments on commit d45e12b

Please sign in to comment.