pub struct ElectromagneticField {
pub electric_field: f64,
pub magnetic_flux_density: f64,
}Expand description
A scalar electric and magnetic field pair.
Fields§
§electric_field: f64§magnetic_flux_density: f64Implementations§
Source§impl ElectromagneticField
impl ElectromagneticField
Sourcepub const fn new(
electric_field: f64,
magnetic_flux_density: f64,
) -> Option<ElectromagneticField>
pub const fn new( electric_field: f64, magnetic_flux_density: f64, ) -> Option<ElectromagneticField>
Creates a field pair when both scalar components are finite.
Sourcepub fn electric_force_on_charge(&self, charge: f64) -> Option<f64>
pub fn electric_force_on_charge(&self, charge: f64) -> Option<f64>
Computes electric force using the field’s electric component.
Sourcepub fn lorentz_force_scalar(
&self,
charge: f64,
velocity: f64,
angle_radians: f64,
) -> Option<f64>
pub fn lorentz_force_scalar( &self, charge: f64, velocity: f64, angle_radians: f64, ) -> Option<f64>
Computes the scalar Lorentz-force convenience relation for this field pair.
Sourcepub fn energy_density(&self) -> Option<f64>
pub fn energy_density(&self) -> Option<f64>
Computes combined electromagnetic energy density for this field pair.
§Examples
use use_electromagnetism::ElectromagneticField;
let field = ElectromagneticField::new(10.0, 2.0).unwrap();
assert!(field.energy_density().unwrap() > 0.0);Sourcepub fn poynting_magnitude(&self) -> Option<f64>
pub fn poynting_magnitude(&self) -> Option<f64>
Computes Poynting magnitude when the stored field values are used as magnitudes.
Trait Implementations§
Source§impl Clone for ElectromagneticField
impl Clone for ElectromagneticField
Source§fn clone(&self) -> ElectromagneticField
fn clone(&self) -> ElectromagneticField
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ElectromagneticField
impl Debug for ElectromagneticField
Source§impl PartialEq for ElectromagneticField
impl PartialEq for ElectromagneticField
Source§fn eq(&self, other: &ElectromagneticField) -> bool
fn eq(&self, other: &ElectromagneticField) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for ElectromagneticField
impl StructuralPartialEq for ElectromagneticField
Auto Trait Implementations§
impl Freeze for ElectromagneticField
impl RefUnwindSafe for ElectromagneticField
impl Send for ElectromagneticField
impl Sync for ElectromagneticField
impl Unpin for ElectromagneticField
impl UnsafeUnpin for ElectromagneticField
impl UnwindSafe for ElectromagneticField
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