coord2d 0.1.4

rust lib for coordinate in 2d system
Documentation
coord2d-0.1.4 has been yanked.

modules coord2d

rust lib for coordinate in 2d system

example 1

use coord2d::*;

fn main() {
    let coord1: coords::Coord = coords::new(3.0, 4.0);
    let coord2: coords::Coord = coords::new(5.0, 13.0);
    let sum: coords::Coord = coord1 + coord2;

    println!("{:?}", sum);
}

example 2

use coord2d::*;

fn main() {
    let coord1: coords::Coord = coords::new(3.0, 4.0);
    let coord2: coords::Coord = coords::new(5.0, 13.0);

    let h: vectors::Vector = vectors::new(coord1, coord2);
    let l: vectors::Vector = vectors::new(coord1, coord2);

    let m: vectors::Vector = h + l;
    let s: vectors::Vector = h - l;

    println!("{:?}", h);
    println!("{:?}", m);
    println!("{:?}", s);
    
}

TO DO

  • basic math
  • add fn give magnitude of vector
  • add properties

stats

Anurag's GitHub stats

Top Langs