summaryrefslogtreecommitdiff
path: root/examples/03-struct-generic/src/point.hob
blob: 5beed86e42957387c3653fada3fec70caa2b17c5 (plain)
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
/// A set of drawings.
struct OwnedLineDrawing[TPoint] {
    field drawing: LineDrawing[TPoint];
    field owner: String;
}

/// A 2D drawing made up of straight lines.
struct LineDrawing2D {
    field lines: List[Line[Point2D]];
}

/// A drawing made up of straight lines.
struct LineDrawing[TPoint] {
    field lines: List[Line[TPoint]];
}

/// A cubic Bezier curve.
struct BezierCurve[TPoint] {
    field start: Line[TPoint];
    field end: Line[TPoint];
}

/// A straight line from one point to another.
struct Line[TPoint] {
    field start: TPoint;
    field end: TPoint;
}

/// A 2D point.
struct Point2D {
    field x: Int32;
    field y: Int32;
}