fj_kernel/objects/full/vertex.rs
1/// A vertex, defined in global (3D) coordinates
2///
3/// This struct exists to distinguish between vertices and points at the type
4/// level. This is a relevant distinction, as vertices are part of a shape that
5/// help define its topology.
6///
7/// Points, on the other hand, might be used to approximate a shape for various
8/// purposes, without presenting any deeper truth about the shape's structure.
9///
10/// # Validation
11///
12/// Vertices must be unique within a shape, meaning an identical vertex must not
13/// exist in the same shape. In the context of vertex uniqueness, points that
14/// are close to each other are considered identical. The minimum distance
15/// between distinct vertices can be configured using the respective field in
16/// [`ValidationConfig`].
17///
18/// # Equality
19///
20/// `Vertex` contains no data and exists purely to be used within a `Handle`,
21/// where `Handle::id` can be used to compare different instances of `Vertex`.
22///
23/// If `Vertex` had `Eq`/`PartialEq` implementations, it containing no data
24/// would mean that all instances of `Vertex` would be considered equal. This
25/// would be very error-prone.
26///
27/// If you need to reference a `Vertex` from a struct that needs to derive
28/// `Eq`/`Ord`/..., you can use `HandleWrapper<Vertex>` to do that. It will
29/// use `Handle::id` to provide those `Eq`/`Ord`/... implementations.
30///
31/// [`ValidationConfig`]: crate::validate::ValidationConfig
32#[derive(Clone, Copy, Debug, Default, Hash)]
33pub struct Vertex {}
34
35impl Vertex {
36 /// Construct a `Vertex` from a position
37 pub fn new() -> Self {
38 Self::default()
39 }
40}