Class: OpenCV::Cv::Vec3d

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

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



5007
5008
5009
5010
5011
5012
5013
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5007

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



5004
5005
5006
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5004

def __obj_ptr__
  @__obj_ptr__
end

Class Method Details

.all(alpha) ⇒ Object

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



5037
5038
5039
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5037

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



4999
5000
5001
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4999

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4930

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

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

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



4987
4988
4989
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4987

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



4978
4979
4980
4981
4982
4983
4984
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4978

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



4993
4994
4995
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4993

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

Instance Method Details

#!=(vec) ⇒ Object

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



5055
5056
5057
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5055

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

#*(val) ⇒ Object

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



5070
5071
5072
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5070

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

#+(vec) ⇒ Object

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



5060
5061
5062
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5060

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

#-(vec) ⇒ Object

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



5065
5066
5067
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5065

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

#/(val) ⇒ Object

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



5075
5076
5077
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5075

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

#==(vec) ⇒ Object

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



5050
5051
5052
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5050

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

#[](i) ⇒ Object



45
46
47
48
# File 'lib/ruby/ropencv/ropencv_ruby.rb', line 45

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

#[]=(i, val0) ⇒ Object



49
50
51
52
# File 'lib/ruby/ropencv/ropencv_ruby.rb', line 49

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


5018
5019
5020
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5018

def __owner__?
    @__obj_ptr__[:bowner]
end

#mul(other) ⇒ Object

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



5042
5043
5044
5045
5046
5047
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5042

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



5032
5033
5034
# File 'lib/ruby/ropencv/ropencv_types.rb', line 5032

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