87 lines
3.6 KiB
Markdown
87 lines
3.6 KiB
Markdown
# Step 7: Vector3 Value Type
|
|
|
|
## 담당 역할과 필수 스킬
|
|
|
|
- 담당 역할: `implementation-agent`
|
|
- 필수 스킬: `harness`, `fesa-cpp-msvc-tdd`
|
|
- 이 Step만 `RED -> observed failure -> minimal GREEN -> focused/full VERIFY`로 수행한다.
|
|
|
|
## 읽어야 할 파일
|
|
|
|
- `/AGENTS.md`
|
|
- `/docs/CODINGSTYLE.md`
|
|
- `/docs/ARCHITECTURE.md`
|
|
- `/docs/ADR.md`
|
|
- `/docs/cpp-object-oriented-modular-refactoring/implementation-plan.md`
|
|
- `/include/fesa/math/vector.h`
|
|
- `/src/fesa/math/vector.cpp`
|
|
- `/tests/unit/math/vector_test.cpp`
|
|
- `/src/fesa/CMakeLists.txt`, `/tests/CMakeLists.txt`
|
|
- `/phases/cpp-object-oriented-modular-refactoring/index.json`
|
|
- `/phases/cpp-object-oriented-modular-refactoring/step7.md`
|
|
|
|
## 작업
|
|
|
|
Requirement `R-DUP-001`의 reusable value type만 구현한다. Existing consumers는 아직
|
|
migrate하지 않는다.
|
|
|
|
1. `/tests/unit/math/vector3_test.cpp`를 먼저 만들고 `C-VEC3-001`을 작성한다.
|
|
2. Test는 component access, exact add/subtract/scalar operations, Dot, Cross orientation,
|
|
Norm, finite/nonfinite, zero/nonfinite normalization rejection을 검증한다.
|
|
3. Test가 missing `fesa/math/vector3.h`로 compile failure가 나는 RED를 기록한다.
|
|
4. Candidate interface는 다음 의미를 제공한다.
|
|
|
|
```cpp
|
|
class Vector3 {
|
|
public:
|
|
constexpr Vector3() noexcept;
|
|
constexpr Vector3(double x, double y, double z) noexcept;
|
|
constexpr double X() const noexcept;
|
|
constexpr double Y() const noexcept;
|
|
constexpr double Z() const noexcept;
|
|
constexpr double operator[](std::size_t index) const noexcept;
|
|
constexpr Vector3 operator+(const Vector3& rhs) const noexcept;
|
|
constexpr Vector3 operator-(const Vector3& rhs) const noexcept;
|
|
constexpr Vector3 operator*(double scalar) const noexcept;
|
|
double Dot(const Vector3& rhs) const noexcept;
|
|
Vector3 Cross(const Vector3& rhs) const noexcept;
|
|
double Norm() const noexcept;
|
|
std::optional<Vector3> Normalized() const noexcept;
|
|
bool IsFinite() const noexcept;
|
|
};
|
|
```
|
|
|
|
5. `Normalized()`는 arbitrary tolerance, clamp, diagnostic을 소유하지 않는다. Exact zero
|
|
또는 nonfinite norm만 empty result로 거부하고 scale-aware geometry rejection은 caller에
|
|
남긴다.
|
|
6. Trivial implementation은 header-only로 둘 수 있다. 별도 `.cpp`를 만들면 CMake에
|
|
등록하고 두 경우 모두 production Doxygen를 작성한다.
|
|
|
|
## Acceptance Criteria
|
|
|
|
```powershell
|
|
cmake --build .harness/build --config Debug --target fesa_unit_tests
|
|
ctest --test-dir .harness/build -C Debug -R "Vector3" --output-on-failure
|
|
& "C:/Program Files/LLVM/bin/clang-format.exe" --dry-run --Werror `
|
|
include/fesa/math/vector3.h tests/unit/math/vector3_test.cpp
|
|
& "C:/Program Files/LLVM/bin/clang-tidy.exe" --config-file=.clang-tidy `
|
|
include/fesa/math/vector3.h -- -x c++ -std=c++17 -Iinclude
|
|
cmake --build .harness/build --config Debug
|
|
ctest --test-dir .harness/build -C Debug --show-only=json-v1
|
|
ctest --test-dir .harness/build -C Debug --output-on-failure
|
|
```
|
|
|
|
## 검증 및 상태 갱신
|
|
|
|
- Missing header RED, arithmetic GREEN, tidy/format/full CTest를 summary에 기록한다.
|
|
- 성공 시 현재 Step만 `completed`로 갱신한다.
|
|
- normalization policy가 승인 설계와 충돌하면 `blocked`로 기록한다.
|
|
- timestamp, retry, commit, advancement는 Executor 소유다.
|
|
|
|
## 금지사항
|
|
|
|
- Dynamic `Vector` storage/API를 Vector3에 합치지 마라. 이유: 서로 다른 ownership/size 계약이다.
|
|
- Tolerance 또는 FESA diagnostic을 Vector3에 넣지 마라.
|
|
- Beam/shell/results/I/O consumers를 수정하지 마라. 이유: Step 8–9 소유다.
|
|
- 직접 commit하거나 hook script를 수동 실행하지 마라.
|