can't tell my left from my right

This commit is contained in:
David Rose 2007-08-15 22:05:25 +00:00
parent 39662c86e0
commit 6f76b082fa
3 changed files with 5 additions and 5 deletions

View File

@ -24,7 +24,7 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE bool EggGroupNode:: INLINE bool EggGroupNode::
is_right(const LVector2d &v1, const LVector2d &v2) { is_right(const LVector2d &v1, const LVector2d &v2) {
return (-v1[0] * v2[1] + v1[1] * v2[0]) > 0; return (v1[0] * v2[1] - v1[1] * v2[0]) > 0;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -183,7 +183,7 @@ protected:
CoordinateSystem coordsys, CoordinateSystem coordsys,
BamCacheRecord *record); BamCacheRecord *record);
private: PUBLISHED:
INLINE static bool is_right(const LVector2d &v1, const LVector2d &v2); INLINE static bool is_right(const LVector2d &v1, const LVector2d &v2);
private: private:

View File

@ -51,7 +51,7 @@ PGItem::BackgroundFocus PGItem::_background_focus;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE bool INLINE bool
is_right(const LVector2f &v1, const LVector2f &v2) { is_right(const LVector2f &v1, const LVector2f &v2) {
return (-v1[0] * v2[1] + v1[1] * v2[0]) > 0; return (v1[0] * v2[1] - v1[1] * v2[0]) > 0;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -1272,12 +1272,12 @@ clip_frame(pvector<LPoint2f> &source_points, const Planef &plane) const {
new_points.reserve(source_points.size() + 1); new_points.reserve(source_points.size() + 1);
LPoint2f last_point = source_points.back(); LPoint2f last_point = source_points.back();
bool last_is_in = !is_right(last_point - from2d, delta2d); bool last_is_in = is_right(last_point - from2d, delta2d);
bool all_in = last_is_in; bool all_in = last_is_in;
pvector<LPoint2f>::const_iterator pi; pvector<LPoint2f>::const_iterator pi;
for (pi = source_points.begin(); pi != source_points.end(); ++pi) { for (pi = source_points.begin(); pi != source_points.end(); ++pi) {
const LPoint2f &this_point = (*pi); const LPoint2f &this_point = (*pi);
bool this_is_in = !is_right(this_point - from2d, delta2d); bool this_is_in = is_right(this_point - from2d, delta2d);
// There appears to be a compiler bug in gcc 4.0: we need to // There appears to be a compiler bug in gcc 4.0: we need to
// extract this comparison outside of the if statement. // extract this comparison outside of the if statement.