27 Pt2 (
double x,
double y,
double w) {
pt[0] = x;
pt[1] = y;
pt[2] =
w; }
29 Pt2 (
const char *coord_str);
40 inline bool operator== (
Pt2 &rhs) {
48 return !((*this) == rhs);
57 for (
unsigned i = 0 ; i < 2 ; ++i ) {
67 for (
unsigned i = 0 ; i < 2 ; ++i ) {
76 for (
unsigned i = 0 ; i < 2 ; ++i ) {
86 inline void print(
char const *s)
const { printf (
"%s(%8.2f : %8.2f : %8.2f)\n", s,
pt[0],
pt[1],
pt[2]); }
96 Pt3 (
double x,
double y,
double z,
double w) {
pt[0] = x;
pt[1] = y;
pt[2] = z;
pt[3] =
w; }
97 Pt3 (
const char *coord_str);
99 inline bool operator== (
Pt3 &rhs) {
114 for (
unsigned i = 0 ; i < 3 ; ++i ) {
124 for (
unsigned i = 0 ; i < 3 ; ++i ) {
133 for (
unsigned i = 0 ; i < 3 ; ++i ) {
151 inline void print(
char const *s)
const {
152 printf (
"%s(%8.2f : %8.2f : %8.2f : %8.2f)\n", s,
pt[0],
pt[1],
pt[2],
pt[3]);
Cartesian point / 2D vector and related operations.
Two-dimensional point that doubles as a vector.
Pt2 operator*(double const s) const
Pt2 operator+(Pt2 &rhs) const
double operator[](unsigned int index) const
Pt2 operator-(Pt2 &rhs) const
bool operator!=(Pt2 &rhs)
void print(char const *s) const
Pt2(double x, double y, double w)
Pt2(Geom::Point const &point)
Pt3 operator*(double const s) const
Pt3(double x, double y, double z, double w)
double operator[](unsigned int index) const
Pt3 operator-(Pt3 &rhs) const
Pt3 operator+(Pt3 &rhs) const
void print(char const *s) const
constexpr Coord infinity()
Get a value representing infinity.
Generic auxiliary routines for 3D axes.