added test, doc
authorRohit Girdhar <rohit@iiith>
Thu, 20 Feb 2014 12:21:48 +0000 (17:51 +0530)
committerRohit Girdhar <rohit@iiith>
Thu, 20 Feb 2014 12:21:48 +0000 (17:51 +0530)
modules/core/doc/basic_structures.rst
modules/core/src/matrix.cpp
modules/core/test/test_io.cpp

index 886a886..280c317 100644 (file)
@@ -316,6 +316,7 @@ RotatedRect
         RotatedRect();
         RotatedRect(const Point2f& center, const Size2f& size, float angle);
         RotatedRect(const CvBox2D& box);
+        RotatedRect(const Point2f& point1, const Point2f& point2, const Point2f& point3);
 
         //! returns 4 vertices of the rectangle
         void points(Point2f pts[]) const;
@@ -338,7 +339,11 @@ The class represents rotated (i.e. not up-right) rectangles on a plane. Each rec
         :param size: Width and height of the rectangle.
         :param angle: The rotation angle in a clockwise direction. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle.
         :param box: The rotated rectangle parameters as the obsolete CvBox2D structure.
+    .. ocv:function:: RotatedRect::RotatedRect(const Point2f& point1, const Point2f& point2, const Point2f& point3)
 
+        :param point1:
+        :param point2:
+        :param point3: Any 3 end points of the RotatedRect. They must be given in order (either clockwise or anticlockwise).
     .. ocv:function:: void RotatedRect::points( Point2f pts[] ) const
     .. ocv:function:: Rect RotatedRect::boundingRect() const
 
index 02ca1c9..7f1dfe6 100644 (file)
@@ -5216,7 +5216,7 @@ RotatedRect::RotatedRect(const Point2f& _point1, const Point2f& _point2, const P
     // wd_i stores which vector (0,1) or (1,2) will make the width
     // One of them will definitely have slope within -1 to 1
     int wd_i = 0;
-    if( vecs[1][0] != 0 && abs(vecs[1][1] / vecs[1][0]) <= 1.0f ) wd_i = 1;
+    if( abs(vecs[1][1]) < abs(vecs[1][0]) ) wd_i = 1;
     int ht_i = (wd_i + 1) % 2;
 
     float _angle = atan(vecs[wd_i][1] / vecs[wd_i][0]) * 180.0f / (float) CV_PI;
index 23c0aad..71c7391 100644 (file)
@@ -403,6 +403,7 @@ protected:
             Size s1(6, 7), os1;
             Complex<int> c1(9, 10), oc1;
             Rect r1(11, 12, 13, 14), or1;
+            RotatedRect rr1(Point2f(0,0), Point2f(100,100), Point2f(50, 150));
             Vec<int, 5> v1(15, 16, 17, 18, 19), ov1;
             Scalar sc1(20.0, 21.1, 22.2, 23.3), osc1;
             Range g1(7, 8), og1;