Class: OpenCV::Cv::Vec4f

Inherits:
Object
  • Object
show all
Extended by:
FFI::DataConverter
Defined in:
lib/ruby/ropencv/ropencv_ruby.rb,
lib/ruby/ropencv/ropencv_types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ Vec4f

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Vec4f.



5365
5366
5367
5368
5369
5370
5371
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5365

def initialize(ptr)
    @__obj_ptr__ = if ptr.is_a? Vec4fStruct
                       ptr
                   else
                       Vec4fStruct.new(FFI::AutoPointer.new(ptr,Vec4fStruct.method(:release)))
                   end
end

Instance Attribute Details

#__obj_ptr__Object (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5362
5363
5364
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5362

def __obj_ptr__
  @__obj_ptr__
end

Class Method Details

.all(alpha) ⇒ Object

methods wrapper for cv::Vec4f cv::Vec4f::all(float alpha)



5390
5391
5392
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5390

def self.all(alpha)
    Rbind::cv_vec_4f_all(alpha)
end

.from_native(ptr, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

can be overwritten by the user



5357
5358
5359
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5357

def self.from_native(ptr,context)
    rbind_from_native(ptr,context)
end

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5288

def self.new(*args)
    if args.first.is_a?(FFI::Pointer) || args.first.is_a?(Vec4fStruct)
        raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1
        return super(args.first)
    end
    # wrapper for cv::Vec4f::Vec4f(float *val)
    @@cv_vec_4f_vec_4f_defaults0 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_vec_4f_vec_4f_defaults0[i]
        end
        begin
            return Rbind::cv_vec_4f_vec_4f(*args)
        rescue TypeError => e
            @error = e
        end
    end

    # wrapper for cv::Vec4f::Vec4f(const cv::Vec4f vec)
    @@cv_vec_4f_vec_4f2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_vec_4f_vec_4f2_defaults1[i]
        end
        begin
            return Rbind::cv_vec_4f_vec_4f2(*args)
        rescue TypeError => e
            @error = e
        end
    end

    # wrapper for cv::Vec4f::Vec4f(float t1, float t2, float t3, float t4)
    @@cv_vec_4f_vec_4f3_defaults2 ||= [nil, nil, nil, nil]
    if(args.size >= 4 && args.size <= 4)
        args.size.upto(3) do |i|
            args[i] = @@cv_vec_4f_vec_4f3_defaults2[i]
        end
        begin
            return Rbind::cv_vec_4f_vec_4f3(*args)
        rescue TypeError => e
            @error = e
        end
    end

    raise ArgumentError, "no constructor for #{self}(#{args.inspect})"
end

.rbind_from_native(ptr, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5345
5346
5347
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5345

def self.rbind_from_native(ptr,context)
    Vec4f.new(ptr)
end

.rbind_to_native(obj, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5336
5337
5338
5339
5340
5341
5342
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5336

def self.rbind_to_native(obj,context)
    if obj.is_a? Vec4f
        obj.__obj_ptr__
    else
        raise TypeError, "expected kind of #{name}, was #{obj.class}"
    end
end

.to_native(obj, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

can be overwritten by the user



5351
5352
5353
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5351

def self.to_native(obj,context)
    rbind_to_native(obj,context)
end

Instance Method Details

#!=(vec) ⇒ Object

wrapper for bool cv::Vec4f::operator!=(const cv::Vec4f vec)



5408
5409
5410
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5408

def !=(vec)
    Rbind::cv_vec_4f_operator_unequal( self, vec)
end

#*(val) ⇒ Object

wrapper for cv::Vec4f cv::Vec4f::operator*(float val)



5423
5424
5425
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5423

def *(val)
    Rbind::cv_vec_4f_operator_mult( self, val)
end

#+(vec) ⇒ Object

wrapper for cv::Vec4f cv::Vec4f::operator+(const cv::Vec4f vec)



5413
5414
5415
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5413

def +(vec)
    Rbind::cv_vec_4f_operator_plus( self, vec)
end

#-(vec) ⇒ Object

wrapper for cv::Vec4f cv::Vec4f::operator-(const cv::Vec4f vec)



5418
5419
5420
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5418

def -(vec)
    Rbind::cv_vec_4f_operator_minus( self, vec)
end

#/(val) ⇒ Object

wrapper for cv::Vec4f cv::Vec4f::operator/(float val)



5428
5429
5430
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5428

def /(val)
    Rbind::cv_vec_4f_operator_div( self, val)
end

#==(vec) ⇒ Object

wrapper for bool cv::Vec4f::operator==(const cv::Vec4f vec)



5403
5404
5405
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5403

def ==(vec)
    Rbind::cv_vec_4f_operator_equal( self, vec)
end

#[](i) ⇒ Object



67
68
69
70
# File 'lib/ruby/ropencv/ropencv_ruby.rb', line 67

def [](i)
    raise "Out of bound #{i}" if i < 0 || i > 3
    val.get_float32(i*4)
end

#[]=(i, val0) ⇒ Object



71
72
73
74
# File 'lib/ruby/ropencv/ropencv_ruby.rb', line 71

def []=(i,val0)
    raise "Out of bound #{i}" if i < 0 || i > 3
    val.put_float32(i*4,val0)
end

#__owner__?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

returns true if the underlying pointer is owner of the real object

Returns:

  • (Boolean)


5376
5377
5378
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5376

def __owner__?
    @__obj_ptr__[:bowner]
end

#mul(other) ⇒ Object

wrapper for cv::Vec4f cv::Vec4f::mul(const cv::Vec4f other)



5395
5396
5397
5398
5399
5400
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5395

def mul(other)
    result = Rbind::cv_vec_4f_mul( self, other)
    # store owner insight the pointer to not get garbage collected
    result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__?
    result
end