Skip to content

AngularVelocity3D has no typed cross product with Displacement3D: the strategy doc's ω × r = Velocity3D was never declared #548

Open

Description

@matt-edmondson

Plan:

**3. Cross product** (`.Cross()`) - two V3 operands, result is V3:
```
V3 × V3 → V3 Displacement3D × Force3D = Torque3D
AngularVelocity3D × Displacement3D = Velocity3D
```
(rule table: L470-L481)

3. Cross product (.Cross()) - two V3 operands, result is V3:

V3 × V3 → V3       Displacement3D × Force3D = Torque3D
                    AngularVelocity3D × Displacement3D = Velocity3D

What exists today

  • The doc gives two cross-product examples, and only the first one, Torque, exists. It is declared on Length in Semantics.SourceGenerators/Metadata/dimensions.json (L86-L89), next to Displacement3D × Velocity3D = SpecificAngularMomentum3D. The generator emits both as Displacement3D.Cross(...).
  • AngularVelocity in dimensions.json (around L436-L452) declares "crossProducts": []. The only Cross on AngularVelocity3D<T> is the untyped same-type Cross(AngularVelocity3D<T>) (see Same-type Cross() on 3D quantities returns the operand's dimension, so Displacement3D × Displacement3D (m²) types as a length #521).
  • AngularVelocity3D, Displacement3D and Velocity3D all exist, and the dimensions check out: T⁻¹ · L = L T⁻¹. The angle is dimensionless in the product.

What's missing

You can't write Velocity3D<double> v = omega.Cross(r); for the tangential velocity of a point on a rotating body. Today you have to unwrap to raw vectors and rebuild the quantity, which loses the type safety the library exists for.

Acceptance criteria

  • AngularVelocity declares { "other": "Length", "result": "Velocity", "forms": [3] } in crossProducts.
    • The order is ω × r, so the declaration goes on AngularVelocity, the same way r × F lives on Length.
    • The reverse order is the negation, and a dimension check can't catch a wrong sign, so it must not be auto-generated as commutative.
  • The generated AngularVelocity3D<T>.Cross(Displacement3D<T>) returns Velocity3D<T>.
  • The committed generated output, the C++ projection and the vocabulary are regenerated, and verify-generated passes.
  • A test next to the existing r.Cross(f) test in Semantics.Test/Quantities/VectorQuantityTests.cs checks the sign: ω = (0, 0, 1) rad/s × r = (1, 0, 0) m = (0, 1, 0) m/s.
  • Overload operands such as Position3D follow whatever Position3D.Cross(Force3D) and Position3D.Cross(Velocity3D) don't compile: vector overloads don't forward their base's typed cross products #506 settles.

Dependencies

None blocking. Related:

Activity

  1. added
    enhancement
    on Nov 9, 2026
  2. matt-edmondson commented on Nov 9, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions