Class: OpenCV::Cv::Vec2d

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

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



4824
4825
4826
4827
4828
4829
4830
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4824

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



4821
4822
4823
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4821

def __obj_ptr__
  @__obj_ptr__
end

Class Method Details

.all(alpha) ⇒ Object

wrapper for cv::Vec2d cv::Vec2d::all(double alpha)



4854
4855
4856
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4854

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



4816
4817
4818
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4816

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4747

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

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

    # wrapper for cv::Vec2d::Vec2d(double t1, double t2)
    @@cv_vec_2d_vec_2d3_defaults2 ||= [nil, nil]
    if(args.size >= 2 && args.size <= 2)
        args.size.upto(1) do |i|
            args[i] = @@cv_vec_2d_vec_2d3_defaults2[i]
        end
        begin
            return Rbind::cv_vec_2d_vec_2d3(*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.



4804
4805
4806
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4804

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



4795
4796
4797
4798
4799
4800
4801
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4795

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



4810
4811
4812
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4810

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

Instance Method Details

#!=(vec) ⇒ Object

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



4880
4881
4882
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4880

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

#*(val) ⇒ Object

wrapper for cv::Vec2d cv::Vec2d::operator*(double val)



4895
4896
4897
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4895

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

#+(vec) ⇒ Object

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



4885
4886
4887
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4885

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

#-(vec) ⇒ Object

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



4890
4891
4892
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4890

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

#/(val) ⇒ Object

wrapper for cv::Vec2d cv::Vec2d::operator/(double val)



4900
4901
4902
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4900

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

#==(vec) ⇒ Object

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



4875
4876
4877
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4875

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

#[](i) ⇒ Object



34
35
36
37
# File 'lib/ruby/ropencv/ropencv_ruby.rb', line 34

def [](i)
    raise "Out of bound #{i}" if i < 0 || i > 1 
    val.get_float64(i*8)
end

#[]=(i, val0) ⇒ Object



38
39
40
41
# File 'lib/ruby/ropencv/ropencv_ruby.rb', line 38

def []=(i,val0)
    raise "Out of bound #{i}" if i < 0 || i > 1 
    val.put_float64(i*8,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)


4835
4836
4837
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4835

def __owner__?
    @__obj_ptr__[:bowner]
end

#conjObject

wrapper for cv::Vec2d cv::Vec2d::conj()



4867
4868
4869
4870
4871
4872
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4867

def conj()
    result = Rbind::cv_vec_2d_conj( self)
    # 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

#mul(other) ⇒ Object

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



4859
4860
4861
4862
4863
4864
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4859

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

#valObject

methods wrapper for double *val



4849
4850
4851
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4849

def val()
    Rbind::cv_vec_2d_get_val( self)
end