GeometryPurpose
L302class GeometryPurpose(StrEnum)fastsim.api.geometry 的公共 Python API;签名从 FastSim 源码直接提取。
源码 src/fastsim/api/geometry.pyclass GeometryPurpose(StrEnum)class GeometryRepresentation(StrEnum)class GeometryMotionClass(StrEnum)class GeometryStorageKind(StrEnum)class GeometryLocatorScheme(StrEnum)class GeometryAxis(StrEnum)class SignedGeometryAxis(StrEnum)class GeometryDType(StrEnum)class GeometryContentProfile(StrEnum)Closed, versioned byte layouts supported by ``scene.geometry@2``. Every profile is headerless, C-contiguous, and little-endian. Consequently ``byte_size`` is both the encoded payload size and the decoded array size in version 1; compressed/container formats require a future profile or service version instead of being guessed from an arbitrary format string.
class GeometrySdfSignConvention(StrEnum)class GeometryVoxelValueSemantics(StrEnum)class GeometryAxisConvention(object)Fully specified portable basis convention for one resolved resource.
| 字段 | 类型 | 默认值 |
|---|---|---|
| up_axis | SignedGeometryAxis | — |
| forward_axis | SignedGeometryAxis | — |
| handedness | str | 'right_handed' |
class MeshResourceSchema(object)Raw mesh arrays: vertices first, then triangle indices. Both arrays are headerless C-order arrays. Vertices have shape ``(N, 3)`` in metres and use a floating dtype. Triangle indices have shape ``(M, 3)`` and use an unsigned integer dtype. The profile fixes little-endian byte order; ``index_byte_offset`` is therefore the exact vertex byte count.
| 字段 | 类型 | 默认值 |
|---|---|---|
| vertex_dtype | GeometryDType | — |
| vertex_shape | tuple[int, int] | — |
| index_dtype | GeometryDType | — |
| index_shape | tuple[int, int] | — |
class SdfResourceSchema(object)Dense SDF array with shape ``(X, Y, Z)`` and Z as the fastest axis.
| 字段 | 类型 | 默认值 |
|---|---|---|
| dtype | GeometryDType | — |
| shape_xyz | tuple[int, int, int] | — |
| origin_xyz_m | tuple[float, float, float] | — |
| cell_size_xyz_m | tuple[float, float, float] | — |
| sign_convention | GeometrySdfSignConvention | GeometrySdfSignConvention.NEGATIVE_INSIDE |
class VoxelResourceSchema(object)Dense uint8 occupancy grid shaped ``(X, Y, Z)``, Z fastest.
| 字段 | 类型 | 默认值 |
|---|---|---|
| dtype | GeometryDType | — |
| shape_xyz | tuple[int, int, int] | — |
| origin_xyz_m | tuple[float, float, float] | — |
| cell_size_xyz_m | tuple[float, float, float] | — |
| value_semantics | GeometryVoxelValueSemantics | GeometryVoxelValueSemantics.ZERO_FREE_NONZERO_OCCUPIED |
class HeightfieldResourceSchema(object)Dense height samples shaped ``(Y, X)`` with X as the fastest axis.
| 字段 | 类型 | 默认值 |
|---|---|---|
| dtype | GeometryDType | — |
| shape_yx | tuple[int, int] | — |
| origin_xy_m | tuple[float, float] | — |
| spacing_xy_m | tuple[float, float] | — |
| height_scale_m | float | — |
| height_offset_m | float | 0.0 |
class AxisAlignedBoundingBox(object)A finite AABB expressed in one explicitly named frame.
| 字段 | 类型 | 默认值 |
|---|---|---|
| frame_id | str | — |
| minimum_xyz_m | tuple[float, float, float] | — |
| maximum_xyz_m | tuple[float, float, float] | — |
class CollisionFilterMetadata(object)Portable collision-layer membership and allow-list metadata.
| 字段 | 类型 | 默认值 |
|---|---|---|
| layer | str | — |
| collides_with | tuple[str, ...] | — |
class InlineBox(object)| 字段 | 类型 | 默认值 |
|---|---|---|
| size_xyz_m | tuple[float, float, float] | — |
| representation | GeometryRepresentation | GeometryRepresentation.BOX |
class InlineSphere(object)| 字段 | 类型 | 默认值 |
|---|---|---|
| radius_m | float | — |
| representation | GeometryRepresentation | GeometryRepresentation.SPHERE |
class InlineCapsule(object)| 字段 | 类型 | 默认值 |
|---|---|---|
| radius_m | float | — |
| axial_length_m | float | — |
| axis | GeometryAxis | — |
| representation | GeometryRepresentation | GeometryRepresentation.CAPSULE |
class InlineCylinder(object)| 字段 | 类型 | 默认值 |
|---|---|---|
| radius_m | float | — |
| axial_length_m | float | — |
| axis | GeometryAxis | — |
| representation | GeometryRepresentation | GeometryRepresentation.CYLINDER |
class InlineHalfspace(object)Exact infinite half-space with local boundary ``z=0`` and solid ``z<=0``.
class GeometryLocalPose(object)A frame-free geometry-local rigid transform. In ``InlineCompoundPart`` this value is exactly ``geometry_T_part``. It is intentionally not a :class:`Pose`: a geometry-local coordinate system is not a public FrameCatalog node and therefore must not masquerade as one.
| 字段 | 类型 | 默认值 |
|---|---|---|
| xyz_m | tuple[float, float, float] | — |
| quat_xyzw | tuple[float, float, float, float] | — |
class InlineCompoundPart(object)One primitive child in a bounded inline compound collider. ``local_pose`` is exactly ``geometry_T_part``. It has no ``frame_id`` because the geometry-local coordinate system is not a FrameCatalog node.
| 字段 | 类型 | 默认值 |
|---|---|---|
| part_id | str | — |
| local_pose | GeometryLocalPose | — |
| scale_xyz | tuple[float, float, float] | — |
| primitive | InlinePrimitive | — |
class InlineCompound(object)| 字段 | 类型 | 默认值 |
|---|---|---|
| parts | tuple[InlineCompoundPart, ...] | — |
| representation | GeometryRepresentation | GeometryRepresentation.COMPOUND |
aabb_intersects_halfspace(aabb: AxisAlignedBoundingBox, parent_frame_T_halfspace: Pose) -> boolReturn exact analytic intersection with an oriented infinite half-space. The AABB and pose must use the same frame. Local ``+Z`` is the outward normal, so a point is occupied exactly when ``normal · (point-origin) <= 0``.
class GeometryCatalogEntry(object)One path-free collision, visual, or planning geometry fact. ``local_pose`` is ``parent_frame_T_geometry``; its ``frame_id`` is the owning entity/link frame selected by the provider. Compound child poses are frame-free ``geometry_T_part`` values.
| 字段 | 类型 | 默认值 |
|---|---|---|
| geometry_id | str | — |
| entity_id | str | — |
| link_id | str | None | — |
| purpose | GeometryPurpose | — |
| representation | GeometryRepresentation | — |
| local_pose | Pose | — |
| scale_xyz | tuple[float, float, float] | — |
| motion_class | GeometryMotionClass | — |
| collision_filter | CollisionFilterMetadata | — |
| provenance_sha256 | str | — |
| resource_id | str | None | None |
| sha256 | str | None | None |
| content_profile | GeometryContentProfile | None | None |
| inline | InlineGeometry | None | None |
Return the exact immutable resource-cache key, or ``None`` for inline shapes.
class GeometryQuery(object)Bounded deterministic intersection filter shared by geometry reads.
| 字段 | 类型 | 默认值 |
|---|---|---|
| entity_ids | tuple[str, ...] | () |
| aabb | AxisAlignedBoundingBox | None | None |
| motion_classes | tuple[GeometryMotionClass, ...] | () |
| collision_layers | tuple[str, ...] | () |
| purposes | tuple[GeometryPurpose, ...] | () |
| representations | tuple[GeometryRepresentation, ...] | () |
class GeometryCapabilities(object)Exact service capabilities; callers must fail closed outside this set.
| 字段 | 类型 | 默认值 |
|---|---|---|
| representations | tuple[GeometryRepresentation, ...] | — |
| storage_kinds | tuple[GeometryStorageKind, ...] | — |
| content_profiles | tuple[GeometryContentProfile, ...] | — |
| max_catalog_entries | int | — |
| max_subscription_capacity | int | — |
| max_resource_bytes | int | — |
| max_decoded_resource_bytes | int | — |
| supports_structural_deltas | bool | — |
| supports_transform_deltas | bool | — |
Return exact availability; this method never chooses a fallback representation.
Preflight one exact representation/profile pair without fallback.
class GeometryCatalogSnapshot(object)Path-free deterministic structural geometry for one generation.
| 字段 | 类型 | 默认值 |
|---|---|---|
| run_id | str | — |
| plan_digest | str | — |
| generation | int | — |
| world_revision | int | — |
| catalog_revision | int | — |
| geometry_revision | int | — |
| content_sha256 | str | — |
| entries | tuple[GeometryCatalogEntry, ...] | — |
class ScopedResourceLocator(object)Opaque provider-scoped locator; never a filesystem path or native handle.
| 字段 | 类型 | 默认值 |
|---|---|---|
| scheme | GeometryLocatorScheme | — |
| opaque_id | str | — |
class GeometryResourceLeaseDescriptor(object)Portable metadata for one digest-verified read-only resource lease. The v1 resource profiles deliberately support only closed raw little-endian encodings. ``byte_size`` is the encoded byte length and must exactly equal ``schema.decoded_byte_size``. A future compressed encoding must introduce another explicit profile with its own encoded/decoded relationship.
| 字段 | 类型 | 默认值 |
|---|---|---|
| run_id | str | — |
| plan_digest | str | — |
| generation | int | — |
| catalog_revision | int | — |
| geometry_revision | int | — |
| catalog_content_sha256 | str | — |
| lease_token | str | — |
| resource_id | str | — |
| geometry_id | str | — |
| representation | GeometryRepresentation | — |
| storage_kind | GeometryStorageKind | — |
| locator | ScopedResourceLocator | — |
| format | GeometryContentProfile | — |
| units | str | — |
| axis_convention | GeometryAxisConvention | — |
| schema | GeometryResourceSchema | — |
| byte_size | int | — |
| sha256 | str | — |
The only valid immutable cache identity for this resource.
Validate and canonicalize one bounded portable read span. ``offset`` and ``length`` must be exact built-in integers. A ``None`` length means "up to the per-call limit", not "allocate the rest of an arbitrarily large resource". Callers advance the returned span to consume larger resources in bounded chunks.
class GeometryResourceReadRequest(object)One ordered, bounded byte-span request within a resolved batch.
| 字段 | 类型 | 默认值 |
|---|---|---|
| geometry_id | str | — |
| offset | int | 0 |
| length | int | None | None |
class GeometryResourceReadResult(object)One immutable payload result in the exact order requested by a caller.
| 字段 | 类型 | 默认值 |
|---|---|---|
| request | GeometryResourceReadRequest | — |
| data | bytes | — |
class ResolvedGeometryResource(Protocol)Live provider-owned lease around an immutable resource descriptor. ``read`` returns an exact immutable ``bytes`` chunk and must enforce :meth:`GeometryResourceLeaseDescriptor.read_span`. It never exposes a filesystem path, shared-memory object, mmap, file object, native handle, or mutable buffer. A provider invalidates every retained lease on service revocation or generation reset. ``descriptor`` and ``read`` after revocation or close must raise ``RESOURCE_LEASE_REVOKED``. ``closed`` and idempotent ``close`` remain available for lifecycle cleanup.
class ResolvedGeometryResourceBatch(Protocol)Generation-scoped lease over ordered immutable geometry resources. ``descriptors`` is shared by lightweight aliases of the same compiled batch. ``read`` addresses one member by geometry ID without exposing a native handle or requiring one Python lease object per resource. ``read_many`` validates the complete request before one provider batch operation. Results preserve request order; exact duplicate spans retain duplicate logical results while providers may read their native bytes once. Logical result bytes, including duplicates, must fit ``max_total_bytes``; callers split larger worlds into bounded batches. High-rate callers should compile and retain one immutable request tuple per static catalog revision; providers may reuse its validated spans and immutable results by identity. Rebuilding an equivalent tuple is a new public-boundary request and may require O(N) validation again.
class GeometryTransform(object)One geometry pose expressed in its enclosing snapshot's world frame.
| 字段 | 类型 | 默认值 |
|---|---|---|
| geometry_id | str | — |
| world_pose | Pose | — |
class GeometryAttachmentRecord(object)Compact attachment relation for planner collision-world mirrors.
| 字段 | 类型 | 默认值 |
|---|---|---|
| attachment_id | str | — |
| parent_entity_id | str | — |
| child_entity_id | str | — |
| parent_frame_id | str | — |
| child_frame_id | str | — |
| parent_T_child | Pose | — |
| geometry_ids | tuple[str, ...] | — |
| parent_link_id | str | None | None |
| child_link_id | str | None | None |
class GeometryTransformSnapshot(object)One committed transform/attachment view without geometry buffers.
| 字段 | 类型 | 默认值 |
|---|---|---|
| run_id | str | — |
| generation | int | — |
| sim_tick | int | — |
| sim_time_s | float | — |
| sequence | int | — |
| captured_monotonic_ns | int | — |
| world_revision | int | — |
| catalog_revision | int | — |
| geometry_revision | int | — |
| catalog_content_sha256 | str | — |
| transform_revision | int | — |
| attachment_revision | int | — |
| world_frame_id | str | — |
| transforms | tuple[GeometryTransform, ...] | — |
| attachments | tuple[GeometryAttachmentRecord, ...] | — |
class GeometryDeltaKind(StrEnum)class GeometryDelta(object)Exactly one structural update, transform update, or terminal resync.
| 字段 | 类型 | 默认值 |
|---|---|---|
| run_id | str | — |
| generation | int | — |
| sim_tick | int | — |
| sim_time_s | float | — |
| sequence | int | — |
| captured_monotonic_ns | int | — |
| base_sequence | int | — |
| previous_world_revision | int | — |
| world_revision | int | — |
| previous_catalog_revision | int | — |
| catalog_revision | int | — |
| previous_catalog_content_sha256 | str | None | — |
| catalog_content_sha256 | str | None | — |
| previous_geometry_revision | int | — |
| geometry_revision | int | — |
| previous_transform_revision | int | — |
| transform_revision | int | — |
| previous_attachment_revision | int | — |
| attachment_revision | int | — |
| world_frame_id | str | — |
| kind | GeometryDeltaKind | — |
| upserted_entries | tuple[GeometryCatalogEntry, ...] | () |
| removed_geometry_ids | tuple[str, ...] | () |
| transforms | tuple[GeometryTransform, ...] | () |
| attachments | tuple[GeometryAttachmentRecord, ...] | () |
| removed_attachment_ids | tuple[str, ...] | () |
| resync_required | bool | False |
class SceneGeometryErrorCode(StrEnum)class SceneGeometryError(RuntimeError)Typed bounded failure from ``fastsim.scene.geometry@2``.
validate_geometry_resource_binding(catalog: GeometryCatalogSnapshot, descriptor: GeometryResourceLeaseDescriptor, capabilities: GeometryCapabilities) -> GeometryCatalogEntryValidate the exact catalog-to-resolved-resource join before publication. Providers call this after digest verification and before returning a live lease. No field is inferred and no representation fallback is permitted.
validate_geometry_projection(scene_catalog: object, scene_state: object, frame_catalog: object, geometry_catalog: GeometryCatalogSnapshot, transform_snapshot: GeometryTransformSnapshot, *, frame_transforms: tuple[TransformStamped, ...] | None=None) -> NoneValidate one numerically coherent scene/frame/geometry projection. ``frame_transforms`` is the complete set of committed world-to-frame lookup results when arbitrary joint or named frames participate. For the compact base/link-only projection, the same values can be derived exactly from the scene state, which preserves the five-argument validation entry point.
validate_geometry_delta_against(catalog: GeometryCatalogSnapshot, attachments: tuple[GeometryAttachmentRecord, ...], delta: GeometryDelta) -> tuple[tuple[GeometryCatalogEntry, ...], tuple[GeometryAttachmentRecord, ...]]Apply a delta to compact prior facts and validate resulting closure. This helper does not mutate inputs. It is the provider-side publication gate for relationships that cannot be checked from an isolated delta.
class GeometryDeltaSubscription(Protocol)class SceneGeometryService(Protocol)Capability-scoped collision catalog, resources, transforms, and deltas.
class SceneGeometryBatchService(SceneGeometryService, Protocol)Optional additive batch-resource extension for scene geometry.