blenderproc.python.sampler.Disk module

Samples a point on a 1-sphere (circle), or on a 2-ball (disk, i.e. circle + interior space)

class blenderproc.python.sampler.Disk._Disk[source]

Bases: object

static is_clockwise(rel_point, sampled_point)[source]

Checks if the sampled_point is in the clockwise direction in relation to the rel_point.

Parameters:
  • rel_point (Union[Vector, ndarray, List[float]]) – Point relative to which the test is performed.

  • sampled_point (Union[Vector, ndarray, List[float]]) – Point for which test is performed.

Return type:

bool

Returns:

True if the sampled_point lies in the clockwise direction in relation to the rel_point, False if not.

static sample_point(magnitude)[source]

Samples a 3d point from a two-dimensional normal distribution with the third dim equal to 0.

Parameters:

magnitude (float) – Scaling factor of a radius.

Return type:

ndarray

Returns:

Sampled 3d point. Type: numpy.array.

blenderproc.python.sampler.Disk.disk(center, radius, rotation=None, sample_from='disk', start_angle=0, end_angle=180)[source]
Samples a point on a 1-sphere (circle), or on a 2-ball (disk, i.e. circle + interior space), or on an arc/sector

with an inner angle less or equal than 180 degrees. Returns a 3d mathutils.Vector sampled point.

Example 1: Sample a point from a 1-sphere.

Disk.sample(
    center=[0, 0, 4],
    radius=7,
    sample_from="circle"
)

Example 2: Sample a point from a sector.

Disk.sample(
    center=[0, 0, 4],
    radius=7,
    sample_from="sector",
    start_angle=0,
    end_angle=90
)
Parameters:
  • center (Union[Vector, ndarray, List[float]]) – Center (in 3d space) of a 2d geometrical shape to sample from.

  • radius (float) – The radius of the disk.

  • rotation (Union[Vector, ndarray, List[float], None]) – List of three (XYZ) Euler angles that represent the rotation of the 2d geometrical structure used for sampling in 3d space.

  • sample_from (str) – Mode of sampling. Defines the geometrical structure used for sampling, i.e. the shape to sample from.

  • start_angle (float) – Start angle in degrees that is used to define a sector/arc to sample from. Must be smaller than end_angle. Arc’s/sector’s inner angle (between start and end) must be less or equal than 180 degrees. Angle increases in the counterclockwise direction from the positive direction of X axis.

  • end_angle (float) – End angle in degrees that is used to define a sector/arc to sample from. Must be bigger than start_angle. Arc’s/sector’s inner angle (between start and end) must be less or equal than 180 degrees. Angle increases in the counterclockwise direction from the positive direction of X axis.

Return type:

ndarray

Returns:

A random point sampled point on a circle/disk/arc/sector.