blenderproc.python.sampler.PartSphere module

Samples a point from the surface or from the interior of solid sphere which is split in two parts.

blenderproc.python.sampler.PartSphere.part_sphere(center, radius, mode, dist_above_center=0.0, part_sphere_dir_vector=None)[source]

Samples a point from the surface or from the interior of solid sphere which is split in two parts.

https://math.stackexchange.com/a/87238 https://math.stackexchange.com/a/1585996

Example 1: Sample a point from the surface of the sphere that is split by a plane with displacement of 0.5 above center and a normal of [1, 0, 0].

PartSphere.sample(
    center=[0, 0, 0],
    part_sphere_vector=[1, 0, 0],
    mode="SURFACE",
    distance_above_center=0.5
)
Parameters:
  • center (Union[Vector, ndarray, List[float]]) – Location of the center of the sphere.

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

  • mode (str) – Mode of sampling. Determines the geometrical structure used for sampling. Available: SURFACE (sampling from the 2-sphere), INTERIOR (sampling from the 3-ball).

  • dist_above_center (float) – The distance above the center, which should be used. Default: 0.0 (half of the sphere).

  • part_sphere_dir_vector (Union[Vector, ndarray, List[float], None]) – The direction in which the sphere should be split, the end point of the vector, will be in the middle of the sphere pointing towards the middle of the resulting surface. Default: [0, 0, 1].

Return type:

ndarray

Returns:

A random point lying inside or on the surface of a solid sphere.