OrthographicProjector
struct · ferroui-livecharts · v0.5.0
struct OrthographicProjector
Projects longitude and latitude on a globe facing the centre coordinate. The far side of the globe is not visible.
Members
PREFERRED_RATIOnewmap_widthmap_heightx_offsety_offsetcenter_longitudecenter_latituderadiusscreen_center_xscreen_center_yis_visibleto_mapto_coordinates
PREFERRED_RATIO
const PREFERRED_RATIO: [f64; 2]
The aspect ratio of a circular globe.
new
fn new(map_width: f64, map_height: f64, offset_x: f64, offset_y: f64, center_lon: f64, center_lat: f64) -> Self
A globe in the map area of the given size at the given offset, facing center_lon and
center_lat (degrees). Its radius is half of the smaller side of the area.
map_width
fn map_width(self: &Self) -> f64
map_height
fn map_height(self: &Self) -> f64
x_offset
fn x_offset(self: &Self) -> f64
y_offset
fn y_offset(self: &Self) -> f64
center_longitude
fn center_longitude(self: &Self) -> f64
The longitude the globe faces.
center_latitude
fn center_latitude(self: &Self) -> f64
The latitude the globe faces.
radius
fn radius(self: &Self) -> f64
The radius of the globe on the screen.
screen_center_x
fn screen_center_x(self: &Self) -> f64
The screen position of the centre of the globe.
screen_center_y
fn screen_center_y(self: &Self) -> f64
is_visible
fn is_visible(self: &Self, longitude: f64, latitude: f64) -> bool
Whether the coordinate is on the near hemisphere: the cosine of its angular distance from the centre is positive.
to_map
fn to_map(self: &Self, longitude: f64, latitude: f64) -> Point
to_coordinates
fn to_coordinates(self: &Self, screen: Point) -> Option<(f64, f64)>
The inverse orthographic projection (Snyder, Map Projections, USGS): only the near hemisphere is recoverable, and a position outside the disc has no coordinate.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedPropertyValueAnyValueClassDefaultsErasedDestructorIntoEitherCloneDebugStructuralPartialEqPartialEq
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.