iRegion3

alias iRegion3 = Region!(3, int)

Examples

1 auto a = fRegion1(1,5);
2 auto b = fRegion1(2,5);
3 assert( a.overlap(b) == b.overlap(a) );
4 assert( a.overlap(b) == fRegion1(2,4) );
5 
6 assert( a.overlapLocal(b) == fRegion1(2,3) );
auto a = fRegion1(1,2);
auto b = fRegion1(4,2);
assert( a.expand(b) == fRegion1(1,5) );
alias Region!(5,float) MSR; // MultiSpaceRegtion
alias MSR.vec_t msrvec;
auto a = MSR( msrvec(1,0,3,4,3), msrvec(3,2,4,8,4) );
assert( msrvec(2,1,4,5,5) in a );
auto a = fRegion2( vec2(1,1), vec2(2,2) );
assert( a.contains(2,2) );
1 alias NReg = Region!(0,float);
2 auto r1 = NReg( 1,2,3,4 );
3 assertEq( r1.dims, 2 );
4 assertEq( r1.pos.data, [1,2] );
5 assertEq( r1.size.data, [3,4] );
6 
7 assert( vec2(2,3) in r1 );
8 
9 auto r2 = NReg( 1,2 );
10 assertEq( r2.dims, 1 );
11 assertEq( r2.pos.data, [1] );
12 assertEq( r2.size.data, [2] );
13 
14 assert( Vector!(0,float)(1.4) in r2 );
15 r2.dims = 3;
16 r2.pos = vec3(1,2,3);
17 r2.size = vec3(1,2,3);
18 //mustExcept({ r2.size = vec2(1,2); }); // uncatcable exception from invariant
19 r2 = NReg( vec2(1,2), vec2(3,2) );
20 assert( vec2(2,3) in r2 );

Meta