Geometry arrays and tensor kernels

Contents

Geometry arrays and tensor kernels#

embodichain.compute.geometry provides reusable Torch operations on dense float32/float64 tensors. Inputs share dtype and device; outputs stay on that CPU or CUDA device. The kernels do not accept entity UIDs, asset paths, mesh library objects or simulator handles, and do not import scene services.

For the batched AABB and triangle APIs, shape, dtype, device and scalar-argument checks use host metadata. Numeric validity is computed on the tensor device and returned through masks or NaN outputs; no tensor value is copied to the host to decide validity. The CPU contact-patch API below instead consumes NumPy arrays and reports finite-qualification errors explicitly.

Independent batches and object axes#

Leading dimensions broadcast according to Torch rules. B denotes independent layouts and N denotes objects within one layout. A collection of N objects is not N independent layouts. Pairwise comparisons require explicit singleton axes; there is no implicit all-pairs expansion:

# boxes: (B, N, 2, 3), with min/max corners in the penultimate axis.
from embodichain.compute.geometry import aabb_overlap_depth

depths = aabb_overlap_depth(boxes[:, :, None], boxes[:, None, :])
# depths: (B, N, N, 3), with comparisons confined to each batch.

group_height_offset reduces only the N object axis of (..., N, 2, 3) boxes. Its boolean valid_mask has shape (..., N) and ignores padded objects, including their invalid numeric values. Support heights and mask leading axes may broadcast with the independent batch dimensions. Empty or all-padding groups return zero offsets and false validity. This object mask is independent of simulator environment selection.

Operations and invalid values#

Tensor contracts#

Operation

Output

Numeric invalidity

aabb_overlap_depth

Per-axis intersection lengths, (..., D)

Nonfinite/reversed boxes or nonfinite results produce all-NaN rows.

aabb_containment_violation

Per-axis boundary violations, (..., D)

Invalid boxes or regions produce all-NaN rows; boundary contact is valid.

aabb_separation

Euclidean box distance in the broadcast batch shape

Invalid boxes produce NaN; overlapping or touching boxes have zero distance.

group_height_offset

(offset, valid) in the broadcast batch shape

An unmasked invalid box or invalid support/result invalidates that group.

transform_aabbs

Affine-transformed bounds, (..., 2, 3)

Invalid boxes, transforms, non-affine last rows or overflow produce NaN boxes.

triangle_geometry

Normals (..., 3), areas (...), validity (...)

Degenerate, nonfinite or unrepresentable triangles return zero measurements and false validity.

AABB overlap is positive volume only when all axis depths are positive; touching faces produce zero on the touching axis. Affine transforms support rotation, nonuniform scale, shear and reflection, with an exact final row of [0, 0, 0, 1]. They bound transformed input boxes, not the original mesh. Triangle winding controls normal sign; callers own slope and area thresholds.

CPU strategies and benchmark scope#

Scene support selection, polygon placement, greedy packing and constrained SLSQP solving remain CPU strategies under sim.scene. They may invoke these kernels using CPU tensors. Kernel CUDA support does not move those strategies to GPU or enable B>1 scene-state operations and physical hosts.

The geometry kernel benchmark measures kernels separately from scene solver and simulator work. Compare recorded shapes, dtype, device, warmup and synchronization policy when interpreting results.

Public kernel namespace#

aabb_overlap_depth

Return nonnegative intersection lengths along every coordinate axis.

aabb_containment_violation

Return the largest boundary violation on each coordinate axis.

aabb_separation

Return Euclidean distance between broadcastable axis-aligned input boxes.

convex_projection_distance_to_origin

Lower-bound the distance from the origin to a planar convex hull.

axis_contact_pose

Construct an axis-aligned contact frame with the source float32 convention.

group_height_offset

Compute a common Z translation aligning a group's lowest box to a height.

transform_aabbs

Compute exact axis-aligned bounds of affine-transformed input boxes.

triangle_geometry

Measure triangle unit normals and areas across arbitrary leading batches.

nearest_half_turn_pose

Select the closest of two local-Z half-turn grasp orientations.

rotate_rigid_grasp

Rotate a link around its local axis while preserving a rigid grasp.

transform_vertex_bounds

Return exact bounds of transformed vertices for one environment.

aabb_sphere_cover

Cover an input vertex AABB with 27 circumscribed cell spheres.

AABB arithmetic and group reductions#

aabb_overlap_depth

Return nonnegative intersection lengths along every coordinate axis.

aabb_containment_violation

Return the largest boundary violation on each coordinate axis.

group_height_offset

Compute a common Z translation aligning a group's lowest box to a height.

aabb_separation

Return Euclidean distance between broadcastable axis-aligned input boxes.

Broadcastable Torch box arithmetic without host reads of tensor values.

Functions:

aabb_containment_violation(bounds, region)

Return the largest boundary violation on each coordinate axis.

aabb_overlap_depth(bounds_a, bounds_b)

Return nonnegative intersection lengths along every coordinate axis.

aabb_separation(bounds_a, bounds_b)

Return Euclidean distance between broadcastable axis-aligned input boxes.

group_height_offset(bounds, support_z, *[, ...])

Compute a common Z translation aligning a group's lowest box to a height.

embodichain.compute.geometry.aabb.aabb_containment_violation(bounds, region)[source]#

Return the largest boundary violation on each coordinate axis.

Parameters:
  • bounds (Tensor) – Object minimum and maximum corners, shaped (..., 2, D).

  • region (Tensor) – Allowed minimum and maximum corners, shaped (..., 2, D).

Return type:

Tensor

Returns:

Nonnegative violation distances, shaped broadcast(...), D. A fully contained box has a zero row, including boundary contact. Invalid boxes produce all-NaN rows. Tensor values remain on their original device; only shape/dtype/device metadata is validated on the host.

embodichain.compute.geometry.aabb.aabb_overlap_depth(bounds_a, bounds_b)[source]#

Return nonnegative intersection lengths along every coordinate axis.

Parameters:
  • bounds_a (Tensor) – Minimum and maximum corners, shaped (..., 2, D).

  • bounds_b (Tensor) – Corresponding or broadcastable boxes, shaped (..., 2, D).

Return type:

Tensor

Returns:

Intersection lengths, shaped broadcast(...), D. A pair intersects with positive volume only when every component is positive. Touching faces and disjoint axes have zero depth. Invalid (nonfinite or reversed) input boxes produce an all-NaN row without synchronizing the device.

Inputs must share float32/float64 dtype and device. Add singleton leading axes explicitly for pairwise comparisons; this function does not infer an object axis or materialize an implicit N-by-N matrix.

embodichain.compute.geometry.aabb.aabb_separation(bounds_a, bounds_b)[source]#

Return Euclidean distance between broadcastable axis-aligned input boxes.

Parameters:
  • bounds_a (Tensor) – Minimum/maximum corners with shape (…, 2, D).

  • bounds_b (Tensor) – Same dtype/device and broadcastable leading dimensions.

Return type:

Tensor

Returns:

Zero for overlap/touch; positive distance otherwise. Invalid bounds produce NaN. No scene ownership or physical success is inferred.

embodichain.compute.geometry.aabb.group_height_offset(bounds, support_z, *, valid_mask=None, clearance=0.0)[source]#

Compute a common Z translation aligning a group’s lowest box to a height.

Parameters:
  • bounds (Tensor) – Group boxes, shaped (..., N, 2, 3). Leading dimensions are independent batches; N is the number of objects within one group.

  • support_z (Tensor) – Target support height, broadcastable to the leading batch dimensions. Must share the bounds’ float32/float64 dtype and device.

  • valid_mask (Tensor | None) – Optional bool tensor, shaped (..., N), on the same device. False entries are padding; their numeric values are ignored.

  • clearance (float) – Finite Python scalar added to the target height, in metres.

Return type:

tuple[Tensor, Tensor]

Returns:

(offset, valid) with the broadcast batch shape. Empty/all-padding groups, nonfinite support heights, or any unmasked invalid box return zero offset and false validity. The validity tensor is never read by the host. A valid offset translates every group member by the same amount.

Affine box transforms#

transform_aabbs

Compute exact axis-aligned bounds of affine-transformed input boxes.

Batched affine bounding-box transforms implemented with Torch tensors.

Functions:

transform_aabbs(bounds, transforms)

Compute exact axis-aligned bounds of affine-transformed input boxes.

embodichain.compute.geometry.transforms.transform_aabbs(bounds, transforms)[source]#

Compute exact axis-aligned bounds of affine-transformed input boxes.

Parameters:
  • bounds (Tensor) – Minimum/maximum corners, shaped (..., 2, 3).

  • transforms (Tensor) – Broadcastable affine transforms, shaped (..., 4, 4). Rotation, nonuniform scale, shear and reflection are supported.

Return type:

Tensor

Returns:

Transformed minimum/maximum corners in the broadcast batch shape, preserving input dtype and device. Nonfinite/reversed boxes, nonfinite transforms, non-affine last rows and unrepresentable results produce all-NaN boxes using device-side masks. No rigid-transform policy is applied, and no tensor value is copied to the host.

Mesh envelopes#

transform_vertex_bounds projects the actual B=1 vertices before reducing bounds, rather than rotating a larger input AABB. aabb_sphere_cover covers the input AABB using the existing 27 circumscribed cell spheres. These pure tensor operations carry no simulation identity and do not certify cooked shapes or continuous collision freedom.

input_mesh_bounds and input_mesh_radius consume explicit ordered Trimesh inputs. Install embodichain[geometry] for these CPU mesh routines; importing the tensor-only mesh-bound functions does not load Trimesh. maximum_halfspace_violation measures all supplied points in bounded 256-row multiplication chunks. iter_clearance_translations yields the original horizontal positive/negative and upward candidates lazily, rounding clearances outward in the caller’s tensor dtype.

transform_vertex_bounds(mesh, pose)

Return exact bounds of transformed vertices for one environment.

aabb_sphere_cover(vertices)

Cover an input vertex AABB with 27 circumscribed cell spheres.

input_mesh_bounds(meshes, pose)

Transform the local AABB corners of an ordered input mesh group.

input_mesh_radius(meshes, pose)

Measure the largest transformed vertex norm while preserving mesh order.

maximum_halfspace_violation(points, normals, ...)

Measure the largest point/plane residual with bounded multiplication scratch.

iter_clearance_translations(lower, upper, ...)

Yield the original horizontal +/- and upward clearance translations.

embodichain.compute.geometry.mesh_bounds.transform_vertex_bounds(mesh, pose)[source]#

Return exact bounds of transformed vertices for one environment.

Parameters:
  • mesh (Tensor) – Nonempty owning-frame vertices, shape (1, V, 3).

  • pose (Tensor) – Owning-frame-to-output transform, shape (1, 4, 4).

Return type:

tuple[Tensor, Tensor]

Returns:

Minimum and maximum output-frame coordinates, each with shape (1, 3). Vertices are converted to the pose’s dtype/device before projection.

Raises:

ValueError – If geometry, transform shapes or finite values are invalid.

embodichain.compute.geometry.mesh_bounds.aabb_sphere_cover(vertices)[source]#

Cover an input vertex AABB with 27 circumscribed cell spheres.

Parameters:

vertices (Tensor) – Nonempty object-local vertices with shape (V, 3).

Return type:

Tensor

Returns:

Float32 sphere centers/radii, shape (27, 4), in the input frame and device. This bounds the input envelope, not native cooked geometry.

Raises:

ValueError – If vertices have an invalid shape or nonfinite coordinates.

embodichain.compute.geometry.mesh_bounds.input_mesh_bounds(meshes, pose)[source]#

Transform the local AABB corners of an ordered input mesh group.

The caller owns geometry/pose validation. This preserves the original corner construction and NumPy/Trimesh projection without sampling or convexification.

Return type:

tuple[ndarray, ndarray]

embodichain.compute.geometry.mesh_bounds.input_mesh_radius(meshes, pose)[source]#

Measure the largest transformed vertex norm while preserving mesh order.

Return type:

float

embodichain.compute.geometry.mesh_bounds.maximum_halfspace_violation(points, normals, offsets)[source]#

Measure the largest point/plane residual with bounded multiplication scratch.

Parameters:
  • points (ndarray) – Finite floating points, shape (N, D), N > 0.

  • normals (ndarray) – Finite halfspace normals, shape (F, D), F > 0.

  • offsets (ndarray) – Finite plane offsets, shape (F,). Inside means point @ normal <= offset; callers own normalization and the allowed tolerance.

Return type:

float

Returns:

Maximum signed residual over every point and plane. Original point/plane order and 256-row chunks are preserved; no vertices are subsampled.

embodichain.compute.geometry.mesh_bounds.iter_clearance_translations(lower, upper, mesh_envelopes, plane_envelopes, *, horizontal, reference)[source]#

Yield the original horizontal +/- and upward clearance translations.

Inputs are validated geometric envelopes. Magnitudes are rounded outward with nextafter in the reference dtype/device. Lazy iteration preserves the caller’s interleaved collision-query order; no candidate is ranked here.

Return type:

Iterator[tuple[Tensor, str, Tensor]]

Triangle measurements#

triangle_geometry

Measure triangle unit normals and areas across arbitrary leading batches.

Batched triangle measurements without mesh-library or scene dependencies.

Functions:

triangle_geometry(triangles)

Measure triangle unit normals and areas across arbitrary leading batches.

embodichain.compute.geometry.mesh.triangle_geometry(triangles)[source]#

Measure triangle unit normals and areas across arbitrary leading batches.

Parameters:

triangles (Tensor) – Three 3D vertices per triangle, shaped (..., 3, 3), with float32/float64 coordinates on their original CPU or CUDA device.

Return type:

tuple[Tensor, Tensor, Tensor]

Returns:

(normals, areas, valid) with shapes (..., 3), (...) and (...). Winding determines normal sign. Degenerate, nonfinite or numerically unrepresentable triangles return zero normals and areas with false validity. Numerical degeneracy includes cross products whose components cannot exceed their cancellation error bound, twice dtype epsilon times the sum of the two determinant-product magnitudes. This scale-relative arithmetic check is not a scene area or slope threshold. No tensor values are read on the host.

Rigid grasp transforms#

These pure tensor operations select a half-turn grasp orientation and rotate a link with its rigidly attached TCP about a link-local axis. Atomic motion primitives and benchmark case generation share this algebra; physical validation and execution remain in their consuming layers. rigid_pose_displacement returns corresponding translation distances and rotation angles without selecting elapsed time or stability thresholds.

nearest_half_turn_pose

Select the closest of two local-Z half-turn grasp orientations.

rotate_rigid_grasp

Rotate a link around its local axis while preserving a rigid grasp.

rigid_pose_displacement

Measure translation and rotation magnitudes between corresponding poses.

pose_axis_alignment

Project a caller-normalized object axis onto a world-frame direction.

axis_contact_pose

Construct an axis-aligned contact frame with the source float32 convention.

validate_rigid_pose_batch

Validate observed finite, proper rigid transforms without changing them.

rotate_held_object_world_z

Rotate an attached object about world Z, keeping its origin and attachment.

rotate_final_pose_world_z

Rotate only the final pose orientation about world Z, retaining origins.

Pure rigid-pose geometry shared by motion primitives and case generation.

Functions:

axis_contact_pose(target_pose, local_axis, ...)

Construct an axis-aligned contact frame with the source float32 convention.

nearest_half_turn_pose(target_pose, ...)

Select the closest of two local-Z half-turn grasp orientations.

pose_axis_alignment(pose, local_axis, *[, ...])

Project a caller-normalized object axis onto a world-frame direction.

rigid_pose_displacement(pose, reference)

Measure translation and rotation magnitudes between corresponding poses.

rotate_final_pose_world_z(poses, angle)

Rotate only the final pose orientation about world Z, retaining origins.

rotate_held_object_world_z(eef, held, angle)

Rotate an attached object about world Z, keeping its origin and attachment.

rotate_rigid_grasp(link_pose, grasp_pose, ...)

Rotate a link around its local axis while preserving a rigid grasp.

support_mesh_envelope(object_vertices, ...)

Transform source mesh envelopes without selecting support acceptance.

validate_rigid_pose_batch(pose, batch_size)

Validate observed finite, proper rigid transforms without changing them.

embodichain.compute.geometry.rigid.axis_contact_pose(target_pose, local_axis, local_point, roll)[source]#

Construct an axis-aligned contact frame with the source float32 convention.

Parameters:
  • target_pose (Tensor) – Batched target-link transforms, shape (B, 4, 4).

  • local_axis (Tensor) – Finite nonzero target-local Z direction, shape (3,).

  • local_point (Sequence[float]) – Three finite target-local contact coordinates.

  • roll (float) – Finite rotation of the contact X/Y axes about contact Z, in radians.

Return type:

Tensor

Returns:

Owned float32 contact poses on the target’s device. The least-aligned Cartesian axis completes the frame; ties preserve argmin ordering. Position and Z remain fixed while the declared roll rotates X/Y.

This pure kernel retains the source conversion, normalization and roll order. Callers validate physical transforms and finite calibration values; this construction performs no reachability, collision or contact qualification.

embodichain.compute.geometry.rigid.nearest_half_turn_pose(target_pose, reference_pose)[source]#

Select the closest of two local-Z half-turn grasp orientations.

Parameters:
  • target_pose (Tensor) – Candidate rigid transforms, shaped (B, 4, 4).

  • reference_pose (Tensor) – Reference transforms with the same shape and dtype.

Return type:

Tensor

Returns:

Selected poses with unchanged translation, dtype and device. Ties select the half-turn variant. Neither input is modified.

embodichain.compute.geometry.rigid.pose_axis_alignment(pose, local_axis, *, world_axis=None, direction_free=False)[source]#

Project a caller-normalized object axis onto a world-frame direction.

Parameters:
  • pose (Tensor) – Observed rigid transforms, shaped (B, 4, 4).

  • local_axis (Sequence[float]) – Three object-local axis coordinates, normalized by the caller.

  • world_axis (Sequence[float] | None) – Three normalized world coordinates; None selects positive Z.

  • direction_free (bool) – Whether either sign of the axis is acceptable.

Return type:

Tensor

Returns:

Per-row dot products, or their absolute values. Nonfinite pose values remain nonfinite evidence; this helper selects no acceptance threshold.

embodichain.compute.geometry.rigid.rigid_pose_displacement(pose, reference)[source]#

Measure translation and rotation magnitudes between corresponding poses.

Parameters:
  • pose (Tensor) – Rigid transforms, shape (B, 4, 4).

  • reference (Tensor) – Previous transforms with the same shape, dtype and device.

Return type:

tuple[Tensor, Tensor]

Returns:

Translation distances in metres and rotation angles in radians, each shaped (B,). Nonfinite input remains nonfinite evidence; this function does not choose a stability threshold or certify transform validity.

embodichain.compute.geometry.rigid.rotate_final_pose_world_z(poses, angle)[source]#

Rotate only the final pose orientation about world Z, retaining origins.

Parameters:
  • poses (Tensor) – One pose or ordered poses per row, (B, 4, 4) or (B, T, 4, 4).

  • angle (float) – World-Z heading offset in radians.

Return type:

Tensor

Returns:

Owned poses with unchanged translations and intermediate orientations.

embodichain.compute.geometry.rigid.rotate_held_object_world_z(eef, held, angle)[source]#

Rotate an attached object about world Z, keeping its origin and attachment.

Parameters:
  • eef (Tensor) – World end-effector transforms, shape (B, 4, 4).

  • held (Tensor) – Object-to-end-effector attachment transforms of the same shape.

  • angle (float) – World-Z rotation in radians.

Return type:

tuple[Tensor, Tensor]

Returns:

Rotated end-effector and object transforms, preserving source arithmetic.

embodichain.compute.geometry.rigid.rotate_rigid_grasp(link_pose, grasp_pose, axis, axis_origin, angles)[source]#

Rotate a link around its local axis while preserving a rigid grasp.

Parameters:
  • link_pose (Tensor) – Initial link transforms, shaped (B, 4, 4).

  • grasp_pose (Tensor) – Initial TCP transforms, shaped (B, 4, 4).

  • axis (Tensor) – Nonzero local rotation axis, shaped (3,).

  • axis_origin (Sequence[float]) – Three coordinates of the local rotation origin.

  • angles (Tensor) – Rotation angles in radians, shaped (W,) or (B, W).

Return type:

tuple[Tensor, Tensor]

Returns:

Link and TCP transforms, each shaped (B, W, 4, 4), in the input link’s dtype and device. Inputs remain unchanged. The caller owns physical feasibility and motion-limit validation.

embodichain.compute.geometry.rigid.support_mesh_envelope(object_vertices, reference_vertices, object_pose, reference_pose, *, inset_xy=0.0)[source]#

Transform source mesh envelopes without selecting support acceptance.

Parameters:
  • object_vertices (Tensor) – Local object vertices, shaped (B, V, 3).

  • reference_vertices (Tensor) – Local reference vertices, shaped (B, W, 3).

  • object_pose (Tensor) – Matching object transforms, shaped (B, 4, 4).

  • reference_pose (Tensor) – Matching reference transforms, shaped (B, 4, 4).

  • inset_xy (float) – Explicit nonnegative shrink of the horizontal reference bounds.

Return type:

tuple[Tensor, Tensor, Tensor, Tensor]

Returns:

Object bottom (B,), reference top (B,), horizontal lower and upper reference bounds (B, 2), on the input dtype/device. Nonfinite values propagate into measurements. Mesh envelopes establish no native contact.

embodichain.compute.geometry.rigid.validate_rigid_pose_batch(pose, batch_size)[source]#

Validate observed finite, proper rigid transforms without changing them.

Parameters:
  • pose (Tensor) – Float32/float64 transforms shaped (batch_size, 4, 4).

  • batch_size (int) – Exact expected number of observations.

Raises:

ValueError – Shape, finiteness, rotation or homogeneous row is invalid.

Return type:

None

The source observation tolerances are retained: orthogonality/determinant use absolute tolerance 1e-4 and homogeneous rows 1e-5, with Torch’s default relative tolerance. This validates geometry, not observation authenticity.

Circular-prism qualification#

The CPU source-mesh proof checks two complete radial rings, convex closed triangle topology and strict containment of additional rotor colliders. It preserves the existing qualification tolerances and returns a radius, without simulation state or task-specific success evaluation.

embodichain.compute.geometry.cylinder.circular_prism_radius(vertices, faces, axis, origin, *, extra_colliders=())[source]#

Qualify two complete radial rings and closed convex triangle topology.

Parameters:
  • vertices (ndarray) – Full grip-shell vertices in one link-local frame.

  • faces (ndarray) – Matching indexed triangles, preserving authored order.

  • axis (ndarray) – Unit hinge axis in that frame.

  • origin (ndarray) – Hinge origin in that frame.

  • extra_colliders (Sequence[ndarray]) – Other rotor collider vertices in the same frame.

Return type:

float

Returns:

Maximum qualified radius in metres. This source-compatible proof requires all grip vertices on exactly two uniform rings with at least 16 points; it does not prove native cooked-shape or continuous motion equivalence.

Raises:

ValueError – The source shape cannot establish this geometric boundary.

Native support patch measurements#

This CPU NumPy/Shapely calculation consumes numeric contact arrays and explicit actor IDs. Positive impulses with normalized upward normals at least 0.9 form the measured XY patch. The reported COM distance is measured against its convex hull; no silhouette containment, stability window or task verdict is inferred.

support_from_contacts

Measure the upward load patch between two explicit actors.

contact_load_path

Measure one substep's upward connectivity and external contact coupling.

embodichain.compute.geometry.contact_support.support_from_contacts(pairs, positions, normals, impulses, center_of_mass, *, object_actor, reference_actor, tolerance)[source]#

Measure the upward load patch between two explicit actors.

Parameters:
  • pairs (ndarray) – Native contact actor pairs, shape (C, 2).

  • positions (ndarray) – Matching contact positions in one common frame, shape (C, 3).

  • normals (ndarray) – Matching native normals directed from the first to second actor.

  • impulses (ndarray) – Matching scalar normal impulses, shape (C,).

  • center_of_mass (ndarray) – Observed payload COM in the same frame, shape (3,).

  • object_actor (int) – Exact native payload actor ID.

  • reference_actor (int) – Exact native support actor ID.

  • tolerance (float) – Declared COM-to-contact-patch tolerance in metres.

Return type:

tuple[bool, dict[str, Any]]

Returns:

Whether the upward patch geometrically supports the COM and its measured patch, distance and upward impulse. This instantaneous observation does not prove a complete stability window or task acceptance. Contact order, normal arithmetic and the source’s upward-normal threshold are retained.

Raises:

ValueError – Contact observations are nonfinite or selected normals are zero.

contact_load_path checks one sampled contact graph using positive upward loads and explicit dynamic cargo IDs. It does not join paths across substeps or choose a stable-window duration. That qualification belongs to the consumer.

embodichain.compute.geometry.contact_support.contact_load_path(pairs, normals, impulses, *, object_actor, reference_actor, dynamic_actors)[source]#

Measure one substep’s upward connectivity and external contact coupling.

Parameters:
  • pairs (list[list[int]]) – Native actor pairs, shape (C, 2).

  • normals (list[list[float]]) – Matching normals from first to second actor, shape (C, 3).

  • impulses (list[float]) – Matching nonnegative normal impulses, shape (C,).

  • object_actor (int) – Payload actor whose load path is queried.

  • reference_actor (int) – Exact root support actor.

  • dynamic_actors (set[int]) – Explicit dynamic cargo actors allowed on intermediate paths.

Return type:

tuple[bool, bool]

Returns:

Whether a positive upward load path reaches the payload, and whether its coupled dynamic cargo has an external contact outside that rooted path. Substeps are never combined. Window coverage and qualification remain the caller’s responsibility.

Raises:

ValueError – Actor IDs or contact arrays violate the numerical contract.

Pour arcs and grasp projections#

These B=1 numerical routines retain an observed staging orientation, generate an ordered-jaw fixed-pivot arc, and project five downstream targets for each candidate grasp before IK. PourGraspProjection owns its numeric inputs and retains invalid candidates’ staging fallbacks. Its angle and sample count are resolved query operands; policies, scene observations and physical acceptance remain with callers.

PourFrameSet

Owned B=1 numeric tilt arc and ordered candidate-projection targets.

JawPourFrameSet

Owned tensor arc and ordered-jaw diagnostics for the legacy convention.

PourGraspProjection

Owned numeric inputs for candidate-dependent Pour look-ahead before IK.

gravity_top_frame(vertices, rotation)

Return the object-local gravity-up axis and source top-plane pivot.

pour_staging_pose(source_vertices, ...)

Preserve observed entry R in a conservative source-only staging proposal.

pour_frames(source_vertices, ...)

Build one fixed-pivot tilt/restore arc using an ordered object-local jaw.

jaw_tilt_axis(jaw_line, upright)

Project an ordered jaw line into the plane normal to the vessel upright.

jaw_pour_frames(object_pose, ...)

Build the distinct legacy jaw-oriented, mouth-pivot tilt/return samples.

source_pour_staging_frame(vertices, ...)

Preserve the source static bounding-sphere Pour staging construction.

Pure source-only gravity-top proposals, never poured or physical evidence.

Classes:

JawPourFrameSet

Owned tensor arc and ordered-jaw diagnostics for the legacy convention.

PourFrameSet

Owned B=1 numeric tilt arc and ordered candidate-projection targets.

PourGraspProjection

Owned numeric inputs for candidate-dependent Pour look-ahead before IK.

Functions:

gravity_top_frame(vertices, rotation)

Return the object-local gravity-up axis and source top-plane pivot.

jaw_pour_frames(object_pose, ...)

Build the distinct legacy jaw-oriented, mouth-pivot tilt/return samples.

jaw_tilt_axis(jaw_line, upright)

Project an ordered jaw line into the plane normal to the vessel upright.

measure_pour_receiver(anchor, vertices, ...)

Measure a source proxy against its observed receiver mesh projection.

measure_pour_tilt(vertices, poses)

Measure a recorded rigid tilt/restore window in the source numeric order.

pour_frames(source_vertices, ...)

Build one fixed-pivot tilt/restore arc using an ordered object-local jaw.

pour_staging_pose(source_vertices, ...)

Preserve observed entry R in a conservative source-only staging proposal.

source_pour_staging_frame(vertices, ...)

Preserve the source static bounding-sphere Pour staging construction.

class embodichain.compute.geometry.pouring.JawPourFrameSet[source]#

Owned tensor arc and ordered-jaw diagnostics for the legacy convention.

class embodichain.compute.geometry.pouring.PourFrameSet[source]#

Owned B=1 numeric tilt arc and ordered candidate-projection targets.

Arrays are independent of caller input buffers. The five targets retain staging, peak, restore, return transport and return placement order; they establish no IK, collision, physical retention or liquid-transfer evidence.

class embodichain.compute.geometry.pouring.PourGraspProjection[source]#

Owned numeric inputs for candidate-dependent Pour look-ahead before IK.

Parameters:
  • source_vertices (ndarray) – Already-scaled source-local vertices, shape (V, 3).

  • receiver_vertices (ndarray) – Already-scaled receiver-local vertices, shape (R, 3).

  • staging (ndarray) – Resolved world staging transform, shape (4, 4).

  • receiver_pose (ndarray) – Same-observation receiver world transform.

  • return_pose (ndarray) – Resolved object target shared by return transport/placement.

  • pad_line_tcp (Tensor) – Ordered jaw vector in TCP coordinates, shape (3,).

  • gravity_world (tuple[float, float, float]) – Actual finite negative-Z gravity vector.

  • angle_rad (float) – Angle resolved from the future Pour invocation’s options.

  • sample_count (int) – Sample count resolved from that invocation’s motion policy.

No robot, program, provider or future-state callback is retained. The angle and sample count are already-resolved query operands, not another policy configuration. Invalid candidates keep the five staging fallback targets.

Methods:

__init__(*, source_vertices, ...)

targets(object_to_eef)

Project the five ordered object targets for every exact grasp variant.

valid_mask(object_to_eef)

Identify finite jaw axes with nonzero gravity-plane projection.

__init__(*, source_vertices, receiver_vertices, staging, receiver_pose, return_pose, pad_line_tcp, gravity_world, angle_rad, sample_count)#
targets(object_to_eef)[source]#

Project the five ordered object targets for every exact grasp variant.

Parameters:

object_to_eef (Tensor) – Candidate transforms, shape (…, 4, 4).

Return type:

tuple[Tensor, Tensor]

Returns:

TCP targets shaped (5, …, 4, 4) and the candidate geometry mask. Invalid candidates retain staging projections in all five slots.

valid_mask(object_to_eef)[source]#

Identify finite jaw axes with nonzero gravity-plane projection.

Parameters:

object_to_eef (Tensor) – Candidate transforms, shape (…, 4, 4).

Return type:

Tensor

Returns:

Per-candidate geometry mask on the input device; no IK is performed.

embodichain.compute.geometry.pouring.gravity_top_frame(vertices, rotation)[source]#

Return the object-local gravity-up axis and source top-plane pivot.

Parameters:
  • vertices (ndarray) – Nonempty validated native vertices, shape (V, 3). The input dtype is preserved for the source bounds/center reductions.

  • rotation (ndarray) – Validated proper (3, 3) rotation from object to world.

Return type:

tuple[ndarray, ndarray]

Returns:

Owned local up-axis and top-plane pivot arrays. This geometric point is neither a detected spout nor a fluid-transfer observation. Callers own pose/mesh validation; this kernel preserves the original arithmetic.

embodichain.compute.geometry.pouring.jaw_pour_frames(object_pose, jaw_line_object, upright, mesh_vertices, receiver_pose, *, angle_rad, sample_count)[source]#

Build the distinct legacy jaw-oriented, mouth-pivot tilt/return samples.

Parameters:
  • object_pose (Tensor) – Batched current object transforms, shape (B, 4, 4).

  • jaw_line_object (Tensor) – Ordered pad-line vectors in object coordinates (B, 3).

  • upright (Tensor) – One object-local upright vector (3,).

  • mesh_vertices (Tensor | None) – Optional local vertices for the gravity-top mouth pivot.

  • receiver_pose (Tensor | None) – Optional batched receiver transforms selecting tilt sign.

  • angle_rad (float) – Signed angle from the resolved action options.

  • sample_count (int) – Resolved motion sample count, at least three.

Return type:

JawPourFrameSet

Returns:

Object poses and local axis/direction diagnostics. The first pose follows the source’s nonzero-angle convention; callers discard it when prepending observed joint state. Thus count=3 omits the peak in the executed path. The direction diagnostic precedes the optional receiver-sign flip, as in the source contract. No physical pouring or collision is inferred.

embodichain.compute.geometry.pouring.jaw_tilt_axis(jaw_line, upright)[source]#

Project an ordered jaw line into the plane normal to the vessel upright.

Parameters:
  • jaw_line (Tensor) – Batched object-local jaw vectors, shape (…, 3).

  • upright (Tensor) – Object-local upright vectors with the same shape as jaw_line.

Return type:

tuple[Tensor, Tensor, Tensor]

Returns:

Projected unit axes, visible tilt directions and finite nondegenerate validity masks. The source norm thresholds and signed jaw order remain unchanged; invalid rows do not establish a usable tilt axis.

embodichain.compute.geometry.pouring.measure_pour_receiver(anchor, vertices, triangles, pose)[source]#

Measure a source proxy against its observed receiver mesh projection.

Parameters:
  • anchor (Tensor) – Observed CPU world point, shape (3,).

  • vertices (Tensor) – Validated scaled CPU receiver vertices, shape (V, 3).

  • triangles (Tensor) – Original CPU triangle indices, shape (F, 3).

  • pose (Tensor) – Receiver’s validated CPU world pose at the same selected slot.

Return type:

tuple[float, float, bool]

Returns:

XY projection distance, height above the receiver’s maximum world Z and exact projected coverage. Original Torch precision is retained before the source-compatible float64 triangle union. No semantic verdict is made.

embodichain.compute.geometry.pouring.measure_pour_tilt(vertices, poses)[source]#

Measure a recorded rigid tilt/restore window in the source numeric order.

Parameters:
  • vertices (Tensor) – Validated scaled CPU local vertices, shape (V, 3).

  • poses (Tensor) – Validated CPU pose window, shape (T, 4, 4), including its original start and end states. Input precision is retained.

Return type:

tuple[int, float, float, Tensor]

Returns:

First maximum-tilt row, maximum tilt in radians, final restore error in radians and the gravity-top proxy’s world point at that row. These are geometric measurements without tilt thresholds or fluid conclusions.

embodichain.compute.geometry.pouring.pour_frames(source_vertices, receiver_vertices, observed_staging_pose, observed_receiver_pose, jaw_line_object, declared_angle_rad, return_pose, *, sample_count, gravity_world)[source]#

Build one fixed-pivot tilt/restore arc using an ordered object-local jaw.

Parameters:
  • source_vertices (ndarray) – Already-scaled source vertices in runtime-local meters.

  • receiver_vertices (ndarray) – Already-scaled receiver vertices in runtime-local meters.

  • observed_staging_pose (ndarray) – Current unbatched source arena pose at Pour entry.

  • observed_receiver_pose (ndarray) – Current unbatched receiver arena pose.

  • jaw_line_object (ndarray) – Ordered pad-line vector in the source object’s frame.

  • declared_angle_rad (float) – Nonzero tilt magnitude; no explicit sign is owned.

  • return_pose (ndarray) – Explicit measured-entry return SE3; never inferred here.

  • sample_count (int) – Number of samples including entry, peak and restored end.

  • gravity_world (ndarray | tuple[float, float, float]) – Actual World gravity; this MVP requires finite negative-Z.

Return type:

PourFrameSet

Returns:

object_arc (N,4,4), object_targets (5,4,4), ordered target_roles and axis/pivot/bearing diagnostics. Targets are staging, peak, restore, return transport and return Place. physical_evidence is always False. The caller owns candidate G/TCP composition and semantic/physical gates.

embodichain.compute.geometry.pouring.pour_staging_pose(source_vertices, receiver_vertices, observed_source_pose, observed_receiver_pose, *, clearance_m, gravity_world)[source]#

Preserve observed entry R in a conservative source-only staging proposal.

Parameters:
  • source_vertices (ndarray) – Already-scaled source vertices in its runtime-local basis.

  • receiver_vertices (ndarray) – Already-scaled receiver vertices in its runtime-local basis.

  • observed_source_pose (ndarray) – Current unbatched source arena SE3, not initial-R.

  • observed_receiver_pose (ndarray) – Current unbatched receiver arena SE3.

  • clearance_m (float) – Explicit nonnegative source-envelope clearance in meters.

  • gravity_world (ndarray | tuple[float, float, float]) – Actual World gravity; this MVP requires finite negative-Z.

Return type:

ndarray

Returns:

A fresh float64 4x4 pose retaining every observed rotation value. The source sweep sphere certifies neither the hand, a receiver opening, a collision-free path nor native bearing. No rotation is reprojected.

embodichain.compute.geometry.pouring.source_pour_staging_frame(vertices, upright_axis, initial_rotation, reference_top, finger_radius)[source]#

Preserve the source static bounding-sphere Pour staging construction.

Parameters:
  • vertices (ndarray) – Imported body-local source vertices in their original order.

  • upright_axis (ndarray) – Source longest-axis direction in that same local basis.

  • initial_rotation (ndarray) – Authored source world rotation.

  • reference_top (float) – Receiver upper offset from its origin along world Z.

  • finger_radius (float) – Explicit nominal hand reserve, not measured collision data.

Return type:

tuple[ndarray, ndarray, ndarray]

Returns:

Receiver-relative translation pose, world orientation and local pivot. The original 15 mm reserve and axis-alignment order remain unchanged.

Triangle mesh XY projection#

The complete positive-area triangle union preserves concavities, holes and disconnected components. It takes plain native vertex/face arrays and retains source float64 projection arithmetic and face order. It does not select floor regions, choose placements, inspect simulation handles or compute task success.

triangle_mesh_xy_projection(vertices, faces)

Union all positive-area XY triangle projections in source face order.

embodichain.compute.geometry.projection.triangle_mesh_xy_projection(vertices, faces)[source]#

Union all positive-area XY triangle projections in source face order.

Parameters:
  • vertices (ndarray) – Validated finite mesh vertices, shape (V, 3). Values are converted to float64 just as the source Trimesh mesh constructor did.

  • faces (ndarray) – Authored triangle indices, shape (F, 3). Degenerate XY triangles contribute no area; empty faces produce an empty geometry.

Return type:

BaseGeometry

Returns:

Owned Shapely geometry preserving concavities, holes and disconnected components. This is a complete mesh projection, not a convex hull or floor-region selector. Input arrays are never modified.

Projected clearance and envelope gaps#

The convex-projection routine returns a lower bound to the origin distance for explicit planar points. Signed envelope gaps retain their supplied transforms and reduction order. Neither query acquires scene geometry or selects a collision tolerance.

Conservative CPU distances to complete convex planar projections.

Functions:

convex_projection_distance_to_origin(points)

Lower-bound the distance from the origin to a planar convex hull.

embodichain.compute.geometry.convex_projection.convex_projection_distance_to_origin(points)[source]#

Lower-bound the distance from the origin to a planar convex hull.

Parameters:

points (Union[_Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[bool | int | float | complex | str | bytes]]) – Nonempty finite real coordinates with shape (N, 2). Duplicate points and degenerate single-point/collinear projections are valid.

Return type:

float

Returns:

Non-negative CPU float64 distance in the input units. The complete convex projection is checked, including edges and interior. A scale-dependent roundoff allowance is subtracted; near-collinear projections also subtract the maximum residual from their principal segment. Zero therefore does not establish separation. Input storage remains unchanged.

Raises:
  • ValueError – Coordinates are not finite real (N, 2) values.

  • scipy.spatial.QhullError – A nondegenerate projection cannot be resolved.

Note

This CPU/SciPy kernel preserves the qualified source projection procedure. It performs deduplication and a convex hull, with O(N log N) typical cost and O(N) intermediate storage. It is not a mesh or continuous collision certificate; the consumer owns projection frames and margins.

Signed world-axis envelope separation over explicit numeric geometry.

Functions:

signed_envelope_gaps(object_vertices, ...)

Measure signed separations with the original transform/reduction order.

embodichain.compute.geometry.envelope.signed_envelope_gaps(object_vertices, object_pose, reference_vertices, reference_pose, axes)[source]#

Measure signed separations with the original transform/reduction order.

Parameters:
  • object_vertices (Tensor) – Local payload vertices, shape (B,V,3).

  • object_pose (Tensor) – Payload world poses, shape (B,4,4).

  • reference_vertices (Tensor) – Local reference points, shape (R,3) or (B,R,3).

  • reference_pose (Tensor) – Reference world poses, shape (B,4,4).

  • axes (Sequence[tuple[int, int]]) – Explicit numeric (axis,sign) selections. No relation vocabulary is inferred.

Return type:

Tensor

Returns:

Gaps of shape (A,B), retaining pose dtype/device. No separation threshold or task acceptance is applied.

Grasp samples and release clearance#

These routines consume measured numeric hand samples, object vertices and explicit geometric axes. They retain candidate order and expose masks or proposals; a returned direction or clearance does not establish acquisition, release or a collision-free motion. Uniform grasp fitting preserves the source support bottom while reporting the original pad-span margins.

Uniform grasp-fit arithmetic independent of assets, robots and task semantics.

Classes:

GraspFitScale

Uniform scale result retaining the original support bottom and fit margins.

Functions:

compute_grasp_fit_scale(vertices, *, ...)

Fit a source mesh below a measured jaw gap while preserving support height.

class embodichain.compute.geometry.grasp_fit.GraspFitScale[source]#

Uniform scale result retaining the original support bottom and fit margins.

Methods:

__init__(factor, body_scale, origin_z, ...)

__init__(factor, body_scale, origin_z, extents, support_bottom_z, fit_span, pad_margin, usable_span)#
embodichain.compute.geometry.grasp_fit.compute_grasp_fit_scale(vertices, *, body_scale, rotation_xyz_degrees, origin_z, opening, contact_clearance, fit_mode)[source]#

Fit a source mesh below a measured jaw gap while preserving support height.

Parameters:
  • vertices (ndarray) – Unscaled object-local Z-up source vertices, shape (V, 3).

  • body_scale (tuple[float, float, float]) – Source positive XYZ scale.

  • rotation_xyz_degrees (tuple[float, float, float]) – Source intrinsic-XYZ Euler angles, in degrees.

  • origin_z (float) – Source world origin height.

  • opening (float) – Explicit calibrated jaw opening in metres.

  • contact_clearance (float) – Explicit required separation per jaw.

  • fit_mode (Literal['minimum_axis', 'single_arm_transverse']) – Minimum axis for a paired grasp or maximum transverse axis for a single arm. The source algorithm does not search a new orientation.

Return type:

GraspFitScale

Returns:

Original v3 bounded uniform scale with the 2 mm pad-margin floor, 1 mm fit margin and 0.25 minimum scale. This is a source proposal, not a reachability, native contact or physical retention certificate.

Tensor interpolation of sampled gripper surfaces.

Classes:

GraspApproach

Read-only numeric direction and optional object-axis region for one trial.

Functions:

adaptive_grasp_approaches(axis, pose, tcp, ...)

Order declared geometric approach alternatives without robot-name inference.

closing_ground_clearance(body, pads, gaps, ...)

Reduce floor clearance over the discrete open-to-contact hand stroke.

full_object_opening_mask(vertices, poses, ...)

Require the full local mesh to fit between open pads for each proposal.

interpolate_hand_samples(body, pads, gaps, ...)

Interpolate closing samples at candidate pad gaps, clamping at endpoints.

opposite_grasp_end(axis, pose, source, ...)

Choose the receiver end opposite the source's projected grasp.

class embodichain.compute.geometry.gripper.GraspApproach[source]#

Read-only numeric direction and optional object-axis region for one trial.

Methods:

__init__(direction, axis, positive)

__init__(direction, axis, positive)#
embodichain.compute.geometry.gripper.adaptive_grasp_approaches(axis, pose, tcp, *, ends, positive=None, purpose='pour')[source]#

Order declared geometric approach alternatives without robot-name inference.

Parameters:
  • axis (Tensor) – Observed unit object axis, shape (B, 3).

  • pose (Tensor) – Observed object poses, shape (B, 4, 4).

  • tcp (Tensor) – Observed TCP poses with the same batch.

  • ends (bool) – Whether opposite object-axis end regions are allowed.

  • positive (Tensor | None) – Optional exact per-row end-region selection.

  • purpose (str) – Declared manipulation intent selecting source order.

Return type:

tuple[GraspApproach, ...]

Returns:

Ordered vertical/diagonal approaches and optional axis regions. The source direction, region and tie order are unchanged.

embodichain.compute.geometry.gripper.closing_ground_clearance(body, pads, gaps, widths, poses, *, ground_height)[source]#

Reduce floor clearance over the discrete open-to-contact hand stroke.

Parameters:
  • body (Tensor) – Hand body surface samples (G, V, 3) in the contact frame.

  • pads (Tensor) – Pad surface samples (G, 2, P, 3) in the same frame.

  • gaps (Tensor) – Strictly descending sample gaps (G,).

  • widths (Tensor) – Proposed contact gaps (K,); narrower stroke samples are excluded because physical object contact arrests further closure.

  • poses (Tensor) – World contact-frame poses (K, 4, 4).

  • ground_height (float) – Explicit horizontal world plane in metres.

Return type:

Tensor

Returns:

Minimum signed heights (K,), including an interpolated contact endpoint. Invalid poses or widths receive negative infinity. This is discrete geometry qualification, not continuous collision detection or evidence of physical contact. Intermediates contain at most 32 poses.

embodichain.compute.geometry.gripper.full_object_opening_mask(vertices, poses, object_pose, opening)[source]#

Require the full local mesh to fit between open pads for each proposal.

Parameters:
  • vertices (Tensor) – Object-local points, shape (V, 3).

  • poses (Tensor) – Candidate world grasp poses, shape (K, 4, 4).

  • object_pose (Tensor) – Current object-to-world pose, broadcastable over candidates.

  • opening (float) – Calibrated maximum pad opening, in metres.

Return type:

Tensor

Returns:

Candidate validity mask. The source two-millimetre pad reserve and ordered 64-pose chunks remain unchanged; no physical grip is inferred.

embodichain.compute.geometry.gripper.interpolate_hand_samples(body, pads, gaps, widths)[source]#

Interpolate closing samples at candidate pad gaps, clamping at endpoints.

Parameters:
  • body (Tensor) – Body samples of shape (G, V, 3).

  • pads (Tensor) – Two pad surfaces of shape (G, 2, P, 3).

  • gaps (Tensor) – Strictly descending sample gaps of shape (G,), with G >= 2.

  • widths (Tensor) – Candidate pad gaps of shape (K,); owns output dtype/device.

Return type:

tuple[Tensor, Tensor]

Returns:

Interpolated body and pad samples, with leading candidate dimension K. Inputs are not modified. Numeric validity and monotonicity belong to the geometry-construction boundary, avoiding repeated device synchronization.

embodichain.compute.geometry.gripper.opposite_grasp_end(axis, pose, source, destination)[source]#

Choose the receiver end opposite the source’s projected grasp.

Parameters:
  • axis (Tensor) – Observed unit object axes (B,3).

  • pose (Tensor) – Object poses (B,4,4).

  • source (Tensor) – Current source TCP poses in the same world frame.

  • destination (Tensor) – Current receiver TCP poses in the same world frame.

Return type:

Tensor

Returns:

Positive-end mask. Source projections within 1e-5 of the center retain the receiver-nearest end, including the original exact-zero tie.

Numeric released-hand nominal envelope targets, not collision certificates.

Functions:

released_hand_height(current, object_pose, ...)

Measure nominal release height without replacing collision qualification.

released_hand_targets(current, root, *, ...)

First clear vertically, then move toward the owning arm's root.

embodichain.compute.geometry.hand_clearance.released_hand_height(current, object_pose, vertices, *, opening_width, finger_length, finger_width, finger_thickness, palm_depth)[source]#

Measure nominal release height without replacing collision qualification.

Parameters:
  • current (Tensor) – Observed world TCP transforms.

  • object_pose (Tensor) – Observed object transforms, preserving environment rows.

  • vertices (Tensor) – Scaled object-local geometry vertices.

  • opening_width (float) – Declared gripper opening width in metres.

  • finger_length (float) – Explicit nominal finger length.

  • finger_width (float) – Explicit nominal finger width.

  • finger_thickness (float) – Explicit nominal finger thickness.

  • palm_depth (float) – Explicit nominal depth behind the finger origin.

Return type:

Tensor

Returns:

World-Z clearance height with the source 0.01 m reserve.

embodichain.compute.geometry.hand_clearance.released_hand_targets(current, root, *, height, retreat)[source]#

First clear vertically, then move toward the owning arm’s root.

Parameters:
  • current (Tensor) – Observed world TCP transforms, shape (B,4,4).

  • root (Tensor) – Corresponding observed world arm-root transforms.

  • height (float | Tensor) – Minimum world-Z TCP clearance height per row.

  • retreat (float) – Explicit horizontal distance in metres.

Return type:

Tensor

Returns:

Ordered raised and withdrawn TCP targets, shape (B,2,4,4).

Placement dimensions and ordered proposals#

Mesh-axis and placement dimensions use explicit input geometry and target orientation. The CPU proposal routines preserve complete projected footprints, contact-patch COM coverage and the first qualified candidate’s original order. They consume numerical arrays and polygons; object ownership, observed contact and task acceptance stay with their callers.

embodichain.compute.geometry.landing.select_table_landing(table_mesh, object_vertices, position, obstacle_bounds, *, table_top_z, object_bottom, object_top, axis_aligned_axis, placement_clearance, relation_clearance)[source]#

Preserve a supported XY or move an occupied full footprint to free support.

The table mesh is already in world coordinates. Object vertices are scaled local coordinates for explicit axis alignment, otherwise already rotated into the intended orientation. Obstacles arrive in the owning declaration’s stable order as world-frame envelopes. This pure endpoint calculation keeps source triangle unions, Minkowski exclusions and nearest-point tie behavior; it proves neither approach-path clearance nor physical placement success.

Parameters:
  • table_mesh (Trimesh) – World-frame table triangles.

  • object_vertices (ndarray) – Payload vertices in the frame described above.

  • position (Sequence[float]) – Proposed world XYZ origin.

  • obstacle_bounds (Sequence[ndarray]) – Ordered world-frame minimum/maximum corner arrays.

  • table_top_z (float) – Declared support height in metres.

  • object_bottom (float) – Payload lower vertical extent relative to its origin.

  • object_top (float) – Payload upper vertical extent relative to its origin.

  • axis_aligned_axis (int | None) – Explicit local long axis, or no axis alignment.

  • placement_clearance (float) – Release clearance in metres.

  • relation_clearance (float) – Horizontal obstacle clearance in metres.

Return type:

tuple[float, float, float]

Returns:

Supported world XYZ origin, preserving the proposed Z coordinate.

Numeric source-envelope dimensions for declaration-time placement.

Functions:

dominant_local_axis(vertices)

Return the unique major mesh axis in the object-local basis.

horizontal_placement_distance(...[, ...])

Return source-envelope center separation along an explicit numeric axis.

horizontal_placement_extent(vertices, ...)

Return a conservative horizontal half extent in the intended pose.

horizontal_slender_axis(vertices, rotation)

Apply the source horizontal three-to-one full-mesh extent selector.

vertical_placement_bounds(vertices, ...)

Return bottom/top offsets for the intended object orientation.

embodichain.compute.geometry.placement_dimensions.dominant_local_axis(vertices)[source]#

Return the unique major mesh axis in the object-local basis.

Parameters:

vertices (ndarray) – Scaled local vertices with shape (V, 3).

Return type:

list[float]

Returns:

Unit basis vector for the unique long axis. Near-ties retain the original 1.25 ratio and 1e-6 extent rejection thresholds.

embodichain.compute.geometry.placement_dimensions.horizontal_placement_distance(object_vertices, object_rotation, reference_vertices, reference_rotation, *, reference_is_articulation, relation_clearance, axis_aligned_clearance, world_axis, object_axis_aligned, reference_axis_aligned, minimum, reference_direction=1)[source]#

Return source-envelope center separation along an explicit numeric axis.

Parameters:
  • object_vertices (ndarray) – Scaled local payload vertices.

  • object_rotation (ndarray) – Payload local-to-world rotation.

  • reference_vertices (ndarray) – Scaled local reference vertices.

  • reference_rotation (ndarray) – Reference local-to-world rotation.

  • reference_is_articulation (bool) – Measure the signed edge from its root origin.

  • relation_clearance (float) – Ordinary envelope margin in metres.

  • axis_aligned_clearance (float) – Envelope margin for an aligned payload.

  • world_axis (int) – Explicit horizontal axis index.

  • object_axis_aligned (bool) – Use the payload’s transverse half-span.

  • reference_axis_aligned (bool) – Use the rigid reference’s transverse half-span.

  • minimum (float) – Minimum requested separation in metres.

  • reference_direction (int) – Signed side of the reference envelope.

Return type:

float

Returns:

Maximum of requested minimum and source-envelope separation. No collision or native bearing qualification is implied.

embodichain.compute.geometry.placement_dimensions.horizontal_placement_extent(vertices, rotation, *, world_axis, axis_aligned)[source]#

Return a conservative horizontal half extent in the intended pose.

Parameters:
  • vertices (ndarray) – Scaled local vertices with shape (V, 3).

  • rotation (ndarray) – Local-to-world 3x3 rotation for ordinary orientation.

  • world_axis (int) – Explicit numeric horizontal axis index.

  • axis_aligned (bool) – Use half the largest transverse extent of the long axis.

Return type:

float

Returns:

Half-span under the selected source orientation convention.

embodichain.compute.geometry.placement_dimensions.horizontal_slender_axis(vertices, rotation)[source]#

Apply the source horizontal three-to-one full-mesh extent selector.

Parameters:
  • vertices (ndarray) – Scaled object-local mesh vertices, shape (V, 3).

  • rotation (ndarray) – Authored local-to-world object rotation, shape (3, 3).

Return type:

bool

Returns:

Whether the longest full-mesh extent is at least three times the middle positive extent and its world vertical axis component is below one half. This selects a proposal policy only; it is not grasp qualification.

embodichain.compute.geometry.placement_dimensions.vertical_placement_bounds(vertices, rotation, *, axis_aligned)[source]#

Return bottom/top offsets for the intended object orientation.

Parameters:
  • vertices (ndarray) – Scaled local vertices with shape (V, 3).

  • rotation (ndarray) – Local-to-world 3x3 rotation for the ordinary orientation.

  • axis_aligned (bool) – Use the qualified long local axis as vertical.

Return type:

tuple[float, float]

Returns:

Minimum and maximum vertical coordinates relative to the object origin.

Source-mesh placement proposals, never native support certification.

Functions:

first_unoccupied_landing(object_mesh_zup, ...)

Select the first source-qualified candidate without reranking or retries.

generate_on_targets(object_mesh_zup, ...[, ...])

Propose full-footprint placements with source contact-patch COM coverage.

reserved_placement_footprint(vertices, ...)

Measure a proposed full footprint and conflict with prior reservations.

embodichain.compute.geometry.placement_proposals.first_unoccupied_landing(object_mesh_zup, support_mesh_world, rotation, preferred_xy, occupied, *, clearance_m, separation_m)[source]#

Select the first source-qualified candidate without reranking or retries.

Parameters:
  • object_mesh_zup (Trimesh) – Scaled object-local source triangles.

  • support_mesh_world (Trimesh) – World-frame source support triangles.

  • rotation (ndarray) – Intended object-local to world rotation.

  • preferred_xy (Sequence[float]) – Original object XY used for candidate ordering.

  • occupied (Iterable[BaseGeometry]) – Earlier world-XY reservations.

  • clearance_m (float) – Vertical release clearance.

  • separation_m (float) – Both the source contact band and planar separation.

Return type:

tuple[ndarray, Polygon] | None

Returns:

First candidate origin and footprint, or None when none is qualified.

embodichain.compute.geometry.placement_proposals.generate_on_targets(object_mesh_zup, reference_mesh_world, rotations, preferred_xy, clearance_m, contact_band_m, *, occupied_footprints=(), separation_m=0.0)[source]#

Propose full-footprint placements with source contact-patch COM coverage.

Meshes already own their scale and Z-up coordinates. Rotations are object- local to world 3x3 matrices. The convex-hull uniform COM is only a proposal prior, including for non-watertight sources. Native bearing is unverified. The finite point choices are conservative, not a complete feasible set. Preferred XY values are one point or a nonempty batch of world-frame points. Occupied world-XY footprints exclude complete payload overlap, with the requested planar separation. Their convex envelopes are conservative.

Parameters:
  • object_mesh_zup (Trimesh) – Scaled object-local triangles in the Z-up basis.

  • reference_mesh_world (Trimesh) – Scaled support triangles in world coordinates.

  • rotations (Iterable[ndarray]) – Ordered object-local to world rotation matrices.

  • preferred_xy (Sequence[float] | Sequence[Sequence[float]]) – One or more ordered world-frame XY preferences.

  • clearance_m (float) – Vertical release clearance above the support.

  • contact_band_m (float) – Combined source surface-height band.

  • occupied_footprints (Iterable[BaseGeometry]) – Previously reserved world-XY polygons.

  • separation_m (float) – Minimum planar distance from each occupied footprint.

Return type:

list[dict[str, Any]]

Returns:

Ordered pose and geometry proposal records. Native bearing remains unverified in every record; no simulator or semantic state is consumed.

embodichain.compute.geometry.placement_proposals.reserved_placement_footprint(vertices, rotation, position, occupied, *, separation_m)[source]#

Measure a proposed full footprint and conflict with prior reservations.

Parameters:
  • vertices (ndarray) – Scaled object-local vertices.

  • rotation (ndarray) – Intended local-to-world orientation.

  • position (Sequence[float]) – Proposed world origin.

  • occupied (Iterable[BaseGeometry]) – Earlier world-XY footprints in declaration order.

  • separation_m (float) – Required planar separation.

Return type:

tuple[Polygon, bool]

Returns:

Proposed footprint and whether any earlier reservation conflicts.

Measured mesh projections#

PadProjectionStroke owns explicit captured mesh and pose samples without retaining runtime objects. Preshape fitting uses the full target projection; floor-content projection and occupied-floor proposals keep source order and reservation measurements. These results provide geometric facts and proposed displacements, without interpreting physical effect evidence.

Numeric pad projection and occupied-floor proposals for measured manipulation.

Classes:

OccupiedFloorProposal

Parent-frame displacement and original reservation measurements.

PadProjectionStroke

Numeric mesh/pose stroke with source per-sample bounded temporary storage.

PreshapeProjectionFit

Source stroke selection and full target projected width, without a grip verdict.

ProjectedFloorContents

Already-projected floor occupants; no runtime or target callback is retained.

Functions:

fit_projected_preshape(target_points_tcp, ...)

Select the last captured stroke index enclosing the full target projection.

project_floor_contents(floor, floor_height, ...)

Project ordered observed contents before a release target is evaluated.

propose_occupied_floor_landing(floor, ...)

Preserve the source full-footprint five-millimetre occupied-floor proposal.

class embodichain.compute.geometry.measured_manipulation.OccupiedFloorProposal[source]#

Parent-frame displacement and original reservation measurements.

Methods:

__init__(displacement_parent, observed_contents)

metadata()

Return source-shaped owned proposal diagnostics, never physical evidence.

__init__(displacement_parent, observed_contents, selected_root_xy=None, floor_boundary_gap_m=None, content_gaps_m=())#
metadata()[source]#

Return source-shaped owned proposal diagnostics, never physical evidence.

Return type:

dict[str, object]

class embodichain.compute.geometry.measured_manipulation.PadProjectionStroke[source]#

Numeric mesh/pose stroke with source per-sample bounded temporary storage.

Parameters:
  • vertices (tuple[ndarray, ...]) – Ordered body-local meshes, each finite (V,3).

  • tcp_poses (ndarray) – Ordered link-to-TCP transforms on the original stroke (S,4,4).

Arrays own immutable byte-backed snapshots. Sampling allocates only one transformed point cloud, retaining the source mesh order and NumPy dtype.

Methods:

__init__(vertices, tcp_poses)

sample(index)

Return one source-ordered point cloud in TCP coordinates.

__init__(vertices, tcp_poses)#
sample(index)[source]#

Return one source-ordered point cloud in TCP coordinates.

Return type:

ndarray

class embodichain.compute.geometry.measured_manipulation.PreshapeProjectionFit[source]#

Source stroke selection and full target projected width, without a grip verdict.

Methods:

__init__(fraction, target_width_m, ...)

__init__(fraction, target_width_m, fitting_indices)#
class embodichain.compute.geometry.measured_manipulation.ProjectedFloorContents[source]#

Already-projected floor occupants; no runtime or target callback is retained.

Methods:

__init__(floor, contents)

propose(target_vertices_oriented, ...)

Select the original reserved release after required target operands exist.

__init__(floor, contents)#
propose(target_vertices_oriented, target_position_parent)[source]#

Select the original reserved release after required target operands exist.

Return type:

OccupiedFloorProposal

embodichain.compute.geometry.measured_manipulation.fit_projected_preshape(target_points_tcp, negative_pad_points, positive_pad_points, *, pad_rest_offsets, target_rest_offset)[source]#

Select the last captured stroke index enclosing the full target projection.

Parameters:
  • target_points_tcp (ndarray) – Complete target points in the selected grasp TCP frame (V,3).

  • negative_pad_points (ndarray | PadProjectionStroke) – First ordered pad points (S,N,3), or its bounded source mesh/pose stroke without materializing all sample vertices.

  • positive_pad_points (ndarray | PadProjectionStroke) – Second pad points/stroke on the same S grid.

  • pad_rest_offsets (tuple[float, float]) – Original ordered finite native rest offsets in metres.

  • target_rest_offset (float) – Original nonnegative target native rest offset.

Return type:

PreshapeProjectionFit

Returns:

Source fitting index/fraction and projected target width. The unchanged two-millimetre side reserve is added to each pair’s native rest offsets. Missing/degenerate data or no fitting sample rejects without a proposal.

embodichain.compute.geometry.measured_manipulation.project_floor_contents(floor, floor_height, contents_parent)[source]#

Project ordered observed contents before a release target is evaluated.

Parameters:
  • floor (Polygon) – Qualified original parent-local floor region.

  • floor_height (float) – Original local support height.

  • contents_parent (Sequence[tuple[str, ndarray]]) – Ordered source geometry already transformed to this frame.

Return type:

ProjectedFloorContents

Returns:

Exact occupancy selection, retaining the source no-contents short circuit. This geometric projection is not a physical release or stability verdict.

embodichain.compute.geometry.measured_manipulation.propose_occupied_floor_landing(floor, floor_height, target_vertices_oriented, target_position_parent, contents_parent)[source]#

Preserve the source full-footprint five-millimetre occupied-floor proposal.

Parameters:
  • floor (Polygon) – Exact parent-local qualified floor region.

  • floor_height (float) – Original parent-local support height.

  • target_vertices_oriented (ndarray) – Source subject vertices after release rotation (V,3).

  • target_position_parent (ndarray) – Original release translation in the parent frame (3,).

  • contents_parent (Sequence[tuple[str, ndarray]]) – Fresh already-transformed object geometry, in original sorted identity order; no simulation or task state enters Compute.

Return type:

OccupiedFloorProposal

Returns:

Unchanged release when no object occupies this floor, otherwise the source polylabel proposal and exact boundary/content gaps. No valid reserved region raises; height, orientation and success standards remain unchanged.

Source geometry adaptation#

Source relation helpers retain the original orientation labels, AABB support tie order and confinement measurements on explicit arrays. Target helpers derive declared approach directions, upright orientations, release heights and bounded carry distances without reading semantic graphs or choosing robot defaults. region_staging_pose changes only staging XY within an explicitly projected and inset region.

Pure source-envelope orientation and support proposals without simulation.

Functions:

source_orientation_label(geometry)

Classify a source dominant axis using the unchanged geometric thresholds.

source_rigid_policy_facts(subject, objects)

Read source AABB confinement and height proposals without runtime queries.

source_support_proposal(uid, child, objects, ...)

Propose one source AABB support with original overlap/tie ordering.

embodichain.compute.geometry.source_relations.source_orientation_label(geometry)[source]#

Classify a source dominant axis using the unchanged geometric thresholds.

Parameters:

geometry (Mapping[str, Any] | None) – Local extents, source axis rotation and primitive kind, or None.

Return type:

str

Returns:

Standing, lying or unknown source orientation; no task success judgment.

embodichain.compute.geometry.source_relations.source_rigid_policy_facts(subject, objects)[source]#

Read source AABB confinement and height proposals without runtime queries.

Parameters:
  • subject (Mapping[str, Any]) – Source object with optional final_world_aabb attributes.

  • objects (Sequence[Mapping[str, Any]]) – Original source inventory order, including articulation bounds.

Return type:

tuple[bool, bool]

Returns:

Whether an articulation AABB encloses the source, and whether its vertical span exceeds both horizontal spans. These are planning permissions, not physical containment or contact evidence.

embodichain.compute.geometry.source_relations.source_support_proposal(uid, child, objects, *, tolerance)[source]#

Propose one source AABB support with original overlap/tie ordering.

Parameters:
  • uid (str) – Child identity excluded from parent candidates.

  • child (ndarray) – World bounds (2, 3).

  • objects (Mapping[str, Mapping[str, Any]]) – Ordered source records with optional world_aabb min/max metadata.

  • tolerance (float) – Original vertical gap allowance in metres.

Return type:

dict[str, Any] | None

Returns:

Geometric proposal with original confidence/gap/overlap values, or None. This proposal establishes no physical load path or retention certificate.

Numeric declaration targets retaining original source frame arithmetic.

Functions:

bounded_carry_lift(bottom, top, *, minimum, ...)

Preserve the original vertical-span carry lift within explicit bounds.

constrained_pick_approach(world_axis)

Retain the original downward-minus-axis constrained grasp direction.

upright_origin_height(local_minimum, ...[, ...])

Keep original mesh-origin release height and optional rotation reserve.

upright_source_quaternion(...)

Align a positive authored axis to +Z with the original float32 arithmetic.

embodichain.compute.geometry.source_targets.bounded_carry_lift(bottom, top, *, minimum, maximum, reserve)[source]#

Preserve the original vertical-span carry lift within explicit bounds.

Parameters:
  • bottom (float) – Complete source geometry minimum vertical offset.

  • top (float) – Complete source geometry maximum vertical offset.

  • minimum (float) – Explicit minimum lift.

  • maximum (float) – Explicit maximum lift.

  • reserve (float) – Explicit extra clearance above half the complete span.

Return type:

float

Returns:

Numeric declaration lift, without motion or collision qualification.

embodichain.compute.geometry.source_targets.constrained_pick_approach(world_axis)[source]#

Retain the original downward-minus-axis constrained grasp direction.

Parameters:

world_axis (Sequence[float]) – Three finite components of the explicitly selected source axis.

Return type:

list[float]

Returns:

Normalized approach, or downward for the original 1e-6 degenerate norm. NumPy float64 arithmetic retains the original declaration values.

Raises:

ValueError – The declared axis is not a finite three-vector.

embodichain.compute.geometry.source_targets.upright_origin_height(local_minimum, support_height, release_clearance, *, staging_radius=None, staging_margin=0.0, staging_clearance=0.0)[source]#

Keep original mesh-origin release height and optional rotation reserve.

Parameters:
  • local_minimum (float) – Raw authored minimum on the selected source axis.

  • support_height (float) – Explicit world support top.

  • release_clearance (float) – Explicit release offset above support.

  • staging_radius (float | None) – Optional complete scaled-vertex rotation radius.

  • staging_margin (float) – Additional clearance around that rotation radius.

  • staging_clearance (float) – Fixed extra staging height when no radius is selected.

Return type:

float

Returns:

Declared object-origin height; no contact/stability assurance is implied.

embodichain.compute.geometry.source_targets.upright_source_quaternion(initial_euler_degrees, local_axis, *, world_yaw)[source]#

Align a positive authored axis to +Z with the original float32 arithmetic.

Parameters:
  • initial_euler_degrees (Sequence[float]) – Original intrinsic-XYZ source angles, in degrees.

  • local_axis (Sequence[float]) – Explicit unit source axis in the imported object’s basis.

  • world_yaw (float) – World vertical rotation applied after positive-axis alignment.

Return type:

list[float]

Returns:

Original XYZW quaternion values as Python floats. Antiparallel sources retain the deterministic least-aligned-axis tie break. This computes a declared pose; it performs no planning or physical qualification.

Inset receiver staging proposals from explicit source numeric geometry.

Functions:

region_staging_pose(source_vertices, ...)

Move only staging XY to the arm-nearest point of the inset projection.

embodichain.compute.geometry.pour_region.region_staging_pose(source_vertices, receiver_vertices, receiver_faces, observed_source_pose, observed_receiver_pose, arm_origin_world, *, clearance_m, gravity_world, proxy_position_tolerance_m)[source]#

Move only staging XY to the arm-nearest point of the inset projection.

The declared position budget is a planning reserve, not a contact threshold. Complete receiver triangles preserve holes and disconnected components; an empty or invalid inset has no fallback. The reserve constructs a proposal, not an exact encoded/native r-ball certificate. The shared staging proposal still owns entry R, height and source-envelope clearance.

Parameters:
  • source_vertices (ndarray) – Scaled source-local vertices.

  • receiver_vertices (ndarray) – Scaled receiver-local vertices.

  • receiver_faces (ndarray) – Full original receiver triangle indices.

  • observed_source_pose (ndarray) – Current source world transform.

  • observed_receiver_pose (ndarray) – Current receiver world transform.

  • arm_origin_world (ndarray) – Explicit active-arm root position.

  • clearance_m (float) – Source staging height reserve.

  • gravity_world (ndarray) – Actual finite negative-Z world gravity.

  • proxy_position_tolerance_m (float) – Explicit positive receiver inset budget.

Return type:

ndarray

Returns:

Staging transform preserving source orientation/height and selecting only XY through the original nearest-point inset rule. No native success is inferred from the source projection.

Rigid staging inputs#

as_rigid_matrix checks the original finite, proper-transform tolerances without repairing or reducing input precision. distal_staging_variants uses explicit TCP/root geometry to produce the ordered outward translations; rejected geometry or bounds remain unavailable proposals. Robot kinematics, collision queries and execution policy are outside these numeric operations.

Pure rigid input validation without motion or runtime dependencies.

Functions:

as_rigid_matrix(value)

Validate one rigid matrix without changing its numeric dtype.

embodichain.compute.geometry.pose_checks.as_rigid_matrix(value)[source]#

Validate one rigid matrix without changing its numeric dtype.

Accept (4,4) or one explicit (1,4,4) row. NumPy inputs are borrowed read-only; Tensor inputs are detached and transferred to CPU when necessary. The source residuals use 1e-6 for the last row and 1e-5 for rotation/determinant, with zero relative tolerance. This does not normalize or repair a pose.

Return type:

ndarray

Ordered distal-envelope translations used as staging hints.

Functions:

distal_staging_variants(targets, ...)

Build the original ordered TCP/root-anchored outward translations.

embodichain.compute.geometry.staging.distal_staging_variants(targets, object_pose, attachment, *, active, passive, tcp, roots, points, hand_owner_fk_error)[source]#

Build the original ordered TCP/root-anchored outward translations.

Parameters:
  • targets (Tensor) – Original two staging poses, shape (1,2,4,4).

  • object_pose (Tensor) – Actual object pose, shape (1,4,4).

  • attachment (ndarray) – Object-to-tool transform, shape (4,4).

  • active (str) – Active numeric-map key.

  • passive (str) – Passive numeric-map key.

  • tcp (Mapping[str, ndarray]) – World tool frames for both keys.

  • roots (Mapping[str, ndarray]) – World root frames for both keys.

  • points (Mapping[str, ndarray]) – Distal collision-input world points for both keys.

  • hand_owner_fk_error (Mapping[str, float]) – Observed/model discrepancy diagnostics to retain.

Return type:

list[tuple[str, Tensor | None, dict[str, Any]]]

Returns:

Ordered B/C tuples containing optional three-pose targets and numeric reports. A bound failure returns None for that candidate; no collision, kinematic or physical success is inferred.

Qualified contact heights#

contact_support_heights selects the highest qualified patch point without averaging penetration away. Missing load, COM support or finite coordinates produce NaN and preserve the caller’s conservative envelope. The sensor-facing qualified_support_heights API delegates to this shared calculation; TaskSpec uses it without importing Lab or acquiring physical state.

embodichain.compute.geometry.contact_support.contact_support_heights(supported, observation, like)[source]#

Refine heights only from NativeSupportObservation’s qualified patch.

Its contact points already require positive upward load and COM support. Keep the highest qualified point so penetration is not hidden by averaging. Unavailable rows cannot replace the existing conservative mesh envelope.

Parameters:
  • supported (Tensor) – Measured support flags, one boolean per environment.

  • observation (Mapping[str, Any]) – Original contact-patch measurements and COM distances.

  • like (Tensor) – Per-environment numeric reference for output shape, dtype and device.

Return type:

Tensor

Returns:

Highest qualified contact height for each row, or NaN when the row lacks finite positive upward load and a qualified COM patch. No pose is sampled.

Declared alignment targets#

These functions consume already observed numerical poses and object-local axes. alignment_target_axis selects an upright vertical direction or the nearest vertical pole when direction is free. held_alignment_targets preserves the source heading/lift order, optional explicit destination, and supplied arm-root and object-to-end-effector transforms. It returns owned target poses without IK, scene queries, collision checks or physical acceptance. Callers own acquisition, resource identity and motion/recovery policy.

alignment_target_axis(source, *, direction_free)

Keep an undirected vertical axis on its nearest pole; upright remains +Z.

held_alignment_targets(object_pose, ...[, ...])

Build declared alignment/lift operands from already observed numeric poses.

embodichain.compute.geometry.alignment.alignment_target_axis(source, *, direction_free)[source]#

Keep an undirected vertical axis on its nearest pole; upright remains +Z.

Parameters:
  • source (Tensor) – Batched observed axis directions, shape (B, 3).

  • direction_free (bool) – Allow the negative pole for a downward source direction.

Return type:

Tensor

Returns:

Owned signed vertical unit directions with the source dtype and device.

embodichain.compute.geometry.alignment.held_alignment_targets(object_pose, local_axis, *, position, direction_free, preserve_yaw, object_vertices=None, root_pose=None, object_to_eef=None)[source]#

Build declared alignment/lift operands from already observed numeric poses.

Parameters:
  • object_pose (Tensor) – Observed world object poses, shape (B,4,4).

  • local_axis (Sequence[float]) – Declared object-local alignment axis.

  • position (Sequence[float] | None) – Optional exact world destination; omitted retains current origin.

  • direction_free (bool) – Preserve the nearest vertical pole instead of forcing +Z.

  • preserve_yaw (bool) – Return one aligned pose without source arm-facing selection.

  • object_vertices (Tensor | None) – Scaled local geometry for direction-free height correction.

  • root_pose (Tensor | None) – Observed active-arm root needed for yaw-free arm-facing selection.

  • object_to_eef (Tensor | None) – Verified held transform for that same active resource.

Return type:

Tensor

Returns:

Owned single target or two-pose acquired-heading lift/aligned-target grid. No IK, scene lookup, collision qualification or success judgment occurs.

Recorded rigid Pour measurements#

These pure numeric functions measure a recorded rigid tilt/restore window and receiver projection. They take explicit source vertices and poses, preserve input precision and first-maximum order, and set no acceptance thresholds or fluid-transfer conclusions.

embodichain.compute.geometry.pouring.measure_pour_tilt(vertices, poses)[source]

Measure a recorded rigid tilt/restore window in the source numeric order.

Parameters:
  • vertices (Tensor) – Validated scaled CPU local vertices, shape (V, 3).

  • poses (Tensor) – Validated CPU pose window, shape (T, 4, 4), including its original start and end states. Input precision is retained.

Return type:

tuple[int, float, float, Tensor]

Returns:

First maximum-tilt row, maximum tilt in radians, final restore error in radians and the gravity-top proxy’s world point at that row. These are geometric measurements without tilt thresholds or fluid conclusions.

embodichain.compute.geometry.pouring.measure_pour_receiver(anchor, vertices, triangles, pose)[source]

Measure a source proxy against its observed receiver mesh projection.

Parameters:
  • anchor (Tensor) – Observed CPU world point, shape (3,).

  • vertices (Tensor) – Validated scaled CPU receiver vertices, shape (V, 3).

  • triangles (Tensor) – Original CPU triangle indices, shape (F, 3).

  • pose (Tensor) – Receiver’s validated CPU world pose at the same selected slot.

Return type:

tuple[float, float, bool]

Returns:

XY projection distance, height above the receiver’s maximum world Z and exact projected coverage. Original Torch precision is retained before the source-compatible float64 triangle union. No semantic verdict is made.