#ifndef _global_h # include "global.h" #endif #ifndef _vec2list_h # include "vec2list.h" #endif #ifndef _mat2_h # include "mat2.h" #endif Vec2List::Vec2List( int len_in ) { alloc_len = len_in; len = 0; v = new Vec2[alloc_len]; } Vec2List::Vec2List( const Vec2List &vl ) { v = 0; *this = vl; } Vec2List::Vec2List( const Vec2List &vl, const Mat2 &m ) { alloc_len = len = vl.Len(); v = new Vec2[alloc_len]; for (int i=0;imax_x) max_x=v[i].X(); if (v[i].Y()max_y) max_y=v[i].Y(); } *tl = Vec2(min_x,min_y); *br = Vec2(max_x,max_y); } else { *tl = Vec2Zero; *br = Vec2Zero; } } const Vec2List& Vec2List::SetAt(int id,const Vec2 &z) { if (id>=0&&id=alloc_len) { alloc_len += 4; Vec2 *new_v = new Vec2[alloc_len]; for (i=0;i=id;i--) v[i+1]=v[i]; // shift to the end len++; v[id] = z; return *this; } const Vec2List& Vec2List::Del(int id) { int i; for (i=id;i but not include const Vec2List& Vec2List::DelRange( int from, int to, int *start ) { int i; if (fromto) { // cut to end for (i=to+1;i<=from;i++) v[i-to-1]=v[i]; *start=from-to-1; len=from-to; return *this; } else { /* from == to */ *start=from; return *this; } } const Vec2List& Vec2List::operator=(const Vec2List &vl) { if (v) delete v; alloc_len = len = vl.Len(); v = new Vec2[alloc_len]; for (int i=0;i=alloc_len) { alloc_len += 4; Vec2 *new_v = new Vec2[alloc_len]; for (int i=0;i