skrobot.sdf.UnionSDF

class skrobot.sdf.UnionSDF(sdf_list, coords=None)[source]

One can concat multiple SDFs sdf_list by using this class.

For consistency in the concatenation, it is required that the all SDFs to be concated are with use_abs=False.

Methods

__call__(points_obj)[source]

Compute signed distances of input points to the implicit surface.

Parameters:

points_obj (numpy.ndarray[float](n_point, 3)) – 2 dim point array w.r.t. object coordinate.

Returns:

signed_distances – 1 dim (n_point,) array of signed distance.

Return type:

numpy.ndarray[float]

classmethod from_robot_model(robot_model, dim_grid=50)[source]

Create union sdf from a robot model

Parameters:

robot_model (skrobot.model.RobotModel) – Using the links of the robot_model this creates the UnionSDF instance.

Returns:

union_sdf – union sdf of robot_model

Return type:

skrobot.sdf.UnionSDF

on_surface(points_obj)[source]

Check if points are on the surface.

Parameters:

points_obj (numpy.ndarray[float](n_point, 3)) – 2 dim point array w.r.t. an object coordinate.

Returns:

  • logicals (numpy.ndarray[bool](n_point,)) – boolean vector of the on-surface predicate for points_obj.

  • sd_vals (numpy.ndarray[float](n_point,)) – signed distances corresponding to logicals.

surface_points(n_sample=1000)[source]

Sample points from the implicit surface of the sdf.

Parameters:

n_sample (int) – number of sample points.

Returns:

  • points_obj (numpy.ndarray[float](n_point, 3)) – sampled points w.r.t object coordinate.

  • dists (numpy.ndarray[float](n_point,)) – signed distances corresponding to points_obj.

__eq__(value, /)

Return self==value.

__ne__(value, /)

Return self!=value.

__lt__(value, /)

Return self<value.

__le__(value, /)

Return self<=value.

__gt__(value, /)

Return self>value.

__ge__(value, /)

Return self>=value.