summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJovansonlee Cesar <ivanceras@gmail.com>2023-07-23 15:33:36 +0800
committerJovansonlee Cesar <ivanceras@gmail.com>2023-07-23 15:33:36 +0800
commit21be43a38d17afb46a9179161bb8a537b9c2fa35 (patch)
tree74eac905660224835dc0443cd428d60a5ad4bcb2
parent49bbe52655eb2da908e7f9a1b71546bdf0585af0 (diff)
chore: replace lazy_static with once_cell::Lazy
-rw-r--r--Cargo.lock8
-rw-r--r--packages/svgbob/Cargo.toml2
-rw-r--r--packages/svgbob/src/map/ascii_map.rs2778
-rw-r--r--packages/svgbob/src/map/circle_map.rs773
-rw-r--r--packages/svgbob/src/map/unicode_map.rs359
5 files changed, 2411 insertions, 1509 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 44ef058..fad1d49 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -410,12 +410,6 @@ dependencies = [
]
[[package]]
-name = "lazy_static"
-version = "1.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
-
-[[package]]
name = "libc"
version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -993,9 +987,9 @@ version = "0.7.1"
dependencies = [
"indexmap",
"itertools",
- "lazy_static",
"log",
"nalgebra",
+ "once_cell",
"parry2d",
"pom",
"sauron",
diff --git a/packages/svgbob/Cargo.toml b/packages/svgbob/Cargo.toml
index ec1a7f9..11f4877 100644
--- a/packages/svgbob/Cargo.toml
+++ b/packages/svgbob/Cargo.toml
@@ -12,7 +12,7 @@ edition = "2021"
[dependencies]
nalgebra = "0.32.1"
parry2d = "0.13.5"
-lazy_static = "1.3.0"
+once_cell = "1.18.0"
sauron = { version = "0.57.0", default-features = false}
#sauron = { path = "../../../sauron", default-features = false}
unicode-width = "0.1.9"
diff --git a/packages/svgbob/src/map/ascii_map.rs b/packages/svgbob/src/map/ascii_map.rs
index 6ed3033..fb8706d 100644
--- a/packages/svgbob/src/map/ascii_map.rs
+++ b/packages/svgbob/src/map/ascii_map.rs
@@ -11,1088 +11,1774 @@ use crate::{
Fragment, Property,
Signal::{self, Medium, Strong, Weak},
};
-use lazy_static::lazy_static;
+use once_cell::sync::Lazy;
use std::{collections::BTreeMap, sync::Arc};
-lazy_static! {
+/// The figure below is a Cell that can contain 1 character, divided into 32 equal small rectangles called CellGrid.
+/// ```ignore
+/// 0 1 2 3 4 B C D
+/// 0┌─┬─┬─┬─┐ A┌─┬─┬─┬─┐E
+/// 1├─┼─┼─┼─┤ │ │ │ │ │
+/// 2├─┼─┼─┼─┤ F├─G─H─I─┤J
+/// 3├─┼─┼─┼─┤ │ │ │ │ │
+/// 4├─┼─┼─┼─┤ K├─L─M─N─┤O
+/// 5├─┼─┼─┼─┤ │ │ │ │ │
+/// 6├─┼─┼─┼─┤ P├─Q─R─S─┤T
+/// 7├─┼─┼─┼─┤ │ │ │ │ │
+/// 8└─┴─┴─┴─┘ U└─┴─┴─┴─┘Y
+/// ``` V W X
- /// The figure below is a Cell that can contain 1 character, divided into 32 equal small rectangles called CellGrid.
- /// ```ignore
- /// 0 1 2 3 4 B C D
- /// 0┌─┬─┬─┬─┐ A┌─┬─┬─┬─┐E
- /// 1├─┼─┼─┼─┤ │ │ │ │ │
- /// 2├─┼─┼─┼─┤ F├─G─H─I─┤J
- /// 3├─┼─┼─┼─┤ │ │ │ │ │
- /// 4├─┼─┼─┼─┤ K├─L─M─N─┤O
- /// 5├─┼─┼─┼─┤ │ │ │ │ │
- /// 6├─┼─┼─┼─┤ P├─Q─R─S─┤T
- /// 7├─┼─┼─┼─┤ │ │ │ │ │
- /// 8└─┴─┴─┴─┘ U└─┴─┴─┴─┘Y
- /// ``` V W X
+pub static ASCII_PROPERTIES: Lazy<BTreeMap<char, Property>> = Lazy::new(|| {
+ let cell = Cell::new(0, 0);
- pub static ref ASCII_PROPERTIES: BTreeMap<char, Property> = {
- #![allow(unused)]
+ let a = CellGrid::a();
+ let b = CellGrid::b();
+ let c = CellGrid::c();
+ let d = CellGrid::d();
+ let e = CellGrid::e();
+ let f = CellGrid::f();
+ let g = CellGrid::g();
+ let h = CellGrid::h();
+ let i = CellGrid::i();
+ let j = CellGrid::j();
+ let k = CellGrid::k();
+ let l = CellGrid::l();
+ let m = CellGrid::m();
+ let n = CellGrid::n();
+ let o = CellGrid::o();
+ let p = CellGrid::p();
+ let q = CellGrid::q();
+ let r = CellGrid::r();
+ let s = CellGrid::s();
+ let t = CellGrid::t();
+ let u = CellGrid::u();
+ let v = CellGrid::v();
+ let w = CellGrid::w();
+ let x = CellGrid::x();
+ let y = CellGrid::y();
- let cell = Cell::new(0,0);
+ /// cellgrids that have no names
+ /// just name them with coordinate locations
+ let _01 = CellGrid::point(0, 1);
+ let _11 = CellGrid::point(1, 1);
+ let _21 = CellGrid::point(2, 1);
+ let _31 = CellGrid::point(3, 1);
+ let _41 = CellGrid::point(4, 1);
+ let _03 = CellGrid::point(0, 3);
+ let _13 = CellGrid::point(1, 3);
+ let _23 = CellGrid::point(2, 3);
+ let _33 = CellGrid::point(3, 3);
+ let _43 = CellGrid::point(4, 3);
+ let _05 = CellGrid::point(0, 5);
+ let _15 = CellGrid::point(1, 5);
+ let _25 = CellGrid::point(2, 5);
+ let _35 = CellGrid::point(3, 5);
+ let _45 = CellGrid::point(4, 5);
+ let _07 = CellGrid::point(0, 7);
+ let _17 = CellGrid::point(1, 7);
+ let _27 = CellGrid::point(2, 7);
+ let _37 = CellGrid::point(3, 7);
+ let _47 = CellGrid::point(4, 7);
- let a = CellGrid::a();
- let b = CellGrid::b();
- let c = CellGrid::c();
- let d = CellGrid::d();
- let e = CellGrid::e();
- let f = CellGrid::f();
- let g = CellGrid::g();
- let h = CellGrid::h();
- let i = CellGrid::i();
- let j = CellGrid::j();
- let k = CellGrid::k();
- let l = CellGrid::l();
- let m = CellGrid::m();
- let n = CellGrid::n();
- let o = CellGrid::o();
- let p = CellGrid::p();
- let q = CellGrid::q();
- let r = CellGrid::r();
- let s = CellGrid::s();
- let t = CellGrid::t();
- let u = CellGrid::u();
- let v = CellGrid::v();
- let w = CellGrid::w();
- let x = CellGrid::x();
- let y = CellGrid::y();
+ let unit1 = Cell::unit(1); // 0.25
+ let unit1_5 = Cell::unit(1) * 1.5; // 0.375
+ let unit2 = Cell::unit(2); // 0.5
+ let unit3 = Cell::unit(3); // 0.75
+ let unit4 = Cell::unit(4); // 1.0
+ let unit5 = Cell::unit(5); // 1.25
+ let unit6 = Cell::unit(6); // 1.5
+ let unit7 = Cell::unit(7); // 1.75
+ let unit8 = Cell::unit(8); // 2.0
- /// cellgrids that have no names
- /// just name them with coordinate locations
- let _01 = CellGrid::point(0, 1);
- let _11 = CellGrid::point(1, 1);
- let _21 = CellGrid::point(2, 1);
- let _31 = CellGrid::point(3, 1);
- let _41 = CellGrid::point(4, 1);
- let _03 = CellGrid::point(0, 3);
- let _13 = CellGrid::point(1, 3);
- let _23 = CellGrid::point(2, 3);
- let _33 = CellGrid::point(3, 3);
- let _43 = CellGrid::point(4, 3);
- let _05 = CellGrid::point(0, 5);
- let _15 = CellGrid::point(1, 5);
- let _25 = CellGrid::point(2, 5);
- let _35 = CellGrid::point(3, 5);
- let _45 = CellGrid::point(4, 5);
- let _07 = CellGrid::point(0, 7);
- let _17 = CellGrid::point(1, 7);
- let _27 = CellGrid::point(2, 7);
- let _37 = CellGrid::point(3, 7);
- let _47 = CellGrid::point(4, 7);
+ // in between 1 and 2
+ let between1_2 = (unit1 + unit2) / 2.0; // 0.375
- let unit1 = Cell::unit(1); // 0.25
- let unit1_5 = Cell::unit(1) * 1.5; // 0.375
- let unit2 = Cell::unit(2); // 0.5
- let unit3 = Cell::unit(3); // 0.75
- let unit4 = Cell::unit(4); // 1.0
- let unit5 = Cell::unit(5); // 1.25
- let unit6 = Cell::unit(6); // 1.5
- let unit7 = Cell::unit(7); // 1.75
- let unit8 = Cell::unit(8); // 2.0
-
- // in between 1 and 2
- let between1_2 = (unit1 + unit2) / 2.0; // 0.375
-
- /// char, default static fragments, conditional fragments
- let map: Vec<(
- char,
- Vec<(Signal, Vec<Fragment>)>,
- Arc<dyn Fn(&Property, &Property, &Property, &Property, &Property, &Property, &Property, &Property) -> Vec<(bool, Vec<Fragment>)> + Sync + Send >,
- )> = vec![
- ///////////////
- // dash -
- ///////////////
- (
- '-',
- vec![
- (Strong, vec![line(k, o)]),
- ],
- Arc::new(
- move| top_left, top, top_right, left, right, bottom_left, bottom, bottom_right| {
- vec![
- (true, vec![line(k,o)]),
- ]
- }
- )
+ /// char, default static fragments, conditional fragments
+ let map: Vec<(
+ char,
+ Vec<(Signal, Vec<Fragment>)>,
+ Arc<
+ dyn Fn(
+ &Property,
+ &Property,
+ &Property,
+ &Property,
+ &Property,
+ &Property,
+ &Property,
+ &Property,
+ ) -> Vec<(bool, Vec<Fragment>)>
+ + Sync
+ + Send,
+ >,
+ )> = vec![
+ ///////////////
+ // dash -
+ ///////////////
+ (
+ '-',
+ vec![(Strong, vec![line(k, o)])],
+ Arc::new(
+ move |top_left,
+ top,
+ top_right,
+ left,
+ right,
+ bottom_left,
+ bottom,
+ bottom_right| {
+ vec![(true, vec![line(k, o)])]
+ },
),
- ///////////////
- // tilde ~
- ///////////////
- (
- '~',
- vec![
- (Strong, vec![broken_line(k, o)]),
- ],
- Arc::new(
- move|top_left, top, top_right, left, right, bottom_left, bottom, bottom_right| {
- vec![
- (true, vec![broken_line(k, o)]),
- ]
- }
- )
+ ),
+ ///////////////
+ // tilde ~
+ ///////////////
+ (
+ '~',
+ vec![(Strong, vec![broken_line(k, o)])],
+ Arc::new(
+ move |top_left,
+ top,
+ top_right,
+ left,
+ right,
+ bottom_left,
+ bottom,
+ bottom_right| {
+ vec![(true, vec![broken_line(k, o)])]
+ },
),
- ////////////////////
- // vertical line |
- ////////////////////
- (
- '|',
- vec![
- (Strong, vec![line(c,w)]),
- ],
- Arc::new(
- move|top_left, top, top_right, left, right, bottom_left, bottom, bottom_right| {
- vec![
- (!bottom_left.is('/') && !bottom_right.is('\\') && !top_left.is('\\') && !top_right.is('/'), vec![line(c,w)]),
- // _
- // |
- (top_right.line_overlap(u, v), vec![line(c,e)]),
- // _
- // |
- (top_left.line_overlap(x, y), vec![line(a,c)]),
- // |_
- (right.line_overlap(u,v), vec![line(w,y)]),
- // _|
- (left.line_overlap(x,y), vec![line(u,w)]),
- // |-
- (right.line_strongly_overlap(k,l), vec![line(m,o)]),
- // -|
- (left.line_strongly_overlap(n,o), vec![line(k,m)]),
- // TODO: restrict lef, right, bottom, top_right, is not connecting to
- // here
- // |
- // /
- (bottom_left.line_overlap(e,u), vec![line(c,m),line(m,u)]),
- // TODO: restrict left, right, bottom, top_left, top_right
- // |
- // \
- (bottom_right.line_overlap(a,y), vec![line(c,m), line(m,y)]),
- // TODO: restrict left, right, top, bottom_left, bottom_right
- // \ /
- // |
- (top_left.line_overlap(a,y) && top_right.line_overlap(e,u), vec![line(a,m),line(m,w),line(m,e)]),
- ]
- }
- )
+ ),
+ ////////////////////
+ // vertical line |
+ ////////////////////
+ (
+ '|',
+ vec![(Strong, vec![line(c, w)])],
+ Arc::new(
+ move |top_left,
+ top,
+ top_right,
+ left,
+ right,
+ bottom_left,
+ bottom,
+ bottom_right| {
+ vec![
+ (
+ !bottom_left.is('/')
+ && !bottom_right.is('\\')
+ && !top_left.is('\\')
+ && !top_right.is('/'),
+ vec![line(c, w)],
+ ),
+ // _
+ // |
+ (top_right.line_overlap(u, v), vec![line(c, e)]),
+ // _
+ // |
+ (top_left.line_overlap(x, y), vec![line(a, c)]),
+ // |_
+ (right.line_overlap(u, v), vec![line(w, y)]),
+ // _|
+ (left.line_overlap(x, y), vec![line(u, w)]),
+ // |-
+ (right.line_strongly_overlap(k, l), vec![line(m, o)]),
+ // -|
+ (left.line_strongly_overlap(n, o), vec![line(k, m)]),
+ // TODO: restrict lef, right, bottom, top_right, is not connecting to
+ // here
+ // |
+ // /
+ (
+ bottom_left.line_overlap(e, u),
+ vec![line(c, m), line(m, u)],
+ ),
+ // TODO: restrict left, right, bottom, top_left, top_right
+ // |
+ // \
+ (
+ bottom_right.line_overlap(a, y),
+ vec![line(c, m), line(m, y)],
+ ),
+ // TODO: restrict left, right, top, bottom_left, bottom_right
+ // \ /
+ // |
+ (
+ top_left.line_overlap(a, y)
+ && top_right.line_overlap(e, u),
+ vec![line(a, m), line(m, w), line(m, e)],
+ ),
+ ]
+ },
),
- ////////////////////
- // exclamation bang !
- ////////////////////
- (
- '!',
- vec![
- (Strong, vec![broken_line(c,w)]),
- ],
- Arc::new(
- move| top_left, top, top_right, left, right, bottom_left, bottom, bottom_right| {
- vec![
- (top.line_strongly_overlap(r,w) || bottom.line_strongly_overlap(c,h), vec![broken_line(c,w)]),
- ]
- }
- )
+ ),
+ ////////////////////
+ // exclamation bang !
+ ////////////////////
+ (
+ '!',
+ vec![(Strong, vec![broken_line(c, w)])],
+ Arc::new(
+ move |top_left,
+ top,
+ top_right,
+ left,
+ right,
+ bottom_left,
+ bottom,
+ bottom_right| {
+ vec![(
+ top.line_strongly_overlap(r, w)
+ || bottom.line_strongly_overlap(c, h),
+ vec![broken_line(c, w)],
+ )]
+ },
),
- ////////////////////
- // colon :
- ////////////////////
- (
- ':',
- vec![
- (Strong, vec![broken_line(c,w)]),
- ],
- Arc::new(
- move| top_left, top, top_right, left, right, bottom_left, bottom, bottom_right| {
- vec![
- (top.line_strongly_overlap(r,w) || bottom.line_strongly_overlap(c,h), vec![broken_line(c,w)]),
- ]
- }
- )
+ ),
+ ////////////////////
+ // colon :
+ ////////////////////
+ (
+ ':',
+ vec![(Strong, vec![broken_line(c, w)])],
+ Arc::new(
+ move |top_left,
+ top,
+ top_right,
+ left,
+ right,
+ bottom_left,
+ bottom,
+ bottom_right| {
+ vec![(
+ top.line_strongly_overlap(r, w)
+ || bottom.line_strongly_overlap(c, h),
+ vec![broken_line(c, w)],
+ )]
+ },
),
- /////////////////////////
- // plus cross +
- /////////////////////////
- (
- '+',
- vec![
- (Medium, vec![line(c,w),line(k,o)]),
- (Weak, vec![line(a,y), line(u,e)]),
- ],
- Arc::new(
- move| top_left, top, top_right, left, right, bottom_left, bottom, bottom_right| {
- vec![
- // |
- // +
- (top.line_overlap(r,w), vec![line(c, m)]),
- // +
- // |
- (bottom.line_overlap(c,h), vec![line(m,w)]),
- // -+
- (left.line_overlap(n,o), vec![line(k,m)]),
- // +-
- (right.line_overlap(k,l), vec![line(m,o)]),
-
- // .+
- (left.line_weakly_overlap(n,o), vec![line(k,m)]),
- // +.
- (right.line_weakly_overlap(k,l), vec![line(m,o)]),
-
- // \
- // +
- (top_left.line_overlap(s,y), vec![line(a, m)]),
- // +
- // \
- (bottom_right.line_overlap(a,g), vec![line(m, y)]),
- // /
- // +
- (top_right.line_overlap(q,u), vec![line(m, e)]),
- // +
- // /
- (bottom_left.line_overlap(e,i), vec![line(m, u)]),
- ]
- }
- )
+ ),
+ /////////////////////////
+ // plus cross +
+ /////////////////////////
+ (
+ '+',
+ vec![
+ (Medium, vec![line(c, w), line(k, o)]),
+ (Weak, vec![line(a, y), line(u, e)]),
+ ],
+ Arc::new(
+ move |top_left,
+ top,
+ top_right,
+ left,
+ right,
+ bottom_left,
+ bottom,
+ bottom_right| {
+ vec![
+ // |
+ // +
+ (top.line_overlap(r, w), vec![line(c, m)]),
+ // +
+ // |
+ (bottom.line_overlap(c, h), vec![line(m, w)]),
+ // -+
+ (left.line_overlap(n, o), vec![line(k, m)]),
+ // +-
+ (right.line_overlap(k, l), vec![line(m, o)]),
+ // .+
+ (left.line_weakly_overlap(n, o), vec![line(k, m)]),
+ // +.
+ (right.line_weakly_overlap(k, l), vec![line(m, o)]),
+ // \
+ // +
+ (top_left.line_overlap(s, y), vec![line(a, m)]),
+ // +
+ // \
+ (bottom_right.line_overlap(a, g), vec![line(m, y)]),
+ // /
+ // +
+ (top_right.line_overlap(q, u), vec![line(m, e)]),
+ // +
+ // /
+ (bottom_left.line_overlap(e, i), vec![line(m, u)]),
+ ]
+ },
),
- /////////////////////////
- // letter X
- /////////////////////////
- (
- 'X',
- vec![
- (Strong, vec![line(a,y), line(u,e)]),
- ],
- Arc::new(
- move|top_left, top, top_right, left, right, bottom_left, bottom, bottom_right| {
- vec![
- /*
- // \ X
- // X \
- (top_left.line_overlap(s,y) || bottom_right.line_overlap(a,g), vec![line(a, y)]),
- // / X
- // X /
- (top_right.line_overlap(q,u) || bottom_left.line_overlap(e,i), vec![line(e, u)]),
- */
-
- // -x
- (left.line_strongly_overlap(m,o), vec![line(m,k)]),
- // x-
- (right.line_strongly_overlap(k,l), vec![line(m,o)]),
- // |
- // x
- (top.line_strongly_overlap(r,w), vec![line(m,c)]),
- // x
- // |
- (bottom.line_strongly_overlap(c,h), vec![line(m,w)]),
- // \
- // x
- (top_left.line_strongly_overlap(s,y), vec![line(m,a)]),
- // /
- // x
- (top_right.line_strongly_overlap(u,q), vec![line(m,e)]),
- // x
- // /
- (bottom_left.line_strongly_overlap(e,i), vec![line(m,u)]),
- // x
- // \
- (bottom_right.line_strongly_overlap(a,g), vec![line(m,y)]),
- ]
- }
- )
+ ),
+ /////////////////////////
+ // letter X
+ /////////////////////////
+ (
+ 'X',
+ vec![(Strong, vec![line(a, y), line(u, e)])],
+ Arc::new(
+ move |top_left,
+ top,
+ top_right,
+ left,
+ right,
+ bottom_left,
+ bottom,
+ bottom_right| {
+ vec![
+ /*
+ // \ X
+ // X \
+ (top_left.line_overlap(s,y) || bottom_right.line_overlap(a,g), vec![line(a, y)]),
+ // / X
+ // X /
+ (top_right.line_overlap(q,u) || bottom_left.line_overlap(e,i), vec![line(e, u)]),
+ */
+ // -x
+ (left.line_strongly_overlap(m, o), vec![line(m, k)]),
+ // x-
+ (right.line_strongly_overlap(k, l), vec![line(m, o)]),
+ // |
+ // x
+ (top.line_strongly_overlap(r, w), vec![line(m, c)]),
+ // x
+ // |
+ (bottom.line_strongly_overlap(c, h), vec![line(m, w)]),
+ // \
+ // x
+ (
+ top_left.line_strongly_overlap(s, y),
+ vec![line(m, a)],
+ ),
+ // /
+ // x
+ (
+ top_right.line_strongly_overlap(u, q),
+ vec![line(m, e)],
+ ),
+ // x
+ // /
+ (
+ bottom_left.line_strongly_overlap(e, i),
+ vec![line(m, u)],
+ ),
+ // x
+ // \
+ (
+ bottom_right.line_strongly_overlap(a, g),
+ vec![line(m, y)],
+ ),
+ ]
+ },
),
- /////////////////////////
- // asterisk *
- /////////////////////////
- (
- '*',
- vec![
- (Strong, vec![circle(m, unit1_5, true)]),
- (Medium, vec![line(c,w),line(k,o)]),
- (Weak, vec![line(a,y), line(u,e)]),
- ],
- Arc::new(
- move| top_left, top, top_right, left, right, bottom_left, bottom, bottom_right| {
- vec![
-
- // must have at least one connection
- // \|/
- // -*-
- // /|\
- (top.line_strongly_overlap(r,w) || bottom.line_strongly_overlap(c,h)
- || left.line_strongly_overlap(n,o) || right.line_strongly_overlap(k,l)
- || top_left.line_strongly_overlap(s,y)|| bottom_right.line_strongly_overlap(a,g)
- || bottom_left.line_strongly_overlap(u,q) || top_right.line_strongly_overlap(e,i),
- vec![circle(m,unit1_5,true)]),
-
- // |
- // *
- (top.line_strongly_overlap(r,w),
- vec![line(c,h)]
- ),
- // *
- // |
- (bottom.line_strongly_overlap(c,h),
- vec![line(w,r)]
- ),
- // -*
- (left.line_overlap(n,o), vec![line(k,m)]),
- // *-
- (right.line_overlap(k,l), vec![line(m,o)]),
-
- // \
- // *
- (top_left.line_strongly_overlap(s,y),
- vec![line(a,g)]
- ),
- // /
- // *
- (top_right.line_strongly_overlap(u,q),
- vec![line(e,i)]
- ),
- // *
- // /
- (bottom_left.line_strongly_overlap(e,i),
- vec![line(u,q)]
- ),
- // *
- // \
- (bottom_right.line_strongly_overlap(a,g),
- vec![line(s,y)]
- ),
- ]
- }
- )
+ ),
+ /////////////////////////
+ // asterisk *
+ /////////////////////////
+ (
+ '*',
+ vec![
+ (Strong, vec![circle(m, unit1_5, true)]),
+ (Medium, vec![line(c, w), line(k, o)]),
+ (Weak, vec![line(a, y), line(u, e)]),
+ ],
+ Arc::new(
+ move |top_left,
+ top,
+ top_right,
+ left,
+ right,
+ bottom_left,
+ bottom,
+ bottom_right| {
+ vec![
+ // must have at least one connection
+ // \|/
+ // -*-
+ // /|\
+ (
+ top.line_strongly_overlap(r, w)
+ || bottom.line_strongly_overlap(c, h)
+ || left.line_strongly_overlap(n, o)
+ || right.line_strongly_overlap(k, l)
+ || top_left.line_strongly_overlap(s, y)
+ || bottom_right.line_strongly_overlap(a, g)
+ || bottom_left.line_strongly_overlap(u, q)
+ || top_right.line_strongly_overlap(e, i),
+ vec![circle(m, unit1_5, true)],
+ ),
+ // |
+ // *
+ (top.line_strongly_overlap(r, w), vec![line(c, h)]),
+ // *
+ // |
+ (bottom.line_strongly_overlap(c, h), vec![line(w, r)]),
+ // -*
+ (left.line_overlap(n, o), vec![line(k, m)]),
+ // *-
+ (right.line_overlap(k, l), vec![line(m, o)]),
+ // \
+ // *
+ (
+ top_left.line_strongly_overlap(s, y),
+ vec![line(a, g)],
+ ),
+ // /
+ // *
+ (
+ top_right.line_strongly_overlap(u, q),
+ vec![line(e, i)],
+ ),
+ // *
+ // /
+ (
+ bottom_left.line_strongly_overlap(e, i),
+ vec![line(u, q)],
+ ),
+ // *
+ // \
+ (
+ bottom_right.line_strongly_overlap(a, g),
+ vec![line(s, y)],
+ ),
+ ]
+ },
),
-
- /////////////////////////
- // hash pound #
- /////////////////////////
- (
- '#',
- vec![
- (Strong, vec![rect(f,t,true, false)]),
- (Medium, vec![line(c,w),line(k,o)]),
- (Weak, vec![line(a,y), line(u,e)]),
- ],
- Arc::new(
- move| top_left, top, top_right, left, right, bottom_left, bottom, bottom_right| {
- vec![
- //
- // |
- // --#--
- // |
- (top.line_overlap(r,w) || bottom.line_overlap(c,h)
- || left.line_overlap(n,o) || right.line_overlap(k,l),
- vec![rect(f,t, true, false)]),
-
- //
- // \ # / #
- // # \ # /
- //
- (top_left.line_overlap(s,y)|| bottom_right.line_overlap(a,g)
- || bottom_left.line_overlap(u,q) || top_right.line_overlap(e,i),
- vec![polygon(vec![m.adjust(1.4,2.0), m.adjust(1.4,-2.0), m.adjust(-1.4,-2.0),m.adjust(-1.4,2.0)], true, vec![DiamondBullet])]),
- //
- // |
- // #
- //
- (top.line_overlap(r,w),
- vec![line(c,h)]),
-
- //
- // #
- // |
- //
- ( bottom.line_overlap(c,h),
- vec![line(r,w)]),
-
- // \
- // #
- (top_left.line_strongly_overlap(s,y),
- vec![line(a,g)]
- ),
- // /
- // #
- (top_right.line_strongly_overlap(u,q),
- vec![line(e,i)]
- ),
- // #
- // /
- (bottom_left.line_strongly_overlap(e,i),
- vec![line(u,q)]
- ),
- // #
- // \
- (bottom_right.line_strongly_overlap(a,g),
- vec![line(s,y)]
- ),
- ]
- }
- )
+ ),
+ /////////////////////////
+ // hash pound #
+ /////////////////////////
+ (
+ '#',
+ vec![
+ (Strong, vec![rect(f, t, true, false)]),
+ (Medium, vec![line(c, w), line(k, o)]),
+ (Weak, vec![line(a, y), line(u, e)]),
+ ],
+ Arc::new(
+ move |top_left,
+ top,
+ top_right,
+ left,
+ right,
+ bottom_left,
+ bottom,
+ bottom_right| {
+ vec![
+ //
+ // |
+ // --#--
+ // |
+ (
+ top.line_overlap(r, w)
+ || bottom.line_overlap(c, h)
+ || left.line_overlap(n, o)
+ || right.line_overlap(k, l),
+ vec![rect(f, t, true, false)],
+ ),
+ //
+ // \ # / #
+ // # \ # /
+ //
+ (
+ top_left.line_overlap(s, y)
+ || bottom_right.line_overlap(a, g)
+ || bottom_left.line_overlap(u, q)
+ || top_right.line_overlap(e, i),
+ vec![polygon(
+ vec![
+ m.adjust(1.4, 2