an.ir.world#

One world, many shots: the scene world’s geometry and its lowering (ADR 0009).

A scene may declare a world (SceneIR.world): members at world positions with a size, named viewpoints, and a travel. A shot with a viewpoint is a pinhole camera onto that world; this module turns the two into what the stage already understands — a stage placement per entity, and plain set/tween actions for the streams of a travelling view — so the compiler, the shot cache and the renderers see nothing new. A shot without a viewpoint is untouched, and a hand stage.at always wins.

The projection, with the stage’s axes extended by depth (x right, y DOWN, z away from the viewer): a point p seen from a camera at c with basis (forward, right, down) and focal length f (pixels) lands at

depth = (p − c) · forward sx = f · ((p − c) · right) / depth sy = f · ((p − c) · down) / depth

and an entity of world size S whose art is n pixels tall at stage.scale 1 is drawn at stage.scale = (S / n) · f / depth. That is the multiplane camera: near things are large and rush past, far things are small and barely move, and a close-up is the same world seen from nearer.

>>> from an.ir.schema import World, WorldMember, Viewpoint
>>> world = World(members=[
...     WorldMember(kind="prop", id="near", store="props", ref="p", at=(1.0, 0.0, 2.0), height=1.0),
...     WorldMember(kind="prop", id="far", store="props", ref="p", at=(1.0, 0.0, 20.0), height=1.0),
... ])
>>> box = (-10.0, -20.0, 10.0, 0.0)             # 20 px tall art, feet at the origin
>>> eye = resolve_viewpoint(world, Viewpoint(at=(0.0, 0.0, 0.0), focal=1000.0),
...                         extents={"near": box, "far": box}, width=1280, height=720)
>>> placed = member_placements(world, eye, extents={"near": box, "far": box}, width=1280, height=720)
>>> placed["near"].at, round(placed["near"].scale, 2)
((500.0, 0.0), 25.0)
>>> placed["far"].at, round(placed["far"].scale, 2)
((50.0, 0.0), 2.5)

Module Attributes

Box

(x0, y0, x1, y1) in its art's pixels at stage.scale 1, relative to its placement point (a character's feet).

Extents

{member or stream id: Box | None}, measured by the stage (an.stage.world.member_extents()); the IR layer only reads it.

HAND_PLACEMENT_TOLERANCE_PX

A hand stage.at this far from the world's placement is "the same" (the cut-continuity tolerance, an#394); farther is a lint warning.

PERSPECTIVE_TOLERANCE

A hand placement whose scale differs from the ground plane's by more than this fraction is out of perspective (catalogue A6).

MEMBER_FLOOR_ALONG

The stage direction of a member's floor line.

Functions

fit_channel(g, a, b, *, tolerance, min_step)

One channel's motion g on [a, b] as tweens: [(t0, t1, v0, v1, easing)], each a cubic-Bézier easing whose end slopes match g's (a Hermite fit: control points (1/3, d0/3, 2/3, 1 − d1/3)), split in two wherever the fit strays more than tolerance from g — dense where the motion bends (a stream instance near the camera), one segment where it is straight.

focal_length(viewpoint, *, width)

The lens in pixels: focal as given, else from fov (horizontal, degrees; DFLT_FOV_DEG when unset) and the frame width.

ground_scale(projection, at, *, floor_y, unit)

The stage.scale of a member standing on the horizontal plane y = floor_y whose feet are drawn at screen at (px from the frame centre), or None at or above the horizon or when the plane is not below the eye.

frame_poses(scene, *[, film_starts])

Per framed shot, where each frame stands in the world as the shot opens and as it closes (after the shot's own <frame>:at_* actions): what an world show --frames prints.

has_world(scene)

Whether lowering would change anything: a world, or a shot with a viewpoint.

lower_world(scene, *, extents[, ...])

The scene with every framed shot's placements derived from the world.

frame_moving_members(scene, index, *[, ...])

The positioned members of shot index's world that stand in a frame moving relative to the viewpoint's over the shot (the rule lower_world() samples their motion by), or that a reframe carries between frames.

member_of(entity, **placement)

The world member a shot entity becomes (the inverse of entity_of()): its fields as they are, its stage dropped (a member is placed by each shot's viewpoint) and its after kept, with placement (at, height, ...) where the world stands it.

member_placements(world, projection, *, ...)

Every member's placement under projection: {id: Placed}.

planes_at_infinity(world, environments)

Every plane of world at infinity (an#735), by an validate's own rule: listed far under world.travel.plates (in listing order), then each plane of an environment member in a frame coupled far (in member order).

pose_look(pose)

The (yaw, pitch) in degrees a pose faces.

resolve_viewpoint(world, viewpoint, *, ...)

The camera a viewpoint is, as a Projection, in its own frame's units.

stream_instances(stream, travel, *, s_min, s_max)

The instances of stream whose position along the travel lies in [s_min, s_max]: [(k, world position)], k the instance index.

stream_slots(stream, travel)

How many entities a stream needs by its depth range: one per instance that can be between near and far at once, plus one.

viewpoint_of(world, viewpoint)

The shot's viewpoint as a model: a name is looked up in the world.

world_ground_at(spec, t)

The floor spec (an entity's overrides.ground, as the world's lowering writes it) gives at shot time t: a member's keys interpolated linearly, held past either end.

world_ground_mark(shot, entity)

entity's an.base.GROUND_OVERRIDE mark on shot, or None.

Classes

GroundAt(at, along[, scale, lateral])

A member's floor at one instant (an.base.GROUND_OVERRIDE), in the coordinates of its stage.at: the floor point under its placement point (at), the floor line's unit direction (along), the stage px one world unit along the floor spans there (scale: focal over depth), and where that floor point lies along the floor in the frame the member stands in, in world units from where it stood as the shot opens (lateral).

Lowered(scene[, notes, origins, carried])

The scene as the compiler will see it, the notes to report, and for each framed shot where its lowered entities came from (origins: per lowered entity index, the author's entity index, or None for one the world added), so a finding on a lowered shot can name the author's line.

Placed(id, at, scale, depth, box, in_frame, via)

Where one member lands in a framed shot.

PlaneAtInfinity(member, plane, reason, ...)

A plane at infinity, and why (an#735): what an validate pins to parallax factor 0 and a genre's far-plate critic judges.

Projection(at, forward, right, down, focal)

A resolved viewpoint: where the camera is, which way it looks, its lens.

WorldNote(shot, index, severity, kind, ...)

One thing the lowering did or could not do for one shot, for an validate (its severity) and an world show.

Exceptions

WorldError

A world or viewpoint that cannot be resolved (an unknown member, a subject whose extent is unknown, a viewpoint name the world does not have, a travel past its budget).

an.ir.world.Box#

(x0, y0, x1, y1) in its art’s pixels at stage.scale 1, relative to its placement point (a character’s feet). None means it could not be measured (nothing drawn, or a compile that failed: the lowering’s note says which).

Type:

A member’s native extent

alias of tuple[float, float, float, float]

an.ir.world.Extents#

{member or stream id: Box | None}, measured by the stage (an.stage.world.member_extents()); the IR layer only reads it.

alias of Mapping[str, Box | None]

class an.ir.world.GroundAt(at, along, scale=1.0, lateral=0.0)[source]#

Bases: object

A member’s floor at one instant (an.base.GROUND_OVERRIDE), in the coordinates of its stage.at: the floor point under its placement point (at), the floor line’s unit direction (along), the stage px one world unit along the floor spans there (scale: focal over depth), and where that floor point lies along the floor in the frame the member stands in, in world units from where it stood as the shot opens (lateral). A stage point on the floor is at lateral + (p - at) · along / scale world units along it, in the member’s own frame: a foot that keeps that number keeps its place on the floor, however the member, its frame or the camera carry it across the stage.

position(p)[source]#

Where stage point p lies along the floor, in world units in the member’s frame (see the class).

>>> GroundAt((10.0, 50.0), (1.0, 0.0), 2.0, 3.0).position((30.0, 50.0))
13.0
Return type:

float

an.ir.world.HAND_PLACEMENT_TOLERANCE_PX: float = 2.0#

A hand stage.at this far from the world’s placement is “the same” (the cut-continuity tolerance, an#394); farther is a lint warning.

class an.ir.world.Lowered(scene, notes=list(), origins=dict(), carried=dict())[source]#

Bases: object

The scene as the compiler will see it, the notes to report, and for each framed shot where its lowered entities came from (origins: per lowered entity index, the author’s entity index, or None for one the world added), so a finding on a lowered shot can name the author’s line.

carried: dict[int, int]#

Per continued shot (an#542), how many actions its continue: put before the author’s, so a finding’s actions/<k> can name the author’s line.

an.ir.world.MEMBER_FLOOR_ALONG: tuple[float, float] = (1.0, 0.0)#

The stage direction of a member’s floor line. Members are billboards that never roll with the camera: an upright figure stands on a level line, so under a rolled camera its floor is level too (the horizon’s tilt would put its downhill foot into the floor). When members roll, this is the horizon’s stage direction.

an.ir.world.PERSPECTIVE_TOLERANCE: float = 0.15#

A hand placement whose scale differs from the ground plane’s by more than this fraction is out of perspective (catalogue A6).

class an.ir.world.Placed(id, at, scale, depth, box, in_frame, via, note='')[source]#

Bases: object

Where one member lands in a framed shot.

at: tuple[float, float] | None#

Screen pixels from the frame centre; None when another pass places it (attached without an offset) or it cannot be placed (see note).

box: tuple[float, float, float, float] | None#

Its screen box, when its extent is known.

note: str = ''#

Why it is not placed by the world, when it is not.

via: str#

world (projected), attached (from the host’s placement), host (goes with the host, placed by nothing here), environment.

class an.ir.world.PlaneAtInfinity(member, plane, reason, frame, coupled_frame, ir_path)[source]#

Bases: object

A plane at infinity, and why (an#735): what an validate pins to parallax factor 0 and a genre’s far-plate critic judges.

member/plane name it ("<member>/<plane>", as the travel’s plates list it); reason is "listed" (far under world.travel.plates) or "frame" (it stands in frame, which is, or hangs from, coupled_frame, coupled far); ir_path is where a finding about it points: the listing (world/travel/plates/far/<k>) or the world member that puts it in the frame (world/members/<j>).

>>> PlaneAtInfinity("set", "sky", "frame", "horizon", "far", "world/members/0").why
"in frame 'horizon', under 'far' coupled `far`"
property path: str#

"<member>/<plane>", as world.travel.plates lists it.

property why: str#

The reason, in words.

class an.ir.world.Projection(at, forward, right, down, focal, aim=None)[source]#

Bases: object

A resolved viewpoint: where the camera is, which way it looks, its lens.

>>> eye = Projection(at=(0.0, 0.0, 0.0), forward=(0.0, 0.0, 1.0), right=(1.0, 0.0, 0.0), down=(0.0, 1.0, 0.0), focal=1000.0)
>>> eye.project((2.0, -1.0, 10.0))
(200.0, -100.0, 10.0)
>>> eye.project((0.0, 0.0, -1.0)) is None
True
>>> rolled = Projection((0.0, 0.0, 0.0), *_basis(0.0, 0.0, 90.0), focal=100.0)
>>> [round(v, 6) + 0.0 for v in rolled.project((1.0, 0.0, 10.0))]   # a point on the right: now at the bottom
[0.0, 10.0, 10.0]
aim: tuple[float, float, float] | None = None#

the centre of the band it frames (not the subject’s footing). None for a camera given by at. The jump-cut check measures a shot’s size there (an#853).

Type:

The point a subject-framed viewpoint aims at

moved(by)[source]#

The same camera translated by by (the vehicle moved).

Return type:

Projection

project(p)[source]#

(sx, sy, depth): screen pixels from the frame centre, and the depth; None for a point at or behind the camera.

Return type:

tuple[float, float, float] | None

transformed(pose)[source]#

The same camera carried by a frame whose pose is pose: this projection is in the frame’s units, the result is in its parent’s (the world’s, for a frame’s world pose).

>>> eye = Projection((0.0, 0.0, 0.0), (0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0), 100.0)
>>> eye.transformed(Pose(at=(0.0, 0.0, 4.0))).at
(0.0, 0.0, 4.0)
>>> eye.transformed(Pose()) is eye
True
Return type:

Projection

view(p)[source]#

p in camera coordinates: (right, down, depth).

Return type:

tuple[float, float, float]

exception an.ir.world.WorldError[source]#

Bases: ValueError

A world or viewpoint that cannot be resolved (an unknown member, a subject whose extent is unknown, a viewpoint name the world does not have, a travel past its budget). The IR layer raises it; an validate reports it as an error and the lowering is then skipped for that scene.

class an.ir.world.WorldNote(shot, index, severity, kind, entity, message)[source]#

Bases: object

One thing the lowering did or could not do for one shot, for an validate (its severity) and an world show.

property description: str#

The note as a finding says it (validate and the render alike).

property ir_path: str#

the shot’s entities.

Type:

Where a finding on it points

an.ir.world.fit_channel(g, a, b, *, tolerance, min_step)[source]#

One channel’s motion g on [a, b] as tweens: [(t0, t1, v0, v1, easing)], each a cubic-Bézier easing whose end slopes match g’s (a Hermite fit: control points (1/3, d0/3, 2/3, 1 − d1/3)), split in two wherever the fit strays more than tolerance from g — dense where the motion bends (a stream instance near the camera), one segment where it is straight. A segment is never shorter than min_step.

>>> segs = fit_channel(lambda t: 100.0 / (10.0 - t), 0.0, 9.0, tolerance=1.0, min_step=0.05)
>>> segs[0][:2], segs[-1][1], round(segs[-1][3], 1)
((0.0, 4.5), 9.0, 100.0)
>>> len(segs) < 8
True
Return type:

list[tuple[float, float, float, float, Any]]

an.ir.world.focal_length(viewpoint, *, width)[source]#

The lens in pixels: focal as given, else from fov (horizontal, degrees; DFLT_FOV_DEG when unset) and the frame width. A wider frame at the same field of view is a longer focal, so a world framed once frames the same at any resolution.

>>> round(focal_length(Viewpoint(fov=90.0), width=1280))
640
>>> focal_length(Viewpoint(focal=500.0), width=1280)
500.0
Return type:

float

an.ir.world.frame_moving_members(scene, index, *, film_start=None)[source]#

The positioned members of shot index’s world that stand in a frame moving relative to the viewpoint’s over the shot (the rule lower_world() samples their motion by), or that a reframe carries between frames. A stage floor does not stay under them, so a check measuring against it (skate on solve.ground or the member’s own floor, an#519) cannot judge them; a world that declares ground gives each its own floor and reference point, keyed as the camera sees it (overrides.ground, world_ground_at()). Empty for a shot no world frames; raises WorldError as lowering would.

>>> frame_moving_members(SceneIR(), 0)
frozenset()
Return type:

frozenset[str]

an.ir.world.frame_poses(scene, *, film_starts=None)[source]#

Per framed shot, where each frame stands in the world as the shot opens and as it closes (after the shot’s own <frame>:at_* actions): what an world show --frames prints.

>>> from an.ir.schema import Frame, FrameMoving, Viewpoint, World
>>> scene = SceneIR(world=World(frames={"car": Frame(moving=FrameMoving(speed=10.0))},
...                             viewpoints={"v": Viewpoint(at=(0.0, 0.0, 0.0), frame="car")}),
...                 timeline=[Shot(id="s", duration=2.0, viewpoint="v")])
>>> row = frame_poses(scene)[0]
>>> row["viewpoint_frame"], row["frames"][0]["name"], row["frames"][0]["end"]["at"]
('car', 'car', (0.0, 0.0, 20.0))
Return type:

list[dict[str, Any]]

an.ir.world.ground_scale(projection, at, *, floor_y, unit)[source]#

The stage.scale of a member standing on the horizontal plane y = floor_y whose feet are drawn at screen at (px from the frame centre), or None at or above the horizon or when the plane is not below the eye.

The single-view relation (catalogue A6): the ray through the pixel meets the floor at depth t * f, and a member of unit world units per native pixel is drawn at unit * f / depth = unit * ray_y / (floor_y - eye_y), so scale grows with the pixel’s distance below the horizon.

>>> eye = Projection((0.0, 0.0, 0.0), (0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0), 1000.0)
>>> round(ground_scale(eye, (0.0, 100.0), floor_y=1.0, unit=0.01), 3)    # feet 100 px below the horizon
1.0
>>> round(ground_scale(eye, (0.0, 200.0), floor_y=1.0, unit=0.01), 3)    # nearer: twice the size
2.0
>>> ground_scale(eye, (0.0, -50.0), floor_y=1.0, unit=0.01) is None      # above the horizon
True
Return type:

float | None

an.ir.world.has_world(scene)[source]#

Whether lowering would change anything: a world, or a shot with a viewpoint.

>>> has_world(SceneIR())
False
Return type:

bool

an.ir.world.lower_world(scene, *, extents, film_starts=None, fps=None, extent_problems=None, plane_geometry=None, bands=None, band_problems=None, view_for=None)[source]#

The scene with every framed shot’s placements derived from the world.

A shot without a viewpoint is returned as it is. For a framed shot: its listed entities keep their order of appearance among themselves but are drawn in depth order (far first) with the members the frame shows and the shot did not list; environments come first; listed entities that are not members go on top. A listed member’s hand stage.at wins (a note says when it disagrees with the world; its scale is the world’s unless set); one without is filled in. A member the viewpoint hides is left out unless the shot lists it: the listing wins, and a note says so. Under a travel, the streams’ slot entities are added with their motion; a scene already lowered gains nothing from a second pass.

extents is what the stage measured (an.stage.world.member_extents()), extent_problems why some could not be; film_starts is where each shot starts in the film, so stream phase is continuous across cuts (the shot sum by default); plane_geometry is {environment member id: {plane: (offset, box)}}, each plane’s origin on screen (Plane.offset) and its drawn box around it (None: unknown), read by the stage (an.stage.world.plane_geometry()): where a plane at a world depth is anchored and when it is on screen (an#503; the origin and no box for one it does not name); bands is where a subject’s own rig puts each shot size (Bands, measured by an.stage.world.member_shot_sizes()), and band_problems why a subject’s could not be (a shot_size note on each shot that frames it). view_for is (member, relative_yaw) -> actions | None (ViewFor, bound to the kinds’ own hook by an.stage.world.member_views()): for each shown member with a facing it is given the camera’s yaw about the member relative to where it faces (an#734), and what it returns is put at the head of the shot’s actions. None (the default): no member is turned to the camera.

Raises WorldError for a viewpoint the world cannot resolve.

>>> lower_world(SceneIR(), extents={}).scene.timeline
[]
Return type:

Lowered

an.ir.world.member_of(entity, **placement)[source]#

The world member a shot entity becomes (the inverse of entity_of()): its fields as they are, its stage dropped (a member is placed by each shot’s viewpoint) and its after kept, with placement (at, height, …) where the world stands it. Its joints stay with the shot: they tie it to other entities of THAT shot, and entity_of() gives a member none.

>>> e = AssetRef(kind="prop", id="lamp", store="props", ref="lamp",
...              stage=StagePlacement(at=(1.0, 2.0), after="set/sky"))
>>> m = member_of(e, at=(0.0, 0.0, 5.0), height=1.0)
>>> m.at, m.after, m.stage
((0.0, 0.0, 5.0), 'set/sky', None)
Return type:

WorldMember

an.ir.world.member_placements(world, projection, *, extents, width, height, hide=(), hand=None, extent_problems=None, member_at=None, fixed=None)[source]#

Every member’s placement under projection: {id: Placed}.

Positioned members are projected; attached ones follow their host (an offset in the host’s native units, times the host’s scale); an environment is present with no placement. A member behind the camera is placed nowhere and is not in frame. hand is {id: (at, scale)} for members a shot placed by hand, positioned or attached: that placement stands in for the derived one (its depth stays the world’s), so what is attached to it follows the hand, as the compiler’s own passes do. extent_problems says why an extent could not be measured, for the note. member_at overrides a member’s at with where it stands in the viewpoint’s frame (a member in another frame, or moved by an action); fixed is a placement some other pass already settled (a member in motion), which attached members then follow.

Return type:

dict[str, Placed]

an.ir.world.planes_at_infinity(world, environments)[source]#

Every plane of world at infinity (an#735), by an validate’s own rule: listed far under world.travel.plates (in listing order), then each plane of an environment member in a frame coupled far (in member order). A member’s planes are read from its descriptor in environments (the environments store); a listed plane is reported even when its descriptor cannot be read, and a listed path with no / is skipped (malformed: another check’s to report). For a genre’s critic (cutan’s far-plate critic, reeleehq/cutan#177), so the check and the critic share one definition of “far”.

>>> from an.ir.schema import Travel
>>> w = World(travel=Travel(plates={"far": ["set/sky", "oops"]}))
>>> [(p.path, p.reason, p.ir_path) for p in planes_at_infinity(w, {})]
[('set/sky', 'listed', 'world/travel/plates/far/0')]
Return type:

list[PlaneAtInfinity]

an.ir.world.pose_look(pose)[source]#

The (yaw, pitch) in degrees a pose faces.

>>> pose_look(Pose())
(0.0, 0.0)
Return type:

tuple[float, float]

an.ir.world.resolve_viewpoint(world, viewpoint, *, extents, width, height, member_at=None, bands=None)[source]#

The camera a viewpoint is, as a Projection, in its own frame’s units. member_at overrides a subject’s at with where it stands in the VIEWPOINT’s frame (a subject in another frame, at the shot’s start). bands gives a subject’s own band for a size (its rig’s landmarks, an.genres.EntityKind.shot_sizes); otherwise SHOT_SIZES’. A band that names its own columns ((top, bottom, left, right), an#769) is framed at its true width and centred on it.

Crop policy for a partial size (medium, close_up; an#769). When a band’s true width is known and fitting it would put the camera so far back that the size is not a jump-cut step (an.ir.schema.JUMP_CUT_SIZE_RATIO) nearer than the next wider size, the camera comes in to that step, but never nearer than the band’s height needs: the sides are cropped rather than the cut becoming a jump cut. A band without columns is fitted at its box’s aspect, as before.

A viewpoint with at is that camera. One with a subject is computed: on the look direction, at the distance that fills fill of the frame with the subject’s band (SHOT_SIZES; its rows at its box’s aspect, _band_box()), shifted so the band’s centre lands at subject_at. With several subjects the band is their union, aimed at their mean depth, and the distance is what the NEAREST subject needs from its own depth, so every subject’s band fits the frame’s height and width.

>>> from an.ir.schema import World, WorldMember
>>> world = World(members=[WorldMember(kind="prop", id="p", store="props", ref="p", at=(3.0, 0.0, 10.0), height=2.0)])
>>> eye = resolve_viewpoint(world, Viewpoint(subject="p", size="full", focal=900.0),
...                         extents={"p": (-10.0, -40.0, 10.0, 0.0)}, width=1600, height=900)
>>> [round(v, 3) for v in eye.at]           # 2 units tall fills 0.9 × 900 px: 2.222 away, centred on the box
[3.0, -1.0, 7.778]
Return type:

Projection

an.ir.world.stream_instances(stream, travel, *, s_min, s_max)[source]#

The instances of stream whose position along the travel lies in [s_min, s_max]: [(k, world position)], k the instance index.

Instance k stands at k × mean spacing plus a seeded jitter that keeps consecutive spacings inside the stream’s range, lane to the right of the direction of travel, at height y.

>>> from an.ir.schema import Stream, Travel
>>> t = Travel(speed=10.0)
>>> s = Stream(id="pole", ref="pole", height=6.0, every=12.0, lane=2.0)
>>> stream_instances(s, t, s_min=0.0, s_max=30.0)
[(0, (2.0, 0.0, 0.0)), (1, (2.0, 0.0, 12.0)), (2, (2.0, 0.0, 24.0))]
Return type:

list[tuple[int, tuple[float, float, float]]]

an.ir.world.stream_slots(stream, travel)[source]#

How many entities a stream needs by its depth range: one per instance that can be between near and far at once, plus one. Instance k is drawn by slot k mod slots, so an entity is reused for the next instance once this one has passed the camera. A shot takes the larger of this and what its viewpoint shows (_span_slots(), an#516), so the count, and the slot an instance takes, can differ between two shots; nothing relies on it, since each shot compiles alone.

>>> stream_slots(Stream(id="pole", ref="pole", height=6.0, every=12.0), Travel(speed=10.0, near=0.5, far=60.0))
6
Return type:

int

an.ir.world.viewpoint_of(world, viewpoint)[source]#

The shot’s viewpoint as a model: a name is looked up in the world.

>>> viewpoint_of(World(viewpoints={"a": Viewpoint(focal=1.0)}), "a").focal
1.0
>>> viewpoint_of(None, "a")
Traceback (most recent call last):
...
an.ir.world.WorldError: shot names viewpoint 'a' but the scene has no `world`
Return type:

Viewpoint | None

an.ir.world.world_ground_at(spec, t)[source]#

The floor spec (an entity’s overrides.ground, as the world’s lowering writes it) gives at shot time t: a member’s keys interpolated linearly, held past either end. None for a spec that is not one of the lowering’s two shapes.

>>> world_ground_at({"at": [3.0, 120.0], "along": [1.0, 0.0], "scale": 60.0}, 0.5)
GroundAt(at=(3.0, 120.0), along=(1.0, 0.0), scale=60.0, lateral=0.0)
>>> world_ground_at({"keys": [[0.0, 0.0, 100.0, 1.0, 0.0, 60.0, 0.0],
...                           [1.0, 0.0, 140.0, 1.0, 0.0, 80.0, 0.5]]}, 0.25)
GroundAt(at=(0.0, 110.0), along=(1.0, 0.0), scale=65.0, lateral=0.125)
>>> world_ground_at(240, 1.0), world_ground_at("nonsense", 0.0)
(None, None)
Return type:

GroundAt | None

an.ir.world.world_ground_mark(shot, entity)[source]#

entity’s an.base.GROUND_OVERRIDE mark on shot, or None. It is read only on a shot lowered from a world (one with a viewpoint): the lowering owns it there (lower_world() writes it under a world that declares ground and drops any other), and the compiler refuses it on any other shot, so a hand-written one is never taken for the world’s floor.

>>> from an.ir.schema import AssetRef, Shot
>>> e = AssetRef(kind="prop", id="p", store="props", ref="r",
...              overrides={"ground": {"at": [0, 60], "along": [1, 0]}})
>>> world_ground_mark(Shot(id="s", duration=1.0, viewpoint="v"), e)
{'at': [0, 60], 'along': [1, 0]}
>>> world_ground_mark(Shot(id="s", duration=1.0), e) is None
True
Return type:

Any | None