tuples.cc

来自「一个用MATLAB语言编写的摄像机标定工具箱,内容丰富」· CC 代码 · 共 87 行

CC
87
字号
//
// tuples.cc
//
// $Id: tuples.cc,v 1.1.1.1 2001/02/28 00:28:40 cstolte Exp $
//

#include <sgl/tuples.h>
#define MINMAX
#include <mathfunc.h>

std::ostream &
operator<<(std::ostream &os, const Tuple2f &t)
{
    os << t.u << ", " << t.v;
    return os;
}

Tuple2f
Tuple2f::min(const Tuple2f &t1, const Tuple2f &t2)
{
    return Tuple2f(::min(t1.u, t2.u), ::min(t1.v, t2.v));
}

Tuple2f
Tuple2f::max(const Tuple2f &t1, const Tuple2f &t2)
{
    return Tuple2f(::max(t1.u, t2.u), ::max(t1.v, t2.v));
}

std::ostream &
operator<<(std::ostream &os, const Tuple2d &t)
{
    os << t.u << ", " << t.v;
    return os;
}

Tuple2d
Tuple2d::min(const Tuple2d &t1, const Tuple2d &t2)
{
    return Tuple2d(::min(t1.u, t2.u), ::min(t1.v, t2.v));
}

Tuple2d
Tuple2d::max(const Tuple2d &t1, const Tuple2d &t2)
{
    return Tuple2d(::max(t1.u, t2.u), ::max(t1.v, t2.v));
}

std::ostream &
operator<<(std::ostream &os, const Tuple3f &t)
{
    os << t.x << ", " << t.y << ", " << t.z;
    return os;
}

Tuple3f
Tuple3f::min(const Tuple3f &t1, const Tuple3f &t2)
{
    return Tuple3f(::min(t1.x, t2.x), ::min(t1.y, t2.y), ::min(t1.z, t2.z));
}

Tuple3f
Tuple3f::max(const Tuple3f &t1, const Tuple3f &t2)
{
    return Tuple3f(::max(t1.x, t2.x), ::max(t1.y, t2.y), ::max(t1.z, t2.z));
}

std::ostream &
operator<<(std::ostream &os, const Tuple3d &t)
{
    os << t.x << ", " << t.y << ", " << t.z;
    return os;
}

Tuple3d
Tuple3d::min(const Tuple3d &t1, const Tuple3d &t2)
{
    return Tuple3d(::min(t1.x, t2.x), ::min(t1.y, t2.y), ::min(t1.z, t2.z));
}

Tuple3d
Tuple3d::max(const Tuple3d &t1, const Tuple3d &t2)
{
    return Tuple3d(::max(t1.x, t2.x), ::max(t1.y, t2.y), ::max(t1.z, t2.z));
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?