[−][src]Trait fpn::cg::Polar
Convert from cartesian cooridates to polar/sphere coordinates
For Vector2 return Vector2 x: distance, y: couterclock angle from X-axix For Vector3 return Vector3 x: distance, y: couterclock angle from X-axis, z: angle from positive Y-axis
If T is one of the primitives, then T will be cast to f64 and use native sqrt, atan2 to compute.
If T is FPN, then T will be converted to F64
using trait To
. The computation is using
binary search against a prepared angle array(from 0
to 0.25pi
), with time complexity O(log(K))
where
K
mean the array length which is fixed as 65
currently. The result difference for radius
distance is about radius * 0.25pi/65
which is about 0.012 * radius
, for angle the
difference is about 0.012
plus the eps()
of the specific FPN
Required methods
Loading content...Implementors
impl Polar<f32> for Vector2<f32>
[src]
impl Polar<f32> for Vector3<f32>
[src]
impl Polar<f64> for Vector2<f64>
[src]
impl Polar<f64> for Vector3<f64>
[src]
impl Polar<i16> for Vector2<i16>
[src]
impl Polar<i16> for Vector3<i16>
[src]
impl Polar<i32> for Vector2<i32>
[src]
impl Polar<i32> for Vector3<i32>
[src]
impl Polar<i64> for Vector2<i64>
[src]
impl Polar<i64> for Vector3<i64>
[src]
impl Polar<i8> for Vector2<i8>
[src]
impl Polar<i8> for Vector3<i8>
[src]
impl<F> Polar<FPN<i16, F>> for FVector2<i16, F> where
F: Unsigned,
[src]
F: Unsigned,
fn polar(&self) -> Self
[src]
fn distance(&self) -> FPN<i16, F>
[src]
fn distance_square(&self) -> FPN<i16, F>
[src]
impl<F> Polar<FPN<i16, F>> for FVector3<i16, F> where
F: Unsigned,
[src]
F: Unsigned,
fn polar(&self) -> Self
[src]
fn distance(&self) -> FPN<i16, F>
[src]
fn distance_square(&self) -> FPN<i16, F>
[src]
impl<F> Polar<FPN<i32, F>> for FVector2<i32, F> where
F: Unsigned,
[src]
F: Unsigned,
fn polar(&self) -> Self
[src]
fn distance(&self) -> FPN<i32, F>
[src]
fn distance_square(&self) -> FPN<i32, F>
[src]
impl<F> Polar<FPN<i32, F>> for FVector3<i32, F> where
F: Unsigned,
[src]
F: Unsigned,
fn polar(&self) -> Self
[src]
fn distance(&self) -> FPN<i32, F>
[src]
fn distance_square(&self) -> FPN<i32, F>
[src]
impl<F> Polar<FPN<i64, F>> for FVector2<i64, F> where
F: Unsigned,
[src]
F: Unsigned,
fn polar(&self) -> Self
[src]
fn distance(&self) -> FPN<i64, F>
[src]
fn distance_square(&self) -> FPN<i64, F>
[src]
impl<F> Polar<FPN<i64, F>> for FVector3<i64, F> where
F: Unsigned,
[src]
F: Unsigned,
fn polar(&self) -> Self
[src]
fn distance(&self) -> FPN<i64, F>
[src]
fn distance_square(&self) -> FPN<i64, F>
[src]
impl<F> Polar<FPN<i8, F>> for FVector2<i8, F> where
F: Unsigned,
[src]
F: Unsigned,
fn polar(&self) -> Self
[src]
fn distance(&self) -> FPN<i8, F>
[src]
fn distance_square(&self) -> FPN<i8, F>
[src]
impl<F> Polar<FPN<i8, F>> for FVector3<i8, F> where
F: Unsigned,
[src]
F: Unsigned,