快速求出三角形其它两个点的索引
2008-08-01 01:20
162 查看
inline void tri_get_other_vert_index( int i,int& a,int& b )
{
static int other_index_1[3] = {1,0,0};
static int other_index_2[3] = {2,2,1};
a = other_index_1[i];
b = other_index_2[i];
}
通常用在循环处理三个顶点时,每次都需要得到另外两个顶点时;也可用于得到快速得到另外两条边.
如果用条件判断,那么每个循环至少需要判断2次,如下所示:
inline void tri_get_other_vert_index( int i,int& a,int& b )
{
if( i == 0 )
a = 1,b=2;
else if( i == 1)
a = 0,b=2;
else
a = 0,b=2;
}
{
static int other_index_1[3] = {1,0,0};
static int other_index_2[3] = {2,2,1};
a = other_index_1[i];
b = other_index_2[i];
}
通常用在循环处理三个顶点时,每次都需要得到另外两个顶点时;也可用于得到快速得到另外两条边.
如果用条件判断,那么每个循环至少需要判断2次,如下所示:
inline void tri_get_other_vert_index( int i,int& a,int& b )
{
if( i == 0 )
a = 1,b=2;
else if( i == 1)
a = 0,b=2;
else
a = 0,b=2;
}
相关文章推荐
- 快速索引 (对View的自定义,黑马程序员)
- 举两个例子以快速明白Java中的简单工厂模式
- 如何快速找到一个整数的两个最接近的因子
- 快速索引
- 快速辅助索引创建(innodb plugin)
- 两个整形数交换的算法,不使用其它变量
- Order by/子查询 吸收索引 快速测试 ....
- 自定义侧边快速索引栏
- JS实现快速比较两个字符串中包含有相同数字的方法
- java把两个有序的list合并的最快速的方法
- 快速算法的两个实现方法
- qt creator 快速入门 知识点索引 笔记
- 三角形类--两个类之间的联系
- 查询访问同一表的两个以上索引(一)
- 叉乘、快速排斥与跨立实验及求取三角形面积
- 两个变量交换值的方法 按位异或 快速交换两个变量。
- 快速索引
- 没有索引也可以快速查询
- Xcode中如何快速切换两个项目
- PHP中2种方法快速地合并数组,你知道吗?合并两个数组有几种方式,试比较它们的异同