nmarshall commited on
Commit
7fd55a1
·
1 Parent(s): 2aca128

qvm: point rotation helper

Browse files
docs/ASSET_PIPELINE_TODO.md CHANGED
@@ -541,3 +541,6 @@ Research progress: RE-619 [report](research/QVM_SHARED_SHOT_AIM.md); remaining n
541
 
542
 
543
  Research progress: RE-620 [report](research/QVM_SHOT_TRACE_REQUEST.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
541
 
542
 
543
  Research progress: RE-620 [report](research/QVM_SHOT_TRACE_REQUEST.md); remaining native/content/runtime/platform scope stays open.
544
+
545
+
546
+ Research progress: RE-621 [report](research/QVM_ROTATE_POINT.md); remaining native/content/runtime/platform scope stays open.
docs/FINDINGS.md CHANGED
@@ -896,3 +896,6 @@ Bounded qagame paths recover bomb-plant/inactivity correction requests, direct f
896
 
897
 
898
  **RE-620 — Shot trace prelude candidate bounds and native request:** 291641 unlinks the shooter, may request unrecovered rewind/setup helpers, widens eligible candidate bounds and issues native−25 with mask100663297. [Evidence](research/QVM_SHOT_TRACE_REQUEST.md).
 
 
 
 
896
 
897
 
898
  **RE-620 — Shot trace prelude candidate bounds and native request:** 291641 unlinks the shooter, may request unrecovered rewind/setup helpers, widens eligible candidate bounds and issues native−25 with mask100663297. [Evidence](research/QVM_SHOT_TRACE_REQUEST.md).
899
+
900
+
901
+ **RE-621 — Complete point rotation helper and alias write ordering:** 61092 constructs a rotation matrix using a minimum-axis basis and native trig; point/output alias changes results because final component stores reread input. [Evidence](research/QVM_ROTATE_POINT.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -861,3 +861,6 @@ Research progress: RE-619 [report](research/QVM_SHARED_SHOT_AIM.md); remaining n
861
 
862
 
863
  Research progress: RE-620 [report](research/QVM_SHOT_TRACE_REQUEST.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
861
 
862
 
863
  Research progress: RE-620 [report](research/QVM_SHOT_TRACE_REQUEST.md); remaining native/content/runtime/platform scope stays open.
864
+
865
+
866
+ Research progress: RE-621 [report](research/QVM_ROTATE_POINT.md); remaining native/content/runtime/platform scope stays open.
docs/RESEARCH_LEDGER.md CHANGED
@@ -782,3 +782,8 @@ Actual293732 now calls recovered290493 with its local forward/global muzzle, the
782
  ## 2026-10-20 — RE-620 Shot trace prelude candidate bounds and native request (separate task commit)
783
 
784
  291641 unlinks the shooter, may request unrecovered rewind/setup helpers, widens eligible candidate bounds and issues native−25 with mask100663297. Four branch fixtures and six player records check every candidate word, skip gates, native ABI and unchanged trace buffer. Full suite: 973 tests pass. Report regenerates byte-identically (297738 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
 
 
 
 
 
 
782
  ## 2026-10-20 — RE-620 Shot trace prelude candidate bounds and native request (separate task commit)
783
 
784
  291641 unlinks the shooter, may request unrecovered rewind/setup helpers, widens eligible candidate bounds and issues native−25 with mask100663297. Four branch fixtures and six player records check every candidate word, skip gates, native ABI and unchanged trace buffer. Full suite: 973 tests pass. Report regenerates byte-identically (297738 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
785
+
786
+
787
+ ## 2026-10-20 — RE-621 Complete point rotation helper and alias write ordering (separate task commit)
788
+
789
+ 61092 constructs a rotation matrix using a minimum-axis basis and native trig; point/output alias changes results because final component stores reread input. 81 fixtures compare unit-axis matrices to independent Rodrigues geometry, exact f32 matrix application, native arguments/order and zero-axis stopping. Full suite: 977 tests pass. Report regenerates byte-identically (275902 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -904,3 +904,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
904
 
905
 
906
  - [x] RE-620 Shot trace prelude candidate bounds and native request ([report](research/QVM_SHOT_TRACE_REQUEST.md)).
 
 
 
 
904
 
905
 
906
  - [x] RE-620 Shot trace prelude candidate bounds and native request ([report](research/QVM_SHOT_TRACE_REQUEST.md)).
907
+
908
+
909
+ - [x] RE-621 Complete point rotation helper and alias write ordering ([report](research/QVM_ROTATE_POINT.md)).
docs/research/QVM_ROTATE_POINT.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Complete point rotation helper and alias write ordering
2
+
3
+ RE-621. Reproduce with `python3 scripts/analyze_qvm_rotate_point.py`; check with `python3 scripts/test_qvm_rotate_point.py`. The [machine report](qvm-rotate-point.json) retains source identity and bounded fixtures.
4
+
5
+ Actual61093–62064 now executes the complete rotation helper. It selects a perpendicular axis, retains the source squared reciprocal projection, normalizes with supplied sqrt, constructs basis/rotation matrices and applies them to the input point. Native order is sqrt,cos,sin,sin,cos with identical radian arguments for all trig calls. Eighty fixtures cover coordinate/oblique unit axes, two points, five angles and separate/in-place output. Matrices match independent unit-axis Rodrigues geometry within2e−6; exact f32 matrix application checks all final words. In-place output is not generically safe: later components reread earlier overwritten input components. Zero axis stops before projection division with output unchanged. Nonunit axes, axis/output alias, other overlap and native-library bit parity remain outside the validated domain.
6
+
7
+ No original executable/full QVM/native collision/physics/rendering executes. Native responses and legal input domains are supplied or unverified where stated; full runtime/macOS/Linux Rust/Bevy/Solari gameplay remains open.
docs/research/README.md CHANGED
@@ -462,3 +462,6 @@ The extension collector adds five focused tests for native tail calls, command-r
462
 
463
 
464
  [RE-620: Shot trace prelude candidate bounds and native request](QVM_SHOT_TRACE_REQUEST.md). Reproduce with `python3 scripts/analyze_qvm_shot_trace_request.py`; check with `python3 scripts/test_qvm_shot_trace_request.py`.
 
 
 
 
462
 
463
 
464
  [RE-620: Shot trace prelude candidate bounds and native request](QVM_SHOT_TRACE_REQUEST.md). Reproduce with `python3 scripts/analyze_qvm_shot_trace_request.py`; check with `python3 scripts/test_qvm_shot_trace_request.py`.
465
+
466
+
467
+ [RE-621: Complete point rotation helper and alias write ordering](QVM_ROTATE_POINT.md). Reproduce with `python3 scripts/analyze_qvm_rotate_point.py`; check with `python3 scripts/test_qvm_rotate_point.py`.
docs/research/qvm-rotate-point.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_qvm_rotate_point.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Complete61092 rotation helper with explicit zero-axis and alias boundaries."""
3
+ import itertools,math
4
+ from pathlib import Path
5
+ from qvm_research_support import source,execute
6
+ from qvm_shot_math_support import TRIG
7
+ from analyze_qvm_acceleration import word
8
+ from analyze_qvm_slide_prefix import vec
9
+ from analyze_qvm import write_json
10
+ LOCAL=0x79800000
11
+ AXIS=LOCAL+0x1000
12
+ POINT=LOCAL+0x1100
13
+ OUTPUT=LOCAL+0x1200
14
+
15
+ def rotate(ins,m,args):
16
+ m=dict(m);initial={'axis':vec(m,args[12]),'point':vec(m,args[16]),'angle':args[20],'output':vec(m,args[8]),'in_place_point':args[8]==args[16]}
17
+ for o,v in args.items():m[LOCAL+304+o]=v
18
+ nonzero=any(v&0x7fffffff for v in initial['axis']);m,_,e=execute(ins,61093,62065 if nonzero else 61224,m,(0,0,0),LOCAL,TRIG)
19
+ return m,{'initial':initial,'execution':e,'output':vec(m,args[8]),'matrix':[[m[LOCAL+168+12*i+4*j]&0xffffffff for j in range(3)] for i in range(3)] if nonzero else None,'status':'void-epilogue' if nonzero else 'zero-axis-division-boundary'}
20
+
21
+ def fixture(axis,point,angle,in_place=False):
22
+ m={}
23
+ for p,v in [(AXIS,axis),(POINT,point),(OUTPUT,(91,92,93))]:
24
+ for j,x in enumerate(v):m[p+4*j]=word(x)
25
+ return m,{8:POINT if in_place else OUTPUT,12:AXIS,16:POINT,20:word(angle)}
26
+
27
+ def main():
28
+ q,raw,h,ins=source();rows=[]
29
+ for axis,point,angle,alias in itertools.product([(1,0,0),(0,1,0),(0,0,1),(1/math.sqrt(3),)*3],[(1,2,3),(0,-1,0)],[0,18,90,180,-45],[False,True]):
30
+ m,a=fixture(axis,point,angle,alias);rows.append(rotate(ins,m,a)[1])
31
+ m,a=fixture((0,0,0),(1,2,3),18);rows.append(rotate(ins,m,a)[1])
32
+ write_json(Path('docs/research/qvm-rotate-point.json'),{'source':q['source'],'sha256':q['sha256'],'probes':rows,'limits':'Complete61093–62064 for finite unit axes with supplied math natives. Original libm parity, nonunit axes, axis/output alias and partial overlaps unverified. Zero axis stops before projection division. Point/output alias follows source sequential reads and is not assumed safe.'})
33
+ if __name__=='__main__':main()
scripts/test_qvm_rotate_point.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,math,unittest
2
+ from pathlib import Path
3
+ from test_qvm_ground import word,n,f
4
+
5
+ def apply_source_writes(p):
6
+ point=list(map(n,p['initial']['point']));out=[]
7
+ for j,row in enumerate(p['matrix']):
8
+ values=[f(n(a)*b) for a,b in zip(row,point)];value=f(f(values[0]+values[1])+values[2]);out.append(word(value))
9
+ if p['initial']['in_place_point']:point[j]=value
10
+ return out
11
+
12
+ def rodrigues(p):
13
+ a=list(map(n,p['initial']['axis']));angle=f(n(p['initial']['angle'])*n(1016003125));c=math.cos(angle);s=math.sin(angle);return [[c*float(i==j)+(1-c)*a[i]*a[j]+s*sum((1 if (i,j,k) in [(1,0,2),(2,1,0),(0,2,1)] else -1 if (i,j,k) in [(0,1,2),(1,2,0),(2,0,1)] else 0)*a[k] for k in range(3)) for j in range(3)] for i in range(3)]
14
+ class RotatePointTests(unittest.TestCase):
15
+ @classmethod
16
+ def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-rotate-point.json').read_text())
17
+ def test_matrix_against_independent_unit_axis_geometry(self):
18
+ self.assertEqual(len(self.r['probes']),81)
19
+ for p in self.r['probes'][:-1]:
20
+ for row,expected in zip(p['matrix'],rodrigues(p)):
21
+ for value,want in zip(row,expected):self.assertAlmostEqual(n(value),want,delta=2e-6)
22
+ def test_exact_f32_matrix_application_and_alias_write_order(self):
23
+ for p in self.r['probes'][:-1]:self.assertEqual(p['output'],apply_source_writes(p))
24
+ self.assertTrue(any(p['output']!=self.r['probes'][j-1]['output'] for j,p in enumerate(self.r['probes'][:-1]) if p['initial']['in_place_point']))
25
+ def test_native_call_order_and_radian_arguments(self):
26
+ for p in self.r['probes'][:-1]:
27
+ self.assertEqual([c['target'] for c in p['execution']['calls']],[-107,-105,-104,-104,-105]);self.assertEqual([c['args']['8']&0xffffffff for c in p['execution']['calls'][1:]],[word(f(n(p['initial']['angle'])*n(1016003125)))]*4)
28
+ def test_zero_axis_boundary_preserves_output(self):
29
+ p=self.r['probes'][-1];self.assertEqual(p['status'],'zero-axis-division-boundary');self.assertEqual(p['output'],p['initial']['output']);self.assertEqual(p['execution']['calls'],[])
30
+ if __name__=='__main__':unittest.main()