Class: OpenCV::Cv::Point

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ Point

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



3048
3049
3050
3051
3052
3053
3054
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3048

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



3045
3046
3047
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3045

def __obj_ptr__
  @__obj_ptr__
end

Class Method Details

.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



3040
3041
3042
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3040

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2984

def self.new(*args)
    if args.first.is_a?(FFI::Pointer) || args.first.is_a?(PointStruct)
        raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1
        return super(args.first)
    end
    # wrapper for cv::Point::Point(int x, int y)
    @@cv_point_point_defaults0 ||= [nil, nil]
    if(args.size >= 2 && args.size <= 2)
        args.size.upto(1) do |i|
            args[i] = @@cv_point_point_defaults0[i]
        end
        begin
            return Rbind::cv_point_point(*args)
        rescue TypeError => e
            @error = e
        end
    end

    # wrapper for cv::Point::Point(const cv::Point pt)
    @@cv_point_point2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_point_point2_defaults1[i]
        end
        begin
            return Rbind::cv_point_point2(*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.



3028
3029
3030
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3028

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



3019
3020
3021
3022
3023
3024
3025
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3019

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



3034
3035
3036
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3034

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

Instance Method Details

#+(pt) ⇒ Object

wrapper for void cv::Point::operator+(const cv::Point pt)



3134
3135
3136
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3134

def +(pt)
    Rbind::cv_point_operator_plus( self, pt)
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)


3059
3060
3061
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3059

def __owner__?
    @__obj_ptr__[:bowner]
end

#cross(pt) ⇒ Object

wrapper for double cv::Point::cross(const cv::Point pt)



3124
3125
3126
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3124

def cross(pt)
    Rbind::cv_point_cross( self, pt)
end

#dot(*args) ⇒ Object

wrapper for overloaded method dot

Raises:

  • (ArgumentError)


3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3093

def dot(*args)
    # wrapper for int cv::Point::dot(const cv::Point pt)
    @@cv_point_dot_defaults0 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_point_dot_defaults0[i]
        end
        begin
            return Rbind::cv_point_dot(self,*args)
        rescue TypeError => e
            @error = e
        end
    end

    # wrapper for double cv::Point::dot(const cv::Point pt)
    @@cv_point_dot2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_point_dot2_defaults1[i]
        end
        begin
            return Rbind::cv_point_dot2(self,*args)
        rescue TypeError => e
            @error = e
        end
    end

    raise ArgumentError, "No overloaded signature fits to: #{args.map(&:class)}"
end

#inside(rect) ⇒ Object

wrapper for bool cv::Point::inside(const cv::Rect rect)



3129
3130
3131
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3129

def inside(rect)
    Rbind::cv_point_inside( self, rect)
end

#xObject

methods wrapper for int x



3073
3074
3075
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3073

def x()
    Rbind::cv_point_getx( self)
end

#x=(value) ⇒ Object

wrapper for int x



3078
3079
3080
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3078

def x=(value)
    Rbind::cv_point_setx( self, value)
end

#yObject

wrapper for int y



3083
3084
3085
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3083

def y()
    Rbind::cv_point_gety( self)
end

#y=(value) ⇒ Object

wrapper for int y



3088
3089
3090
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3088

def y=(value)
    Rbind::cv_point_sety( self, value)
end