Пример #1
0
    Wall::Wall() {

        QSharedPointer< point3D<double> > spoint(new point3D<double>());
        startPoint = spoint;
        QSharedPointer< point3D<double> > epoint(new point3D<double>());
        endPoint = epoint;
    }
Пример #2
0
FVec2 EmissionSource::sample(RandomGen &rand) const {
  switch (type) {
  case Type::point:
    return pos;
  case Type::rect: {
    auto f2 = rand.getFloat2Fast();
    return pos + FVec2((f2.first * 2.0f - 1.0f) * param.x, (f2.second * 2.0f - 1.0f) * param.y);
  }
  case Type::sphere: {
    FVec2 spoint(rand.getFloatFast(-1.0f, 1.0f), rand.getFloatFast(-1.0f, 1.0f));
    while(spoint.x * spoint.x + spoint.y * spoint.y > 1.0f)
      spoint = FVec2(rand.getFloatFast(-1.0f, 1.0f), rand.getFloatFast(-1.0f, 1.0f));
    return pos + spoint * param.x;
  }
  }

  return {};
}