Ejemplo n.º 1
0
					//----------
					void AddScan::buildPreviewRays() {
						this->previewRays.clear();
						auto fitPoints = this->getFitPoints();

						//we should have already thrown if camera or projector is missing
						auto cameraNode = this->getInput<Scan::Graycode>()->getInput<Item::Camera>();
						auto projectorNode = this->getInput<Item::Projector>();
						
						auto cameraView = cameraNode->getViewInWorldSpace();
						auto projectorView = projectorNode->getViewInWorldSpace();

						for (auto & fitPoint : fitPoints) {
							auto cameraRay = cameraView.castCoordinate(fitPoint.camera);
							auto projectorRay = projectorView.castCoordinate(fitPoint.projector);

							this->previewRays.addVertices({ cameraRay.getStart()
								, cameraRay.getMidpoint()
								, projectorRay.getStart()
								, projectorRay.getMidpoint()
							});
							
							ofColor color(fitPoint.median);

							this->previewRays.addColors({ color
							, color
							, color
							, color });
						}

						previewRays.setMode(ofPrimitiveMode::OF_PRIMITIVE_LINES);
					}
Ejemplo n.º 2
0
Archivo: range.cpp Proyecto: jtb/RIVALS
  bool Range::next(string & chrom, Interval & intv){
    if(!on_chromosome) return false;
    chrom = chr;
    
    while(!recurse.empty()){
      Cargo c = recurse.top();
      Interval i = cvector.at(c.root);
      if(d.getStart() >= i.getSubMax()){
	recurse.pop();
      }else{
	if(!c.goLeft){
	  //check this one, pop, then put right on top if it exists and start is less than i stop
	  recurse.pop();
	  if(d.getStop() > i.getStart()){
	    Capacity root;
	    if(getMidpoint(c.root+1, c.high, root)){
	      recurse.push(Cargo(c.root+1, c.high, root));
	    }
	  
	    if(i.overlaps(d)){
	      intv = i;
	      return true;
	    }
	  }//else this node and right children do not overlap d
	}else{
	  recurse.top().goLeft = false;
	  //go left
	  Capacity root;
	  if(getMidpoint(c.low, c.root, root)){
	    recurse.push(Cargo(c.low, c.root, root));
	  }
	}
      }
    }
    return false;
  }
Ejemplo n.º 3
0
Archivo: range.cpp Proyecto: jtb/RIVALS
  void Range::setChr(string chrom){
    recurse = stack<Cargo>();
    Capacity start;
    Capacity stop;
    if(getRanges(chrom, chrmap, start, stop)){
      on_chromosome = true;
      chr = chrom;
      cvector.setRange(offset, start, stop);
      Capacity root;
      if(getMidpoint(0, cvector.size(), root)){
	recurse.push(Cargo(0, cvector.size(), root));
      }
    }else{
      on_chromosome = false;
    }
  }