RBFVectorFieldGenerator2D::RBFVectorFieldGenerator2D()
    : Processor()
    , vectorField_("vectorField", DataVec4Float32::get(), false)
    , size_("size", "Volume size", ivec2(700, 700), ivec2(1, 1), ivec2(1024, 1024))
    , seeds_("seeds", "Number of seeds", 9, 1, 100)
    , shape_("shape", "Shape Parameter", 1.2f, 0.0001f, 10.0f, 0.0001f)
    , gaussian_("gaussian", "Gaussian")
    , randomness_("randomness", "Randomness")
    , useSameSeed_("useSameSeed", "Use same seed", true)
    , seed_("seed", "Seed", 1, 0, std::numeric_limits<int>::max())
    , rd_()
    , mt_(rd_())
    , theta_(0, 2 * M_PI)
    , x_(-1.0, 1.0) {
    addPort(vectorField_);

    addProperty(size_);
    addProperty(seeds_);
    addProperty(shape_);
    addProperty(gaussian_);

    addProperty(randomness_);
    randomness_.addProperty(useSameSeed_);
    randomness_.addProperty(seed_);
    useSameSeed_.onChange([&]() { seed_.setVisible(useSameSeed_.get()); samples_.clear(); });
    seed_.onChange([&]() { samples_.clear(); });
}
Exemplo n.º 2
0
SeedPointGenerator::SeedPointGenerator()
    : Processor()
    , seedPoints_("seedPoints")
    , lineGroup_("line", "Line")
    , planeGroup_("plane", "Plane")
    , sphereGroup_("sphere", "Sphere")
    , numberOfPoints_("numberOfPoints", "Number of Points", 10, 1, 1000)
    , planeResolution_("planeResolution", "Resolution", vec2(4, 4), vec2(2, 2), vec2(100, 100))
    , planeOrigin_("planeOrigin_", "Origin", vec3(0.0f, 0.0f, 0.5f), vec3(-1, -1, -1),
                   vec3(1, 1, 1))
    , planeE1_("planeP1_", "Offset 1", vec3(1.0f, 0.0f, 0.5f), vec3(-1, -1, -1), vec3(1, 1, 1))
    , planeE2_("planeP2_", "Offset 2", vec3(0.0f, 1.0f, 0.5f), vec3(-1, -1, -1), vec3(1, 1, 1))
    , sphereCenter_("sphereCenter", "Center", vec3(0.5f, 0.5f, 0.5f), vec3(0, 0, 0), vec3(1, 1, 1))
    , sphereRadius_("sphereRadius", "Radius")
    , lineStart_("lineStart", "Start", vec3(0.5f, 0.0f, 0.5f), vec3(-1, -1, -1), vec3(1, 1, 1))
    , lineEnd_("lineEnd_", "End", vec3(0.5f, 1.0f, 0.5f), vec3(-1, -1, -1), vec3(1, 1, 1))
    , generator_("generator", "Generator")
    , randomness_("randomness", "Randomness")
    , useSameSeed_("useSameSeed", "Use same seed", true)
    , seed_("seed", "Seed", 1, 0, 1000)
    , rd_()
    , mt_(rd_()) {
    addPort(seedPoints_);

    generator_.addOption("random", "Random", RND);
    generator_.addOption("line", "Line", LINE);
    generator_.addOption("plane", "Plane", PLANE);
    generator_.addOption("sphere", "Sphere", SPHERE);
    generator_.setCurrentStateAsDefault();
    generator_.onChange(this, &SeedPointGenerator::onGeneratorChange);
    addProperty(generator_);

    lineGroup_.addProperty(lineStart_);
    lineGroup_.addProperty(lineEnd_);
    addProperty(lineGroup_);

    planeGroup_.addProperty(planeResolution_);
    planeGroup_.addProperty(planeOrigin_);
    planeGroup_.addProperty(planeE1_);
    planeGroup_.addProperty(planeE2_);
    addProperty(planeGroup_);

    sphereGroup_.addProperty(sphereCenter_);
    sphereGroup_.addProperty(sphereRadius_);
    sphereRadius_.set(vec2(0.45, 0.55));
    sphereRadius_.setCurrentStateAsDefault();
    addProperty(sphereGroup_);

    addProperty(numberOfPoints_);

    addProperty(randomness_);
    randomness_.addProperty(useSameSeed_);
    randomness_.addProperty(seed_);
    useSameSeed_.onChange([&]() { seed_.setVisible(useSameSeed_.get()); });

    onGeneratorChange();
}
Exemplo n.º 3
0
det::num_generator::num_generator(size_t upper_bound, size_t count)
	: data_(upper_bound + 1), count_(count),
	  cursor_(0), generator_(rd_())
{
	size_t* ptr = data_.data();
	for (size_t i = 0; i < upper_bound + 1; ++i, ++ptr)
		*ptr = i;

	shuffle();
}
Exemplo n.º 4
0
 /**
  * @brief Randomize the engine
  */
 static void Randomize() { engine_.seed(rd_()); }
Exemplo n.º 5
0
int Randomizer::Random(int a, int b) {
        std::random_device rd_;
        std::mt19937 gen_(rd_());
	std::uniform_int_distribution<> dis(a, b);
	return dis(gen_);
}
UniformInt::UniformInt(int min, int max, int seed):gen_(rd_()),dis_(min,max) {
	gen_.seed(seed);
}