本文整理汇总了C++中Octree::add方法的典型用法代码示例。如果您正苦于以下问题:C++ Octree::add方法的具体用法?C++ Octree::add怎么用?C++ Octree::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Octree
的用法示例。
在下文中一共展示了Octree::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addSphere
void addSphere()
{
if(spheres.size()>=MAX) return ;
GLfloat r, x, y, z, vx, vy, vz;
int signo;
r = (rand()/ (RAND_MAX + 1.0))/2.75 + 0.3;
signo = pow(-1.0, (rand()%2)+1); //Generates 1 or 2
x = signo*(rand()%12)/(rand()%12 + 1.0);
y = (rand()%15)/(rand()%15+1.0) + 10.0;
signo = pow(-1.0, (rand()%2)+1);
z = signo*(rand()%12)/(rand()%12 + 1.0);
signo = pow(-1.0, (rand()%2)+1);
vx = signo*(rand()%2+1);
signo = pow(-1.0, (rand()%2)+1);
vy = signo*(rand()%2+1);
signo = pow(-1.0, (rand()%2)+1);
vz = signo*(rand()%2+1);
GLint tex=rand()%8;
Vector3 pos(x,y,z), vel(vx,vy,vz);
//cout << "r: "<< r << " pos: " << pos << " vel: " << vel << " tex: "<< texNames[tex] << endl;
Sphere *s = new Sphere(r,pos,vel,texts[tex], quad);
spheres.push_back(s);
octree.add(s);
}
示例2: octree
int
main (int argc, char** argv)
{
OBJReader reader;
PointCloud cloud;
Octree octree (10);
reader.read (argv[1], cloud);
std::cout << "size:" << cloud.size () << std::endl;
octree.add (cloud);
std::cout << "leafs:" << octree.getLeafCount () << std::endl;
return 0;
}
示例3: main
void main() {
setuptriglookup();
allegrosetup(scrwid,scrhei);
makepalette(&greypalette);
mypalette(255,0,0,0);
mypalette(0,0,0,0);
mypalette(255,1,1,1);
mypalette(128,0,0,0);
for (int r=0;r<16;r++) {
for (int g=0;g<16;g++) {
int palc=r+g*16;
mypalette(palc,(r==0?0:brightness+0.2+change*0.5*r/15.0),(g==0?0:brightness+change*0.1+0.2*g/15.0),(g==0?0:brightness+change*0.2+0.6*g/15.0));
// Groovy colours mypalette(palc,(r==0?0:0.1+0.6*r/15.0),(g==0?0:0.1+0.2*g/15.0),(g==0?0:0.1+0.7*g/15.0));
// Good colours: mypalette(palc,(r==0?0:0.3+0.4*r/15.0),(g==0?0:0.1+0.2*g/15.0),(g==0?0:0.3+0.5*g/15.0));
}
}
float pd=2.5;
PPsetup(scrwid,scrhei,pd);
V3d vel=V3d(0,0,0);
V3d acc=V3d(0,0,0);
float droll=0;
float dyaw=0;
float dpitch=0;
int frame=0;
// Set up track
randomise();
for (int i=0;i<=15;i++) {
waves+Wave();
// waves.num(i).display();
}
for (float thru=0;thru<1.0;thru+=1.0/(float)numps) {
V3d here=getpos(thru);
V3d forward=getpos(thru+0.00001)-here;
V3d up=V3d::normcross(V3d::crazy,forward);
V3d right=V3d::normcross(forward,up);
for (int i=0;i<tunnelps;i++) {
float t=2*pi*(float)i/(float)tunnelps;
float s=sin(t);
float c=cos(t);
V3d v=here+tunnelrad*(s*up+c*right);
octree.add(v);
}
}
for (int i=1;i<500;i++) {
octree.add(8.0*V3d(floatrnd(-1,1),floatrnd(-1,1),floatrnd(-1,1)));
}
// Display track
float t=0;
do {
t=t+0.03;
V3d from=V3d::rotate(6.0*V3d::k,V3d::j,t);
ori.forcez(from.neg());
pos=from;
plotscene();
writescreen();
} while (!key[KEY_SPACE]);
do {
} while (key[KEY_SPACE]);
// Race
starttimer();
float thru=0;
float marker=0;
pos=getpos(marker);
V3d *tail=new V3d[taillen];
int tailpos=0;
do {
thru+=0.001;
// V3d last=V3d(pos.x,pos.y,pos.z);
// V3d pos=getpos(thru);
// V3d next=getpos(thru+0.00001);
// V3d newz=next-pos;
// ori.forcez(newz);
frame++;
// float pd=1.6+1.3*sin(2*pi*frame/1000.0);
plotscene();
// Plot and move marker
V3d m;
for (int i=1;i<=15;i++) {
m=V3d::disorientate(getpos(marker)-pos,ori);
if (m.mod()<markerrange)
marker+=0.0002;
}
float u=PPgetunitnoadd(m);
bool plot=false;
if (u) {
int x,y;
float rad=0.12*u;
if (PPgetscrposnoadd(m,PPlefteye,&x,&y))
if (left.inimage(x,y)) {
plot=true;
//.........这里部分代码省略.........