pub struct ProjectivePoint {
pub coords: Vec<i64>,
}Expand description
A point in projective space P^n represented by homogeneous coordinates.
The coordinates are stored as a vector of i64; the actual point is the
equivalence class [x₀ : x₁ : … : xₙ] where not all xᵢ are zero.
Fields§
§coords: Vec<i64>Homogeneous coordinates [x₀ : x₁ : … : xₙ].
Implementations§
Source§impl ProjectivePoint
impl ProjectivePoint
Sourcepub fn new(coords: Vec<i64>) -> Option<Self>
pub fn new(coords: Vec<i64>) -> Option<Self>
Create a new projective point from homogeneous coordinates.
Returns None if all coordinates are zero.
Sourcepub fn normalize(&self) -> Self
pub fn normalize(&self) -> Self
Normalize by dividing by the GCD of the coordinates (keeping the first nonzero positive).
Sourcepub fn equiv(&self, other: &ProjectivePoint) -> bool
pub fn equiv(&self, other: &ProjectivePoint) -> bool
Check if two projective points represent the same element of P^n.
Trait Implementations§
Source§impl Clone for ProjectivePoint
impl Clone for ProjectivePoint
Source§fn clone(&self) -> ProjectivePoint
fn clone(&self) -> ProjectivePoint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProjectivePoint
impl Debug for ProjectivePoint
Source§impl Display for ProjectivePoint
impl Display for ProjectivePoint
Source§impl PartialEq for ProjectivePoint
impl PartialEq for ProjectivePoint
impl Eq for ProjectivePoint
impl StructuralPartialEq for ProjectivePoint
Auto Trait Implementations§
impl Freeze for ProjectivePoint
impl RefUnwindSafe for ProjectivePoint
impl Send for ProjectivePoint
impl Sync for ProjectivePoint
impl Unpin for ProjectivePoint
impl UnsafeUnpin for ProjectivePoint
impl UnwindSafe for ProjectivePoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more