private void renderCircleHexagonal(Canvas canvas, int cols, int rows, int centerDistance , int circleDiameter ) { double spaceX = centerDistance/2.0; double spaceY = centerDistance*Math.sin(UtilAngle.radian(60)); for (int row = 0; row < rows; row++) { int y = (int)((rows-row-1)*spaceY); for (int col = row%2; col < cols; col += 2) { int x = (int)(col*spaceX); canvas.drawOval(new RectF(x,y,x+circleDiameter,y+circleDiameter),paintBlack); } } }
@Override public void updateCylinder(int width, int height, double vfov) { synchronized (distorter) { distorter.configure(width,height,(float)UtilAngle.radian(vfov)); distortImage.setModel(distorter); // let it know the transform has changed if( distorted.width != width || distorted.height != height ) { rendered = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR); distorted.reshape(width, height); } if (inputMethod == InputMethod.IMAGE) { renderOutput(inputCopy); } } }
double spaceY = ratio*Math.sin(UtilAngle.radian(60)); double radius = 1.0/2.0;
double vfov = UtilAngle.radian(120); distorter.configure(imgWidth, imgHeight, (float)vfov);
UtilAngle.radian(60)); } finally { open.mLock.unlock();
double vfov = UtilAngle.radian(120); cylinderToEqui.configure(width, height, (float)vfov); this.distorter.setModel(cylinderToEqui);
/** * If there is a nearly perfect line a node farther down the line can come before. This just selects the closest */ void pruneNearlyIdenticalAngles() { for (int i = 0; i < listInfo.size(); i++) { NodeInfo infoN = listInfo.get(i); for (int j = 0; j < infoN.edges.size(); ) { int k = (j+1)%infoN.edges.size; double angularDiff = UtilAngle.dist(infoN.edges.get(j).angle,infoN.edges.get(k).angle); if( angularDiff < UtilAngle.radian(5)) { NodeInfo infoJ = infoN.edges.get(j).target; NodeInfo infoK = infoN.edges.get(k).target; double distJ = infoN.ellipse.center.distance(infoJ.ellipse.center); double distK = infoN.ellipse.center.distance(infoK.ellipse.center); if( distJ < distK ) { infoN.edges.remove(k); } else { infoN.edges.remove(j); } } else { j++; } } } }