Search in sources :

Example 6 with Polygon2D_I32

use of georegression.struct.shapes.Polygon2D_I32 in project narchy by automenta.

the class ShapeSensor method inputQuadBlob.

private void inputQuadBlob(int k, List<PointIndex_I32> polygon, float w, float h) {
    Polygon2D_I32 p = new Polygon2D_I32(polygon.size());
    for (PointIndex_I32 v : polygon) p.vertexes.add(v);
    Rectangle2D_I32 quad = new Rectangle2D_I32();
    UtilPolygons2D_I32.bounding(p, quad);
    float cx = ((quad.x0 + quad.x1) / 2f) / w;
    float cy = ((quad.y0 + quad.y1) / 2f) / h;
    float cw = quad.getWidth() / w;
    float ch = quad.getHeight() / h;
    Term pid = $.p(id, $.the(k));
    float conf = nar.confDefault(BELIEF);
    long now = nar.time();
    believe(now, $.inh(pid, $.the("x")), $.t(cx, conf));
    believe(now, $.inh(pid, $.the("y")), $.t(cy, conf));
    believe(now, $.inh(pid, $.the("w")), $.t(cw, conf));
    believe(now, $.inh(pid, $.the("h")), $.t(ch, conf));
}
Also used : Polygon2D_I32(georegression.struct.shapes.Polygon2D_I32) PointIndex_I32(boofcv.struct.PointIndex_I32) Rectangle2D_I32(georegression.struct.shapes.Rectangle2D_I32) Term(nars.term.Term)

Aggregations

Polygon2D_I32 (georegression.struct.shapes.Polygon2D_I32)6 Point2D_F64 (georegression.struct.point.Point2D_F64)3 FDistort (boofcv.abst.distort.FDistort)1 PointIndex_I32 (boofcv.struct.PointIndex_I32)1 Quadrilateral_F64 (georegression.struct.shapes.Quadrilateral_F64)1 Rectangle2D_I32 (georegression.struct.shapes.Rectangle2D_I32)1 Random (java.util.Random)1 Term (nars.term.Term)1