66 double s = std::sin(angler);
67 double c = std::cos(angler);
84 os <<
"(" << q.
x <<
", " << q.
y <<
")";
149 double limit =
dot(p) * epsilon * epsilon;
150 return ((*
this - p).
mag2() <= limit);
155 double d = (*
this - p).
mag2();
157 if ((pdp > 0) && (d < pdp))
159 return std::sqrt(d / pdp);
161 else if ((pdp == 0) && (d == 0))
175 double v1v2 = std::fabs(
dot(v));
179 return ((
mag2() == 0) && (v.
mag2() == 0)) ? 0 : 1;
181 double abscross = std::fabs(
x * v.
y -
y - v.
x);
182 if (abscross >= v1v2)
188 return abscross / v1v2;
193 double epsilon)
const
197 double v1v2 = std::fabs(
dot(v));
201 return ((
mag2() == 0) && (v.
mag2() == 0));
203 double abscross = std::fabs(
x * v.
y -
y - v.
x);
204 return (abscross <= epsilon * v1v2);
211 double v1v2 = std::fabs(
dot(v));
216 double abscross = std::fabs(
x * v.
y -
y - v.
x);
217 if (v1v2 >= abscross)
223 return v1v2 / abscross;
228 double epsilon)
const
232 double v1v2 = std::fabs(
dot(v));
233 double abscross = std::fabs(
x * v.
y -
y - v.
x);
234 return (v1v2 <= epsilon * abscross);
static double setTolerance(double tol)
bool isParallel(const UVector2 &p, double epsilon=tolerance) const
std::ostream & operator<<(std::ostream &os, const UVector2 &q)
bool isOrthogonal(const UVector2 &p, double epsilon=tolerance) const
int compare(const UVector2 &v) const
double howParallel(const UVector2 &p) const
UVector2 operator/(const UVector2 &p, double a)
double howOrthogonal(const UVector2 &p) const
bool operator<(const UVector2 &v) const
bool isNear(const UVector2 &p, double epsilon=tolerance) const
bool operator>=(const UVector2 &v) const
double howNear(const UVector2 &p) const
bool operator>(const UVector2 &v) const
double operator()(int i) const
bool operator<=(const UVector2 &v) const
double dot(const UVector2 &p) const