Пример #1
0
	void PCModelObject::setCloud(const PCPtr& nuCloud)
	{
		cloud = nuCloud;
		computeBoundingBox(cloud, vMin, vMax);
		setCenter(computeCentroid(cloud));
		cloudScreenCoords = getScreenCoords(cloud);
	}
Пример #2
0
//--------------------------------------------------------------
void PCM::draw() {
    CHECK_ACTIVE;

    ofResetColor();

    if(drawPC) {
        ofPushMatrix();
        ofTranslate(420, 320);
        // we need a proper camera class
        drawPointCloud();
        ofPopMatrix();
    }
    else {
        gKinect->getDepthTextureReference().draw(0, 0, -0.001f, KINECT_DEFAULT_WIDTH, KINECT_DEFAULT_HEIGHT);

        if(IsFeatureActive(FEATURE_SHOW_RGB))
        {
            ofEnableAlphaBlending();
            ofSetColor(255,255,255,128);
            calibratedTex.draw(0,0);
            ofDisableAlphaBlending();
        }

        ofResetColor();

        // Dibujar mesa y objetos detectados
        ofPushMatrix();
        {
            gModel->objectsMutex.lock();
            for (vector<ModelObjectPtr>::const_iterator it = gModel->getObjects().begin(); it != gModel->getObjects().end(); it++)
            {
                (*it)->drawObject();
            }
            gModel->objectsMutex.unlock();

        }
        {
            gModel->tableMutex.lock();
            if(gModel->getTable().get() != NULL)
                gModel->getTable()->draw();
            gModel->tableMutex.unlock();
        }

        ofPopMatrix();

        // dibujar Frustum en ventana de debug
        Frustum::debugDrawFrustum();

        for (map<int, DataTouch>::const_iterator t = touchPoints.begin(); t != touchPoints.end(); ++t)
        {
            ofVec3f s(getScreenCoords(t->second.getTouchPoint()));
            ofSetColor(kRGBBlue);
            ofCircle(s.x, s.y, 3, 4);
            ofSetColor(kRGBRed);
            ofDrawBitmapString(ofToString(t->first), s.x, s.y);
        }
    }
}
Пример #3
0
	void PCPolyhedron::draw() {
		pcPolygonsMutex.lock();
		for (int i = 0; i < pcpolygons.size(); i++)
			pcpolygons[i]->draw();

		ofSetColor(this->getColor());
		for(int i = 0; i < vertexs.size(); i++)
		{
			ofVec3f w = getScreenCoords(vertexs.at(i));
			ofCircle(w.x, w.y, 5, 4);
		}
		static vector<pair<int, int> > lines;
		if (lines.empty())
		{
			lines.push_back(make_pair(0, 1));
			lines.push_back(make_pair(1, 2));
			lines.push_back(make_pair(2, 3));
			lines.push_back(make_pair(3, 0));
			lines.push_back(make_pair(4, 5));
			lines.push_back(make_pair(5, 6));
			lines.push_back(make_pair(6, 7));
			lines.push_back(make_pair(7, 4));
			lines.push_back(make_pair(0, 4));
			lines.push_back(make_pair(1, 5));
			lines.push_back(make_pair(2, 6));
			lines.push_back(make_pair(3, 7));
		}
		for(int i = 0; i < lines.size(); i++)
		{
			ofVec3f w1 = getScreenCoords(vertexs[lines[i].first]);
			ofVec3f w2 = getScreenCoords(vertexs[lines[i].second]);
			ofLine(w1.x, w1.y, 5, w2.x, w2.y, 5);
		}

		ofSetColor(0,0,255);
		ofVec3f sAvg = getScreenCoords(this->getCenter());
		ofDrawBitmapString(ofToString(this->getId()), sAvg.x, sAvg.y, 0);


		pcPolygonsMutex.unlock();
	}
Пример #4
0
void LatticeSim::getStructure ( CAABase&  pBases ){
  //TBase * pBases = new TBase[SEQUENCE_LENGTH];
  Chain2D * ch = lattice->chains[0];
  int nBases= ch->N;
  pBases.resize(nBases);
  //centre on screen
  for(int n=0;n<ch->N;n++){
    Residue2D * res = lattice->chains[0]->residues[n];  
    pBases[n].x= res->pos.x ;
    pBases[n].y=res->pos.y;
    pBases[n].t=res->aa;
    //cout<<pBases[n].t<<endl;
  }
  getScreenCoords(pBases);
  //printTBase(nBases,pBases);
  //pB = pBases;
  return;
}
//------------------------------------------------------------------------------
void HudTextureElement::getPositionAndSize(Vector2d & pos, float & size) const
{
    try
    {
        pos  = getScreenCoords(section_);
    } catch (ParamNotFoundException & e)
    {
        // Assume that size is given and alignment will be done,
        // return center position per default
        pos = Vector2d(0.0f, 0.0f);
    }

    try
    {
        size = alignAndGetSize(section_, pos, aspect_ratio_);
    } catch (ParamNotFoundException & e)
    {
        // An offset by -0.5 puts the texture into the center (\see
        // HudTextureElement::updateVb()).
        pos = Vector2d(-0.5f, -0.5f);
        size = 1.0f;
    }
}
Пример #6
0
void LatticeSim::getNativeStructure  ( CAABase& rBases){
  lattice->native->getNativeStructure(rBases);
  getScreenCoords(rBases);
}