Class: OpenCV::Cv::Vec4d

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

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



5182
5183
5184
5185
5186
5187
5188
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5182

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



5179
5180
5181
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5179

def __obj_ptr__
  @__obj_ptr__
end

Class Method Details

.all(alpha) ⇒ Object

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



5212
5213
5214
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5212

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



5174
5175
5176
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5174

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5105

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

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

    # wrapper for cv::Vec4d::Vec4d(double t1, double t2, double t3, double t4)
    @@cv_vec_4d_vec_4d3_defaults2 ||= [nil, nil, nil, nil]
    if(args.size >= 4 && args.size <= 4)
        args.size.upto(3) do |i|
            args[i] = @@cv_vec_4d_vec_4d3_defaults2[i]
        end
        begin
            return Rbind::cv_vec_4d_vec_4d3(*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.



5162
5163
5164
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5162

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



5153
5154
5155
5156
5157
5158
5159
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5153

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



5168
5169
5170
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5168

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

Instance Method Details

#!=(vec) ⇒ Object

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



5238
5239
5240
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5238

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

#*(val) ⇒ Object

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



5253
5254
5255
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5253

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

#+(vec) ⇒ Object

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



5243
5244
5245
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5243

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

#-(vec) ⇒ Object

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



5248
5249
5250
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5248

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

#/(val) ⇒ Object

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



5258
5259
5260
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5258

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

#==(vec) ⇒ Object

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



5233
5234
5235
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5233

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

#[](i) ⇒ Object



56
57
58
59
# File 'lib/ruby/ropencv/ropencv_ruby.rb', line 56

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

#[]=(i, val0) ⇒ Object



60
61
62
63
# File 'lib/ruby/ropencv/ropencv_ruby.rb', line 60

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


5193
5194
5195
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5193

def __owner__?
    @__obj_ptr__[:bowner]
end

#conjObject

wrapper for cv::Vec4d cv::Vec4d::conj()



5225
5226
5227
5228
5229
5230
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5225

def conj()
    result = Rbind::cv_vec_4d_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::Vec4d cv::Vec4d::mul(const cv::Vec4d other)



5217
5218
5219
5220
5221
5222
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5217

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



5207
5208
5209
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5207

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