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
/// Defines the visual data of the figure.
#[derive(Debug)]
pub struct Figure {
/// The points to be displayed
pub points: Vec<Point>,
/// The lines to be displayed
pub lines: Vec<Line>,
/// The segments to be displayed.
pub segments: Vec<Segment>,
/// The canvas size.
pub canvas_size: (usize, usize),
}
/// Defines visual info about points.
#[derive(Debug)]
pub struct Point {
/// The text to display next to the point.
pub label: String,
/// The definition allows the projector to find the point's position.
pub definition: PointDefinition,
}
/// How the point is defined
#[derive(Debug)]
pub enum PointDefinition {
/// For free points, that are adjusted by the generator.
Indexed(usize),
/// An intersection of two lines.
Crossing(LineDefinition, LineDefinition),
}
/// How the line is defined.
#[derive(Debug)]
pub enum LineDefinition {
/// Indices pointing to geometrical constructs creating that line
TwoPoints(Box<PointDefinition>, Box<PointDefinition>),
}
/// Defines visual info about lines.
#[derive(Debug)]
pub struct Line {
/// The text to display next to the line.
pub label: String,
/// The definition allows the projector to find where the line should be drawn.
pub definition: LineDefinition,
}
/// Defines visual info about segments.
#[derive(Debug)]
pub struct Segment {
/// The text to display next to the segment
pub label: String,
/// The beginning and the end of the segment.
pub points: (usize, usize),
}