📄 tuples.h
字号:
//
// tuples.h
//
// $Id: tuples.h,v 1.1.1.1 2001/02/28 00:28:40 cstolte Exp $
//
#ifndef SGL_TUPLES_H
#define SGL_TUPLES_H
#include <sgl/defs.h>
//////////
// Tuple2f
struct Tuple2f {
Tuple2f() { }
Tuple2f(float a, float b) { u = a; v = b; }
float u, v;
void glVertex() const;
bool operator==(const Tuple2f &t2) const { return u == t2.u && v == t2.v; }
bool operator!=(const Tuple2f &t2) const { return u != t2.u || v != t2.v; }
static Tuple2f min(const Tuple2f &, const Tuple2f &);
static Tuple2f max(const Tuple2f &, const Tuple2f &);
};
extern std::ostream &operator<<(std::ostream &, const Tuple2f &);
//////////
// Tuple2d
struct Tuple2d {
Tuple2d() { }
Tuple2d(double a, double b) { u = a; v = b; }
double u, v;
void glVertex() const;
bool operator==(const Tuple2d &t2) const { return u == t2.u && v == t2.v; }
bool operator!=(const Tuple2d &t2) const { return u != t2.u || v != t2.v; }
static Tuple2d min(const Tuple2d &, const Tuple2d &);
static Tuple2d max(const Tuple2d &, const Tuple2d &);
};
extern std::ostream &operator<<(std::ostream &, const Tuple2d &);
//////////
// Tuple3f
struct Tuple3f {
Tuple3f() { }
Tuple3f(float a, float b, float c) { x = a; y = b; z = c; }
float x, y, z;
bool operator==(const Tuple3f &t2) const
{ return x == t2.x && y == t2.y && z == t2.z; }
bool operator!=(const Tuple3f &t2) const
{ return x != t2.x || y != t2.y || z != t2.z; }
void glVertex() const;
void glNormal() const;
static Tuple3f min(const Tuple3f &, const Tuple3f &);
static Tuple3f max(const Tuple3f &, const Tuple3f &);
};
extern std::ostream &operator<<(std::ostream &, const Tuple3f &);
//////////
// Tuple3d
struct Tuple3d {
Tuple3d() { }
Tuple3d(double a, double b, double c) { x = a; y = b; z = c; }
double x, y, z;
bool operator==(const Tuple3d &t2) const
{ return x == t2.x && y == t2.y && z == t2.z; }
bool operator!=(const Tuple3d &t2) const
{ return x != t2.x || y != t2.y || z != t2.z; }
void glVertex() const;
void glNormal() const;
static Tuple3d min(const Tuple3d &, const Tuple3d &);
static Tuple3d max(const Tuple3d &, const Tuple3d &);
};
extern std::ostream &operator<<(std::ostream &, const Tuple3d &);
#endif // SGL_TUPLES_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -