mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
arb:: pattern Sublines
This commit is contained in:
parent
2805c6308c
commit
d3d1d689fa
@ -23,6 +23,7 @@ struct shape {
|
||||
vector<tuple<int, int, int>> connections;
|
||||
int size() const { return isize(vertices); }
|
||||
void build_from_angles_edges();
|
||||
vector<pair<int, int> > sublines;
|
||||
};
|
||||
|
||||
struct arbi_tiling {
|
||||
@ -210,6 +211,24 @@ void load(const string& fname) {
|
||||
c.shapes[ai].connections[as] = make_tuple(bi, bs, m);
|
||||
c.shapes[bi].connections[bs] = make_tuple(ai, as, m);
|
||||
}
|
||||
else if(ep.eat("subline(")) {
|
||||
int ai = ep.iparse(); verify_index(ai, c.shapes); ep.force_eat(",");
|
||||
int as = ep.iparse(); verify_index(as, c.shapes[ai]); ep.force_eat(",");
|
||||
int bs = ep.iparse(); verify_index(bs, c.shapes[ai]); ep.force_eat(")");
|
||||
c.shapes[ai].sublines.emplace_back(as, bs);
|
||||
}
|
||||
else if(ep.eat("sublines(")) {
|
||||
int d = ep.rparse(); ep.force_eat(")");
|
||||
for(auto& sh: c.shapes) {
|
||||
for(int i=0; i<isize(sh.vertices); i++)
|
||||
for(int j=0; j<isize(sh.vertices); j++)
|
||||
if(j != i+1 && i != j+1 && !(i==0 && j == isize(sh.vertices)-1) && !(j==0 && i == isize(sh.vertices)-1))
|
||||
if(abs(hdist(sh.vertices[i], sh.vertices[j]) - distunit * d) < 1e-6) {
|
||||
sh.sublines.emplace_back(i, j);
|
||||
println(hlog, "add subline ", i, "-", j);
|
||||
}
|
||||
}
|
||||
}
|
||||
else throw hr_parse_exception("expecting command");
|
||||
}
|
||||
}
|
||||
|
10
pattern2.cpp
10
pattern2.cpp
@ -2686,6 +2686,14 @@ EX namespace linepatterns {
|
||||
}
|
||||
)
|
||||
);
|
||||
linepattern patSublines("sub-lines", 0xFFFFFF00, arb::in,
|
||||
ALLCELLS(
|
||||
int i = arb::id_of(c->master);
|
||||
auto& sh = arb::current.shapes[i];
|
||||
for(auto p: sh.sublines)
|
||||
gridlinef(V, sh.vertices[p.first], sh.vertices[p.second], col, 2 + vid.linequality);
|
||||
)
|
||||
);
|
||||
|
||||
#if HDR
|
||||
extern linepattern patTriTree, patTriRings, patTriOther;
|
||||
@ -2698,7 +2706,7 @@ EX namespace linepatterns {
|
||||
&patVine, &patPalacelike, &patPalace, &patPower, &patHorocycles,
|
||||
&patTriRings, &patTriTree, &patTriOther,
|
||||
&patGoldbergTree, &patIrregularMaster, &patGoldbergSep, &patHeawood, &patArcm,
|
||||
&patCircles, &patRadii, &patMeridians, &patParallels
|
||||
&patCircles, &patRadii, &patMeridians, &patParallels, &patSublines
|
||||
};
|
||||
|
||||
EX void clearAll() {
|
||||
|
Loading…
Reference in New Issue
Block a user