feisty meow concerns codebase
2.140
|
#include <polygon.h>
Public Member Functions | |
polygon () | |
~polygon () | |
void | add (const cartesian_point &to_add) |
adds a new point to the list that represents the polygon's sides. More... | |
int | points () const |
int | sides () const |
cartesian_point & | operator[] (int index) |
retrieves the index-th point in the list. More... | |
bool | inside (const cartesian_point &to_check) |
Returns true if the point "to_check" is inside of this polygon. More... | |
Public Member Functions inherited from basis::array< geometric::cartesian_point > | |
DEFINE_CLASS_NAME ("array") | |
array (int number=0, const geometric::cartesian_point *init=NULL_POINTER, int flags=EXPONENTIAL_GROWTH|FLUSH_INVISIBLE) | |
Constructs an array with room for "number" objects. More... | |
array (const array< geometric::cartesian_point > ©_from) | |
copies the contents & sizing information from "copy_from". More... | |
virtual | ~array () |
destroys the memory allocated for the objects. More... | |
void | reset (int number=0, const geometric::cartesian_point *initial_contents=NULL_POINTER) |
Resizes this array and sets the contents from an array of contents. More... | |
array & | operator= (const array< geometric::cartesian_point > ©_from) |
Copies the array in "copy_from" into this. More... | |
int | length () const |
Returns the current reported length of the allocated C array. More... | |
int | last () const |
Returns the last valid element in the array. More... | |
int | flags () const |
Provides the raw flags value, without interpreting what it means. More... | |
bool | exponential () const |
Returns true if this allocator will grow exponentially on resize. More... | |
bool | simple () const |
Reports whether the templated object is a simple type or not. More... | |
const geometric::cartesian_point & | get (int index) const |
Accesses individual objects stored in "this" at the "index" position. More... | |
geometric::cartesian_point & | use (int index) |
A non-constant version of get(); the returned object can be modified. More... | |
const geometric::cartesian_point & | operator[] (int index) const |
Synonym for get that provides the expected array indexing syntax. More... | |
geometric::cartesian_point & | operator[] (int index) |
Synonym for use that provides the expected array indexing syntax. More... | |
outcome | put (int index, const geometric::cartesian_point &to_put) |
Stores an object at the index "index" in the array. More... | |
array | concatenation (const array &to_concatenate) const |
Returns the concatenation of "this" and the array "to_concatenate". More... | |
array | concatenation (const geometric::cartesian_point &to_concatenate) const |
Returns the concatenation of "this" and the object "to_concatenate". More... | |
array & | concatenate (const array &to_concatenate) |
Appends the array "to_concatenate" onto "this" and returns "this". More... | |
array & | concatenate (const geometric::cartesian_point &to_concatenate) |
Appends the object "to_concatenate" onto "this" and returns "this". More... | |
array & | concatenate (const geometric::cartesian_point *to_concatenate, int length) |
Concatenates a C-array "to_concatenate" onto "this" and returns "this". More... | |
array | operator+ (const array &to_cat) const |
Synonym for concatenation. More... | |
array | operator+ (const geometric::cartesian_point &to_concatenate) const |
Synonym for concatenation. More... | |
array & | operator+= (const array &to_concatenate) |
Synonym for concatenate that modifies "this". More... | |
array & | operator+= (const geometric::cartesian_point &to_concatenate) |
Synonym for concatenate that modifies "this". More... | |
const geometric::cartesian_point * | observe () const |
Returns a pointer to the underlying C array of data. More... | |
geometric::cartesian_point * | access () |
A non-constant access of the underlying C-array. BE REALLY CAREFUL. More... | |
void | swap_contents (array< geometric::cartesian_point > &other) |
Exchanges the contents of "this" and "other". More... | |
void | snarf (array &new_contents) |
Drops "this" array's contents into the dustbin and uses "new_contents". More... | |
array | subarray (int start, int end) const |
Returns the array segment between the indices "start" and "end". More... | |
outcome | insert (int index, int new_indices) |
Adds "new_indices" new positions for objects into the array at "index". More... | |
outcome | overwrite (int index, const array &write_with, int count=-1) |
Stores the array "write_with" into the current array at the "index". More... | |
outcome | stuff (int length, geometric::cartesian_point *to_stuff) const |
Copies at most "length" elements from this into the array "to_stuff". More... | |
outcome | resize (int new_size, how_to_copy way=NEW_AT_END) |
Changes the size of the C array to "new_size". More... | |
outcome | zap (int start, int end) |
Deletes from "this" the objects inclusively between "start" and "end". More... | |
outcome | shrink () |
Cuts loose any allocated space that is beyond the real length. More... | |
outcome | retrain (int new_size, const geometric::cartesian_point *to_copy) |
Resizes the C array and stuffs it with the contents in "to_copy". More... | |
void | shift_data (shift_directions where) |
The valid portion of the array is moved to the left or right. More... | |
int | internal_real_length () const |
Gritty Internal: the real allocated length. More... | |
int | internal_offset () const |
Gritty Internal: the offset from real start to stored data. More... | |
const geometric::cartesian_point * | internal_block_start () const |
Gritty Internal: constant peek at the real allocated pointer. More... | |
geometric::cartesian_point * | internal_block_start () |
Gritty Internal: the real allocated pointer made accessible. More... | |
geometric::cartesian_point *const * | internal_offset_mem () const |
Gritty Internal: the start of the actual stored data. More... | |
Additional Inherited Members | |
Public Types inherited from basis::array< geometric::cartesian_point > | |
enum | specialc_flags |
the flags specify how the array treats its contents and its length. More... | |
enum | how_to_copy |
enum | shift_directions |
void geometric::polygon::add | ( | const cartesian_point & | to_add | ) |
adds a new point to the list that represents the polygon's sides.
bool geometric::polygon::inside | ( | const cartesian_point & | to_check | ) |
Returns true if the point "to_check" is inside of this polygon.
This function assumes that the polygon is closed when performing the check.
Definition at line 26 of file polygon.cpp.
References basis::maximum(), basis::minimum(), geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().
cartesian_point& geometric::polygon::operator[] | ( | int | index | ) |
retrieves the index-th point in the list.
this is valid for indices between zero and points() - 1.
|
inline |
Definition at line 44 of file polygon.h.
References basis::array< geometric::cartesian_point >::length().
Referenced by sides().
|
inline |