Search in sources :

Example 1 with Regularizer

use of org.twak.viewTrace.facades.Regularizer 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;
}
Also used : MiniFacade(org.twak.viewTrace.facades.MiniFacade) RoofTag(org.twak.viewTrace.facades.RoofTag) Bar(org.twak.camp.ui.Bar) Regularizer(org.twak.viewTrace.facades.Regularizer) WallTag(org.twak.viewTrace.facades.WallTag) Tag(org.twak.camp.Tag) WallTag(org.twak.viewTrace.facades.WallTag) RoofTag(org.twak.viewTrace.facades.RoofTag)

Aggregations

Tag (org.twak.camp.Tag)1 Bar (org.twak.camp.ui.Bar)1 MiniFacade (org.twak.viewTrace.facades.MiniFacade)1 Regularizer (org.twak.viewTrace.facades.Regularizer)1 RoofTag (org.twak.viewTrace.facades.RoofTag)1 WallTag (org.twak.viewTrace.facades.WallTag)1