WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Public Member Functions | List of all members
WXP::Points Class Reference

This class creates an array a 2D points (x, y) More...

#include "../include/Points.h"

Public Member Functions

int init ()
 
int init (int size)
 
 Points ()
 
 Points (int size)
 
 ~Points ()
 
 Points (const Points &data)
 
Points operator= (const Points &data)
 
int copy (const Points &data)
 
int copy (const Points &data, int start, int rnum)
 
int clear ()
 
int expand (int size)
 
int add (float x, float y)
 
int add (Point pt)
 
int add1 (Point pt)
 
int add (int ind)
 
int add1 (int ind)
 
int set (int ind, float rx, float ry)
 
int set (int ind, Point &pt)
 
int get (int ind, Point &pt)
 
Point get (int ind)
 
int remove (int ind)
 
int insert (int ind, Point &pt)
 
int insert (int ind, float x, float y)
 
float getX (int ind)
 
float getY (int ind)
 
float getX1 (int ind)
 
float getY1 (int ind)
 
int getNum ()
 
int offset (int ind, float rx, float ry)
 
int offset (float rx, float ry)
 
int within (Point &pt)
 
int getCenter (Point &pt)
 
int getCentroid (Point &pt)
 
int print ()
 

Detailed Description

This class creates an array a 2D points (x, y)

Author
Dan Vietor

Constructor & Destructor Documentation

◆ Points() [1/3]

Points::Points ( )

Constructor. Initializes the values.

References init().

◆ Points() [2/3]

Points::Points ( int  size)

Constructor. Size the arrays.

References init().

◆ ~Points()

Points::~Points ( )

Destructor.

◆ Points() [3/3]

Points::Points ( const Points data)

Copy constructor.

Parameters
dataStrings class to copy from

References copy().

Member Function Documentation

◆ add() [1/3]

int Points::add ( float  rx,
float  ry 
)

◆ add() [2/3]

int Points::add ( int  ind)

Adds a new point from the existing list.

Parameters
indIndex of point to copy to and of list

References add().

◆ add() [3/3]

int Points::add ( Point  pt)

Adds a new point.

Parameters
ptPoint class with values

References expand(), WXP::Point::x, and WXP::Point::y.

◆ add1() [1/2]

int WXP::Points::add1 ( int  ind)
inline

Adds an existing point (no bounds check

Parameters
indIndex of point to add

◆ add1() [2/2]

int WXP::Points::add1 ( Point  pt)
inline

Adds a point (no bounds check

Parameters
ptPoint to add

References WXP::Point::x, and WXP::Point::y.

Referenced by WXP::ContPlot::drawBoxFill(), and WXP::ContPlot::drawFill().

◆ clear()

int WXP::Points::clear ( )
inline

◆ copy() [1/2]

int Points::copy ( const Points data)

Copy data.

Parameters
eptsStrings class to copy from

References init().

Referenced by WXP::Plot::drawLine(), WXP::Plot::drawSpline(), operator=(), and Points().

◆ copy() [2/2]

int Points::copy ( const Points data,
int  start,
int  rnum 
)

Copies a subset of point into array

Parameters
dataPoints
startStarting point within data
rnumNumber of points to copy

References init().

◆ expand()

int Points::expand ( int  size)

Expands array size

Parameters
sizeNew size

Referenced by add(), add(), and insert().

◆ get() [1/2]

Point Points::get ( int  ind)

Gets a specific point value from array.

Parameters
indIndex of value to get
Returns
Output Point class with values

References get().

◆ get() [2/2]

int Points::get ( int  ind,
Point pt 
)

Gets a specific point value from array.

Parameters
indIndex of value to get
Return values
pntOutput Point class with values

References WXP::Point::x, and WXP::Point::y.

Referenced by WXP::Domain::adjust(), WXP::Lev2Plot::draw(), and get().

◆ getCenter()

int Points::getCenter ( Point pt)

Find a point at the center of the polygon

Return values
ptCentral point

References WXP::Point::init(), within(), WXP::Point::x, and WXP::Point::y.

Referenced by WXP::WarnPlot::draw(), and WXP::WatchPlot::draw().

◆ getCentroid()

int Points::getCentroid ( Point pt)

Find the centroid of the polygon (averages X and Y). Centroid can be outside of polygon.

Return values
ptCentroid point

References WXP::Point::x, and WXP::Point::y.

◆ getNum()

int WXP::Points::getNum ( )
inline

◆ getX()

float WXP::Points::getX ( int  ind)
inline

◆ getX1()

float WXP::Points::getX1 ( int  ind)
inline

Returns X value (no bounds check)

Parameters
indIndex in array

Referenced by WXP::XWindow::drawFill(), WXP::Graph::drawFill(), WXP::XWindow::drawLine(), and WXP::Graph::drawLine().

◆ getY()

float WXP::Points::getY ( int  ind)
inline

◆ getY1()

float WXP::Points::getY1 ( int  ind)
inline

Returns Y value (no bounds check)

Parameters
indIndex in array

Referenced by WXP::XWindow::drawFill(), WXP::Graph::drawFill(), WXP::XWindow::drawLine(), and WXP::Graph::drawLine().

◆ init() [1/2]

int Points::init ( )

Initializes the values

Referenced by copy(), copy(), Points(), and Points().

◆ init() [2/2]

int Points::init ( int  size)

Initializes the values

◆ insert() [1/2]

int Points::insert ( int  ind,
float  rx,
float  ry 
)

Insert a point into the array

Parameters
indIndex to insert the point
rxX value
ryY value

References expand().

◆ insert() [2/2]

int Points::insert ( int  ind,
Point pt 
)

Insert a point into the array

Parameters
indIndex to insert the point
ptPoint to insert

References insert(), WXP::Point::x, and WXP::Point::y.

Referenced by insert().

◆ offset() [1/2]

int Points::offset ( float  rx,
float  ry 
)

Offsets the entire array.

Parameters
rxNew x value
ryNew y value

◆ offset() [2/2]

int Points::offset ( int  ind,
float  rx,
float  ry 
)

Offsets a specific point value in array.

Parameters
indIndex of value to set
rxNew x value
ryNew y value

Referenced by WXP::Lev2Plot::draw(), WXP::Graph::drawLine(), WXP::Domain::offsetLine(), and WXP::Domain::wrapLine().

◆ operator=()

Points Points::operator= ( const Points data)

Assignment operator. Used to overload copying

Parameters
dataString class to copy from

References copy().

◆ print()

int Points::print ( )

Prints the values to standard output.

Referenced by WXP::MetaPlot::draw().

◆ remove()

int Points::remove ( int  ind)

Deletes a specific point from array.

Parameters
indIndex of point to delete

◆ set() [1/2]

int Points::set ( int  ind,
float  rx,
float  ry 
)

Sets a specific point value in array.

Parameters
indIndex of value to set
rxNew x value
ryNew y value

Referenced by WXP::Domain::adjust().

◆ set() [2/2]

int Points::set ( int  ind,
Point pt 
)

Sets a specific point value in array.

Parameters
indIndex of value to set
pntNew values

References WXP::Point::x, and WXP::Point::y.

◆ within()

int Points::within ( Point pt)

Determines if a point is within the array.

Parameters
ptPoint to check

References WXP::Point::x, and WXP::Point::y.

Referenced by getCenter().


The documentation for this class was generated from the following files: