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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//! Ordering and hashing for floating point data.
//!
//! This module provides tools to ease the creation of geometry data that can
//! be ordered and hashed. For Plexus, this is most useful for quickly
//! identifying unique geometry in an iterator expression or `Mesh`, such as
//! using a `HashIndexer`.
//!
//! This code is best used with the
//! [derivative](https://crates.io/crates/derivative) crate, which can be used
//! to specify a particular hashing function for a given field. See the
//! [ordered-float](https://crates.io/crates/ordered-float) crate for details
//! about the hashing strategy.
//!
//! # Examples
//!
//! Creating a basic vertex type that can be used for rendering and implements
//! `Hash`:
//!
//! ```rust
//! # #[macro_use]
//! # extern crate derivative;
//! # extern crate plexus;
//! use plexus::ordered;
//!
//! #[derive(Derivative)]
//! #[derivative(Hash)]
//! pub struct Vertex {
//! #[derivative(Hash(hash_with = "ordered::hash_float_array"))]
//! pub position: [f32; 3],
//! }
//! # fn main() {}
//! ```
//!
//! Converting generator types into a hashable type via `HashConjugate`:
//!
//! ```rust
//! use plexus::generate::HashIndexer;
//! use plexus::generate::cube::Cube;
//! use plexus::prelude::*;
//!
//! let (indeces, positions) = Cube::<f32>::with_unit_width()
//! .polygons_with_position()
//! .map_vertices(|position| position.into_hash()) // Convert to hashable type.
//! .triangulate()
//! .index_vertices(HashIndexer::default());
//! ```
use Float;
use ordered_float;
use ;
// TODO: https://github.com/reem/rust-ordered-float/pull/28
pub type NotNan<T> = NotNaN;
pub use OrderedFloat;
pub type r32 = ;
pub type r64 = ;
/// Provides conversion to and from a conjugate type that can be hashed.
///
/// This trait is primarily used to convert geometry to and from hashable data
/// for indexing.
/// Hashes a floating point value.
/// Hashes a slice of floating point values.