From 4f7bd64ab9582bbb8704b4973bbe1c34aae7736c Mon Sep 17 00:00:00 2001 From: Geert-Jan Giezeman Date: Fri, 2 Jul 1999 06:49:15 +0000 Subject: [PATCH] Modified leading underscores into trailing underscores --- .../Intersections_2/web/intersection_2_2.fw | 24 +-- Packages/Intersections_2/web/straight_2.fw | 197 +++++++++--------- 2 files changed, 110 insertions(+), 111 deletions(-) diff --git a/Packages/Intersections_2/web/intersection_2_2.fw b/Packages/Intersections_2/web/intersection_2_2.fw index ef6f26ad6f6..7fadc18b35f 100644 --- a/Packages/Intersections_2/web/intersection_2_2.fw +++ b/Packages/Intersections_2/web/intersection_2_2.fw @@ -670,7 +670,7 @@ CGAL_END_NAMESPACE Line_2_Triangle_2_pair *ncthis = (Line_2_Triangle_2_pair *) this; ncthis->_known = true; - _Straight_2 straight(*_line); + Straight_2_ straight(*_line); Line_2 l(_trian->vertex(0), _trian->vertex(1)); if (l.oriented_side(_trian->vertex(2)) == ON_POSITIVE_SIDE) { // if (_trian->is_counterclockwise()) { @@ -689,15 +689,15 @@ if (l.oriented_side(_trian->vertex(2)) == ON_POSITIVE_SIDE) { Line_2(_trian->vertex(0), _trian->vertex(2))); } switch (straight.current_state()) { - case _Straight_2::EMPTY: + case Straight_2_::EMPTY: ncthis->_result = NO; return _result; - case _Straight_2::POINT: { + case Straight_2_::POINT: { straight.current(ncthis->_intersection_point); ncthis->_result = POINT; return _result; } - case _Straight_2::SEGMENT: { + case Straight_2_::SEGMENT: { Segment_2 seg; straight.current(seg); ncthis->_intersection_point = seg.start(); @@ -914,7 +914,7 @@ CGAL_END_NAMESPACE Ray_2_Triangle_2_pair *ncthis = (Ray_2_Triangle_2_pair *) this; ncthis->_known = true; - _Straight_2 straight(*_ray); + Straight_2_ straight(*_ray); Line_2 l(_trian->vertex(0), _trian->vertex(1)); if (l.oriented_side(_trian->vertex(2)) == ON_POSITIVE_SIDE) { // if (_trian->is_counterclockwise()) { @@ -933,15 +933,15 @@ if (l.oriented_side(_trian->vertex(2)) == ON_POSITIVE_SIDE) { Line_2(_trian->vertex(0), _trian->vertex(2))); } switch (straight.current_state()) { - case _Straight_2::EMPTY: + case Straight_2_::EMPTY: ncthis->_result = NO; return _result; - case _Straight_2::POINT: { + case Straight_2_::POINT: { straight.current(ncthis->_intersection_point); ncthis->_result = POINT; return _result; } - case _Straight_2::SEGMENT: { + case Straight_2_::SEGMENT: { Segment_2 seg; straight.current(seg); ncthis->_intersection_point = seg.start(); @@ -1156,7 +1156,7 @@ CGAL_END_NAMESPACE Segment_2_Triangle_2_pair *ncthis = (Segment_2_Triangle_2_pair *) this; ncthis->_known = true; - _Straight_2 straight(*_seg); + Straight_2_ straight(*_seg); Line_2 l(_trian->vertex(0), _trian->vertex(1)); if (l.oriented_side(_trian->vertex(2)) == ON_POSITIVE_SIDE) { straight.cut_right_off( @@ -1174,15 +1174,15 @@ if (l.oriented_side(_trian->vertex(2)) == ON_POSITIVE_SIDE) { Line_2(_trian->vertex(0), _trian->vertex(2))); } switch (straight.current_state()) { - case _Straight_2::EMPTY: + case Straight_2_::EMPTY: ncthis->_result = NO; return _result; - case _Straight_2::POINT: { + case Straight_2_::POINT: { straight.current(ncthis->_intersection_point); ncthis->_result = POINT; return _result; } - case _Straight_2::SEGMENT: { + case Straight_2_::SEGMENT: { Segment_2 seg; straight.current(seg); ncthis->_intersection_point = seg.start(); diff --git a/Packages/Intersections_2/web/straight_2.fw b/Packages/Intersections_2/web/straight_2.fw index 1562c4188bd..def9fcf01dc 100644 --- a/Packages/Intersections_2/web/straight_2.fw +++ b/Packages/Intersections_2/web/straight_2.fw @@ -4,27 +4,27 @@ CGAL_BEGIN_NAMESPACE -class _Straight_2_base { +class Straight_2_base_ { public: enum states {EMPTY, POINT, SEGMENT, RAY, LINE}; protected: enum bound_states {NO_UNBOUNDED=0, MIN_UNBOUNDED=1, MAX_UNBOUNDED=2, BOTH_UNBOUNDED = 3, LINE_EMPTY = 4}; - _Straight_2_base() ; - int _main_dir; // _support is x or y directed (0/1). - int _dir_sign; // sign of main direction coord. - unsigned int _bound_state; // 0, 1, 2, 3, 4. + Straight_2_base_() ; + int main_dir_; // support_ is x or y directed (0/1). + int dir_sign_; // sign of main direction coord. + unsigned int bound_state_; // 0, 1, 2, 3, 4. }; template -class _Straight_2: public _Straight_2_base { +class Straight_2_: public Straight_2_base_ { public: - _Straight_2() ; - _Straight_2(Point_2 const &point) ; - _Straight_2(Line_2 const &line) ; - _Straight_2(Ray_2 const &ray) ; - _Straight_2(Segment_2 const &seg) ; - ~_Straight_2() {} + Straight_2_() ; + Straight_2_(Point_2 const &point) ; + Straight_2_(Line_2 const &line) ; + Straight_2_(Ray_2 const &ray) ; + Straight_2_(Segment_2 const &seg) ; + ~Straight_2_() {} void cut_right_off(Line_2 const & cutter) ; int collinear_order(Point_2 const & p1, Point_2 const &p2) const ; @@ -34,9 +34,9 @@ public: void current(Point_2 &point) const; states current_state() const; protected: - Line_2 _support; // The supporting line. - Point_2 _min; - Point_2 _max; + Line_2 support_; // The supporting line. + Point_2 min_; + Point_2 max_; }; CGAL_END_NAMESPACE @@ -52,25 +52,25 @@ CGAL_END_NAMESPACE CGAL_BEGIN_NAMESPACE inline -_Straight_2_base:: -_Straight_2_base() +Straight_2_base_:: +Straight_2_base_() { - _bound_state = LINE_EMPTY; + bound_state_ = LINE_EMPTY; } template -_Straight_2_base::states -_Straight_2:: +Straight_2_base_::states +Straight_2_:: current_state() const { - switch (_bound_state) { + switch (bound_state_) { case BOTH_UNBOUNDED: return LINE; case MIN_UNBOUNDED: case MAX_UNBOUNDED: return RAY; case NO_UNBOUNDED: - return (collinear_order(_min, _max) == 0) ? POINT : SEGMENT; + return (collinear_order(min_, max_) == 0) ? POINT : SEGMENT; case LINE_EMPTY: default: return EMPTY; @@ -78,104 +78,103 @@ current_state() const } template -_Straight_2:: -_Straight_2() +Straight_2_:: +Straight_2_() { - _bound_state = LINE_EMPTY; + bound_state_ = LINE_EMPTY; } template -_Straight_2:: -_Straight_2(Line_2 const &line) +Straight_2_:: +Straight_2_(Line_2 const &line) { - _support = line; - Vector_2 const &dir(_support.direction().vector()); - _main_dir = (abs(dir.x()) > abs(dir.y()) ) ? 0 : 1; - _dir_sign = sign(_support.direction().vector().cartesian(_main_dir)); - _bound_state = BOTH_UNBOUNDED; + support_ = line; + Vector_2 const &dir = support_.direction().vector(); + main_dir_ = (abs(dir.x()) > abs(dir.y()) ) ? 0 : 1; + dir_sign_ = sign(support_.direction().vector().cartesian(main_dir_)); + bound_state_ = BOTH_UNBOUNDED; } template -_Straight_2:: -_Straight_2(Point_2 const &point) +Straight_2_:: +Straight_2_(Point_2 const &point) { - _support = Line_2(point, Direction_2(R::RT(1),R::RT(0))); - _main_dir = 0; - _dir_sign = 1; - _bound_state = NO_UNBOUNDED; - _min = point; - _max = point; + support_ = Line_2(point, Direction_2(R::RT(1),R::RT(0))); + main_dir_ = 0; + dir_sign_ = 1; + bound_state_ = NO_UNBOUNDED; + min_ = point; + max_ = point; } template -_Straight_2:: -_Straight_2(Ray_2 const &ray) +Straight_2_:: +Straight_2_(Ray_2 const &ray) { - _support = ray.supporting_line(); - Vector_2 const &dir(ray.direction().vector()); -// _main_dir = (abs(dir.hx()) > abs(dir.hy()) ) ? 0 : 1; - _main_dir = (abs(dir.x()) > abs(dir.y()) ) ? 0 : 1; - _dir_sign = sign(_support.direction().vector().cartesian(_main_dir)); - _bound_state = MAX_UNBOUNDED; - _min = ray.start(); + support_ = ray.supporting_line(); + Vector_2 const &dir = ray.direction().vector(); +// main_dir_ = (abs(dir.hx()) > abs(dir.hy()) ) ? 0 : 1; + main_dir_ = (abs(dir.x()) > abs(dir.y()) ) ? 0 : 1; + dir_sign_ = sign(support_.direction().vector().cartesian(main_dir_)); + bound_state_ = MAX_UNBOUNDED; + min_ = ray.start(); } template -_Straight_2:: -_Straight_2(Segment_2 const &seg) +Straight_2_:: +Straight_2_(Segment_2 const &seg) { - _support = seg.supporting_line(); - Vector_2 const &dir(_support.direction().vector()); -// _main_dir = (abs(dir.hx()) > abs(dir.hy()) ) ? 0 : 1; - _main_dir = (abs(dir.x()) > abs(dir.y()) ) ? 0 : 1; - _dir_sign = sign(_support.direction().vector().cartesian(_main_dir)); - _bound_state = NO_UNBOUNDED; - _min = seg.start(); - _max = seg.end(); + support_ = seg.supporting_line(); + Vector_2 const &dir = support_.direction().vector(); + main_dir_ = (abs(dir.x()) > abs(dir.y()) ) ? 0 : 1; + dir_sign_ = sign(support_.direction().vector().cartesian(main_dir_)); + bound_state_ = NO_UNBOUNDED; + min_ = seg.start(); + max_ = seg.end(); } template void -_Straight_2:: +Straight_2_:: current(Line_2 &line) const { - CGAL_kernel_assertion(_bound_state == BOTH_UNBOUNDED); - line = _support; + CGAL_kernel_assertion(bound_state_ == BOTH_UNBOUNDED); + line = support_; } template void -_Straight_2:: +Straight_2_:: current(Ray_2 &ray) const { - CGAL_kernel_assertion(_bound_state == MIN_UNBOUNDED - || _bound_state == MAX_UNBOUNDED); - if (_bound_state == MIN_UNBOUNDED) { - ray = Ray_2(_max, -_support.direction()); + CGAL_kernel_assertion(bound_state_ == MIN_UNBOUNDED + || bound_state_ == MAX_UNBOUNDED); + if (bound_state_ == MIN_UNBOUNDED) { + ray = Ray_2(max_, -_support.direction()); } else { - ray = Ray_2(_min, _support.direction()); + ray = Ray_2(min_, support_.direction()); } } template void -_Straight_2:: +Straight_2_:: current(Segment_2 &seg) const { - CGAL_kernel_assertion(_bound_state == NO_UNBOUNDED - && collinear_order(_min, _max) != 0); - seg = Segment_2(_min, _max); + CGAL_kernel_assertion(bound_state_ == NO_UNBOUNDED + && collinear_order(min_, max_) != 0); + seg = Segment_2(min_, max_); } template void -_Straight_2:: +Straight_2_:: current(Point_2 &pt) const { - CGAL_kernel_assertion(_bound_state == NO_UNBOUNDED - && collinear_order(_min, _max) == 0); - pt = _min; + CGAL_kernel_assertion(bound_state_ == NO_UNBOUNDED + && collinear_order(min_, max_) == 0); + pt = min_; } /* @@ -233,59 +232,59 @@ sign_of_cross(Direction_2 const &dir1, template void -_Straight_2:: +Straight_2_:: cut_right_off(Line_2 const & cutter) // cut off any part of this straight that is to the right of the cutter. { - if (_bound_state == LINE_EMPTY) + if (bound_state_ == LINE_EMPTY) return; Point_2 ispoint; bool new_point; Line_2_Line_2_pair pair(&_support, &cutter); switch (pair.intersection_type()) { case Line_2_Line_2_pair::NO: - if (cutter.has_on_negative_side(_support.point())) - _bound_state = LINE_EMPTY; + if (cutter.has_on_negative_side(support_.point())) + bound_state_ = LINE_EMPTY; break; case Line_2_Line_2_pair::LINE: break; case Line_2_Line_2_pair::POINT: pair.intersection(ispoint); new_point = false; - switch (sign_of_cross(_support.direction(), cutter.direction())) { + switch (sign_of_cross(support_.direction(), cutter.direction())) { case -1: // new minimum. - if (_bound_state & MIN_UNBOUNDED) { + if (bound_state_ & MIN_UNBOUNDED) { new_point = true; - _bound_state ^= MIN_UNBOUNDED; // exclusive or removes flag. + bound_state_ ^= MIN_UNBOUNDED; // exclusive or removes flag. } else { - if (collinear_order(ispoint, _min) == -1) + if (collinear_order(ispoint, min_) == -1) new_point = true; } if (new_point) { - if (!(_bound_state & MAX_UNBOUNDED) - && collinear_order(ispoint, _max) == -1) - _bound_state = LINE_EMPTY; + if (!(bound_state_ & MAX_UNBOUNDED) + && collinear_order(ispoint, max_) == -1) + bound_state_ = LINE_EMPTY; else - _min = ispoint; + min_ = ispoint; } break; case 0: // should not happen CGAL_kernel_warning_msg(false, "Internal CGAL error."); break; case 1: // new maximum - if (_bound_state & MAX_UNBOUNDED) { + if (bound_state_ & MAX_UNBOUNDED) { new_point = true; - _bound_state ^= MAX_UNBOUNDED; // exclusive or removes flag. + bound_state_ ^= MAX_UNBOUNDED; // exclusive or removes flag. } else { - if (collinear_order(ispoint, _max) == 1) + if (collinear_order(ispoint, max_) == 1) new_point = true; } if (new_point) { - if (!(_bound_state & MIN_UNBOUNDED) - && collinear_order(ispoint, _min) == 1) - _bound_state = LINE_EMPTY; + if (!(bound_state_ & MIN_UNBOUNDED) + && collinear_order(ispoint, min_) == 1) + bound_state_ = LINE_EMPTY; else - _max = ispoint; + max_ = ispoint; } break; } @@ -295,18 +294,18 @@ cut_right_off(Line_2 const & cutter) template int -_Straight_2:: +Straight_2_:: collinear_order(Point_2 const &pt1, Point_2 const & pt2) const -// Compare two points on the _support line. +// Compare two points on the support_ line. // If the second point lies in the direction of the direction vector from // the first point, the result is 1. // Other results are -1 (other side) and 0 (coincidence). { int diffsign; - diffsign = sign(pt2.cartesian(_main_dir)-pt1.cartesian(_main_dir)); + diffsign = sign(pt2.cartesian(main_dir_)-pt1.cartesian(main_dir_)); if (diffsign == 0) return 0; - return (diffsign == _dir_sign) ? 1 : -1; + return (diffsign == dir_sign_) ? 1 : -1; } CGAL_END_NAMESPACE