Class: OpenCV::CvTwoPoints

Inherits:
Object
  • Object
show all
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

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;
}

#point1Object

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);
}

#point2Object

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_aryArray Also known as: to_a

Return 2 point by Array.

Returns:

  • (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));
}