Math Utilities¶
- class util.math.ConvexHull(points, incremental=False, qhull_options=None)¶
Extendes scipy’s ConvexHull to compute the centroid and to represent convex hull in the form of line segments. More information for the parent class here: https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.ConvexHull.html
- centroid()¶
Calculates the centroid of a 2D convex hull
- Returns
The 2D centroid
- Return type
np.array
- line_segments()¶
Returns the convex hull as a list of line segments (LineSegment2D).
- Returns
The list of line segments
- Return type
list
- plot(ax=None)¶
Plots the convex hull in 2D.
- axmatplotlib.axes
An axes object to use for plotting in an existing plot
- class util.math.OrnsteinUhlenbeckActionNoise(mu, sigma=0.2, theta=0.15, dt=0.01, x0=None, seed=999)¶
Taken from https://github.com/openai/baselines/blob/master/baselines/ddpg/noise.py, which is based on http://math.stackexchange.com/questions/1287634/implementing-ornstein-uhlenbeck-in-matlab
- util.math.get_distance_of_two_bbox(pose_1, bbox_1, pose_2, bbox_2, density=0.005, plot=False)¶
Calculates the distance between two oriented bounding boxes using point clouds.
- util.math.transform_list_of_points(points, pos, quat, inv=False)¶
Points are w.r.t. {A}. pos and quat is the frame {A} w.r.t {B}. Returns the list of points experssed w.r.t. {B}.
- util.math.triangle_area(t)¶
Calculates the area of a triangle defined given its 3 vertices. n_vertices x n_dims = 3 x 2