habitat.datasets.rearrange.samplers.receptacle.TriangleMeshReceptacle class

Defines a Receptacle surface as a triangle mesh. TODO: configurable maximum height.

Methods

def debug_draw(self, sim: habitat_sim.simulator.Simulator, color: typing.Optional[_magnum.Color4] = None) -> None
Render the Receptacle with DebugLineRender utility at the current frame. Draws the Receptacle mesh. Must be called after each frame is rendered, before querying the image data.
def get_face_verts(self, f_ix: int) -> typing.List[_magnum.Vector3]
Get all three vertices of a mesh triangle given it’s face index as a list of numpy arrays.
def get_global_transform(self, sim: habitat_sim.simulator.Simulator) -> _magnum.Matrix4
Isolates boilerplate necessary to extract receptacle global transform of the Receptacle at the current state.
def sample_area_weighted_triangle(self) -> int
Isolates the area weighted triangle sampling code.
def sample_uniform_global(self, sim: habitat_sim.simulator.Simulator, sample_region_scale: float) -> _magnum.Vector3
Sample a uniform random point in the local Receptacle volume and then transform it into global space.
def sample_uniform_local(self, sample_region_scale: float = 1.0) -> _magnum.Vector3
Sample a uniform random point from the mesh.

Special methods

def __init__(self, name: str, mesh_data: _magnum.trade.MeshData, parent_object_handle: typing.Optional[str] = None, parent_link: typing.Optional[int] = None, up: typing.Optional[_magnum.Vector3] = None, scale: typing.Union[float, _magnum.Vector3, None] = None) -> None
Initialize the TriangleMeshReceptacle from mesh data and pre-compute the area weighted accumulator.

Properties

bounds: _magnum.Range3D get
Get the vertex AABB bounds pre-computed during initialization.
is_parent_object_articulated get
Convenience query for articulated vs. rigid object check.

Method documentation

def habitat.datasets.rearrange.samplers.receptacle.TriangleMeshReceptacle.debug_draw(self, sim: habitat_sim.simulator.Simulator, color: typing.Optional[_magnum.Color4] = None) -> None

Render the Receptacle with DebugLineRender utility at the current frame. Draws the Receptacle mesh. Must be called after each frame is rendered, before querying the image data.

Parameters
sim Simulator must be provided.
color Optionally provide wireframe color, otherwise magenta.

def habitat.datasets.rearrange.samplers.receptacle.TriangleMeshReceptacle.get_face_verts(self, f_ix: int) -> typing.List[_magnum.Vector3]

Get all three vertices of a mesh triangle given it’s face index as a list of numpy arrays.

Parameters
f_ix The index of the mesh triangle.

def habitat.datasets.rearrange.samplers.receptacle.TriangleMeshReceptacle.sample_area_weighted_triangle(self) -> int

Isolates the area weighted triangle sampling code.

Returns a random triangle index sampled with area weighting.

def habitat.datasets.rearrange.samplers.receptacle.TriangleMeshReceptacle.sample_uniform_global(self, sim: habitat_sim.simulator.Simulator, sample_region_scale: float) -> _magnum.Vector3

Sample a uniform random point in the local Receptacle volume and then transform it into global space.

Parameters
sim
sample_region_scale defines a XZ scaling of the sample region around its center.

def habitat.datasets.rearrange.samplers.receptacle.TriangleMeshReceptacle.sample_uniform_local(self, sample_region_scale: float = 1.0) -> _magnum.Vector3

Sample a uniform random point from the mesh.

Parameters
sample_region_scale defines a XZ scaling of the sample region around its center. For example to constrain object spawning toward the center of a receptacle.

def habitat.datasets.rearrange.samplers.receptacle.TriangleMeshReceptacle.__init__(self, name: str, mesh_data: _magnum.trade.MeshData, parent_object_handle: typing.Optional[str] = None, parent_link: typing.Optional[int] = None, up: typing.Optional[_magnum.Vector3] = None, scale: typing.Union[float, _magnum.Vector3, None] = None) -> None

Initialize the TriangleMeshReceptacle from mesh data and pre-compute the area weighted accumulator.

Parameters
name The name of the Receptacle. Should be unique and descriptive for any one object.
mesh_data The Receptacle’s mesh data. A magnum.trade.MeshData object (indices len divisible by 3).
parent_object_handle The rigid or articulated object instance handle for the parent object to which the Receptacle is attached. None for globally defined stage Receptacles.
parent_link Index of the link to which the Receptacle is attached if the parent is an ArticulatedObject. -1 denotes the base link. None for rigid objects and stage Receptacles.
up The “up” direction of the Receptacle in local AABB space. Used for optionally culling receptacles in un-supportive states such as inverted surfaces.
scale The scaling vector (or uniform scaling float) to be applied to the mesh.