Rename Point -> Vec2 to distinguish it clearly from any 3d object

This commit is contained in:
2020-09-26 13:25:49 -07:00
parent fccdbc802b
commit bef423ce38
7 changed files with 86 additions and 86 deletions

View File

@@ -1,5 +1,5 @@
use coremem::{Driver, mat, meas};
use coremem::geom::Point;
use coremem::geom::Vec2;
fn main() {
coremem::init_logging();
@@ -21,11 +21,11 @@ fn main() {
driver.add_measurement(meas::MagneticFlux(width / 2, width / 2));
driver.add_measurement(meas::MagneticStrength(width / 2, width / 2));
let center = Point::new((width/2) as _, (width/2) as _);
let center = Vec2::new((width/2) as _, (width/2) as _);
for y in 0..width {
for x in 0..width {
let d = Point::new(x as _, y as _) - center;
let d = Vec2::new(x as _, y as _) - center;
if (inner_rad as _..outer_rad as _).contains(&d.mag()) {
*driver.state.get_mut(x, y).mat_mut() = mat::Static::conductor(conductivity).into();
} else if d.mag() < ferro_rad as _ {
@@ -46,9 +46,9 @@ fn main() {
let e = drive_current/conductivity;
for y in 0..width {
for x in 0..width {
let d = Point::new(x as _, y as _) - center;
let d = Vec2::new(x as _, y as _) - center;
if (inner_rad as _..outer_rad as _).contains(&d.mag()) {
let tangent = Point::new(-d.y(), d.x()).with_mag(e);
let tangent = Vec2::new(-d.y(), d.x()).with_mag(e);
driver.state.impulse_ex(x, y, tangent.x());
driver.state.impulse_ey(x, y, tangent.y());
}