#include <point2.H>
Inheritance diagram for mlib::Point2list< L, P, V, S >:
Public Member Functions | |
ARRAY (int m=0) | |
ARRAY (CARRAY< P > &l) | |
int | num () const |
bool | empty () const |
bool | valid_index (int k) const |
void | set_unique () |
P * | array () |
P & | operator[] (int j) const |
P & | last () const |
P & | first () const |
void | begin_index () |
void | end_index () |
bool | is_indexing () const |
virtual void | truncate (int n) |
virtual void | realloc (int new_max=0) |
virtual int | get_index (const P &el) const |
bool | add_uniquely (const P &el) |
void | operator+= (const P &el) |
ARRAY< P > & | operator+= (CARRAY< P > &b) |
void | add (const P &p) |
void | push (const P &p) |
void | insert (int ind, int num) |
bool | remove (int k) |
bool | operator-= (const P &el) |
void | operator-= (CARRAY< P > &l) |
bool | rem (const P &p) |
P | pop () |
bool | pull_index (int k) |
bool | pull_element (const P &p) |
ARRAY< P > | extract (int start, int n) const |
virtual void | reverse () |
virtual void | sort (compare_func_t compare) |
Constructors | |
Point2list (int m=16) | |
Construct a list with no points but space for m points. | |
Point2list (const ARRAY< P > &p) | |
Construct a list using the passed in array of points. | |
Point List Property Queries | |
double | winding_number (const P &) const |
Returns the winding number. | |
Intersection Testing Functions | |
bool | intersects_line (const S &line) const |
Returns true if any segment of the polyline crosses the line. | |
bool | intersects_seg (const S &segment) const |
Returns true if any segment of the polyline crosses the given line segment. | |
int | contains (const Point2list< L, P, V, S > &list) const |
int | contains (const P &p) const |
bool | ray_intersect (const P &p, const V &d, P &hit, int loop=0) const |
bool | ray_intersect (const P &p, const V &d, L &hit, int loop=0) const |
P | ray_intersect (const P &p, const V &d, int k0, int k1) const |
List Operations | |
void | fix_endpoints (P a, P b) |
Adjust this polyline so that it runs from a to b (uses a combination of translation, rotation, and scaling). | |
Protected Member Functions | |
virtual void | set_index (const P &, int) const |
virtual void | clear_index (const P &) const |
virtual void | clear_ele (int) |
virtual void | clear_range (int i, int j) |
virtual void | append_ele (const P &el) |
Protected Attributes | |
ARRAY< double > | _partial_length |
P * | _array |
int | _num |
int | _max |
bool | _unique |
bool | _do_index |
Like the Point2 class, Point2list is designed to be the base class for more specific types of lists of 2D points. Specifically, lists of 2D points in different coordinate systems. The template argument L is the type of the derived point list class. This allows the Point2list to return new lists of the same type as the derived class. The template arguments P, V, and S are the types of the corresponding point, vector and line classes (respectively) for the coordinate system of the derived 2D point list class.
Definition at line 196 of file point2.H.
|
Construct a list with no points but space for m points.
|
|
Construct a list using the passed in array of points.
|
|
Definition at line 306 of file support.H. Referenced by mlib::PIXEL_list::operator=(), and mlib::NDCpt_list::operator=(). |
|
|
|
Appends all the points in
Definition at line 542 of file pointlist.C. References ARRAY< P >::operator+=(). |
|
|
|
|
|
|
|
|
|
Computes the average of all the point sin the list.
Definition at line 130 of file pointlist.H. Referenced by GESTURE::center(), Bvert_list::center(), mlib::Wpt_list::get_best_fit_plane(), GESTURE::is_ellipse(), and mlib::Pointlist< L, P, V, S >::spread(). |
|
Computes the averge distance from point p to segment k in the list over the length of segment k.
Definition at line 216 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::length(), and ARRAY< P >::num(). |
|
Definition at line 170 of file pointlist.H. |
|
|
|
|
|
|
|
|
|
|
Make a copy of the point list from point
Definition at line 511 of file pointlist.C. References ARRAY< P >::num(), and ARRAY< P >::valid_index(). |
|
Definition at line 175 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::closest(), and mlib::Pointlist< L, P, V, S >::dist(). |
|
Definition at line 151 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::closest(), mlib::Pointlist< L, P, V, S >::length(), and ARRAY< P >::num(). |
|
Computes everything about the point on the line closest to p.
Definition at line 112 of file pointlist.C. References ARRAY< P >::empty(), err_msg(), mlib::nearest_pt_to_line_seg(), and ARRAY< P >::num(). Referenced by mlib::Pointlist< L, P, V, S >::closest(), mlib::Pointlist< NDCpt_list, NDCpt, NDCvec, NDCline >::dist(), mlib::Pointlist< L, P, V, S >::invert(), and trim_endpt_overlap(). |
|
Reimplemented from ARRAY< P >. Definition at line 94 of file point2.C. References ARRAY< P >::num(). |
|
Definition at line 120 of file point2.C. References ARRAY< P >::num(). Referenced by UVMapping::add_face(). |
|
Distance of the point to the nearest point on the polyline.
Definition at line 141 of file pointlist.H. Referenced by ELLIPSE::avg_dist(), mlib::Pointlist< L, P, V, S >::closest(), mlib::Pointlist< L, P, V, S >::nearest_point(), and GESTURE::radius(). |
|
Computes the distance from point p to the nearest point on segment k in the list.
Definition at line 203 of file pointlist.C. References mlib::nearest_pt_to_line_seg(), and ARRAY< P >::num(). |
|
|
|
|
|
|
Definition at line 198 of file support.H. Referenced by mlib::Point2list< L, P, V, S >::fix_endpoints(). |
|
Adjust this polyline so that it runs from a to b (uses a combination of translation, rotation, and scaling). Pass input parameters by copying in case one is a current endpoint of the polyline. Definition at line 234 of file point2.C. References angle(), mlib::epsAbsMath(), ARRAY< P >::first(), ARRAY< P >::last(), ARRAY< P >::num(), mlib::Pointlist< L, P, V, S >::translate(), and mlib::Pointlist< L, P, V, S >::update_length(). Referenced by GESTURE::fix_endpoints(). |
|
|
|
Computes the interpolated tangent at
Definition at line 413 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::interpolate_length(), ARRAY< P >::num(), and mlib::Pointlist< L, P, V, S >::seg(). |
|
|
|
Computes interpolated values over the polyline. Given interpolation parameter s varying from 0 to 1 along the polyline, return the corresponding point, and optionally the tangent, segment index, and segment paramter there.
Definition at line 322 of file pointlist.C. References ARRAY< P >::empty(), mlib::Pointlist< L, P, V, S >::interpolate_length(), and mlib::Pointlist< L, P, V, S >::seg(). Referenced by get_section(), LINE3D::point(), mlib::Pointlist< L, P, V, S >::resample(), GESTURE::startup_time(), and trim_endpt_overlap(). |
|
Finds the segment containing the interpolation paramenter Parameter s should lie in the range [0,1]. Returns the corresponding segment index, and the paramter t varying from 0 to 1 along that segment.
Definition at line 363 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::_partial_length, ARRAY< P >::empty(), ARRAY< T >::last(), ARRAY< P >::num(), and ARRAY< T >::num(). Referenced by mlib::Pointlist< L, P, V, S >::get_tangent(), mlib::Pointlist< L, P, V, S >::interpolate(), and GESTURE::winding(). |
|
Returns true if any segment of the polyline crosses the line.
Definition at line 294 of file point2.C. References ARRAY< P >::num(), and mlib::Pointlist< L, P, V, S >::pt(). Referenced by GESTURE::intersects_line(). |
|
Returns true if any segment of the polyline crosses the given line segment.
Definition at line 309 of file point2.C. References ARRAY< P >::num(), and mlib::Pointlist< L, P, V, S >::seg(). Referenced by GESTURE::intersects_seg(). |
|
Definition at line 469 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::_partial_length, and mlib::Pointlist< L, P, V, S >::length(). |
|
Definition at line 455 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::closest(). |
|
It's considered a closed loop if the first and last point are the same.
Definition at line 88 of file pointlist.H. Referenced by mlib::Pointlist< L, P, V, S >::self_intersects(). |
|
|
|
Returns true if the points fall in a straight line. len_scale * length() gives the threshold for how close points have to be to the proposed straight line to be accepted. Definition at line 20 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::_partial_length, mlib::Pointlist< L, P, V, S >::length(), ARRAY< T >::num(), ARRAY< P >::num(), and mlib::Pointlist< L, P, V, S >::pt(). |
|
Definition at line 194 of file support.H. Referenced by mlib::Point3list< L, M, P, V, S >::fix_endpoints(), mlib::Point2list< L, P, V, S >::fix_endpoints(), mlib::Pointlist< NDCpt_list, NDCpt, NDCvec, NDCline >::is_closed(), and mlib::Pointlist< L, P, V, S >::resample(). |
|
|
Returns the max value, over the polyline, for the given component i. Components are numbered starting at 0 and are in the same order that they are accessed throught the subscripting operator for the polyline's point type. Definition at line 271 of file pointlist.C. References ARRAY< P >::empty(), err_msg(), max(), ARRAY< P >::num(), and mlib::Pointlist< L, P, V, S >::pt(). |
|
Returns the min value, over the polyline, for the given component i. Components are numbered starting at 0 and are in the same order that they are accessed throught the subscripting operator for the polyline's point type. Definition at line 251 of file pointlist.C. References ARRAY< P >::empty(), err_msg(), min(), ARRAY< P >::num(), and mlib::Pointlist< L, P, V, S >::pt(). |
|
Finds the index of the nearest point in the point list to point p.
Definition at line 85 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::dist(), and ARRAY< P >::num(). |
|
|
|
|
Definition at line 298 of file support.H. Referenced by mlib::Pointlist< L, P, V, S >::append(). |
|
|
|
|
|
|
|
Net length along the polyline at vertex i.
Definition at line 164 of file pointlist.H. |
|
|
|
Prepends all the points in
Definition at line 552 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::clear(), and ARRAY< P >::num(). |
|
Get the ith point in the list.
Definition at line 56 of file pointlist.H. Referenced by mlib::Point2list< L, P, V, S >::intersects_line(), mlib::Pointlist< L, P, V, S >::is_straight(), mlib::Pointlist< L, P, V, S >::max_val(), mlib::Pointlist< L, P, V, S >::min_val(), mlib::Pointlist< NDCpt_list, NDCpt, NDCvec, NDCline >::seg(), mlib::Point3list< L, M, P, V, S >::winding_number(), and mlib::Point2list< L, P, V, S >::winding_number(). |
|
|
|
|
|
|
|
returns the intersection of the ray with a subpart (k0 through k1 inclusive) of the poly line. if it doesn't intersect, returns the nearest point to the ray on the polyline part Definition at line 184 of file point2.C. References mlib::intersect2d(), mlib::Pointlist< L, P, V, S >::length(), and mlib::ray_pt_dist2(). |
|
Definition at line 156 of file point2.C. References ARRAY< P >::num(), and mlib::ray_seg_intersect(). |
|
Definition at line 132 of file point2.C. References ARRAY< P >::num(), and mlib::ray_seg_intersect(). |
|
|
|
|
|
|
|
Resample with the desired number of segments:.
Definition at line 486 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::interpolate(), ARRAY< P >::last(), and mlib::Pointlist< L, P, V, S >::update_length(). |
|
|
|
Get the ith segment in the list.
Definition at line 65 of file pointlist.H. Referenced by mlib::Pointlist< L, P, V, S >::get_tangent(), mlib::Pointlist< L, P, V, S >::interpolate(), mlib::Point2list< L, P, V, S >::intersects_seg(), and mlib::Pointlist< L, P, V, S >::self_intersects(). |
|
Get the length of the ith segment in the list.
Definition at line 62 of file pointlist.H. Referenced by mlib::Pointlist< L, P, V, S >::update_length(). |
|
Does O(n^2) check to see if any segment of the polyline intersects any other, not counting adjacent segments of course.
Definition at line 63 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::is_closed(), j, ARRAY< P >::num(), and mlib::Pointlist< L, P, V, S >::seg(). Referenced by GESTURE::self_intersects(). |
|
|
|
|
|
Reimplemented from ARRAY< P >. Definition at line 235 of file pointlist.H. |
|
|
|
Max distance of any point to average().
Definition at line 227 of file pointlist.C. References mlib::Pointlist< L, P, V, S >::average(), ARRAY< P >::empty(), max(), and ARRAY< P >::num(). Referenced by GESTURE::spread(). |
|
Computes the sum of all the points in the list.
Definition at line 191 of file pointlist.C. References ARRAY< P >::num(). Referenced by mlib::Pointlist< NDCpt_list, NDCpt, NDCvec, NDCline >::average(), and Bvert_list::sum(). |
|
Returns a "tangent" direction at each vertex. At the endpoints it is the direction of the ending segment. At internal vertices it is the average of the two segment directions. Definition at line 72 of file pointlist.H. Referenced by LINE3D::tangent(). |
|
Translate all points in polyline by given vector.
Definition at line 205 of file pointlist.H. Referenced by mlib::Point2list< L, P, V, S >::fix_endpoints(). |
|
|
|
|
Definition at line 186 of file support.H. Referenced by mlib::Pointlist< L, P, V, S >::clone_piece(). |
|
Get the vector from the ith point in the list to the (i + 1)th point in the list.
Definition at line 59 of file pointlist.H. Referenced by mlib::Pointlist< NDCpt_list, NDCpt, NDCvec, NDCline >::segment_length(), and mlib::Pointlist< NDCpt_list, NDCpt, NDCvec, NDCline >::tan(). |
|
Returns the winding number. I.e.,computes the number of times the polyline winds around the given point in the CCW direction. For a closed polyline the result is an integer: e.g. +1 if it winds around once CCW, -1 if it winds once clockwise, and 0 if the given point is outside the projected polyline. Definition at line 321 of file point2.C. References ARRAY< P >::num(), mlib::Pointlist< L, P, V, S >::pt(), and TWO_PI. |
|
Definition at line 121 of file support.H. Referenced by mlib::Wpt_list::closest_vertex(), mlib::Wpt_list::get_best_fit_plane(), mlib::Wpt_list::get_plane(), mlib::Wpt_list::project(), mlib::PIXEL_list::project_to_plane(), mlib::NDCpt_list::project_to_plane(), and mlib::XYpt_list::project_to_plane(). |
|
|
|
|
|
Definition at line 122 of file support.H. Referenced by mlib::Wpt_list::closest_vertex(), mlib::Wpt_list::get_best_fit_plane(), mlib::Wpt_list::get_plane(), mlib::Wpt_list::project(), mlib::PIXEL_list::project_to_plane(), mlib::NDCpt_list::project_to_plane(), and mlib::XYpt_list::project_to_plane(). |
|
|
|