Search in sources :

Example 1 with InAxDouble

use of org.twak.utils.streams.InAxDouble in project chordatlas by twak.

the class Regularizer method augmentWithTween.

private List<MiniFacade> augmentWithTween(List<MiniFacade> in, MegaFeatures megaFeatures) {
    List<MiniFacade> out = new ArrayList<>(in);
    if (megaFeatures == null)
        return out;
    if (in.isEmpty()) {
        for (ImageFeatures iff : megaFeatures.features) for (MiniFacade mf : iff.miniFacades) if (lt - 3 < mf.left && mf.right() < rt + 3)
            out.add(mf);
        return out;
    }
    MegaFeatures mf = in.get(0).imageFeatures.mega;
    double[] range = in.stream().flatMap(m -> Streamz.stream(m.left, m.left + m.width)).collect(new InAxDouble());
    for (ImageFeatures imf : mf.features) for (MiniFacade mf2 : imf.miniFacades) if (mf2.left > range[0] && mf2.left + mf2.width < range[1] && !out.contains(mf2))
        out.add(mf2);
    return out;
}
Also used : DumbCluster1D(org.twak.utils.DumbCluster1D) Cache2(org.twak.utils.Cache2) OptionalDouble(java.util.OptionalDouble) HashMap(java.util.HashMap) CountThings(org.twak.utils.collections.CountThings) Pair(org.twak.utils.Pair) TreeSet(java.util.TreeSet) MapMapList(org.twak.utils.collections.MapMapList) ArrayList(java.util.ArrayList) Arrayz(org.twak.utils.collections.Arrayz) HashSet(java.util.HashSet) Map(java.util.Map) Mathz(org.twak.utils.Mathz) Streamz(org.twak.utils.collections.Streamz) LinkedHashSet(java.util.LinkedHashSet) InAxDouble(org.twak.utils.streams.InAxDouble) Iterator(java.util.Iterator) ImageFeatures(org.twak.tweed.gen.FeatureCache.ImageFeatures) MultiMap(org.twak.utils.collections.MultiMap) Set(java.util.Set) Vector2d(javax.vecmath.Vector2d) MegaFeatures(org.twak.tweed.gen.FeatureCache.MegaFeatures) Collectors(java.util.stream.Collectors) File(java.io.File) Cluster(org.twak.utils.DumbCluster1D.Cluster) Point2d(javax.vecmath.Point2d) List(java.util.List) DumbCluster1DImpl(org.twak.utils.DumbCluster1DImpl) Bounds(org.twak.utils.geom.DRectangle.Bounds) DRectangle(org.twak.utils.geom.DRectangle) Comparator(java.util.Comparator) Collections(java.util.Collections) Feature(org.twak.viewTrace.facades.MiniFacade.Feature) InAxDouble(org.twak.utils.streams.InAxDouble) ImageFeatures(org.twak.tweed.gen.FeatureCache.ImageFeatures) MegaFeatures(org.twak.tweed.gen.FeatureCache.MegaFeatures) ArrayList(java.util.ArrayList)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 Map (java.util.Map)1 OptionalDouble (java.util.OptionalDouble)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 Collectors (java.util.stream.Collectors)1 Point2d (javax.vecmath.Point2d)1 Vector2d (javax.vecmath.Vector2d)1 ImageFeatures (org.twak.tweed.gen.FeatureCache.ImageFeatures)1 MegaFeatures (org.twak.tweed.gen.FeatureCache.MegaFeatures)1 Cache2 (org.twak.utils.Cache2)1 DumbCluster1D (org.twak.utils.DumbCluster1D)1