Class: OpenCV::Cv::Point2f

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

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



3429
3430
3431
3432
3433
3434
3435
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3429

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



3426
3427
3428
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3426

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



3421
3422
3423
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3421

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3365

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

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



3409
3410
3411
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3409

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



3400
3401
3402
3403
3404
3405
3406
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3400

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



3415
3416
3417
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3415

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

Instance Method Details

#+(pt) ⇒ Object

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



3510
3511
3512
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3510

def +(pt)
    Rbind::cv_point_2f_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)


3440
3441
3442
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3440

def __owner__?
    @__obj_ptr__[:bowner]
end

#cross(pt) ⇒ Object

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



3505
3506
3507
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3505

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

#dot(*args) ⇒ Object

wrapper for overloaded method dot

Raises:

  • (ArgumentError)


3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3474

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

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

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

#xObject

methods wrapper for float x



3454
3455
3456
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3454

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

#x=(value) ⇒ Object

wrapper for float x



3459
3460
3461
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3459

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

#yObject

wrapper for float y



3464
3465
3466
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3464

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

#y=(value) ⇒ Object

wrapper for float y



3469
3470
3471
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3469

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