Class: CVFFI::Point

Inherits:
Object
  • Object
show all
Includes:
CvPointCastMethods, CvPointMethods
Defined in:
lib/opencv-ffi-wrappers/core/point.rb

Direct Known Subclasses

Size

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CvPointMethods

#*, #+, #-, #/, #==, #===, #got_what_i_need, #l2_squared_distance, #l2distance, #neighbor?, #neighbor_rsquared?, #rotate, #to_Vector, #to_a

Methods included from CvPointCastMethods

#to_CvPoint, #to_CvPoint2D32f, #to_CvPoint2D64f, #to_Point, #to_a

Constructor Details

#initialize(*args) ⇒ Point

Returns a new instance of Point.



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/opencv-ffi-wrappers/core/point.rb', line 132

def initialize( *args )
  if args.length == 2 and args[1] != nil
    @x = args[0]
    @y = args[1]
  else
    args = args.shift

    case args
    when Hash
      @y = args[:y]
      @x = args[:x]
    when Array
      @x = args[0]
      @y = args[1]
  else
    @x = args.x
    @y = args.y
  end
  end

  @x = @x.to_f
  @y = @y.to_f
  @w = 1
end

Instance Attribute Details

#wObject

Returns the value of attribute w.



130
131
132
# File 'lib/opencv-ffi-wrappers/core/point.rb', line 130

def w
  @w
end

#xObject

Returns the value of attribute x.



130
131
132
# File 'lib/opencv-ffi-wrappers/core/point.rb', line 130

def x
  @x
end

#yObject

Returns the value of attribute y.



130
131
132
# File 'lib/opencv-ffi-wrappers/core/point.rb', line 130

def y
  @y
end

Instance Method Details

#areaObject



157
158
159
# File 'lib/opencv-ffi-wrappers/core/point.rb', line 157

def area
  @y*@x
end