Skip to main content

Ecef

Struct Ecef 

Source
pub struct Ecef { /* private fields */ }
Expand description

地心直交座標系(ECEF: Earth-Centered, Earth-Fixed)における座標を表す。

原点は地球の重心にあり、

  • X 軸は赤道面上で本初子午線方向
  • Y 軸は赤道面上で東経 90 度方向
  • Z 軸は北極方向

単位はすべてメートル。

Implementations§

Source§

impl Ecef

Source

pub fn new(x: f64, y: f64, z: f64) -> Ecef

指定された XYZ 成分から Ecef を生成する。

§Examples

let ecef = Ecef::new(10.0, 20.0, 30.0);

assert_eq!(ecef.x(), 10.0);
assert_eq!(ecef.y(), 20.0);
assert_eq!(ecef.z(), 30.0);
Source

pub fn x(&self) -> f64

X 成分を返す。

§Examples

let ecef = Ecef::new(1.0, 0.0, 0.0);
assert_eq!(ecef.x(), 1.0);
Source

pub fn y(&self) -> f64

Y 成分を返す。

§Examples

let ecef = Ecef::new(0.0, 2.0, 0.0);
assert_eq!(ecef.y(), 2.0);
Source

pub fn z(&self) -> f64

Z 成分を返す。

§Examples

let ecef = Ecef::new(0.0, 0.0, 3.0);
assert_eq!(ecef.z(), 3.0);
Source

pub fn set_x(&mut self, x: f64)

X 成分を設定する。

§Examples

let mut ecef = Ecef::new(0.0, 0.0, 0.0);
ecef.set_x(5.0);

assert_eq!(ecef.x(), 5.0);
Source

pub fn set_y(&mut self, y: f64)

Y 成分を設定する。

§Examples

let mut ecef = Ecef::new(0.0, 0.0, 0.0);
ecef.set_y(6.0);

assert_eq!(ecef.y(), 6.0);
Source

pub fn set_z(&mut self, z: f64)

Z 成分を設定する。

§Examples

let mut ecef = Ecef::new(0.0, 0.0, 0.0);
ecef.set_z(7.0);

assert_eq!(ecef.z(), 7.0);
Source

pub fn single_id(&self, z: u8) -> Result<SingleId, Error>

この ECEF 座標を、指定されたズームレベルの SingleId に変換する。

Source

pub fn range_id(&self, z: u8) -> Result<RangeId, Error>

この ECEF 座標を、指定されたズームレベルの RangeId に変換する。

Source

pub fn distance(&self, other: &Ecef) -> f64

他の Ecef 座標との距離をメートル単位で返す。

§Examples

let a = Ecef::new(0.0, 0.0, 0.0);
let b = Ecef::new(3.0, 4.0, 0.0);

assert_eq!(a.distance(&b), 5.0);
Source

pub fn cross(&self, other: &Ecef) -> Ecef

他のEcef型との外積を取る。

Source

pub fn norm_squared(&self) -> f64

Source

pub fn eq_epsilon(&self, other: &Ecef, epsilon: f64) -> bool

Ecefが同じ位置にあるかを判定します 2点間の直線距離が epsilon 以内にあるかを判定します

Source

pub fn dot(&self, other: &Ecef) -> f64

内積(ドット積)を計算する。

Source

pub fn get_component(&self, index: usize) -> f64

指定された軸インデックス (0=x, 1=y, 2=z) の成分を返す。 投影計算などで軸を動的に扱いたい場合に有用。

Source

pub fn project_2d(&self, u_axis: usize, v_axis: usize) -> (f64, f64)

指定された2つの軸(u, v)に基づいて 2D 平面に投影した座標を返す。

Trait Implementations§

Source§

impl Clone for Ecef

Source§

fn clone(&self) -> Ecef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Ecef

Source§

impl CoverSingleIds for Ecef

Source§

fn cover_single_ids( &self, z: u8, ) -> Result<impl Iterator<Item = SingleId>, Error>

指定されたズームレベルのSingleIdを出力する。
Source§

impl Debug for Ecef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Ecef

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Coordinate> for Ecef

Source§

fn from(value: Coordinate) -> Self

CoordinateEcefへの変換。

let coord = Coordinate::new(43.068564, 41.3507138, 30.0).unwrap();
let ecef: Ecef = coord.into();
print!("{},{},{}", ecef.x(), ecef.y(), ecef.z());
assert_eq!(ecef.x(), 3503254.6369501497);
assert_eq!(ecef.y(), 3083182.6924748584);
assert_eq!(ecef.z(), 4333089.862951963);
Source§

impl PartialEq for Ecef

Source§

fn eq(&self, other: &Ecef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Ecef

Source§

fn partial_cmp(&self, other: &Ecef) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Point for Ecef

Source§

impl Serialize for Ecef

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Ecef

Source§

impl Sub for Ecef

Source§

type Output = Ecef

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl TryFrom<Ecef> for Coordinate

Source§

fn try_from(value: Ecef) -> Result<Self, Self::Error>

地心直交座標系(ECEF)から地理座標(緯度・経度・高度)への変換。

Source§

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations§

§

impl Freeze for Ecef

§

impl RefUnwindSafe for Ecef

§

impl Send for Ecef

§

impl Sync for Ecef

§

impl Unpin for Ecef

§

impl UnsafeUnpin for Ecef

§

impl UnwindSafe for Ecef

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V