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
[src]

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.

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.

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

distance returns the angle between two points.

approx_eq reports whether the two points are similar enough to be equal.

norm returns the point's norm.

impl Point
[src]

chordangle constructs a ChordAngle corresponding to the distance between the two given points. The points must be unit length.

impl Point
[src]

Trait Implementations

impl<'a> From<&'a Point> for Cell
[src]

Performs the conversion.

impl From<Point> for Cell
[src]

Performs the conversion.

impl From<CellID> for Point
[src]

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]

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]

Performs the conversion.

impl From<Point> for CellID
[src]

Performs the conversion.

impl<'a> From<&'a Point> for Cap
[src]

constructs a cap containing a single point.

impl<'a> Add<&'a Point> for Cap
[src]

The resulting type after applying the + operator.

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]

Performs the conversion.

impl From<LatLng> for Point
[src]

Performs the conversion.

impl<'a> From<&'a Point> for LatLng
[src]

Performs the conversion.

impl From<Point> for LatLng
[src]

Performs the conversion.

impl Clone for Point
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Point
[src]

impl PartialEq for Point
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Debug for Point
[src]

Formats the value using the given formatter. Read more

impl Add<Point> for Point
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl<'a, 'b> Add<&'b Point> for &'a Point
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl Sub<Point> for Point
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl<'a, 'b> Sub<&'b Point> for &'a Point
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl Mul<Point> for Point
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<'a, 'b> Mul<&'b Point> for &'a Point
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl Mul<f64> for Point
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<'a> Mul<f64> for &'a Point
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl From<Point> for Vector3<f64>
[src]

Performs the conversion.

impl<'a> From<&'a Point> for Vector3<f64>
[src]

Performs the conversion.

impl From<Vector3<f64>> for Point
[src]

Performs the conversion.

impl<'a> From<&'a Vector3<f64>> for Point
[src]

Performs the conversion.

impl Region for Point
[src]

cap_bound returns a bounding cap for this point.

rect_bound returns a bounding latitude-longitude rectangle from this point.

contains_cell returns false as Points do not contain any other S2 types.

intersects_cell reports whether this Point intersects the given cell.

Auto Trait Implementations

impl Send for Point

impl Sync for Point