Class: OpenCV::CvTwoPoints
- Inherits:
-
Object
- Object
- OpenCV::CvTwoPoints
- Defined in:
- ext/opencv/cvtwopoints.cpp,
ext/opencv/cvtwopoints.cpp
Overview
This class means one twopoints on X axis Y axis. X and Y takes the value of the Integer. see also CvTwopoints2D32F
C structure is here, very simple.
typdef struct CvTwopoints {
int x;
int y;
}
Instance Method Summary collapse
-
#[](index) ⇒ Object
Return value of index dimension.
-
#point1 ⇒ Object
Return point 1.
-
#point2 ⇒ Object
Return point2.
-
#to_ary ⇒ Array
(also: #to_a)
Return 2 point by Array.
Instance Method Details
#[](index) ⇒ Object
Return value of index dimension.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'ext/opencv/cvtwopoints.cpp', line 65
VALUE
rb_aref(VALUE self, VALUE index)
{
switch (NUM2INT(index)) {
case 0:
return cCvPoint::new_object(CVTWOPOINTS(self)->p1);
break;
case 1:
return cCvPoint::new_object(CVTWOPOINTS(self)->p2);
break;
default:
rb_raise(rb_eIndexError, "index should be 0...2");
break;
}
return Qnil;
}
|
#point1 ⇒ Object
Return point 1.
44 45 46 47 48 |
# File 'ext/opencv/cvtwopoints.cpp', line 44
VALUE
rb_point1(VALUE self)
{
return cCvPoint::new_object(CVTWOPOINTS(self)->p1);
}
|
#point2 ⇒ Object
Return point2.
53 54 55 56 57 |
# File 'ext/opencv/cvtwopoints.cpp', line 53
VALUE
rb_point2(VALUE self)
{
return cCvPoint::new_object(CVTWOPOINTS(self)->p2);
}
|
#to_ary ⇒ Array Also known as: to_a
Return 2 point by Array.
88 89 90 91 92 |
# File 'ext/opencv/cvtwopoints.cpp', line 88
VALUE
rb_to_ary(VALUE self)
{
return rb_ary_new3(2, rb_point1(self), rb_point2(self));
}
|