Fixing Windows build

This commit is contained in:
Matthias Koefferlein 2023-08-23 00:03:59 +02:00
parent 9153763a1c
commit 6027510c19
1 changed files with 74 additions and 122 deletions

View File

@ -270,12 +270,22 @@ public:
* Scaling involves rounding which in our case is simply handled * Scaling involves rounding which in our case is simply handled
* with the coord_traits scheme. * with the coord_traits scheme.
*/ */
point<C> &operator*= (double s); point<C> &operator*= (double s)
{
m_x = coord_traits::rounded (m_x * s);
m_y = coord_traits::rounded (m_y * s);
return *this;
}
/** /**
* @brief Scaling self by some integer factor * @brief Scaling self by some integer factor
*/ */
point<C> &operator*= (long s); point<C> &operator*= (long s)
{
m_x = coord_traits::rounded (m_x * s);
m_y = coord_traits::rounded (m_y * s);
return *this;
}
/** /**
* @brief Division by some divisor. * @brief Division by some divisor.
@ -284,62 +294,114 @@ public:
* with the coord_traits scheme. * with the coord_traits scheme.
*/ */
point<C> &operator/= (double s); point<C> &operator/= (double s)
{
double mult = 1.0 / static_cast<double>(s);
*this *= mult;
return *this;
}
/** /**
* @brief Dividing self by some integer divisor * @brief Dividing self by some integer divisor
*/ */
point<C> &operator/= (long s); point<C> &operator/= (long s)
{
double mult = 1.0 / static_cast<double>(s);
*this *= mult;
return *this;
}
/** /**
* @brief The euclidian distance to another point * @brief The euclidian distance to another point
* *
* @param d The other to compute the distance to. * @param d The other to compute the distance to.
*/ */
distance_type distance (const point<C> &p) const; distance_type distance (const point<C> &p) const
{
double ddx (p.x ());
double ddy (p.y ());
ddx -= double (x ());
ddy -= double (y ());
return coord_traits::rounded_distance (sqrt (ddx * ddx + ddy * ddy));
}
/** /**
* @brief The euclidian distance of the point to (0,0) * @brief The euclidian distance of the point to (0,0)
*/ */
distance_type distance () const; distance_type distance () const
{
double ddx (x ());
double ddy (y ());
return coord_traits::rounded_distance (sqrt (ddx * ddx + ddy * ddy));
}
/** /**
* @brief The euclidian distance to another point as double value * @brief The euclidian distance to another point as double value
* *
* @param d The other to compute the distance to. * @param d The other to compute the distance to.
*/ */
double double_distance (const point<C> &p) const; double double_distance (const point<C> &p) const
{
double ddx (p.x ());
double ddy (p.y ());
ddx -= double (x ());
ddy -= double (y ());
return sqrt (ddx * ddx + ddy * ddy);
}
/** /**
* @brief The euclidian distance of the point to (0,0) as double value * @brief The euclidian distance of the point to (0,0) as double value
*/ */
double double_distance () const; double double_distance () const
{
double ddx (x ());
double ddy (y ());
return sqrt (ddx * ddx + ddy * ddy);
}
/** /**
* @brief The square euclidian distance to another point * @brief The square euclidian distance to another point
* *
* @param d The other to compute the distance to. * @param d The other to compute the distance to.
*/ */
area_type sq_distance (const point<C> &p) const; area_type sq_distance (const point<C> &p) const
{
return coord_traits::sq_length (p.x (), p.y (), x (), y ());
}
/** /**
* @brief The square euclidian distance to point (0,0) * @brief The square euclidian distance to point (0,0)
* *
* @param d The other to compute the distance to. * @param d The other to compute the distance to.
*/ */
area_type sq_distance () const; area_type sq_distance () const
{
return coord_traits::sq_length (0, 0, x (), y ());
}
/** /**
* @brief The square of the euclidian distance to another point as double value * @brief The square of the euclidian distance to another point as double value
* *
* @param d The other to compute the distance to. * @param d The other to compute the distance to.
*/ */
double sq_double_distance (const point<C> &p) const; double sq_double_distance (const point<C> &p) const
{
double ddx (p.x ());
double ddy (p.y ());
ddx -= double (x ());
ddy -= double (y ());
return ddx * ddx + ddy * ddy;
}
/** /**
* @brief The square of the euclidian distance of the point to (0,0) as double value * @brief The square of the euclidian distance of the point to (0,0) as double value
*/ */
double sq_double_distance () const; double sq_double_distance () const
{
double ddx (x ());
double ddy (y ());
return ddx * ddx + ddy * ddy;
}
/** /**
* @brief String conversion * @brief String conversion
@ -454,116 +516,6 @@ operator/ (const db::point<C> &p, Number s)
return point<C> (p.x () * mult, p.y () * mult); return point<C> (p.x () * mult, p.y () * mult);
} }
template <class C>
inline point<C> &
point<C>::operator/= (double s)
{
double mult = 1.0 / static_cast<double>(s);
*this *= mult;
return *this;
}
template <class C>
inline point<C> &
point<C>::operator/= (long s)
{
double mult = 1.0 / static_cast<double>(s);
*this *= mult;
return *this;
}
template <class C>
inline point<C> &
point<C>::operator*= (double s)
{
m_x = coord_traits::rounded (m_x * s);
m_y = coord_traits::rounded (m_y * s);
return *this;
}
template <class C>
inline point<C> &
point<C>::operator*= (long s)
{
m_x = coord_traits::rounded (m_x * s);
m_y = coord_traits::rounded (m_y * s);
return *this;
}
template <class C>
inline typename point<C>::distance_type
point<C>::distance (const point<C> &p) const
{
double ddx (p.x ());
double ddy (p.y ());
ddx -= double (x ());
ddy -= double (y ());
return coord_traits::rounded_distance (sqrt (ddx * ddx + ddy * ddy));
}
template <class C>
inline typename point<C>::distance_type
point<C>::distance () const
{
double ddx (x ());
double ddy (y ());
return coord_traits::rounded_distance (sqrt (ddx * ddx + ddy * ddy));
}
template <class C>
inline double
point<C>::double_distance (const point<C> &p) const
{
double ddx (p.x ());
double ddy (p.y ());
ddx -= double (x ());
ddy -= double (y ());
return sqrt (ddx * ddx + ddy * ddy);
}
template <class C>
inline double
point<C>::double_distance () const
{
double ddx (x ());
double ddy (y ());
return sqrt (ddx * ddx + ddy * ddy);
}
template <class C>
inline typename point<C>::area_type
point<C>::sq_distance (const point<C> &p) const
{
return coord_traits::sq_length (p.x (), p.y (), x (), y ());
}
template <class C>
inline typename point<C>::area_type
point<C>::sq_distance () const
{
return coord_traits::sq_length (0, 0, x (), y ());
}
template <class C>
inline double
point<C>::sq_double_distance (const point<C> &p) const
{
double ddx (p.x ());
double ddy (p.y ());
ddx -= double (x ());
ddy -= double (y ());
return ddx * ddx + ddy * ddy;
}
template <class C>
inline double
point <C>::sq_double_distance () const
{
double ddx (x ());
double ddy (y ());
return ddx * ddx + ddy * ddy;
}
/** /**
* @brief The binary + operator (addition point and vector) * @brief The binary + operator (addition point and vector)
* *