Class: OpenCV::Cv::Subdiv2D

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

Constants collapse

PTLOC_ERROR =
-2
PTLOC_OUTSIDE_RECT =
-1
PTLOC_INSIDE =
0
PTLOC_VERTEX =
1
PTLOC_ON_EDGE =
2
NEXT_AROUND_ORG =
0x00
NEXT_AROUND_DST =
0x22
PREV_AROUND_ORG =
0x11
PREV_AROUND_DST =
0x33
NEXT_AROUND_LEFT =
0x13
NEXT_AROUND_RIGHT =
0x31
PREV_AROUND_LEFT =
0x20
PREV_AROUND_RIGHT =
0x02

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ Subdiv2D

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



8319
8320
8321
8322
8323
8324
8325
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8319

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



8316
8317
8318
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8316

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



8311
8312
8313
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8311

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8255

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

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



8299
8300
8301
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8299

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



8290
8291
8292
8293
8294
8295
8296
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8290

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



8305
8306
8307
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8305

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

Instance Method Details

#__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)


8330
8331
8332
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8330

def __owner__?
    @__obj_ptr__[:bowner]
end

#edge_dst(edge, dstpt = 0) ⇒ Object

wrapper for int cv::Subdiv2D::edgeDst(int edge, cv::Point2f *dstpt=0)



8451
8452
8453
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8451

def edge_dst(edge, dstpt = 0)
    Rbind::cv_subdiv2d_edge_dst( self, edge, dstpt)
end

#edge_org(edge, orgpt = 0) ⇒ Object

wrapper for int cv::Subdiv2D::edgeOrg(int edge, cv::Point2f *orgpt=0)



8446
8447
8448
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8446

def edge_org(edge, orgpt = 0)
    Rbind::cv_subdiv2d_edge_org( self, edge, orgpt)
end

#find_nearest(pt, nearest_pt = 0) ⇒ Object

wrapper for int cv::Subdiv2D::findNearest(const cv::Point2f pt, cv::Point2f *nearestPt=0)



8398
8399
8400
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8398

def find_nearest(pt, nearest_pt = 0)
    Rbind::cv_subdiv2d_find_nearest( self, pt, nearest_pt)
end

#get_edge(edge, next_edge_type) ⇒ Object

wrapper for int cv::Subdiv2D::getEdge(int edge, int nextEdgeType)



8426
8427
8428
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8426

def get_edge(edge, next_edge_type)
    Rbind::cv_subdiv2d_get_edge( self, edge, next_edge_type)
end

#get_edge_list(edge_list) ⇒ Object

wrapper for void cv::Subdiv2D::getEdgeList(vector_Vec4f edgeList)



8403
8404
8405
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8403

def get_edge_list(edge_list)
    Rbind::cv_subdiv2d_get_edge_list( self, edge_list)
end

#get_triangle_list(triangle_list) ⇒ Object

wrapper for void cv::Subdiv2D::getTriangleList(vector_Vec6f triangleList)



8408
8409
8410
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8408

def get_triangle_list(triangle_list)
    Rbind::cv_subdiv2d_get_triangle_list( self, triangle_list)
end

#get_vertex(vertex, first_edge = 0) ⇒ Object

wrapper for cv::Point2f cv::Subdiv2D::getVertex(int vertex, int *firstEdge=0)



8418
8419
8420
8421
8422
8423
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8418

def get_vertex(vertex, first_edge = 0)
    result = Rbind::cv_subdiv2d_get_vertex( self, vertex, first_edge)
    # 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

#get_voronoi_facet_list(idx, facet_list, facet_centers) ⇒ Object

wrapper for void cv::Subdiv2D::getVoronoiFacetList(const vector_int idx, vector_vector_Point2f facetList, vector_Point2f facetCenters)



8413
8414
8415
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8413

def get_voronoi_facet_list(idx, facet_list, facet_centers)
    Rbind::cv_subdiv2d_get_voronoi_facet_list( self, idx, facet_list, facet_centers)
end

#init_delaunay(rect) ⇒ Object

methods wrapper for void cv::Subdiv2D::initDelaunay(const cv::Rect rect)



8357
8358
8359
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8357

def init_delaunay(rect)
    Rbind::cv_subdiv2d_init_delaunay( self, rect)
end

#insert(*args) ⇒ Object

wrapper for overloaded method insert

Raises:

  • (ArgumentError)


8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8362

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

    # wrapper for void cv::Subdiv2D::insert(const vector_Point2f ptvec)
    @@cv_subdiv2d_insert2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_subdiv2d_insert2_defaults1[i]
        end
        begin
            return Rbind::cv_subdiv2d_insert2(self,*args)
        rescue TypeError => e
            @error = e
        end
    end

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

#locate(pt, edge, vertex) ⇒ Object

wrapper for int cv::Subdiv2D::locate(const cv::Point2f pt, int edge, int vertex)



8393
8394
8395
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8393

def locate(pt, edge, vertex)
    Rbind::cv_subdiv2d_locate( self, pt, edge, vertex)
end

#next_edge(edge) ⇒ Object

wrapper for int cv::Subdiv2D::nextEdge(int edge)



8431
8432
8433
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8431

def next_edge(edge)
    Rbind::cv_subdiv2d_next_edge( self, edge)
end

#rotate_edge(edge, rotate) ⇒ Object

wrapper for int cv::Subdiv2D::rotateEdge(int edge, int rotate)



8436
8437
8438
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8436

def rotate_edge(edge, rotate)
    Rbind::cv_subdiv2d_rotate_edge( self, edge, rotate)
end

#sym_edge(edge) ⇒ Object

wrapper for int cv::Subdiv2D::symEdge(int edge)



8441
8442
8443
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8441

def sym_edge(edge)
    Rbind::cv_subdiv2d_sym_edge( self, edge)
end