Skip to main content

WorldDistance

Struct WorldDistance 

Source
pub struct WorldDistance(/* private fields */);
Expand description

Distance in the coordinate units a replay packet stream is in (1 unit = 15 meters): entity positions, shell impact points, and any offset between two of them.

The 15 is measured, three ways, on the 15.1.0 corpus:

  • Hull length. Shell impacts on a ship, rotated into its body frame, reach 8 to 10 units from the hull origin on ships whose bow fire node sits 104 to 128 m out. At 15 m/unit that is 120 to 152 m, just past the bow node and inside a ~135 m half-length. At 30 it would be 240 to 300 m, i.e. half-kilometre ships.
  • Hull beam. The same impacts reach 1.1 to 1.6 units abeam, which at 15 m/unit is a 34 to 49 m beam for ships whose real beams are 26 to 38 m. Generous by the few meters an impact point sits proud of the plate; at 30 it would put every beam past 68 m.
  • Gun range. The longest shot in a replay, as |target - origin| from the salvo packet, runs 247 to 808 units. At 15 m/unit those are 3.7 to 12.1 km, every one inside the firing ship’s GameParams maxDist. At 30, ten of the twenty-six replays measured put shots beyond their own ship’s maximum range.

A fourth, functional measurement agrees: sweeping the scale used to place shell impacts into hull fire sections, and scoring each against the section the server actually lit, gives a single-peaked curve topping out at 15 to 16.

So this space and ShipModelDistance measure the same, which is why [WORLD_TO_METERS] is defined as [SHIP_TO_METERS]. They are still separate types because they are separate spaces: a world position is not a ship-model coordinate, and only one of the two is anchored by the waterline and dispersion evidence on ShipModelDistance.

Implementations§

Source§

impl WorldDistance

Source

pub const fn new(v: f32) -> Self

Const constructor for use in static/const contexts.

Source

pub fn value(self) -> f32

Source

pub fn to_meters(self) -> Meters

Source

pub fn to_km(self) -> Km

Trait Implementations§

Source§

impl Clone for WorldDistance

Source§

fn clone(&self) -> WorldDistance

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 WorldDistance

Source§

impl Debug for WorldDistance

Source§

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

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

impl Default for WorldDistance

Source§

fn default() -> WorldDistance

Returns the “default value” for a type. Read more
Source§

impl From<f32> for WorldDistance

Source§

fn from(v: f32) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for WorldDistance

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for WorldDistance

Source§

fn partial_cmp(&self, other: &WorldDistance) -> 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 StructuralPartialEq for WorldDistance

Auto Trait Implementations§

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> 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.