WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Points.h
1#ifndef _WINC_POINTS
2#define _WINC_POINTS
3
4#include <WXP/Const.h>
5#include <WXP/Point.h>
6
7namespace WXP {
8 class Points { /* Coordinate data structure */
9 int num;
10 int max;
11 int ind;
12 float *x;
13 float *y;
15 public:
16 int init();
17 int init( int size );
18 Points();
19 Points(int size);
20 ~Points();
21 Points( const Points &data );
22 Points operator=( const Points &data );
23 int copy( const Points &data );
24 int copy( const Points &data, int start, int rnum );
26 inline int clear(){ num = 0; return 1; };
27 int expand( int size );
28 int add( float x, float y );
29 int add( Point pt );
31 inline int add1( Point pt ){ x[num] = pt.x; y[num] = pt.y; num++; return 1; };
32 int add( int ind );
34 inline int add1( int ind ){ x[num] = x[ind]; y[num] = y[ind]; num++; return 1; };
35 int set( int ind, float rx, float ry );
36 int set( int ind, Point &pt );
37 int get( int ind, Point &pt );
38 Point get( int ind );
39 int remove( int ind );
40 int insert( int ind, Point &pt );
41 int insert( int ind, float x, float y );
43 inline float getX( int ind ){
44 return ind >= num || ind < 0 ? Const::MISS : x[ind]; };
46 inline float getY( int ind ){
47 return ind >= num || ind < 0 ? Const::MISS : y[ind]; };
49 inline float getX1( int ind ){ return x[ind]; };
51 inline float getY1( int ind ){ return y[ind]; };
53 inline int getNum() { return num; };
54 int offset( int ind, float rx, float ry );
55 int offset( float rx, float ry );
56 int within( Point &pt );
57 int getCenter( Point &pt );
58 int getCentroid( Point &pt );
59 int print();
60 };
61}
62#endif
static const int MISS
Definition Const.h:7
This class creates an array a 2D points (x, y)
Definition Points.h:8
int print()
Definition Points.cc:448
int get(int ind, Point &pt)
Definition Points.cc:215
int insert(int ind, Point &pt)
Definition Points.cc:279
int within(Point &pt)
Definition Points.cc:313
int clear()
Definition Points.h:26
int getCentroid(Point &pt)
Definition Points.cc:428
int remove(int ind)
Definition Points.cc:238
int add(float x, float y)
Definition Points.cc:156
int set(int ind, float rx, float ry)
Definition Points.cc:191
int init()
Definition Points.cc:18
float getY(int ind)
Definition Points.h:46
float getX1(int ind)
Definition Points.h:49
~Points()
Definition Points.cc:61
int copy(const Points &data)
Definition Points.cc:95
int expand(int size)
Definition Points.cc:127
int offset(int ind, float rx, float ry)
Definition Points.cc:289
Points()
Definition Points.cc:43
float getY1(int ind)
Definition Points.h:51
int add1(Point pt)
Definition Points.h:31
int getCenter(Point &pt)
Definition Points.cc:335
float getX(int ind)
Definition Points.h:43
int add1(int ind)
Definition Points.h:34
int getNum()
Definition Points.h:53
Points operator=(const Points &data)
Definition Points.cc:82
All WXP classes fall under the WXP namespace.
Definition Angle.h:4
This struct sets a 3D point (x, y, z)
Definition Point.h:5
float x
Definition Point.h:6
float y
Definition Point.h:7