feat(packages): ludic.photo - a camera's photographs: what the lens sees (the frustum and a line of sight over the ground and the trunks), a grade out of a hundred on size, framing, light and the moment weighted by how much subject there is, the frame's best subject and its tags, the roll with its order and pages, a buyer's price on the grade's curve, the best of each subject; the lens, the light and the market through ports; kept, full, deleted and sold as facts; the roll in its own save section
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
473552cc81
commit
24a35f1174
17 changed files with 975 additions and 0 deletions
36
packages/ludic.photo/sight.ludic
Normal file
36
packages/ludic.photo/sight.ludic
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# sight.ludic - in the picture, within reach, and actually seen. A frustum says a subject is in FRONT
|
||||
# of the lens, not that the lens can see it: the ray walks the ground and the trunks between. It is
|
||||
# forgiving on purpose - the subject passes if its body or its head is clear.
|
||||
const PHT_STEP: float = 3.0 # metres between the ray's samples
|
||||
|
||||
function pht_ray_point(x: float, y: float, z: float) -> bool {
|
||||
let cx = PhotoLens.x()
|
||||
let cy = PhotoLens.y()
|
||||
let cz = PhotoLens.z()
|
||||
let d = Math.sqrt((x - cx) * (x - cx) + (y - cy) * (y - cy) + (z - cz) * (z - cz))
|
||||
if d < 3.0 { return true }
|
||||
let n = int(Math.clamp(d / PHT_STEP, 6.0, 120.0))
|
||||
for s in 1 .. n {
|
||||
let f = float(s) / float(n)
|
||||
let px = Math.lerp(cx, x, f)
|
||||
let py = Math.lerp(cy, y, f)
|
||||
let pz = Math.lerp(cz, z, f)
|
||||
let g = PhotoLens.ground(px, pz)
|
||||
# the ground with 35 cm of slack; a trunk once past the lens's own few metres
|
||||
if g - 0.35 > py { return false }
|
||||
if d * f > 6.0 and py - g < 7.0 and PhotoLens.trunk(px, pz, 0.45) { return false }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
# is (x, y, z) in the picture, within `far`, and can the lens see it?
|
||||
export function photo_in_view(x: float, y: float, z: float, far: float) -> bool {
|
||||
let dx = x - PhotoLens.x()
|
||||
let dy = y - PhotoLens.y()
|
||||
let dz = z - PhotoLens.z()
|
||||
let d = Math.sqrt(dx * dx + dy * dy + dz * dz)
|
||||
if d > far or d < 0.5 { return false }
|
||||
if (dx * PhotoLens.fx() + dy * PhotoLens.fy() + dz * PhotoLens.fz()) / d < 0.72 { return false }
|
||||
if not PhotoLens.visible(x, y, z, 1.0) { return false }
|
||||
return pht_ray_point(x, y, z) or pht_ray_point(x, y + 0.55, z)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue