WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
GridPoints.h
1#ifndef _WINC_GRIDPOINTS
2#define _WINC_GRIDPOINTS
3
4#include <WXP/Const.h>
5#include <WXP/GridPoint.h>
6#include <WXP/Rect.h>
7
8namespace WXP {
9 class GridPoints { /* Coordinate data structure */
10 int num;
11 int max;
12 int ind;
13 float *gx;
14 float *gy;
16 public:
17 int init();
18 int init( int size );
19 GridPoints();
20 GridPoints(int size);
22 GridPoints( const GridPoints &data );
23 GridPoints operator=( const GridPoints &data );
24 int copy( const GridPoints &data );
25 int copy( const GridPoints &data, int start, int rnum );
27 inline int clear(){ num = 0; return 1; };
28 int expand( int size );
29 int add( float x, float y );
30 int add( GridPoint gpt );
32 inline int add1( GridPoint gpt ){ gx[num] = gpt.gx; gy[num] = gpt.gy; num++; return 1; };
33 int add( int ind );
35 inline int add1( int ind ){ gx[num] = gx[ind]; gy[num] = gy[ind]; num++; return 1; };
36 int set( int ind, float rx, float ry );
37 int set( int ind, GridPoint &gpt );
38 int get( int ind, GridPoint &gpt );
39 GridPoint get( int ind );
40 int remove( int ind );
41 int insert( int ind, GridPoint &gpt );
42 int insert( int ind, float x, float y );
44 inline float getGX( int ind ){
45 return ind >= num || ind < 0 ? Const::MISS : gx[ind]; };
47 inline float getGY( int ind ){
48 return ind >= num || ind < 0 ? Const::MISS : gy[ind]; };
50 inline float getGX1( int ind ){ return gx[ind]; };
52 inline float getGY1( int ind ){ return gy[ind]; };
54 inline int getNum() { return num; };
55 int offset( int ind, float rx, float ry );
56 int offset( float rx, float ry );
57 int within( GridPoint &gpt );
58 int getCenter( GridPoint &gpt );
59 int getCentroid( GridPoint &gpt );
60 int getBoundingBox( Rect &box );
61 int getPointsWithin( GridPoints &gpts );
62 int print();
63 };
64}
65#endif
static const int MISS
Definition Const.h:7
This class creates an array a 2D points (x, y)
Definition GridPoints.h:9
int copy(const GridPoints &data)
Definition GridPoints.cc:96
int getCentroid(GridPoint &gpt)
Definition GridPoints.cc:429
int remove(int ind)
Definition GridPoints.cc:239
float getGX(int ind)
Definition GridPoints.h:44
int expand(int size)
Definition GridPoints.cc:128
int init()
Definition GridPoints.cc:19
int add(float x, float y)
Definition GridPoints.cc:157
int within(GridPoint &gpt)
Definition GridPoints.cc:314
GridPoints operator=(const GridPoints &data)
Definition GridPoints.cc:83
~GridPoints()
Definition GridPoints.cc:62
float getGX1(int ind)
Definition GridPoints.h:50
int print()
Definition GridPoints.cc:482
int getCenter(GridPoint &gpt)
Definition GridPoints.cc:336
int set(int ind, float rx, float ry)
Definition GridPoints.cc:192
int getNum()
Definition GridPoints.h:54
int add1(GridPoint gpt)
Definition GridPoints.h:32
int add1(int ind)
Definition GridPoints.h:35
int clear()
Definition GridPoints.h:27
float getGY(int ind)
Definition GridPoints.h:47
GridPoints()
Definition GridPoints.cc:44
int get(int ind, GridPoint &gpt)
Definition GridPoints.cc:216
int insert(int ind, GridPoint &gpt)
Definition GridPoints.cc:280
float getGY1(int ind)
Definition GridPoints.h:52
int offset(int ind, float rx, float ry)
Definition GridPoints.cc:290
All WXP classes fall under the WXP namespace.
Definition Angle.h:4
This struct defines basic gridpoint values.
Definition GridPoint.h:5
This structure defines rectangle coordinates.
Definition Rect.h:5