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
2626 2627 2628 2629 2630 2631 2632 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2626
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
2670 2671 2672 2673 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2670
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
2634 2635 2636 2637 2638 2639 2640 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2634
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
2647 2648 2649 2650 2651 2652 2653 2654 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2647
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
2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2656
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
2642 2643 2644 2645 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2642
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));
}
|