27 #include "sgcommon.hpp"
55 {
x[0] = _x0;
x[1] = _x1; }
61 int size ()
const {
return x.size();}
65 double norm()
const {
return std::sqrt((*
this)*(*
this));}
188 template<
class Archive>
194 friend class boost::serialization::access;
static double distance(const SGPoint &p0, const SGPoint &p1)
Calculates distance between p0 and p1 in the sup-norm.
Definition: sgpoint.cpp:96
SGPoint & operator-=(const SGPoint &rhs)
Augmented subtraction.
Definition: sgpoint.cpp:184
friend SGPoint operator/(const SGPoint &point, double d)
Right scalar division.
Definition: sgpoint.cpp:233
void serialize(Archive &ar, const unsigned int version)
Serialize an SGPoint.
Definition: sgpoint.hpp:189
double & operator[](int player)
Access operator.
Definition: sgpoint.hpp:96
double angle(const SGPoint &base) const
Returns the angle in radians relative to base.
Definition: sgpoint.cpp:43
SGPoint & operator/=(double d)
Augmented scalar division.
Definition: sgpoint.cpp:206
SGPoint & operator*=(double d)
Augmented scalar multiplication.
Definition: sgpoint.cpp:199
int size() const
Returns the number of coordinates.
Definition: sgpoint.hpp:61
SGPoint()
Default constructor that sets vector equal to zero.
Definition: sgpoint.hpp:41
SGPoint(int n)
Creates an n dimensional zero vector.
Definition: sgpoint.hpp:45
bool operator<(const SGPoint &rhs) const
Strictly less.
Definition: sgpoint.cpp:275
SGPoint getNormal() const
Returns the counter-clockwise normal vector.
Definition: sgpoint.cpp:37
void max(const SGPoint &p)
Takes the pointwise minimum with another SGPoint.
Definition: sgpoint.cpp:119
static double intersectRay(SGPoint &intersection, SGPoint &weights, const SGPoint &pivot, const SGPoint &direction, const SGPoint &t0, const SGPoint &t1)
Calculates intersection of a segment with a ray.
SGPoint(vector< double > _x)
Creates an SGPoint from the two-vector _x.
Definition: sgpoint.hpp:49
static double signedArea(const SGPoint &p0, const SGPoint &p1, const SGPoint &p2)
Calculates determinant.
Definition: sgpoint.cpp:332
double norm() const
Returns the Euclidean norm.
Definition: sgpoint.hpp:65
const SGPoint operator-(const SGPoint &rhs) const
Vector subtraction.
Definition: sgpoint.cpp:219
bool rotateCW(double pi)
Rotates the point clockwise by pi radians.
Definition: sgpoint.hpp:77
static double invertSystem(SGPoint &x, const SGPoint &b, const SGPoint &a0, const SGPoint &a1)
Inverts a linear system.
Definition: sgpoint.cpp:315
const SGPoint operator+(const SGPoint &rhs) const
Vector addition.
Definition: sgpoint.cpp:216
friend SGPoint operator*(double d, const SGPoint &point)
Left-scalar multiplication.
Definition: sgpoint.cpp:227
const double & operator[](int player) const
Constant access operator.
Definition: sgpoint.hpp:105
bool operator>(const SGPoint &rhs) const
Strictly greater.
Definition: sgpoint.cpp:265
void roundPoint(double tol)
Rounds off significant digits smaller than tol.
Definition: sgpoint.cpp:340
static SGPoint cross(const SGPoint &p0, const SGPoint &p1)
Cross product for 3-vectors.
Definition: sgpoint.cpp:106
void min(const SGPoint &p)
Takes the pointwise minimum with another SGPoint.
Definition: sgpoint.cpp:126
bool operator<=(const SGPoint &rhs) const
Less than or equal.
Definition: sgpoint.cpp:267
bool normalize()
Normalizes so that the norm is one.
Definition: sgpoint.cpp:82
vector< double > x
Definition: sgpoint.hpp:37
A vector in .
Definition: sgpoint.hpp:35
bool rotateCCW(double pi)
Rotates the point clockwise by pi radians.
Definition: sgpoint.cpp:73
bool anyNaN() const
Checks if any of the entries are NaN.
Definition: sgpoint.cpp:27
bool operator==(const SGPoint &rhs) const
Equality.
Definition: sgpoint.cpp:244
SGPoint(double _x0, double _x1)
Creates an SGPoint with elements x and y.
Definition: sgpoint.hpp:54
SGPoint(int n, double _x)
Creates an n dimensional zero vector.
Definition: sgpoint.hpp:47
SGPoint & operator=(const SGPoint &rhs)
Assignment operator.
Definition: sgpoint.cpp:159
friend ostream & operator<<(ostream &out, const SGPoint &rhs)
Output SGPoint to ostream.
Definition: sgpoint.cpp:296
~SGPoint()
Destructor.
Definition: sgpoint.hpp:58
bool operator>=(const SGPoint &rhs) const
Greater than or equal.
Definition: sgpoint.cpp:257
SGPoint & operator+=(const SGPoint &rhs)
Augmented addition.
Definition: sgpoint.cpp:176
void plusWithWeight(const SGPoint &p, double w)
Plus with weight.
Definition: sgpoint.cpp:133
SGPoint(double _x)
Sets both elements of the vector equal to x.
Definition: sgpoint.hpp:43
bool operator!=(const SGPoint &rhs) const
Not equls.
Definition: sgpoint.cpp:254
Definition: sgtuple.hpp:52