pub struct Painter<'a, 'ctx: 'a> { /* private fields */ }
Expand description

The main user interface for drawing graphics.

See Animation and the crate examples for usage.

Implementations§

source§

impl<'a, 'ctx: 'a> Painter<'a, 'ctx>

source

pub fn set_color_map(&mut self, name: &str)

Set the active color map by name.

If the given name is not found in the loaded maps, does not change the map.

source

pub fn set_color_map_index(&mut self, idx: usize)

Set the active color map by its index in the array of loaded maps.

source

pub fn set_color_map_range(&mut self, range: Range<f32>)

Set the range of values that gets mapped onto the active color map. Values outside the range are clamped to its ends.

If the color map is never set, the range is computed as the minimum and maximum of the given values whenever a renderer using the color map is called. This is usually undesirable as it will change the range when the simulation state changes, so setting a constant value is recommended.

source

pub fn vertex_colors(&mut self, c: &Cochain<0, Primal>)

Draw a primal 0-cochain by coloring mesh vertices according to the active color map and interpolating colors for the triangles between.

source

pub fn vertex_colors_dual(&mut self, c: &Cochain<2, Primal>)

Draw a dual 2-cochain by setting its values as colors at the corresponding primal mesh vertices.

source

pub fn triangle_colors(&mut self, c: &Cochain<2, Primal>)

Draw a primal 2-cochain as flat-colored triangles.

source

pub fn triangle_colors_dual(&mut self, c: &Cochain<0, Dual>)

Draw a dual 0-cochain as flat colors on the corresponding primal mesh triangles.

source

pub fn velocity_arrows(&mut self, c: &Cochain<1, Primal>, params: ArrowParams)

Draw a primal 1-cochain representing a velocity in the edge tangent direction as arrows interpolated at triangle barycenters.

source

pub fn flux_arrows(&mut self, c: &Cochain<1, Primal>, params: ArrowParams)

Draw a primal 1-cochain representing a flux in the edge normal direction as arrows interpolated at triangle barycenters.

source

pub fn wireframe(&mut self, params: WireframeParams)

Draw a wireframe model of the simulation mesh.

source

pub fn axes_2d(&mut self, params: AxesParams)

Draw a set of axes around the mesh.

source

pub fn line_list(&mut self, params: LineParams, points: &[Vector3<f64>])

Draw a list of line segments.

Every two points in points define a distinct segment, with a gap left between them.

source

pub fn line_strip(&mut self, params: LineParams, points: &[Vector3<f64>])

Draw a strip of line segments.

Every point in points is connected to both the next and previous one with a line segments.

Auto Trait Implementations§

§

impl<'a, 'ctx> !RefUnwindSafe for Painter<'a, 'ctx>

§

impl<'a, 'ctx> !Send for Painter<'a, 'ctx>

§

impl<'a, 'ctx> !Sync for Painter<'a, 'ctx>

§

impl<'a, 'ctx> Unpin for Painter<'a, 'ctx>

§

impl<'a, 'ctx> !UnwindSafe for Painter<'a, 'ctx>

Blanket Implementations§

source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, D: AdaptFrom<S, Swp, Dwp, T>,

source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
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, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
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, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromAngle<T> for T

source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
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, U> IntoAngle<U> for T
where U: FromAngle<T>,

source§

fn into_angle(self) -> U

Performs a conversion into T.
source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
source§

impl<T> IntoStimulus<T> for T

source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>