Files
Gas-Tank-AR-App/GasTankAR/Views/TankAR/Measurement.swift
Dennis Nemec b8536d4182 Add tank catalog with USDZ models and tank selection
Introduce TankDefinition/TankCatalog loaded from Tanks.json, bundle the
Drachengas USDZ tank models, add tank selection and preview views, and
update the AR experience, editor and project views to use the catalog.
Includes tests for catalog loading and model selection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 19:12:39 +02:00

54 lines
1.2 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// Measurement.swift
// GasTankAR
//
// Created by Dennis Nemec on 28.08.26.
//
import Foundation
import simd
/// Eine benannte Strecke zwischen zwei im Raum gewählten Punkten (Welt-Koordinaten).
enum TankDimension: String, CaseIterable, Hashable, Identifiable {
case height
case length
case width
var id: Self { self }
var title: String {
switch self {
case .height: "Höhe"
case .length: "Länge"
case .width: "Breite"
}
}
}
struct Measurement: Identifiable, Codable {
let id = UUID()
var name: String
let start: SIMD3<Float>
let end: SIMD3<Float>
/// Länge der Strecke in Metern.
var distance: Float { simd_distance(start, end) }
/// Länge als lesbarer Text, z. B. „1,23 m".
var formattedDistance: String {
String(format: "%.2f m", distance)
}
}
/// Ablaufphasen beim Anlegen einer Strecke.
enum MeasurementPhase: Equatable {
/// Kein Messvorgang aktiv.
case idle
/// Wartet auf den ersten Punkt.
case awaitingFirstPoint
/// Wartet auf den zweiten Punkt.
case awaitingSecondPoint
/// Beide Punkte gesetzt – wartet auf die Benennung.
case naming
}