Geometry::Object AnyShapeAbsorption::constructGaugeVolume()
{
  g_log.information("Calculating scattering within the gauge volume defined on the input workspace");

  // Retrieve and create the gauge volume shape
  boost::shared_ptr<const Geometry::Object> volume = ShapeFactory().createShape(m_inputWS->run().getProperty("GaugeVolume")->value());
  // Although DefineGaugeVolume algorithm will have checked validity of XML, do so again here
  if ( !(volume->topRule()) && volume->getSurfacePtr().empty() )
  {
    g_log.error("Invalid gauge volume definition. Unable to construct integration volume.");
    throw std::invalid_argument("Invalid gauge volume definition.");
  }

  return *volume;
}
/// Create the sample object using the Geometry classes, or use the existing one
void AbsorptionCorrection::constructSample(API::Sample &sample) {
  const std::string xmlstring = sampleXML();
  if (xmlstring.empty()) {
    // This means that we should use the shape already defined on the sample.
    m_sampleObject = &sample.getShape();
    // Check there is one, and fail if not
    if (!m_sampleObject->hasValidShape()) {
      const std::string mess(
          "No shape has been defined for the sample in the input workspace");
      g_log.error(mess);
      throw std::invalid_argument(mess);
    }
  } else {
    boost::shared_ptr<IObject> shape = ShapeFactory().createShape(xmlstring);
    sample.setShape(shape);
    m_sampleObject = &sample.getShape();

    g_log.information("Successfully constructed the sample object");
  }
}
Beispiel #3
0
void FishWave::addFish(){
    fishPos = polyline.getPointAtPercent(ofRandom(0, 1));
    fishes.clear();
    shapes.clear();
    particle myParticle;
    myParticle.setInitialCondition(fishPos.x, fishPos.y, 0, ofRandom(-0.7, -0.8));
    fishGravity = ofRandom(-3, -0.8);
    fishDirection = ofRandom(-0.7, 0.7);
    myParticle.radius = ofRandom(20, 30);
    fishes.push_back(myParticle);
    
    ofPath p;
    float  scale = 100;
    float angle = 0;
    float r = ofRandom(30, 60);
    
    int index = (int)ofRandom(shapeTypes.size());
    ShapeType t = shapeTypes[index];
    ShapeBase* s = ShapeFactory(t);
    s->setColor(baseColor);
    s->setup();
    shapes.push_back(s);
}