#include <points.H>
Inheritance diagram for mlib::Wpt_list:
Public Member Functions | |
Point3list (int max=16) | |
Default constructor. Creates an empty list with space for max points. | |
Point3list (const ARRAY< Wpt > &p) | |
Constructor that creates a list containing the points in ARRAY p. | |
Point3list (const ARRAY< Wpt > &p, const Wtransf &t) | |
Constructor that creates a list containing the points in ARRAY p transformed by matrix t. | |
double | winding_number (const Wpt &o, const Wvec &n) const |
Returns the winding number WRT the given point and direction. | |
void | xform (const Wtransf &t) |
Multiply the points by the transform. | |
bool | fix_endpoints (Wpta, Wptb) |
Adjust this polyline so that it runs from a to b (uses a combination of translation, rotation, and scaling). | |
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 | contains (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 | |
Wpt_list (int max=0) | |
Wpt_list (const Point3list< Wpt_list, Wtransf, Wpt, Wvec, Wline > &p) | |
Wpt_list (const Point3list< Wpt_list, Wtransf, Wpt, Wvec, Wline > &p, CWtransf &t) | |
Projection Functions | |
bool | project (XYpt_list &ret) const |
Project to screen coords, provided all Wpts lie in the view frustum. | |
bool | project (PIXEL_list &ret) const |
Project to screen coords, provided all Wpts lie in the view frustum. | |
Nearest Point Functions | |
int | closest_vertex (CPIXEL &p) const |
Returns index of the *vertex* of the polyline that is closest to the given screen-space point (distance measured in PIXELs). Skips vertices that lie outside the view frustum. Returns -1 if no vertices lie in the frustum. | |
Best-Fit Plane Functions | |
bool | get_best_fit_plane (Wplane &P) const |
Return the best-fit plane. | |
bool | get_plane (Wplane &P, double len_scale=1e-3) const |
Return the best-fit plane if the fit is good. Parameter 'len_scale' is multiplied by the length of the polyline to yield a threshold. The fit is considered good if every point lies within the threshold distance from the plane. | |
bool | is_planar (double len_scale=1e-3) const |
Return true if get_plane succeeds with the given threshold. | |
bool | get_plane_normal (Wvec &n) |
Convenience: compute the best-fit plane and return its normal. | |
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 |
Related Functions | |
(Note that these are not member functions.) | |
Overloaded Arithmetic Operators | |
Wpt_list | operator * (CWtransf &x, CWpt_list &pts) |
Multiplies a transformation matrix by every point in the list. | |
Wpt_list | operator * (CWpt_list &pts, double t) |
Multiplies all the points in the list by a scalar constant. | |
Wpt_list | operator+ (CWpt_list &pts1, CWpt_list &pts2) |
Adds all the points in one list to the corresponding points in another list. The two lists must contain the same number of points. |
Definition at line 372 of file points.H.
|
|
|
Definition at line 382 of file points.H. References mlib::Pointlist< L, P, V, S >::update_length(). |
|
Definition at line 391 of file points.H. References mlib::Pointlist< L, P, V, S >::update_length(). |
|
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(), 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. |
|
|
|
Reimplemented from ARRAY< P >. Definition at line 230 of file pointlist.H. Referenced by BMESH::_merge(), UVMapping::add_face(), BMESH::changed(), LINE3D::clear(), mlib::PIXEL_list::operator=(), mlib::NDCpt_list::operator=(), BBOX::points(), mlib::Pointlist< L, P, V, S >::prepend(), project(), mlib::PIXEL_list::project_to_plane(), mlib::NDCpt_list::project_to_plane(), mlib::XYpt_list::project_to_plane(), ELLIPSE::rebuild(), mlib::EDGElist::reset(), BODY::triangulate(), and BMESH::triangulate(). |
|
|
|
|
|
|
|
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(). |
|
Returns index of the *vertex* of the polyline that is closest to the given screen-space point (distance measured in PIXELs). Skips vertices that lie outside the view frustum. Returns -1 if no vertices lie in the frustum.
Definition at line 596 of file points.C. References ARRAY< P >::_array, and ARRAY< P >::_num. |
|
Reimplemented in mlib::Point2list< L, P, V, S >. |
|
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 |
|
Return the best-fit plane.
Definition at line 620 of file points.C. References ARRAY< P >::_array, ARRAY< P >::_num, mlib::Pointlist< L, P, V, S >::average(), mlib::Vec3< V >::is_null(), j, and mlib::Vec3< V >::normalized(). Referenced by get_plane(). |
|
|
|
Return the best-fit plane if the fit is good. Parameter 'len_scale' is multiplied by the length of the polyline to yield a threshold. The fit is considered good if every point lies within the threshold distance from the plane.
Definition at line 657 of file points.C. References ARRAY< P >::_array, ARRAY< P >::_num, mlib::Pointlist< L, P, V, S >::_partial_length, mlib::Plane< PLANE, P, V, L >::dist(), get_best_fit_plane(), mlib::Pointlist< L, P, V, S >::length(), and ARRAY< T >::num(). Referenced by get_plane_normal(), and is_planar(). |
|
Convenience: compute the best-fit plane and return its normal.
Definition at line 445 of file points.H. References get_plane(), and mlib::Plane< PLANE, P, V, L >::normal(). |
|
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(). |
|
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(). |
|
|
|
Return true if get_plane succeeds with the given threshold.
Definition at line 438 of file points.H. References get_plane(), and mlib::Plane< PLANE, P, V, L >::is_valid(). |
|
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. |
|
Constructor that creates a list containing the points in ARRAY p transformed by matrix t.
Definition at line 215 of file point3.H. References mlib::Point3list< L, M, P, V, S >::xform(). |
|
Constructor that creates a list containing the points in ARRAY p.
|
|
Default constructor. Creates an empty list with space for max points.
|
|
|
|
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(). |
|
Project to screen coords, provided all Wpts lie in the view frustum.
Definition at line 583 of file points.C. References project(). |
|
Project to screen coords, provided all Wpts lie in the view frustum.
Definition at line 553 of file points.C. References ARRAY< P >::_array, ARRAY< P >::_num, ARRAY< T >::add(), mlib::Pointlist< L, P, V, S >::clear(), ARRAY< P >::empty(), mlib::NDCZpt::in_frustum(), and ARRAY< T >::realloc(). Referenced by project(). |
|
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(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
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 WRT the given point and direction. I.e., projects the polyline to the plane containing point 'o' and perpendicular to direction 'n', then computes the number of times the result winds around o 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 o is outside the projected polyline. |
|
Multiply the points by the transform.
|
|
Multiplies all the points in the list by a scalar constant.
|
|
Multiplies a transformation matrix by every point in the list.
|
|
Adds all the points in one list to the corresponding points in another list. The two lists must contain the same number of points.
|
|
Definition at line 121 of file support.H. Referenced by closest_vertex(), get_best_fit_plane(), get_plane(), 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 closest_vertex(), get_best_fit_plane(), get_plane(), project(), mlib::PIXEL_list::project_to_plane(), mlib::NDCpt_list::project_to_plane(), and mlib::XYpt_list::project_to_plane(). |
|
|
|