Skip to main content

Point2Soa

Struct Point2Soa 

Source
pub struct Point2Soa<L: Copy + Debug + 'static, const N: usize> {
    pub len: usize,
    pub x: [L; N],
    pub y: [L; N],
}

Fields§

§len: usize§x: [L; N]§y: [L; N]

Implementations§

Source§

impl<L: Copy + Debug + 'static, const N: usize> Point2Soa<L, N>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source§

impl<L, const N: usize> Point2Soa<L, N>
where L: Clone + Default + Copy + Debug + 'static,

Source

pub fn new(default: Point2<L>) -> Self

Source

pub fn push(&mut self, value: Point2<L>)

Source

pub fn pop(&mut self) -> Option<Point2<L>>

Source

pub fn set(&mut self, index: usize, value: Point2<L>)

Source

pub fn get(&self, index: usize) -> Point2<L>

Source

pub fn apply<F>(&mut self, f: F)
where F: FnMut(L, L) -> (L, L),

Source

pub fn iter(&self) -> Point2Iterator<'_, L, N>

Source

pub fn x(&self) -> &[L]

Source

pub fn x_mut(&mut self) -> &mut [L]

Source

pub fn x_range(&self, range: Range<usize>) -> &[L]

Source

pub fn x_range_mut(&mut self, range: Range<usize>) -> &mut [L]

Source

pub fn y(&self) -> &[L]

Source

pub fn y_mut(&mut self) -> &mut [L]

Source

pub fn y_range(&self, range: Range<usize>) -> &[L]

Source

pub fn y_range_mut(&mut self, range: Range<usize>) -> &mut [L]

Source§

impl<const N: usize> Point2Soa<Length, N>

Source

pub fn distances_squared(&self, target: Point2<Length32>, out: &mut [Area32])

Squared distance from every point to target, written to out[..len]. Sqrt-free, so the loop vectorizes; enough for nearest-neighbor style comparisons. Accurate to 1 ulp.

§Panics

If out is shorter than self.len().

Source

pub fn distances(&self, target: Point2<Length32>, out: &mut [Length32])

Distance from every point to target, written to out[..len].

§Panics

If out is shorter than self.len().

Source

pub fn lerp_toward(&mut self, target: Point2<Length32>, ratio: f32)

Every point moved ratio of the way toward target, in place.

Source§

impl<const N: usize> Point2Soa<Length, N>

Source

pub fn distances_squared(&self, target: Point2<Length64>, out: &mut [Area64])

Squared distance from every point to target, written to out[..len]. Sqrt-free, so the loop vectorizes; enough for nearest-neighbor style comparisons. Accurate to 1 ulp.

§Panics

If out is shorter than self.len().

Source

pub fn distances(&self, target: Point2<Length64>, out: &mut [Length64])

Distance from every point to target, written to out[..len].

§Panics

If out is shorter than self.len().

Source

pub fn lerp_toward(&mut self, target: Point2<Length64>, ratio: f64)

Every point moved ratio of the way toward target, in place.

Trait Implementations§

Source§

impl<L, const N: usize> Clone for Point2Soa<L, N>
where L: Clone + Copy + Debug + 'static,

Source§

fn clone(&self) -> Self

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<L: Debug + Copy + Debug + 'static, const N: usize> Debug for Point2Soa<L, N>

Source§

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

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

impl<L, const N: usize> Decode<()> for Point2Soa<L, N>
where L: Decode<()> + Default + Copy + Debug + 'static,

Source§

fn decode<D: Decoder<Context = ()>>( decoder: &mut D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
Source§

impl<L, const N: usize> Default for Point2Soa<L, N>
where L: Default + Copy + Debug + 'static,

Source§

fn default() -> Self

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

impl<'de, L, const N: usize> Deserialize<'de> for Point2Soa<L, N>
where L: Deserialize<'de> + Default + Copy + Debug + 'static,

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<L, const N: usize> Encode for Point2Soa<L, N>
where L: Encode + Copy + Debug + 'static,

Source§

fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError>

Encode a given type.
Source§

impl<L, const N: usize> Serialize for Point2Soa<L, N>
where L: Serialize + Copy + Debug + 'static,

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

Auto Trait Implementations§

§

impl<L, const N: usize> Freeze for Point2Soa<L, N>
where L: Freeze,

§

impl<L, const N: usize> RefUnwindSafe for Point2Soa<L, N>
where L: RefUnwindSafe,

§

impl<L, const N: usize> Send for Point2Soa<L, N>
where L: Send,

§

impl<L, const N: usize> Sync for Point2Soa<L, N>
where L: Sync,

§

impl<L, const N: usize> Unpin for Point2Soa<L, N>
where L: Unpin,

§

impl<L, const N: usize> UnsafeUnpin for Point2Soa<L, N>
where L: UnsafeUnpin,

§

impl<L, const N: usize> UnwindSafe for Point2Soa<L, N>
where L: UnwindSafe,

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> CuMsgPayload for T

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> GetTypeRegistration for T

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> Reflect for T
where T: 'static,

Source§

impl<T> ReflectTypePath for T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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.