Types: implement vectors, colors, rays, and scalar conversions #28

Closed
opened 2026-08-08 08:16:21 +00:00 by hugo · 1 comment
Owner

Objective

Implement Vector2, Vector3, Vector3d, Vector4, Color4, Ray, and their arithmetic/conversion surface.

Deliverables

  • Port constructors, constants, indexing, operators, normalization, dot/cross products, distance/interpolation, parsing/formatting, equality/hash, and binary conversions.
  • Preserve zero-vector behavior, component order, float precision, culture-independent formats, and error handling.
  • Use internal math crates only behind compatibility types.

Validation

  • All owned translated math tests pass with original tolerances.
  • Property checks cover core algebra without replacing direct parity cases.
  • No public dependency-specific vector type leaks.

Prerequisite

The full API shim and semantic test-suite gates are complete.

Project constraints

  • Implement only in native Rust; no LibreMetaverse/.NET bridge, subprocess, RPC, or fallback.
  • Keep mapped public signatures fixed and do not weaken translated parity assertions.
  • Remove failing bodies only for owned behavior and leave unrelated modules untouched.
  • Update docs, coverage/parity status, and focused plus workspace validation evidence.
## Objective Implement Vector2, Vector3, Vector3d, Vector4, Color4, Ray, and their arithmetic/conversion surface. ## Deliverables - Port constructors, constants, indexing, operators, normalization, dot/cross products, distance/interpolation, parsing/formatting, equality/hash, and binary conversions. - Preserve zero-vector behavior, component order, float precision, culture-independent formats, and error handling. - Use internal math crates only behind compatibility types. ## Validation - All owned translated math tests pass with original tolerances. - Property checks cover core algebra without replacing direct parity cases. - No public dependency-specific vector type leaks. ## Prerequisite The full API shim and semantic test-suite gates are complete. ## Project constraints - Implement only in native Rust; no LibreMetaverse/.NET bridge, subprocess, RPC, or fallback. - Keep mapped public signatures fixed and do not weaken translated parity assertions. - Remove failing bodies only for owned behavior and leave unrelated modules untouched. - Update docs, coverage/parity status, and focused plus workspace validation evidence.
hugo added this to the 04 - Types implementation milestone 2026-08-08 08:16:21 +00:00
hugo added the enhancement label 2026-08-08 08:16:21 +00:00
Author
Owner

Implemented and pushed in commit 3068e5e.

Native Rust now covers the complete mapped Vector2, Vector3, Vector3d, Vector4, Color4, and Ray surface (266 members): constructors/constants, arithmetic and operators, normalization thresholds, finite checks, dot/cross/distance/interpolation, matrix/quaternion transforms, parsing/formatting, exact equality and .NET-compatible float hashes, HSV/color conversion, and explicit little-endian binary IO. Mutable destination mappings were corrected to &mut [u8]. Compatibility details from the pinned C# source, including partial buffer mutation, Vector3d.One, and Vector2 transform update order, are preserved. No external math type is exposed.

Verification:

  • cargo test -p libremetaverse-types: 25 passed
  • translated TypeTests vector filter: 2 passed
  • broad vector/color/ray filters: all tests that reach these native types pass; remaining failures stop at later-milestone shims such as AnimationTrack.DecodeRotation, PrimMesher.Coord, Baker/ManagedImage, AssetMaterial, RlvService, GridClient, or StructuredData
  • cargo build --workspace and cargo test --workspace --no-run passed
  • API compile fixture passed
  • mapping/shim generation checks and parity check passed
  • controlled red-suite audit passed: 47 passed, 1284 expected failures, 143 standardized blocking members
  • workspace clippy with -D warnings and workspace rustdoc with -D warnings passed

Completion review found no owned failure-only bodies and coverage now reports 8 native Types / 300 members total.

Implemented and pushed in commit 3068e5e. Native Rust now covers the complete mapped Vector2, Vector3, Vector3d, Vector4, Color4, and Ray surface (266 members): constructors/constants, arithmetic and operators, normalization thresholds, finite checks, dot/cross/distance/interpolation, matrix/quaternion transforms, parsing/formatting, exact equality and .NET-compatible float hashes, HSV/color conversion, and explicit little-endian binary IO. Mutable destination mappings were corrected to &mut [u8]. Compatibility details from the pinned C# source, including partial buffer mutation, Vector3d.One, and Vector2 transform update order, are preserved. No external math type is exposed. Verification: - cargo test -p libremetaverse-types: 25 passed - translated TypeTests vector filter: 2 passed - broad vector/color/ray filters: all tests that reach these native types pass; remaining failures stop at later-milestone shims such as AnimationTrack.DecodeRotation, PrimMesher.Coord, Baker/ManagedImage, AssetMaterial, RlvService, GridClient, or StructuredData - cargo build --workspace and cargo test --workspace --no-run passed - API compile fixture passed - mapping/shim generation checks and parity check passed - controlled red-suite audit passed: 47 passed, 1284 expected failures, 143 standardized blocking members - workspace clippy with -D warnings and workspace rustdoc with -D warnings passed Completion review found no owned failure-only bodies and coverage now reports 8 native Types / 300 members total.
hugo closed this issue 2026-08-08 22:29:33 +00:00
Sign in to join this conversation.