Skip to main content

cumulus3d_align/
error.rs

1/*
2 * error.rs
3 *
4 * Copyright (c) 2026 ParkSangWoo
5 *
6 * Author(s):
7 *
8 *      ParkSangWoo <dev.parksangwoo@gmail.com>
9 *
10 *
11 * This file is part of cumulus3d.
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 *      http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 * SPDX-License-Identifier: Apache-2.0
26 */
27
28//! Alignment errors. Every failure condition is distinguished so that failures are never silently ignored.
29
30/// align crate error.
31#[derive(Debug, thiserror::Error)]
32pub enum AlignError {
33    /// core crate error (I/O, data structures).
34    #[error("core 오류: {0}")]
35    Core(#[from] cumulus3d_core::Error),
36    /// Inlier threshold is not positive.
37    #[error("alignment_max_error 는 양수여야 함: {0}")]
38    BadMaxError(f64),
39    /// Invalid argument.
40    #[error("잘못된 인자: {0}")]
41    InvalidArgument(String),
42    /// Not enough GPS reference positions.
43    #[error("기준 위치 부족: {found}개 (최소 {required})")]
44    TooFewReferences {
45        /// Number found.
46        found: usize,
47        /// Minimum number required.
48        required: usize,
49    },
50    /// Not enough images in common between the model and the GPS list.
51    #[error("공통 영상 부족: {found}개 (최소 {required})")]
52    TooFewCommonImages {
53        /// Number found.
54        found: usize,
55        /// Minimum number required.
56        required: usize,
57    },
58    /// Not enough shared 3D point correspondences between the two reconstructions.
59    #[error("공유 3D 점 대응 부족: {found}개 (최소 {required})")]
60    TooFewCorrespondences {
61        /// Number found.
62        found: usize,
63        /// Minimum number required.
64        required: usize,
65    },
66    /// Robust Sim3 estimation found no model.
67    #[error("견고 Sim3 추정 실패 (인라이어 {inliers}개)")]
68    RansacFailed {
69        /// Number of inliers of the best model.
70        inliers: usize,
71    },
72    /// Point configuration is degenerate, so the Umeyama solution does not exist.
73    #[error("Umeyama 해 없음(퇴화 배치)")]
74    Degenerate,
75}
76
77/// `Result` of the align crate.
78pub type Result<T> = std::result::Result<T, AlignError>;