use of org.twak.viewTrace.facades.MiniFacade in project chordatlas by twak.
the class SkelGen method ensureMF.
private static void ensureMF(SuperFace sf, SuperEdge se) {
se.toEdit = new MiniFacade();
se.toEdit.left = 0;
se.toEdit.width = se.length();
if (se.mini != null && !se.mini.isEmpty())
se.toEdit.height = se.mini.get(0).height;
else
se.toEdit.height = sf.height;
}
use of org.twak.viewTrace.facades.MiniFacade in project chordatlas by twak.
the class SkelGen method tagWalls.
public static Profile tagWalls(Profile profile, float[] roofColor, SuperEdge se, Point2d s, Point2d e) {
MiniFacade mini;
if (se.toEdit == null) {
if (se.mini == null || (se.mini.isEmpty() && se.proceduralFacade == null))
mini = null;
else {
double[] range = findRange(se, s, e, se.proceduralFacade == null ? null : se.proceduralFacade.megafacade);
if (range == null)
mini = null;
else
mini = new Regularizer().go(se.mini, range[0], range[1], se.proceduralFacade);
}
} else
// second time through, use the edited results
mini = se.toEdit;
Tag wall = new WallTag(se.profLine, se.occlusions, mini), roof = new RoofTag(roofColor);
boolean first = true;
for (Loop<Bar> lb : profile.points) {
for (Loopable<Bar> ll : lb.loopableIterator()) {
Bar b = ll.get();
if (// || ll != lb.start && isRoof ( ll.getPrev().get() ) && b.start.distanceSquared( b.end ) < 16 )
isRoof(b))
b.tags.add(roof);
else {
if (first)
b.tags.add(new WallTag(se.profLine, se.occlusions, mini, true));
else
b.tags.add(wall);
}
}
first = false;
}
return profile;
}
use of org.twak.viewTrace.facades.MiniFacade in project chordatlas by twak.
the class FeatureCache method createMinis.
public MultiMap<MegaFeatures, MFPoint> createMinis(BlockGen blockGen) {
MultiMap<MegaFeatures, MFPoint> out = new MultiMap();
for (MegaFeatures m : getBlock(blockGen.center).getFeatures()) {
double mLen = m.megafacade.length();
for (ImageFeatures i : m.features) {
for (int mi = 0; mi <= i.miniFacades.size(); mi++) {
MiniFacade n = mi < i.miniFacades.size() ? i.miniFacades.get(mi) : null, p = (mi - 1) >= 0 ? i.miniFacades.get(mi - 1) : null;
if (// skinny mf filter
n != null && (n.width < MFWidthTol || (n.rects.countValue() == 0 && n.width < MFWidthTol * 3)))
n = null;
if (p != null && (p.width < MFWidthTol || (p.rects.countValue() == 0 && p.width < MFWidthTol * 3)))
p = null;
if (n == null && p == null || n == null && p.softRight || p == null && n.softLeft || p != null && n != null && p.softRight && n.softLeft)
continue;
double ptDist = n == null ? (p.left + p.width) : n.left;
Point2d pt = m.megafacade.fromPPram(ptDist / mLen);
double covTol = 2;
Set<ImageFeatures> covering = m.features.stream().filter(ii -> ii.start + covTol < ptDist && ii.end > ptDist + covTol).collect(Collectors.toSet());
// stuff beyond the end of the facade
double pa = m.megafacade.findPPram(pt) * mLen;
if (pa < -5 || pa > mLen + 5)
continue;
out.put(m, new MFPoint(pt, covering, m, i, p, n));
}
}
}
return out;
}
Aggregations