-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathXYGRID.CPP
54 lines (50 loc) · 1.69 KB
/
XYGRID.CPP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//*****************************************************************
// X Y G r i d
//
// Copyright (c) 1993 by W. John Coulthard
//
// This file is part of QuikGrid.
//
// QuikGrid is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// QuikGrid is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with QuikGrid (File gpl.txt); if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// or visit their website at http://www.fsf.org/licensing/licenses/gpl.txt .
//
//*****************************************************************
#pragma hdrstop
#include "assert.h"
#include "xygrid.h"
xyGridClass::xyGridClass( int i, int j )
{
nx=i;
ny=j;
zgrid = new point2d[nx*ny];
assert( zgrid != 0 );
}
void xyGridClass::New( int i, int j )
{
if( (i==nx)&&(j==ny) ) return;
delete[] zgrid;
nx=i;
ny=j;
zgrid = new point2d[nx*ny];
assert( zgrid != 0 );
}
void xyGridClass::set( int i, int j, int ia, int ib )
{ assert( (i<nx) && (i>=0) );
assert( (j<ny) && (j>=0) );
int offset = j*nx + i;
assert( offset <= nx*ny );
zgrid[offset].ix = ia ;
zgrid[offset].iy = ib ;
}