pub struct Dipole {
pub pos: Vec3,
pub moment: Vec3,
}Expand description
Electric dipole: two equal and opposite charges separated by a small distance.
Fields§
§pos: Vec3§moment: Vec3Implementations§
Source§impl Dipole
impl Dipole
pub fn new(pos: Vec3, moment: Vec3) -> Self
Sourcepub fn field_at(&self, point: Vec3) -> Vec3
pub fn field_at(&self, point: Vec3) -> Vec3
Electric field of a dipole at a given position (far-field approximation). E = (1/4pieps0) * [3(p·r_hat)r_hat - p] / r^3
Sourcepub fn potential_at(&self, point: Vec3) -> f32
pub fn potential_at(&self, point: Vec3) -> f32
Electric potential of a dipole at a given position. V = (1/4pieps0) * p·r_hat / r^2
Sourcepub fn to_charges(&self, separation: f32) -> [PointCharge; 2]
pub fn to_charges(&self, separation: f32) -> [PointCharge; 2]
Convert dipole to a pair of point charges for exact computation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dipole
impl RefUnwindSafe for Dipole
impl Send for Dipole
impl Sync for Dipole
impl Unpin for Dipole
impl UnsafeUnpin for Dipole
impl UnwindSafe for Dipole
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.