MotionPlanner

Struct MotionPlanner 

Source
pub struct MotionPlanner<'a, T = usize>
where T: Eq + Hash,
{ /* private fields */ }
Expand description

The MotionPlanner is a pathfinding algorithm implementation for finding the chain of transformations between two triads along the surface of the hyper-tonnetz.

Implementations§

Source§

impl<'a, T> MotionPlanner<'a, T>
where T: Eq + Hash,

Source

pub fn new(tonnetz: &'a HyperTonnetz<[T; 3], Triads, T>) -> MotionPlanner<'a, T>

Create a new motion planner for the given tonnetz

Source

pub const fn cache(&self) -> &PathCache<T>

returns an immutable reference to the cache

Source

pub const fn cache_mut(&mut self) -> &mut PathCache<T>

returns a mutable reference to the cache

Source

pub const fn config(&self) -> &MotionPlannerConfig

returns an immutable reference to the configuration of the planner

Source

pub const fn config_mut(&mut self) -> &mut MotionPlannerConfig

returns a mutable reference to the configuration of the planner

Source

pub const fn max_depth(&self) -> usize

returns the maximum depth for pathfinding

Source

pub const fn max_paths(&self) -> usize

returns the maximum number of paths to find

Source

pub const fn tonnetz(&self) -> &HyperTonnetz<[T; 3], Triads, T>

returns an immutable reference to the tonnetz

Source

pub fn set_config( &mut self, config: MotionPlannerConfig, ) -> &mut MotionPlanner<'a, T>

updates the current configuration and returns a mutable reference to the instance.

Source

pub fn set_max_depth(&mut self, depth: usize) -> &mut MotionPlanner<'a, T>

set the maximum depth for pathfinding

Source

pub fn set_max_paths(&mut self, paths: usize) -> &mut MotionPlanner<'a, T>

set the maximum number of paths to find

Source

pub fn with_max_depth(self, depth: usize) -> MotionPlanner<'a, T>

consumes the current instance to create another with the given maximum depth

Source

pub fn with_max_paths(self, paths: usize) -> MotionPlanner<'a, T>

consumes the current instance to create another with the given maximum number of paths

Source§

impl<'a, T> MotionPlanner<'a, T>
where T: Hash + Ord + FromPrimitive + ToPrimitive + One + Zero<Output = T> + PitchMod<Output = T> + Add + Copy + Sub<Output = T> + Eq + AddAssign,

Source

pub fn find_paths_to_pitch( &mut self, start_edge: IndexBase<usize, EdgeIndex>, target_pitch: T, ) -> Vec<Path<T>>

find a set of paths from one triad to one that contains the target pitch

Source

pub fn find_paths_between_edges( &mut self, start_edge: IndexBase<usize, EdgeIndex>, goal_edge: IndexBase<usize, EdgeIndex>, ) -> Vec<Path<T>>

Search for paths between two specific edges in the tonnetz

Source

pub fn search_from( &self, start_triad: TriadBase<[T; 3], Triads, T>, target_pitch: T, transforms: Vec<LPR>, triads: Vec<TriadBase<[T; 3], Triads, T>>, edge_ids: Vec<Option<IndexBase<usize, EdgeIndex>>>, max_paths: usize, remaining_depth: usize, ) -> Vec<Path<T>>

Find paths from a specified edge by continuing search from a given state Used for parallel search implementations

Auto Trait Implementations§

§

impl<'a, T> Freeze for MotionPlanner<'a, T>

§

impl<'a, T> RefUnwindSafe for MotionPlanner<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for MotionPlanner<'a, T>
where T: Send + Sync,

§

impl<'a, T> Sync for MotionPlanner<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for MotionPlanner<'a, T>
where T: Unpin,

§

impl<'a, T> UnwindSafe for MotionPlanner<'a, T>

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoWeight<T> for T

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

Source§

type Cont<U> = U

Source§

fn get(&self) -> &T

returns a reference to the inner value
Source§

fn view(&self) -> <T as Wrapper<T>>::Cont<&T>

returns a view of the container containing an immutable reference to the inner value