Skip to content

Commit

Permalink
Change init values for bbox
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoledoux committed Mar 5, 2024
1 parent 22b68d0 commit 9230e8c
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1701,21 +1701,28 @@ impl Triangulation {
let mut miny: f64 = std::f64::MAX;
let mut maxx: f64 = std::f64::MIN;
let mut maxy: f64 = std::f64::MIN;
for i in 1..self.stars.len() {
if self.is_vertex_removed(i).unwrap() {
continue;
}
if self.stars[i].pt[0] < minx {
minx = self.stars[i].pt[0];
}
if self.stars[i].pt[1] < miny {
miny = self.stars[i].pt[1];
}
if self.stars[i].pt[0] > maxx {
maxx = self.stars[i].pt[0];
}
if self.stars[i].pt[1] > maxy {
maxy = self.stars[i].pt[1];
if self.stars.len() == 1 {
minx = std::f64::NEG_INFINITY;
miny = std::f64::NEG_INFINITY;
maxx = std::f64::INFINITY;
maxy = std::f64::INFINITY;
} else {
for i in 1..self.stars.len() {
if self.is_vertex_removed(i).unwrap() {
continue;
}
if self.stars[i].pt[0] < minx {
minx = self.stars[i].pt[0];
}
if self.stars[i].pt[1] < miny {
miny = self.stars[i].pt[1];
}
if self.stars[i].pt[0] > maxx {
maxx = self.stars[i].pt[0];
}
if self.stars[i].pt[1] > maxy {
maxy = self.stars[i].pt[1];
}
}
}
vec![minx, miny, maxx, maxy]
Expand Down

0 comments on commit 9230e8c

Please sign in to comment.