]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Add line heading getter
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 19 Jul 2021 11:55:17 +0000 (13:55 +0200)
committerJiri Vlasak <jiri.vlasak.2@cvut.cz>
Tue, 20 Jul 2021 14:49:17 +0000 (16:49 +0200)
incl/bcar.hh
src/bcar.cc

index 03609968aaecc6b80a9f417700a567476703af37..d62727d383825ca03070ad6962b75fffb9b6ab4a 100644 (file)
@@ -117,6 +117,8 @@ public:
 
        double len() const;
 
+       double h() const;
+
        friend std::ostream& operator<<(std::ostream& out, Line const& li);
 };
 
index 8825fb77c63c1e088dcb19c78447962c2e82c624..d0d40a146b5abba0184d26d0cd87fcf1482bf233 100644 (file)
@@ -222,6 +222,12 @@ Line::len() const
        return this->b_.edist(this->e_);
 }
 
+double
+Line::h() const
+{
+       return atan2(this->e_.y() - this->b_.y(), this->e_.x() - this->b_.x());
+}
+
 std::ostream&
 operator<<(std::ostream& out, Line const& li)
 {