1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#![allow(non_upper_case_globals)]
#![allow(mixed_script_confusables)]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![doc = include_str!("../Readme.md")]

mod circle;
mod ellipse;
mod extension;
mod line;
mod point;

pub use float::{π, Float};

/// The representation of a ellipse.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Ellipse {
    a: Float,
    b: Float,
    c: Float,
    d: Float,
    e: Float,
    f: Float,
}

/// A graphics.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Circle {
    /// Center of the graphics.
    pub center: Point,
    /// Radius of the graphics.
    pub radius: Float,
}

/// A graphics.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Line {
    /// Start of the line.
    pub start: Point,
    /// End of the line.
    pub end: Point,
}

/// A 2D point.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Point {
    /// The x-coordinate.
    pub x: Float,
    /// The y-coordinate.
    pub y: Float,
}

// noinspection NonAsciiCharacters
#[cfg(feature = "f32")]
mod float {
    /// Float Type
    pub type Float = f32;
    /// constant π
    pub const π: Float = std::f32::consts::PI;
}

// noinspection NonAsciiCharacters
#[cfg(feature = "f64")]
mod float {
    /// Float Type
    pub type Float = f64;
    /// constant π
    pub const Pi: Float = std::f64::consts::PI;
}