Class: OpenCV::Cv::Point2d

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

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



3604
3605
3606
3607
3608
3609
3610
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3604

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



3601
3602
3603
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3601

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



3596
3597
3598
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3596

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3540

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

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



3584
3585
3586
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3584

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



3575
3576
3577
3578
3579
3580
3581
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3575

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



3590
3591
3592
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3590

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

Instance Method Details

#+(pt) ⇒ Object

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



3649
3650
3651
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3649

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


3615
3616
3617
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3615

def __owner__?
    @__obj_ptr__[:bowner]
end

#cross(pt) ⇒ Object

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



3685
3686
3687
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3685

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

#dot(*args) ⇒ Object

wrapper for overloaded method dot

Raises:

  • (ArgumentError)


3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3654

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

    # wrapper for double cv::Point2d::dot(const cv::Point2d pt)
    @@cv_point_2d_dot2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_point_2d_dot2_defaults1[i]
        end
        begin
            return Rbind::cv_point_2d_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 double x



3629
3630
3631
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3629

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

#x=(value) ⇒ Object

wrapper for double x



3634
3635
3636
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3634

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

#yObject

wrapper for double y



3639
3640
3641
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3639

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

#y=(value) ⇒ Object

wrapper for double y



3644
3645
3646
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3644

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