图形处理中一个比较有用的函数
来源:互联网 发布:eve有没有mac版 编辑:程序博客网 时间:2024/06/04 19:01
// Template minimum
template <class T>
T min(T a, T b)
{
return (a<b)?a:b;
}
// Maximum
template <class T>
T max(T a, T b)
{
return (a>b)?a:b;
}
// Linear interpolation 线性插值
template <class T>
T lerp(T a, T b, float bal)
{
bal = clamp<float>(bal, 0, 1);
return a + (b - a) * bal;
}
// Floating-point absolute using some binary tricks
float absf(float x)
{
*(long *)&x &= 0x7fffffff;
return x;
}
// Makes an int "wrap" to fit in the range 0..255
int wrap(int x)
{
return (x%256);
}
template <class T>
T min(T a, T b)
{
return (a<b)?a:b;
}
// Maximum
template <class T>
T max(T a, T b)
{
return (a>b)?a:b;
}
// Linear interpolation 线性插值
template <class T>
T lerp(T a, T b, float bal)
{
bal = clamp<float>(bal, 0, 1);
return a + (b - a) * bal;
}
// Floating-point absolute using some binary tricks
float absf(float x)
{
*(long *)&x &= 0x7fffffff;
return x;
}
// Makes an int "wrap" to fit in the range 0..255
int wrap(int x)
{
return (x%256);
}
- 图形处理中一个比较有用的函数
- 一个比较少见,但调试有用的函数
- 有用的函数-字符串处理
- 有用的函数-xml处理
- ASP中一个很有用的时间函数
- Matlab中一个很有用的函数:regionprops
- Matlab中一个很有用的函数:regionprops
- 两个比较有用的Javascript工具函数
- JavaScript 数组几个比较有用的函数
- 比较有用的若干EXCEL常用函数
- 有用的函数-日期/日历处理函数
- url的一些正则处理 一个比较高效的函数
- Python中有用的函数
- VS.2005 中比较有用的快捷键
- VS.2005 中比较有用的快捷键
- MATLAB中几个比较有用的程序
- Mysql中一些比较有用的命令
- 一个很有用的图像处理工具箱
- 利用位运算实现四则运算-华为面试
- 计算几何常用算法概览
- MSN P2P 协议实现
- MSN P2P 协议实现 头文件
- html的select标签事件
- 图形处理中一个比较有用的函数
- [arteam] Quickunpack Cff Explorer Extension V.10, by Shub-Nigurrath
- SGI上的一个 map 的程序例子
- C++中得到基本数据类型的取值范围
- 动态连接库的建立与调用(基础)
- 使用STL容器构成一棵树
- JSP 读取 SQL Server 2000 中 image 型数据生成图片文件
- 视频监控系统的搭建之一 硬件选型
- 软件工程学习笔记一