Skip to content

Commit

Permalink
(fix): #2 #3 bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
VisualGMQ committed May 18, 2023
1 parent 79eaafa commit 0dcf50d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ impl Quaternion {
}

pub fn inverse(&self) -> Quaternion {
self.conjugate() / self.length()
self.conjugate() / self.length_square()
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ mod cohen_sutherland {
};

if outcode & TOP != 0 {
p.x = p1.x + (pt2.x - pt1.x) * (rect_max.y - pt1.y) / (pt2.y - pt1.y);
p.x = pt1.x + (pt2.x - pt1.x) * (rect_max.y - pt1.y) / (pt2.y - pt1.y);
p.y = rect_max.y;
} else if outcode & BOTTOM != 0 {
p.x = p1.x + (pt2.x - pt1.x) * (rect_min.y - pt1.y) / (pt2.y - pt1.y);
p.x = pt1.x + (pt2.x - pt1.x) * (rect_min.y - pt1.y) / (pt2.y - pt1.y);
p.y = rect_min.y;
} else if outcode & RIGHT != 0 {
p.y = pt1.y + (pt2.y - pt1.y) * (rect_max.x - pt1.x) / (pt2.x - pt1.x);
Expand Down

0 comments on commit 0dcf50d

Please sign in to comment.