1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/******************************************************************************
Author: Joaquín Béjar García
Email: jb@taunais.com
Date: 23/2/25
******************************************************************************/
use crateSurfaceError;
use crateSurface;
/// A trait for objects that can generate a mathematical surface in 3D space.
///
/// This trait defines a single method, [`Surfacable::surface`], which is responsible for
/// calculating or constructing a [`Surface`] representation of the object that implements it.
/// The surface may be created through direct construction or as the result of some computational process.
///
/// # Errors
/// The [`Surfacable::surface`] method returns a [`Result`] containing the generated surface on success.
/// If an error occurs during the surface generation process, a [`SurfaceError`] is returned instead.
/// Potential errors could include:
/// - Invalid inputs or parameters leading to a [`SurfaceError::Point3DError`] or [`SurfaceError::ConstructionError`].
/// - Failures during surface computation due to invalid operations (e.g., [`SurfaceError::OperationError`]).
/// - General-purpose errors, such as I/O or analysis issues, represented as
/// [`SurfaceError::RenderError`] or [`SurfaceError::AnalysisError`].
///
/// # Implementors
/// of this trait should define how their specific type generates a [`Surface`].
/// This could involve:
/// - Utilizing existing 3D geometry to build the surface.
/// - Analytical or procedural computations to construct a surface from data.
/// - Interactions with external processes or datasets.
///
/// # See Also
/// For more details on specific error variants, refer to the [`SurfaceError`] enum.
/// For details about the underlying mathematical representation, refer to the [`Surface`] struct.
///
/// # Example Use Cases
/// This trait can be used in scenarios where multiple types need to provide a unified interface
/// for surface generation. For instance, different shapes (spheres, planes, or curves) may implement
/// `Surfacable` so that they can all produce [`Surface`] outputs in a consistent manner.
///
/// # Related Modules
/// - **`crate::surfaces::surface`**: Contains the [`Surface`] structure and its related components.
/// - **`crate::error::surfaces`**: Contains the [`SurfaceError`] type and its variants for error representation.
///