BoundingBox3D RayTriangle::setBoundingBox(void){ Point3D pList[3]; pList[0]=v[0]->position; pList[1]=v[1]->position; pList[2]=v[2]->position; bBox=BoundingBox3D(pList,3); for(int i=0;i<3;i++){ bBox.p[0][i]-=RAYEPS; bBox.p[1][i]+=RAYEPS; } return bBox; }
void PSystem::update() { //cout << ofGetLastFrameTime() << endl; bb = BoundingBox3D(userPosition.x,userPosition.y,userPosition.z,bbW,bbH,bbD); field.update(ofGetLastFrameTime(),bb); flocker.update(ofGetLastFrameTime(),particles); for(int i=0;i<particles.size();i++){ if(!flocker.getIsFollowing(i) && !(particles[i].state==RibbonParticle::Hiding)) particles[i].target.set(field.getParticle(&particles[i])); particles[i].update(ofGetLastFrameTime(),bb); } }
BoundingBox3D RayGroup::setBoundingBox(void){ Point3D* pList; BoundingBox3D tBBox; pList=new Point3D[sNum*2]; for(int i=0;i<sNum;i++){ tBBox=shapes[i]->setBoundingBox(); pList[2*i ]=tBBox.p[0]; pList[2*i+1]=tBBox.p[1]; } tBBox=BoundingBox3D(pList,sNum*2); delete[] pList; bBox=tBBox.transform(getMatrix()); return bBox; }
BoundingBox3D RayTriangle::setBoundingBox(void){ float mx = 1e10; float mn = 1e-10; Point3D p1 = Point3D(mx, mx, mx); Point3D p2 = Point3D(mn, mn, mn); for(int i = 0; i < 3; i++){ p1[0] = fmin(p1[0], v[i]->position[0]); p1[1] = fmin(p1[1], v[i]->position[1]); p1[2] = fmin(p1[2], v[i]->position[2]); p2[0] = fmax(p2[0], v[i]->position[0]); p2[1] = fmax(p2[1], v[i]->position[1]); p2[2] = fmax(p2[2], v[i]->position[2]); } return bBox = BoundingBox3D(p1, p2); }
BoundingBox3D Triangle3D::getBoundingBox() { float minX, minY, minZ; float maxX, maxY, maxZ; minX = minY = minZ = 10000000.0; maxX = maxY = maxZ = -10000000.0; for (int i = 0; i<3; i++) { if (minX > this->v[i].x()) minX = this->v[i].x(); if (minY > this->v[i].y()) minY = this->v[i].y(); if (minZ > this->v[i].z()) minZ = this->v[i].z(); if (maxX < this->v[i].x()) maxX = this->v[i].x(); if (maxY < this->v[i].y()) maxY = this->v[i].y(); if (maxZ < this->v[i].z()) maxZ = this->v[i].z(); } EigenVector3 minV(minX, minY, minZ); EigenVector3 maxV(maxX, maxY, maxZ); return BoundingBox3D(minV, maxV); }
BoundingBox3D RayCone::setBoundingBox(void){ Point3D p; p=Point3D(radius,height/2,radius); bBox=BoundingBox3D(center+p,center-p); return bBox; }
BoundingBox3D RayBox::setBoundingBox(void){ bBox=BoundingBox3D(center-(length/2),center+(length/2)); return bBox; }
BoundingBox3D RaySphere::setBoundingBox(void){ Point3D p1 = Point3D(center[0] - radius, center[1] - radius, center[2] - radius); Point3D p2 = Point3D(center[0] + radius, center[1] + radius, center[2] + radius); return bBox = BoundingBox3D(p1, p2); }
BoundingBox3D StartPointObject::getBoundingBox() const { return BoundingBox3D(MAP_EDITOR_STARTPOINT_LENGTH*2.0, MAP_EDITOR_STARTPOINT_HEIGHT*2.0, MAP_EDITOR_STARTPOINT_LENGTH*2.0, getPosition()); }
BoundingBox3D FinishPlaneObject::getBoundingBox() const { return BoundingBox3D(MAP_EDITOR_FINISH_PLANE_BOX_SIZE, MAP_EDITOR_FINISH_PLANE_BOX_SIZE, MAP_EDITOR_FINISH_PLANE_BOX_SIZE, getPosition()); }