- 积分
- 1411
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-9-7
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
//fract() 取小数
int count=1000;
float offsetx=25,offsety=0.32499998807907104;
for(int i=0;i<=count;i++){
float v=i/count;
float fra=fract(v*offsetx+offsety);
if(fra<0.5){
// do something
}
}
int count=10000;
float offsetx=50,offsety=0.24500000476837158;
for(int i=0;i<=count;i++){
float v=i/count;
float fra=fract(v*offsetx+offsety);
if(fra<0.5){
// do something
}
}
int count=100000;
float offsetx=100,offsety=0.10500000417232513;
for(int i=0;i<=count;i++){
float v=i/count;
float fra=fract(v*offsetx+offsety);
if(fra<0.5){
// do something
}
}
int count=1000000;
float offsetx=200,offsety=-0.16500000655651093;
for(int i=0;i<=count;i++){
float v=i/count;
float fra=fract(v*offsetx+offsety);
if(fra<0.5){
// do something
}
}
要实现在不同的循环中取符合条件的v,例如
第一个循环中取 0.4,0.8
第二个循环中取 0.4,0.6,0.8
第三个循环中取 0.4,0.5,0.6,0.7,0.8
第四个循环中取 0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8
offsetx和offsety应该如何取值或者有怎样的关系?
|
|