mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
Added fmax and fmin operators to vector
This commit is contained in:
parent
82ccb687e4
commit
947294fe99
@ -558,6 +558,28 @@ operator /= (FLOATTYPE scalar) {
|
|||||||
_v.v._1 *= recip_scalar;
|
_v.v._1 *= recip_scalar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: LVecBase2::fmax
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
|
||||||
|
fmax(const FLOATNAME(LVecBase2) &other) {
|
||||||
|
return FLOATNAME(LVecBase2)(_v.v._0 > other._v.v._0 ? _v.v._0 : other._v.v._0,
|
||||||
|
_v.v._1 > other._v.v._1 ? _v.v._1 : other._v.v._1);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: LVecBase2::fmin
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
|
||||||
|
fmin(const FLOATNAME(LVecBase2) &other) {
|
||||||
|
return FLOATNAME(LVecBase2)(_v.v._0 < other._v.v._0 ? _v.v._0 : other._v.v._0,
|
||||||
|
_v.v._1 < other._v.v._1 ? _v.v._1 : other._v.v._1);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: LVecBase2::almost_equal
|
// Function: LVecBase2::almost_equal
|
||||||
// Access: Public
|
// Access: Public
|
||||||
|
@ -107,6 +107,9 @@ PUBLISHED:
|
|||||||
INLINE_LINMATH void operator *= (FLOATTYPE scalar);
|
INLINE_LINMATH void operator *= (FLOATTYPE scalar);
|
||||||
INLINE_LINMATH void operator /= (FLOATTYPE scalar);
|
INLINE_LINMATH void operator /= (FLOATTYPE scalar);
|
||||||
|
|
||||||
|
INLINE_LINMATH FLOATNAME(LVecBase2) fmax(const FLOATNAME(LVecBase2) &other);
|
||||||
|
INLINE_LINMATH FLOATNAME(LVecBase2) fmin(const FLOATNAME(LVecBase2) &other);
|
||||||
|
|
||||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase2) &other,
|
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase2) &other,
|
||||||
FLOATTYPE threshold) const;
|
FLOATTYPE threshold) const;
|
||||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase2) &other) const;
|
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase2) &other) const;
|
||||||
|
@ -718,6 +718,30 @@ operator /= (FLOATTYPE scalar) {
|
|||||||
_v.v._2 *= recip_scalar;
|
_v.v._2 *= recip_scalar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: LVecBase3::fmax
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||||
|
fmax(const FLOATNAME(LVecBase3) &other) {
|
||||||
|
return FLOATNAME(LVecBase3)(_v.v._0 > other._v.v._0 ? _v.v._0 : other._v.v._0,
|
||||||
|
_v.v._1 > other._v.v._1 ? _v.v._1 : other._v.v._1,
|
||||||
|
_v.v._2 > other._v.v._2 ? _v.v._2 : other._v.v._2);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: LVecBase3::fmin
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||||
|
fmin(const FLOATNAME(LVecBase3) &other) {
|
||||||
|
return FLOATNAME(LVecBase3)(_v.v._0 < other._v.v._0 ? _v.v._0 : other._v.v._0,
|
||||||
|
_v.v._1 < other._v.v._1 ? _v.v._1 : other._v.v._1,
|
||||||
|
_v.v._2 < other._v.v._2 ? _v.v._2 : other._v.v._2);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: LVecBase3::cross product (with assigment)
|
// Function: LVecBase3::cross product (with assigment)
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -115,6 +115,9 @@ PUBLISHED:
|
|||||||
INLINE_LINMATH void operator *= (FLOATTYPE scalar);
|
INLINE_LINMATH void operator *= (FLOATTYPE scalar);
|
||||||
INLINE_LINMATH void operator /= (FLOATTYPE scalar);
|
INLINE_LINMATH void operator /= (FLOATTYPE scalar);
|
||||||
|
|
||||||
|
INLINE_LINMATH FLOATNAME(LVecBase3) fmax(const FLOATNAME(LVecBase3) &other);
|
||||||
|
INLINE_LINMATH FLOATNAME(LVecBase3) fmin(const FLOATNAME(LVecBase3) &other);
|
||||||
|
|
||||||
INLINE_LINMATH void cross_into(const FLOATNAME(LVecBase3) &other);
|
INLINE_LINMATH void cross_into(const FLOATNAME(LVecBase3) &other);
|
||||||
|
|
||||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase3) &other,
|
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase3) &other,
|
||||||
|
@ -676,6 +676,32 @@ operator /= (FLOATTYPE scalar) {
|
|||||||
_v.v._3 *= recip_scalar;
|
_v.v._3 *= recip_scalar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: LVecBase4::fmax
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
|
||||||
|
fmax(const FLOATNAME(LVecBase4) &other) {
|
||||||
|
return FLOATNAME(LVecBase4)(_v.v._0 > other._v.v._0 ? _v.v._0 : other._v.v._0,
|
||||||
|
_v.v._1 > other._v.v._1 ? _v.v._1 : other._v.v._1,
|
||||||
|
_v.v._2 > other._v.v._2 ? _v.v._2 : other._v.v._2,
|
||||||
|
_v.v._3 > other._v.v._3 ? _v.v._3 : other._v.v._3);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: LVecBase4::fmin
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
|
||||||
|
fmin(const FLOATNAME(LVecBase4) &other) {
|
||||||
|
return FLOATNAME(LVecBase4)(_v.v._0 < other._v.v._0 ? _v.v._0 : other._v.v._0,
|
||||||
|
_v.v._1 < other._v.v._1 ? _v.v._1 : other._v.v._1,
|
||||||
|
_v.v._2 < other._v.v._2 ? _v.v._2 : other._v.v._2,
|
||||||
|
_v.v._3 < other._v.v._3 ? _v.v._3 : other._v.v._3);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: LVecBase4::almost_equal
|
// Function: LVecBase4::almost_equal
|
||||||
// Access: Public
|
// Access: Public
|
||||||
|
@ -112,6 +112,9 @@ PUBLISHED:
|
|||||||
INLINE_LINMATH void operator *= (FLOATTYPE scalar);
|
INLINE_LINMATH void operator *= (FLOATTYPE scalar);
|
||||||
INLINE_LINMATH void operator /= (FLOATTYPE scalar);
|
INLINE_LINMATH void operator /= (FLOATTYPE scalar);
|
||||||
|
|
||||||
|
INLINE_LINMATH FLOATNAME(LVecBase4) fmax(const FLOATNAME(LVecBase4) &other);
|
||||||
|
INLINE_LINMATH FLOATNAME(LVecBase4) fmin(const FLOATNAME(LVecBase4) &other);
|
||||||
|
|
||||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase4) &other,
|
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase4) &other,
|
||||||
FLOATTYPE threshold) const;
|
FLOATTYPE threshold) const;
|
||||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase4) &other) const;
|
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase4) &other) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user