#[non_exhaustive]pub struct ForceConfig {
pub link_distance: f32,
pub charge: f32,
pub theta: f32,
pub charge_distance_max: f32,
pub collide_padding: f32,
pub collide_strength: f32,
pub gravity: f32,
pub group_strength: f32,
pub velocity_decay: f32,
pub alpha_min: f32,
pub alpha_decay: f32,
}Expand description
Tuning knobs, named after their d3-force counterparts.
ⓘ
ForceConfig::default().with_link_distance(90.).with_charge(-400.)Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.link_distance: f32forceLink().distance(): rest length of an edge, in world units.
charge: f32forceManyBody().strength(): negative repels.
theta: f32forceManyBody().theta(): Barnes–Hut accuracy, lower is more exact.
charge_distance_max: f32Ignore charge beyond this distance; keeps far components from drifting apart.
collide_padding: f32forceCollide() padding added to each node’s radius.
collide_strength: f32§gravity: f32forceX/forceY pull toward the origin; holds disconnected components together.
group_strength: f32Pull of each group (community) member toward its group’s centroid, so communities form visible clusters. 0 disables.
velocity_decay: f32§alpha_min: f32§alpha_decay: f32Implementations§
Source§impl ForceConfig
impl ForceConfig
pub fn with_link_distance(self, value: f32) -> Self
pub fn with_charge(self, value: f32) -> Self
pub fn with_theta(self, value: f32) -> Self
pub fn with_charge_distance_max(self, value: f32) -> Self
pub fn with_collide_padding(self, value: f32) -> Self
pub fn with_collide_strength(self, value: f32) -> Self
pub fn with_gravity(self, value: f32) -> Self
pub fn with_group_strength(self, value: f32) -> Self
pub fn with_velocity_decay(self, value: f32) -> Self
Source§impl ForceConfig
impl ForceConfig
Sourcepub fn with_settle_ticks(self, ticks: u32, alpha_min: f32) -> Self
pub fn with_settle_ticks(self, ticks: u32, alpha_min: f32) -> Self
Sets alpha_min and derives alpha_decay so the layout settles in about ticks steps.
Trait Implementations§
Source§impl Clone for ForceConfig
impl Clone for ForceConfig
Source§impl Debug for ForceConfig
impl Debug for ForceConfig
Auto Trait Implementations§
impl Freeze for ForceConfig
impl RefUnwindSafe for ForceConfig
impl Send for ForceConfig
impl Sync for ForceConfig
impl Unpin for ForceConfig
impl UnsafeUnpin for ForceConfig
impl UnwindSafe for ForceConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().