Struct s2::point::Point [−][src]
pub struct Point(pub Vector);
Point represents a point on the unit sphere as a normalized 3D vector. Fields should be treated as read-only. Use one of the factory methods for creation.
Methods
impl Point
[src]
impl Point
impl Point
[src]
impl Point
pub fn from_coords(x: f64, y: f64, z: f64) -> Self
[src]
pub fn from_coords(x: f64, y: f64, z: f64) -> Self
form_coords creates a new normalized point from coordinates.
This always returns a valid point. If the given coordinates can not be normalized the origin point will be returned.
This behavior is different from the C++ construction of a S2Point from coordinates (i.e. S2Point(x, y, z)) in that in C++ they do not Normalize.
pub fn origin() -> Self
[src]
pub fn origin() -> Self
origin returns a unique "origin" on the sphere for operations that need a fixed reference point. In particular, this is the "point at infinity" used for point-in-polygon testing (by counting the number of edge crossings).
It should not be a point that is commonly used in edge tests in order to avoid triggering code to handle degenerate cases (this rules out the north and south poles). It should also not be on the boundary of any low-level S2Cell for the same reason.
pub fn cross(&self, other: &Self) -> Self
[src]
pub fn cross(&self, other: &Self) -> Self
cross returns a Point that is orthogonal to both p and op. This is similar to p.Cross(op) (the true cross product) except that it does a better job of ensuring orthogonality when the Point is nearly parallel to op, it returns a non-zero result even when p == op or p == -op and the result is a Point.
It satisfies the following properties (f == cross):
(1) f(p, op) != 0 for all p, op
(2) f(op,p) == -f(p,op) unless p == op or p == -op
(3) f(-p,op) == -f(p,op) unless p == op or p == -op
(4) f(p,-op) == -f(p,op) unless p == op or p == -op
pub fn distance(&self, b: &Point) -> Angle
[src]
pub fn distance(&self, b: &Point) -> Angle
distance returns the angle between two points.
pub fn approx_eq(&self, other: &Self) -> bool
[src]
pub fn approx_eq(&self, other: &Self) -> bool
approx_eq reports whether the two points are similar enough to be equal.
pub fn norm(&self) -> f64
[src]
pub fn norm(&self) -> f64
norm returns the point's norm.
pub fn normalize(&self) -> Self
[src]
pub fn normalize(&self) -> Self
pub fn ortho(&self) -> Self
[src]
pub fn ortho(&self) -> Self
pub fn frame(&self) -> Matrix3<f64>
[src]
pub fn frame(&self) -> Matrix3<f64>
impl Point
[src]
impl Point
pub fn chordangle(&self, other: &Point) -> ChordAngle
[src]
pub fn chordangle(&self, other: &Point) -> ChordAngle
chordangle constructs a ChordAngle corresponding to the distance between the two given points. The points must be unit length.
impl Point
[src]
impl Point
Trait Implementations
impl<'a> From<&'a Point> for Cell
[src]
impl<'a> From<&'a Point> for Cell
impl From<Point> for Cell
[src]
impl From<Point> for Cell
impl From<CellID> for Point
[src]
impl From<CellID> for Point
fn from(id: CellID) -> Self
[src]
fn from(id: CellID) -> Self
returns the center of the s2 cell on the sphere as a Point. The maximum directional error in Point (compared to the exact mathematical result) is 1.5 * dblEpsilon radians, and the maximum length error is 2 * dblEpsilon (the same as Normalize).
impl<'a> From<&'a CellID> for Point
[src]
impl<'a> From<&'a CellID> for Point
fn from(id: &'a CellID) -> Self
[src]
fn from(id: &'a CellID) -> Self
cellIDFromPoint returns a leaf cell containing point p. Usually there is exactly one such cell, but for points along the edge of a cell, any adjacent cell may be (deterministically) chosen. This is because s2.CellIDs are considered to be closed sets. The returned cell will always contain the given point, i.e.
Cell::from(&p).contains_point(&p)
is always true.
impl<'a> From<&'a Point> for CellID
[src]
impl<'a> From<&'a Point> for CellID
impl From<Point> for CellID
[src]
impl From<Point> for CellID
impl<'a> From<&'a Point> for Cap
[src]
impl<'a> From<&'a Point> for Cap
impl<'a> Add<&'a Point> for Cap
[src]
impl<'a> Add<&'a Point> for Cap
type Output = Cap
The resulting type after applying the +
operator.
fn add(self, p: &'a Point) -> Self::Output
[src]
fn add(self, p: &'a Point) -> Self::Output
increases the cap if necessary to include the given point. If this cap is empty, then the center is set to the point with a zero height. p must be unit-length.
impl<'a> From<&'a LatLng> for Point
[src]
impl<'a> From<&'a LatLng> for Point
impl From<LatLng> for Point
[src]
impl From<LatLng> for Point
impl<'a> From<&'a Point> for LatLng
[src]
impl<'a> From<&'a Point> for LatLng
impl From<Point> for LatLng
[src]
impl From<Point> for LatLng
impl Clone for Point
[src]
impl Clone for Point
fn clone(&self) -> Point
[src]
fn clone(&self) -> Point
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for Point
[src]
impl Copy for Point
impl PartialEq for Point
[src]
impl PartialEq for Point
fn eq(&self, other: &Point) -> bool
[src]
fn eq(&self, other: &Point) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Point) -> bool
[src]
fn ne(&self, other: &Point) -> bool
This method tests for !=
.
impl Debug for Point
[src]
impl Debug for Point
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Add<Point> for Point
[src]
impl Add<Point> for Point
type Output = Point
The resulting type after applying the +
operator.
fn add(self, other: Point) -> Self::Output
[src]
fn add(self, other: Point) -> Self::Output
Performs the +
operation.
impl<'a, 'b> Add<&'b Point> for &'a Point
[src]
impl<'a, 'b> Add<&'b Point> for &'a Point
type Output = Point
The resulting type after applying the +
operator.
fn add(self, other: &'b Point) -> Self::Output
[src]
fn add(self, other: &'b Point) -> Self::Output
Performs the +
operation.
impl Sub<Point> for Point
[src]
impl Sub<Point> for Point
type Output = Point
The resulting type after applying the -
operator.
fn sub(self, other: Point) -> Self::Output
[src]
fn sub(self, other: Point) -> Self::Output
Performs the -
operation.
impl<'a, 'b> Sub<&'b Point> for &'a Point
[src]
impl<'a, 'b> Sub<&'b Point> for &'a Point
type Output = Point
The resulting type after applying the -
operator.
fn sub(self, other: &'b Point) -> Self::Output
[src]
fn sub(self, other: &'b Point) -> Self::Output
Performs the -
operation.
impl Mul<Point> for Point
[src]
impl Mul<Point> for Point
type Output = Point
The resulting type after applying the *
operator.
fn mul(self, other: Point) -> Self::Output
[src]
fn mul(self, other: Point) -> Self::Output
Performs the *
operation.
impl<'a, 'b> Mul<&'b Point> for &'a Point
[src]
impl<'a, 'b> Mul<&'b Point> for &'a Point
type Output = Point
The resulting type after applying the *
operator.
fn mul(self, other: &'b Point) -> Self::Output
[src]
fn mul(self, other: &'b Point) -> Self::Output
Performs the *
operation.
impl Mul<f64> for Point
[src]
impl Mul<f64> for Point
type Output = Point
The resulting type after applying the *
operator.
fn mul(self, m: f64) -> Self::Output
[src]
fn mul(self, m: f64) -> Self::Output
Performs the *
operation.
impl<'a> Mul<f64> for &'a Point
[src]
impl<'a> Mul<f64> for &'a Point
type Output = Point
The resulting type after applying the *
operator.
fn mul(self, m: f64) -> Self::Output
[src]
fn mul(self, m: f64) -> Self::Output
Performs the *
operation.
impl From<Point> for Vector3<f64>
[src]
impl From<Point> for Vector3<f64>
impl<'a> From<&'a Point> for Vector3<f64>
[src]
impl<'a> From<&'a Point> for Vector3<f64>
impl From<Vector3<f64>> for Point
[src]
impl From<Vector3<f64>> for Point
impl<'a> From<&'a Vector3<f64>> for Point
[src]
impl<'a> From<&'a Vector3<f64>> for Point
impl Region for Point
[src]
impl Region for Point
fn cap_bound(&self) -> Cap
[src]
fn cap_bound(&self) -> Cap
cap_bound returns a bounding cap for this point.
fn rect_bound(&self) -> Rect
[src]
fn rect_bound(&self) -> Rect
rect_bound returns a bounding latitude-longitude rectangle from this point.
fn contains_cell(&self, _: &Cell) -> bool
[src]
fn contains_cell(&self, _: &Cell) -> bool
contains_cell returns false as Points do not contain any other S2 types.
fn intersects_cell(&self, c: &Cell) -> bool
[src]
fn intersects_cell(&self, c: &Cell) -> bool
intersects_cell reports whether this Point intersects the given cell.