#include <point-ref.h>
PointRef is basically a pair of things: (1) a pointer to a PointSetList, and (2) an index (or set of indices) into that PointSetList that references one particular Point. Since there are two ways to reference a particular Point in a PointSetList (either by specifying which PointSet it's in followed by the index of that point within that PointSet, or just by specifying a single index as if you were ignoring PointSet boundaries), PointRef will transparently convert between these two methods of describing a Point, making it easy to use PointSetLists for different applications.
Note that PointRefs become invalid if the PointSetList is modified. PointRef by itself does not perform any consistency checking.
Public Member Functions | |
PointRef (const PointSetList *data, int point_index) | |
Refer to a point initially by specifying a single index. | |
PointRef (const PointSetList *data, int which_point_set, int which_point) | |
Refer to a point initially by specifying which PointSet and index. | |
PointRef (const PointSetList *data, int point_index, int which_point_set, int which_point) | |
Refer to a point by providing both methods of accessing a Feature. | |
PointRef (const PointRef &other) | |
const Point & | point () const |
Get the Feature referred to by this PointRef. | |
int | which_point_set () const |
Find the index of the PointSet that this point is in. | |
int | which_point () const |
Find the index of the point within the PointSet that it's in. | |
int | point_index () const |
Get the index of the point in the list of all Points in this PointSetList. |
PointRef | ( | const PointSetList * | data, | |
int | point_index | |||
) |
Refer to a point initially by specifying a single index.
PointRef | ( | const PointSetList * | data, | |
int | which_point_set, | |||
int | which_point | |||
) |
Refer to a point initially by specifying which PointSet and index.
PointRef | ( | const PointSetList * | data, | |
int | point_index, | |||
int | which_point_set, | |||
int | which_point | |||
) |
Refer to a point by providing both methods of accessing a Feature.
This constructor does not do any consistency checking i.e., to check whether feature_index refers to the same point as (which_point_set, which_point). You should only use this constructor if you know for sure; the reason for this constructor is to quickly build a PointRef if you already know all the indices.
int which_point_set | ( | ) | const |
Find the index of the PointSet that this point is in.
This will usually be used in conjunction with which_point().
int which_point | ( | ) | const |
Find the index of the point within the PointSet that it's in.
This will usually be used in conjunction with which_point_set().
int point_index | ( | ) | const |
Get the index of the point in the list of all Points in this PointSetList.