Struct s2::cell::Cell

source ·
pub struct Cell {
    pub orientation: u8,
    pub id: CellID,
    pub uv: Rect,
    /* private fields */
}
Expand description

Cell is an S2 region object that represents a cell. Unlike CellIDs, it supports efficient containment and intersection tests. However, it is also a more expensive representation.

Fields§

§orientation: u8§id: CellID§uv: Rect

Implementations§

vertex returns the k-th vertex of the cell (k = 0,1,2,3) in CCW order (lower left, lower right, upper right, upper left in the UV plane).

edge returns the inward-facing normal of the great circle passing through the CCW ordered edge from vertex k to vertex k+1 (mod 4) (for k = 0,1,2,3).

bound_uv returns the bounds of this cell in (u,v)-space.

center returns the direction vector corresponding to the center in (s,t)-space of the given cell. This is the point at which the cell is divided into four subcells; it is not necessarily the centroid of the cell in (u,v)-space or (x,y,z)-space

Children returns the four direct children of this cell in traversal order and returns true. If this is a leaf cell, or the children could not be created, false is returned. The C++ method is called Subdivide.

exact_area returns the area of this cell as accurately as possible.

approx_area returns the approximate area of this cell. This method is accurate to within 3% percent for all cell sizes and accurate to within 0.1% for cells at level 5 or higher (i.e. squares 350km to a side or smaller on the Earth’s surface). It is moderately cheap to compute.

average_area returns the average area of cells at the level of this cell. This is accurate to within a factor of 1.7.

latitude returns the latitude of the cell vertex given by (i,j), where “i” and “j” are either 0 or 1.

longitude returns the longitude of the cell vertex given by (i,j), where “i” and “j” are either 0 or 1.

rect_bound returns the bounding rectangle of this cell.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.

cap_bound returns the bounding cap of this cell.

intersects_cell reports whether the intersection of this cell and the other cell is not nil.

contains_cell reports whether this cell contains the other cell.

rect_bound returns a bounding latitude-longitude rectangle that contains the region. The bounds are not guaranteed to be tight.
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.