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
1881 1882 1883 1884 1885 1886 1887 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1881
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
1925 1926 1927 1928 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1925
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
1889 1890 1891 1892 1893 1894 1895 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1889
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
1902 1903 1904 1905 1906 1907 1908 1909 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1902
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
1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1911
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
1897 1898 1899 1900 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1897
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));
}
|