Class: TG::Geometry::Polygon
- Inherits:
-
Object
- Object
- TG::Geometry::Polygon
- Defined in:
- ext/tg_geometry/tg_geometry_ext.c
Instance Method Summary collapse
- #bbox ⇒ Object
- #clockwise? ⇒ Boolean
- #exterior_ring ⇒ Object
- #hole_at(index_value) ⇒ Object
- #holes ⇒ Object
- #num_holes ⇒ Object
Instance Method Details
#bbox ⇒ Object
1851 1852 1853 1854 1855 1856 1857 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1851
static VALUE rb_tg_geometry_polygon_bbox(VALUE self) {
tg_polygon_wrapper_t *w = get_polygon_wrapper(self);
VALUE rect = rect_from_tg_rect(tg_poly_rect(w->poly));
RB_GC_GUARD(self);
return rect;
}
|
#clockwise? ⇒ Boolean
1895 1896 1897 1898 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1895
static VALUE rb_tg_geometry_polygon_clockwise_p(VALUE self) {
tg_polygon_wrapper_t *w = get_polygon_wrapper(self);
return tg_poly_clockwise(w->poly) ? Qtrue : Qfalse;
}
|
#exterior_ring ⇒ Object
1859 1860 1861 1862 1863 1864 1865 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1859
static VALUE rb_tg_geometry_polygon_exterior_ring(VALUE self) {
tg_polygon_wrapper_t *w = get_polygon_wrapper(self);
VALUE ring = ring_wrap_borrowed(w->geom_owner, tg_poly_exterior(w->poly));
RB_GC_GUARD(self);
return ring;
}
|
#hole_at(index_value) ⇒ Object
1872 1873 1874 1875 1876 1877 1878 1879 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1872
static VALUE rb_tg_geometry_polygon_hole_at(VALUE self, VALUE index_value) {
tg_polygon_wrapper_t *w = get_polygon_wrapper(self);
int index = checked_child_index(index_value, tg_poly_num_holes(w->poly), "polygon hole");
VALUE ring = ring_wrap_borrowed(w->geom_owner, tg_poly_hole_at(w->poly, index));
RB_GC_GUARD(self);
return ring;
}
|
#holes ⇒ Object
1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1881
static VALUE rb_tg_geometry_polygon_holes(VALUE self) {
tg_polygon_wrapper_t *w = get_polygon_wrapper(self);
int count = tg_poly_num_holes(w->poly);
VALUE holes = rb_ary_new_capa(count);
for (int i = 0; i < count; i++) {
rb_ary_push(holes, ring_wrap_borrowed(w->geom_owner, tg_poly_hole_at(w->poly, i)));
}
RB_GC_GUARD(self);
RB_GC_GUARD(holes);
return holes;
}
|
#num_holes ⇒ Object
1867 1868 1869 1870 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1867
static VALUE rb_tg_geometry_polygon_num_holes(VALUE self) {
tg_polygon_wrapper_t *w = get_polygon_wrapper(self);
return INT2NUM(tg_poly_num_holes(w->poly));
}
|