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));
}
Aggregations