use of org.twak.tweed.gen.FeatureCache.MegaFeatures in project chordatlas by twak.
the class SkelFootprint method fractureOnFeatures.
private void fractureOnFeatures(MultiMap<MegaFeatures, MFPoint> minis, List<Line> footprint, HalfMesh2 mesh) {
for (MegaFeatures mf : minis.keySet()) pt: for (MFPoint pt : minis.get(mf)) {
if (!Mathz.inRange(mf.megafacade.findPPram(pt), 0, 1))
continue;
Vector2d dir = pt.mega.megafacade.dir();
dir.set(dir.y, -dir.x);
Point2d probe = new Point2d(dir);
probe.scale(2 / dir.length());
probe.add(pt);
for (// don't fracture near minifacade boundaries...we can't distinguish nice block bondaries
Point2d avoid : // don't fracture near minifacade boundaries...we can't distinguish nice block bondaries
pt.mega.megafacade.points()) if (avoid.distanceSquared(pt) < 4)
continue pt;
double bestDist = Double.MAX_VALUE;
for (HalfFace f : mesh.faces) for (HalfEdge e : f) if (e.line().dir().angle(dir) < 0.4) {
double dist = e.line().distance(probe);
if (dist < bestDist)
bestDist = dist;
}
if (bestDist > 0.3) {
Vector2d end = new Vector2d(dir);
end.scale(3 / end.length());
end.add(probe);
Vector2d start = new Vector2d(dir);
start.scale(0.5 / start.length());
start.add(pt);
Line extra = new Line(new Point2d(start), new Point2d(end));
SkelFootprint.insert(mesh, extra, 2, false, false);
}
}
}
Aggregations