The `# mcrf:` stamp recorded verified=<version>@<commit>, so every commit rewrote
the hash in all 130 snippet headers -- a guaranteed 130-file diff carrying no signal
git history doesn't already have, and one `--check` ignores anyway. The version alone
is stable within a dev cycle ("0.2.8-dev") and becomes the release marker at a tag
("0.2.9"), which is the whole point of the field: freezing a version into the docs
site's history, not pinning a commit.
verified is now version-only. The stamper is idempotent again: a second run on a
clean tree changes zero files. This commit is the one-time normalization that strips
the @hash suffix from the existing headers.
Found while cleaning up after a make release-docs run left all 130 snippets dirty
with nothing but hash churn.
46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
# mcrf: objects=[Caption,Color,Frame,Scene,Vector] verified=0.2.8-dev status=ok
|
|
# Vector Normalized - Unit vectors
|
|
import mcrfpy
|
|
|
|
scene = mcrfpy.Scene("demo")
|
|
mcrfpy.current_scene = scene
|
|
|
|
scene.children.append(mcrfpy.Frame(pos=(0, 0), size=(1024, 768), fill_color=mcrfpy.Color(30, 30, 40)))
|
|
|
|
_caption = mcrfpy.Caption(
|
|
text="Vector Normalization",
|
|
pos=(400, 80))
|
|
_caption.fill_color = mcrfpy.Color(255, 220, 100)
|
|
scene.children.append(_caption)
|
|
|
|
# Test vectors
|
|
vectors = [
|
|
mcrfpy.Vector(100, 0),
|
|
mcrfpy.Vector(0, 50),
|
|
mcrfpy.Vector(30, 40),
|
|
mcrfpy.Vector(-100, 100),
|
|
]
|
|
|
|
y = 180
|
|
for v in vectors:
|
|
normalized = v.normalize()
|
|
|
|
info = f"Vector({v.x:.0f}, {v.y:.0f})"
|
|
scene.children.append(mcrfpy.Caption(text=info, pos=(150, y)))
|
|
|
|
scene.children.append(mcrfpy.Caption(
|
|
text=f"magnitude = {v.magnitude():.2f}",
|
|
pos=(400, y)
|
|
))
|
|
|
|
scene.children.append(mcrfpy.Caption(
|
|
text=f"normalized = ({normalized.x:.2f}, {normalized.y:.2f})",
|
|
pos=(600, y)
|
|
))
|
|
|
|
y += 80
|
|
|
|
status = mcrfpy.Caption(text="Normalized vectors have magnitude = 1.0", pos=(350, 600))
|
|
status.outline = 2
|
|
status.outline_color = mcrfpy.Color(0, 0, 0)
|
|
scene.children.append(status)
|