Skip to content

OnlyWorlds Unity SDK 0.42.0

Choose a tag to compare

@tmoosting tmoosting released this 14 Nov 22:12
· 224 commits to main since this release

The default layout method: a world's default picture and one element's, the same points as the
TypeScript SDK and the Python package. A minor release: it adds public API.

Added

  • OWLayout.LayoutByKind(graph) and OWLayout.LayoutAround(graph, focus, steps = 1): a world's default
    picture and one element's, the TypeScript SDK's layoutByKind and layoutAround (4.167.0) and the Python package's
    layout_by_kind and layout_around (0.127.0). By kind: each kind of element gets a point on a circle, links act as
    springs and neighbours push apart for a fixed number of seeded steps, and the answer is fitted into a frame of -1 to
    1. Around: the focus at 0, 0, its neighbours on rings round it, and with steps 2 their neighbours fanned out
      beyond. Each takes an OWWorldGraph or a JObject {nodes, edges} in the TypeScript SDK's words, puts it in one
      order first (so the order it is handed in moves nothing), and answers OWLayoutByKind or OWLayoutAround (Method,
      Version 1, Points in the order the nodes were handed in). A graph it cannot read is an ArgumentException
      naming what. The same graph gives the same points as the two packages: by kind to the last bit, around within
      1e-12 (its cosines and sines are the runtime's). The kinds' anchors on the circle are a table of bit patterns
      (OWLayout.Anchors.cs, generated by codegen/generate_layout_anchors.py from the shared fixture), never computed,
      and Math.min and Math.max are JavaScript's (Mono's Math.Min answers its second argument on a tie of +0 and
      -0). The shared fixture (test/fixtures/layout/by-kind.json, sha256 06a023ea…, vendored in
      Tests/Editor/Fixtures/layout/) runs whole: its 12 by-kind cases bit for bit and its 7 around cases. Checked
      against the TypeScript SDK on 1,500 random graphs as well: 159,081 by-kind points equal to the bit and 705 around
      runs within 1e-12.