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
128
129
130
131
132
133
134
135
136
137
//! 3D Euclidean Geometric Algebra types.
//!
//! This module provides specialized types for 3D Euclidean space `Cl(3,0,0)`,
//! the most commonly used geometric algebra for graphics, physics, and robotics.
//!
//! # Types by Grade
//!
//! | Grade | Type | Components | Geometric Meaning |
//! |-------|------|------------|-------------------|
//! | 0 | Scalar | 1 | Magnitude/weight |
//! | 1 | [`Vector`] | e₁, e₂, e₃ | Direction/position |
//! | 2 | [`Bivector`] | e₁₂, e₁₃, e₂₃ | Oriented plane/rotation axis |
//! | 3 | [`Trivector`] | e₁₂₃ | Oriented volume |
//!
//! # Rotors and Quaternions
//!
//! If you know quaternions, you already know rotors! A 3D rotor **is** a quaternion,
//! just written in a different basis:
//!
//! | Quaternion | Rotor | Meaning |
//! |------------|-------|---------|
//! | `w` | `s` (scalar) | cos(θ/2) |
//! | `x·i` | `e₂₃` | rotation in yz-plane |
//! | `y·j` | `e₃₁` (= -e₁₃) | rotation in zx-plane |
//! | `z·k` | `e₁₂` | rotation in xy-plane |
//!
//! The quaternion formula `q = w + xi + yj + zk` becomes:
//!
//! ```text
//! R = s + e₂₃·x + e₃₁·y + e₁₂·z
//! = cos(θ/2) + sin(θ/2)·B̂
//! ```
//!
//! where `B̂` is the unit bivector of the rotation plane.
//!
//! ## Why Bivectors Beat Axis Vectors
//!
//! Traditional: "Rotate 90° around the z-axis"
//! GA: "Rotate 90° in the xy-plane"
//!
//! These describe the same rotation, but the GA version is more fundamental:
//!
//! - **Rotation happens IN a plane**, not AROUND an axis
//! - The "axis" is just the line perpendicular to that plane (only works in 3D!)
//! - In 2D there's no axis, but there IS a plane (the whole 2D space)
//! - In 4D+ there are multiple perpendicular directions—bivectors still work
//!
//! The axis vector is the **dual** of the rotation bivector: `axis = *B`
//!
//! # The Sandwich Product
//!
//! Rotors rotate vectors using the **sandwich product**:
//!
//! ```text
//! v' = R v R̃ (R̃ is the reverse of R)
//! ```
//!
//! This is identical to the quaternion formula `v' = q v q*` (where `q*` is conjugate).
//!
//! Why a sandwich? The geometric product `R v` would change the grade of `v`,
//! but `R v R̃` guarantees the result is still a vector.
//!
//! # Cross Product via GA
//!
//! The cross product is the dual of the wedge product:
//!
//! ```text
//! a × b = *(a ∧ b)
//! ```
//!
//! Where `*` is the Hodge dual (multiply by inverse pseudoscalar e₁₂₃⁻¹ = e₃₂₁).
//!
//! | Operation | Result | Type |
//! |-----------|--------|------|
//! | `a ∧ b` | Oriented plane containing a, b | Bivector |
//! | `*(a ∧ b)` | Vector perpendicular to that plane | Vector |
//! | `a × b` | Same as above | Vector |
//!
//! # nalgebra Integration
//!
//! With the `nalgebra-0_33` feature (or `0_32`/`0_34`), conversions are provided:
//!
//! | clifford | nalgebra |
//! |----------|----------|
//! | `Vector` | `Vector3<T>` |
//! | `Rotor` | `UnitQuaternion<T>` |
//! | `Bivector` | (no direct equivalent) |
//!
//! ```ignore
//! use clifford::specialized::euclidean::dim3::Rotor;
//! use nalgebra::UnitQuaternion;
//!
//! let rotor = Rotor::from_angle_z(std::f64::consts::FRAC_PI_2);
//! let quat: UnitQuaternion<f64> = rotor.into();
//! ```
//!
//! # Example
//!
//! ```ignore
//! use clifford::ops::Transform;
//! use clifford::specialized::euclidean::dim3::{Vector, Bivector, Rotor};
//! use std::f64::consts::FRAC_PI_2;
//!
//! // Rotate 90° around the z-axis (in the xy-plane)
//! let rotor = Rotor::from_angle_plane(FRAC_PI_2, Bivector::unit_xy());
//! let v = Vector::new(1.0, 0.0, 0.0);
//! let rotated = rotor.transform(&v);
//!
//! // x-axis rotated 90° becomes y-axis
//! assert!((rotated.y() - 1.0).abs() < 1e-10);
//! ```
// Generated code (do not edit manually)
// Domain-specific extensions
pub use NalgebraConversionError;
// Re-export generated types and wrapper aliases
pub use *;