Struct plutchik::Wheel [] [src]

pub struct Wheel {
    pub radians: f32,
    pub weight: f32,
}

Representation of an emotion in the form of a Plutchik Wheel. Useful for emotional tagging and aesthetic comparisons.

Fields

radians: f32 weight: f32

Methods

impl Wheel
[src]

fn mean<T>(emotions: &[T]) -> Wheel where T: Deref<Target=Wheel>

Construct the mean (average) emotion wheel given a number of other emotions.

fn difference(&self, other: &Wheel) -> f32

Compare two Wheels and return the result as a difference weight where 0 is the minimum distance and 1 is the maximum. Determine the difference as the magnitude of the vector that separates both points on the wheel.

fn closest_emotion(&self) -> Emotion

Return the closest matching Emotion variant to the current state of the Wheel.

fn closest_emotions(&self, n: usize) -> Vec<Emotion>

Return the closest n number of emotions to the current state of the wheel.

fn opposite(&self) -> Wheel

Return the wheel's opposite.

Trait Implementations

impl PartialEq for Wheel
[src]

fn eq(&self, __arg_0: &Wheel) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Wheel) -> bool

This method tests for !=.

impl Debug for Wheel
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Clone for Wheel
[src]

fn clone(&self) -> Wheel

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Copy for Wheel
[src]

impl Rand for Wheel
[src]

fn rand<R: Rng>(rng: &mut R) -> Wheel

Generates a random instance of this type using the specified source of randomness. Read more

impl<'a> Into<[f32; 2]> for &'a Wheel
[src]

fn into(self) -> [f32; 2]

Performs the conversion.

impl<'a> Into<[f32; 2]> for Wheel
[src]

fn into(self) -> [f32; 2]

Performs the conversion.

impl<'a> From<[f32; 2]> for Wheel
[src]

fn from(vec: [f32; 2]) -> Wheel

Performs the conversion.