Commit d8abb6c5 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[ex2] use new quad sampler

parent 17f518a1
......@@ -39,18 +39,19 @@ int main()
Box<ctype> unitCube(-0.5, -0.5, 0.0, 0.5, 0.5, 1.0);
using QuadSampler = QuadrilateralSampler<worldDimension>;
using Distro = std::normal_distribution<ctype>;
using NormalDistro = std::normal_distribution<ctype>;
using UniformDistro = std::uniform_real_distribution<ctype>;
QuadSampler quadSampler1(makeUniformPointSampler(unitCube),
Distro(toRadians(45.0), toRadians(5.0)),
Distro(toRadians(90.0), toRadians(5.0)),
Distro(0.5, 0.1),
0.05);
NormalDistro(toRadians(45.0), toRadians(5.0)),
NormalDistro(toRadians(90.0), toRadians(5.0)),
UniformDistro(0.4, 0.6),
UniformDistro(0.4, 0.6));
QuadSampler quadSampler2(makeUniformPointSampler(unitCube),
Distro(toRadians(0.0), toRadians(5.0)),
Distro(toRadians(0.0), toRadians(5.0)),
Distro(0.5, 0.1),
0.05);
NormalDistro(toRadians(0.0), toRadians(5.0)),
NormalDistro(toRadians(0.0), toRadians(5.0)),
UniformDistro(0.5, 0.1),
UniformDistro(0.4, 0.6));
EntityNetworkConstraints<ctype> constraintsOnSelf;
constraintsOnSelf.setMinDistance(0.05);
......
......@@ -16,21 +16,28 @@ def gaussianSampler(mean, stdDev):
return random.gauss(mean, stdDev)
return sample
#returns a sampler from a uniform distribution between min and max
def uniformSampler(min, max):
import random
def sample():
return random.uniform(min, max)
return sample
# we sample quadrialeterals within the box with gaussian distributions for the parameters
from frackit.common import toRadians
from frackit.sampling import QuadrilateralSampler as QuadSampler
quadSampler1 = QuadSampler(pointSampler,
gaussianSampler(toRadians(45.0), toRadians(5.0)), # strike angle
gaussianSampler(toRadians(90.0), toRadians(5.0)), # dip angle
gaussianSampler(0.5, 0.1), # edge length
0.05) # threshold for minimum edge length
uniformSampler(0.4, 0.6), # strike length
uniformSampler(0.4, 0.6)) # dip length
# sampler for quadrilaterals of the secondary orientation
quadSampler2 = QuadSampler(pointSampler,
gaussianSampler(toRadians(0.0), toRadians(5.0)), # strike angle
gaussianSampler(toRadians(0.0), toRadians(5.0)), # dip angle
gaussianSampler(0.5, 0.1), # edge length
0.05) # threshold for minimum edge length
uniformSampler(0.4, 0.6), # strike length
uniformSampler(0.4, 0.6)) # dip length
# constructs a constraints object with default settings for this example
from frackit.entitynetwork import EntityNetworkConstraints
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment