Class: OpenCV::Cv::Vec6f

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) ⇒ Vec6f

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 Vec6f.



5535
5536
5537
5538
5539
5540
5541
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5535

def initialize(ptr)
    @__obj_ptr__ = if ptr.is_a? Vec6fStruct
                       ptr
                   else
                       Vec6fStruct.new(FFI::AutoPointer.new(ptr,Vec6fStruct.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.



5532
5533
5534
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5532

def __obj_ptr__
  @__obj_ptr__
end

Class Method Details

.all(alpha) ⇒ Object

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



5560
5561
5562
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5560

def self.all(alpha)
    Rbind::cv_vec_6f_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



5527
5528
5529
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5527

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5458

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

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

    # wrapper for cv::Vec6f::Vec6f(float t1, float t2, float t3, float t4, float t5, float t6)
    @@cv_vec_6f_vec_6f3_defaults2 ||= [nil, nil, nil, nil, nil, nil]
    if(args.size >= 6 && args.size <= 6)
        args.size.upto(5) do |i|
            args[i] = @@cv_vec_6f_vec_6f3_defaults2[i]
        end
        begin
            return Rbind::cv_vec_6f_vec_6f3(*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.



5515
5516
5517
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5515

def self.rbind_from_native(ptr,context)
    Vec6f.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.



5506
5507
5508
5509
5510
5511
5512
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5506

def self.rbind_to_native(obj,context)
    if obj.is_a? Vec6f
        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



5521
5522
5523
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5521

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

Instance Method Details

#!=(vec) ⇒ Object

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



5578
5579
5580
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5578

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

#*(val) ⇒ Object

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



5593
5594
5595
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5593

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

#+(vec) ⇒ Object

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



5583
5584
5585
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5583

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

#-(vec) ⇒ Object

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



5588
5589
5590
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5588

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

#/(val) ⇒ Object

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



5598
5599
5600
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5598

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

#==(vec) ⇒ Object

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



5573
5574
5575
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5573

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

#[](i) ⇒ Object



78
79
80
81
# File 'lib/ruby/ropencv/ropencv_ruby.rb', line 78

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

#[]=(i, val0) ⇒ Object



82
83
84
85
# File 'lib/ruby/ropencv/ropencv_ruby.rb', line 82

def []=(i,val0)
    raise "Out of bound #{i}" if i < 0 || i > 5
    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)


5546
5547
5548
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5546

def __owner__?
    @__obj_ptr__[:bowner]
end

#mul(other) ⇒ Object

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



5565
5566
5567
5568
5569
5570
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5565

def mul(other)
    result = Rbind::cv_vec_6f_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