当前位置: 首页>>代码示例>>Java>>正文


Java Circle类代码示例

本文整理汇总了Java中org.openimaj.math.geometry.shape.Circle的典型用法代码示例。如果您正苦于以下问题:Java Circle类的具体用法?Java Circle怎么用?Java Circle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Circle类属于org.openimaj.math.geometry.shape包,在下文中一共展示了Circle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawToImage

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
@Override
public void drawToImage(MBFImage image) {
	final List<Touch> toDraw = this.getDrawingPoints();
	// if(this.touchScreen.cameraConfig instanceof
	// TriangleCameraConfig){
	// ((TriangleCameraConfig)this.touchScreen.cameraConfig).drawTriangles(image);
	//
	// }
	for (final Touch touch : toDraw) {
		// Point2d trans =
		// point2d.transform(this.touchScreen.cameraConfig.homography);

		final Circle trans = this.touchScreen.cameraConfig.transformTouch(touch);
		if (trans != null)
			image.drawShapeFilled(trans, RGBColour.BLUE);
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:18,代码来源:TouchTableScreen.java

示例2: matchPoint

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
private Touch matchPoint(Circle query) {
	double minDist = Double.MAX_VALUE;
	Touch best = null;
	
	for (Touch pt : lastPoints) {
		double dist = Line2d.distance(query.calculateCentroid(), pt.calculateCentroid());
		
		if (dist < minDist) {
			minDist = dist;
			best = pt;
		}
	}
	
	if (minDist > threshold) 
		return null;
	if(System.currentTimeMillis() - best.createdTime > TIME_TO_DIE){
		best=null;
	}
	return best;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:21,代码来源:ReallyBasicTouchTracker.java

示例3: drawPoints

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
private static void drawPoints(Stream<IndependentPair<double[], PerceptronClass>> dataStream, Line2d line) {
	final MBFImage img = new MBFImage(300, 300, ColourSpace.RGB);

	img.drawLine(line, 3, RGBColour.BLUE);

	for (final IndependentPair<double[], PerceptronClass> pointClass : dataStream) {

		final double[] pc = pointClass.firstObject();
		final Point2dImpl point = new Point2dImpl((float) pc[0], (float) pc[1]);
		final PerceptronClass cls = pointClass.getSecondObject();
		switch (cls) {
		case TRUE:
			img.drawShapeFilled(new Circle(point, 5), RGBColour.GREEN);
			break;
		case FALSE:
			img.drawShape(new Circle(point, 5), 3, RGBColour.RED);
			break;
		case NONE:
			throw new RuntimeException("NOPE");
		}
	}
	DisplayUtilities.displayName(img, "random");
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:24,代码来源:DrawLinearData.java

示例4: redrawCircles

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
private void redrawCircles(MBFImage output) {
	long now = System.currentTimeMillis();
	output.fill(RGBColour.WHITE);
	MBFImageRenderer rend = output.createRenderer(RenderHints.ANTI_ALIASED);
	for (String hash: this.hashCircles.keySet()) {
		Circle circle = this.hashCircles.get(hash);
		Float[] col = this.hashColours.get(hash);
		float level = 2;
		long lastSeen = this.hashAggregations.get(hash).lastSeen;
		if(lastSeen!=0){				
			long diff = Math.abs(lastSeen - now);
			if(diff < BLIP_TIME){
				level -= (1 - ( diff / (float)BLIP_TIME));
			}
		}
		Float[] offCircleColour = dark(col,level);
		
		drawHashCircle(rend , hash, circle, offCircleColour);
	}
	for (IndependentPair<Point2dImpl, MBFImage> pTextLayer : this.textLayers) {
		
		MBFImage textLayer = pTextLayer.getSecondObject();
		Point2d p = pTextLayer.firstObject();
		output.drawImage(textLayer , (int)p.getX(), (int)p.getY());
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:27,代码来源:PrettyTagRenderer.java

示例5: render

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
protected FImage render(List<IndependentPair<String, Point2d>> pts, int sz) {
	FImage image = new FImage(sz, sz);
	FImageRenderer renderer = image.createRenderer(RenderHints.ANTI_ALIASED);


	for (IndependentPair<String, Point2d> pair : pts) {
		double x = pair.secondObject().getX();
		double y = pair.secondObject().getY();

		int ix = (int) Math.round((x + 0.5) * sz/2);
		int iy = (int) Math.round((y + 0.5) * sz/2);

		renderer.drawShapeFilled(new Circle(ix, iy, 2), 1f);
		renderer.drawText(pair.firstObject(), ix+5, iy, HersheyFont.TIMES_MEDIUM, 20, 1f);
	}
	
	return image;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:19,代码来源:MDS.java

示例6: testCircle

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
/**
 * Test
 */
@Test
public void testCircle() {
	final int imgWidthHeight = 200;

	final FImage circleImage = new FImage(imgWidthHeight, imgWidthHeight);
	final Circle c = new Circle(imgWidthHeight / 2 + 3, imgWidthHeight / 2 + 1, imgWidthHeight / 4);
	circleImage.drawShapeFilled(c, 1f);

	final CannyEdgeDetector det = new CannyEdgeDetector();
	final FImage edgeImage = circleImage.process(det);

	final HoughCircles circ = new HoughCircles(5, imgWidthHeight, 5, 360);
	edgeImage.analyseWith(circ);

	final List<WeightedCircle> best = circ.getBest(1);
	final WeightedCircle b = best.get(0);

	assertTrue(b.equals(c));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:23,代码来源:HoughCirclesTest.java

示例7: drawCentroids

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
private void drawCentroids() {
	for (int i = 0; i < centroids.length; i++) {
		final Circle c = new Circle(centroids[i], 15);
		renderer.drawShapeFilled(c, colours[i]);
		renderer.drawShape(c, 3, RGBColour.BLACK);
	}
}
 
开发者ID:jonhare,项目名称:COMP6208,代码行数:8,代码来源:KMeansDemo.java

示例8: drawPoint

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
private void drawPoint(final Point2dImpl pti, String text) {
	renderer.drawShapeFilled(new Circle(pti, 20), RGBColour.MAGENTA);
	final GeneralFontStyle<Float[]> style = new GeneralFontStyle<Float[]>(new GeneralFont("Arial", Font.BOLD),
			renderer, false);
	style.setHorizontalAlignment(HorizontalAlignment.HORIZONTAL_CENTER);
	renderer.drawText(text, (int) (pti.x), (int) (pti.y + 10), style);
}
 
开发者ID:jonhare,项目名称:COMP6237,代码行数:8,代码来源:SOMDemo.java

示例9: drawPoint

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
private void drawPoint(final Point2dImpl pti, int index) {
	renderer.drawShapeFilled(new Circle(pti, 20), RGBColour.MAGENTA);
	final char c = (char) (65 + index);
	final GeneralFontStyle<Float[]> style = new GeneralFontStyle<Float[]>(new GeneralFont("Arial", Font.BOLD),
			renderer, false);
	style.setHorizontalAlignment(HorizontalAlignment.HORIZONTAL_CENTER);
	renderer.drawText(c + "", (int) (pti.x), (int) (pti.y + 10), style);
}
 
开发者ID:jonhare,项目名称:COMP6237,代码行数:9,代码来源:HClusterDemo.java

示例10: mouseClicked

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
@Override
	public synchronized void mouseClicked(MouseEvent e) {
		if(this.points == null) return;
		double dist = Double.MAX_VALUE;
		Circle foundShape = null;
		InterestPointKeypoint<InterestPointData> foundPoint = null;
		Point2dImpl clickPoint = new Point2dImpl(e.getPoint().x,e.getPoint().y);
		for(InterestPointKeypoint<InterestPointData> point : points){
			Circle ellipse = new Circle(point.location.x, point.location.y, point.scale);
			if(ellipse.isInside(clickPoint)){
//				double pdist = Math.sqrt(clickPoint.x * clickPoint.x + clickPoint.y * clickPoint.y);
				double pdist = point.scale;
				if(pdist < dist){
					foundShape = ellipse;
					foundPoint = point;
					dist = pdist;
				}
			}
		}
		if(foundShape!=null){
//			PolygonExtractionProcessor<S, T> ext = new PolygonExtractionProcessor<S,T>(foundShape, image.newInstance(1, 1).getPixel(0,0));
			FGaussianConvolve blur = new FGaussianConvolve (foundPoint.scale);
			InterestPointImageExtractorProperties<S, T> extract = new InterestPointImageExtractorProperties<S,T>(image.process(blur),foundPoint.location);
			if(frame== null){
				frame = DisplayUtilities.display(extract.image.process(r));
			}
			else{
				frame.dispose();
				frame = DisplayUtilities.display(extract.image.process(r));
			}
		}
	}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:33,代码来源:FeatureClickListener.java

示例11: Touch

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
public Touch(Circle c, long touchID, Point2dImpl motionVector) {
	super(c);
	this.createdTime = System.currentTimeMillis();
	
	this.touchID = touchID;
	this.motionVector = motionVector;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:8,代码来源:Touch.java

示例12: initGame

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
private void initGame() {
	this.lastFrame.fill(RGBColour.BLACK);
	this.frame.fill(RGBColour.BLACK);
	final Random r = new Random();
	this.paddleLeftPoint = new Point2dImpl(0, 0.5f * this.frame_height);
	this.paddleLeft = new Circle(this.paddleLeftPoint, Pong.PADDLE_RADIUS * this.frame_height);
	this.paddleRightPoint = new Point2dImpl(this.frame_width, 0.5f * this.frame_height);
	this.paddleRight = new Circle(this.paddleRightPoint, Pong.PADDLE_RADIUS * this.frame_height);

	this.ballCentre = new Point2dImpl(0.5f * this.frame_width, 0.5f * this.frame_height);
	this.ball = new Circle(this.ballCentre, Pong.BALL_SIZE * this.frame_width);

	this.ballVelocity = new Point2dImpl();

	// float vx = (float) (Math.random() - 0.5);
	// float vy = (float) (Math.random() - 0.5);
	//
	// if (0.5 * vy > vx) {
	// float tmp = vx;
	// vx = vy;
	// vy = tmp;
	// }
	//
	// float mult = (float) (INITIAL_VELOCITY / Math.sqrt(vx*vx + vy*vy));
	// vx*=mult;
	// vy*=mult;
	float vx = r.nextBoolean() ? 1f : -1f;
	float vy = r.nextFloat() * 2 + -1f;
	final float mult = (float) (Pong.INITIAL_VELOCITY / Math.sqrt(vx * vx + vy * vy));
	vx *= mult;
	vy *= mult;
	this.ballVelocity = new Point2dImpl(vx, vy);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:34,代码来源:Pong.java

示例13: normContactDelta

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
private Point2dImpl normContactDelta(final Circle paddle, final Circle ball) {
	final float px = paddle.getX();
	final float py = paddle.getY();
	final float dx = ball.getX() - px;
	final float dy = ball.getY() - py;
	final float plusX = dx * (paddle.getRadius() / (ball.getRadius() + paddle.getRadius()));
	final float plusY = dy * (paddle.getRadius() / (ball.getRadius() + paddle.getRadius()));

	final float prop = (float) (1f / Math.sqrt(plusX * plusX + plusY * plusY));
	return new Point2dImpl(plusX * prop, plusY * prop);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:12,代码来源:Pong.java

示例14: drawWhiteboard

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
private synchronized void drawWhiteboard(MBFImage drawingPanel) {
	// drawingPanel.fill(RGBColour.WHITE);
	if (mode == MODE.MODEL || this.calibrationPointIndex < this.calibrationPoints.size()) {
		drawingPanel.fill(RGBColour.WHITE);
		final Point2d waitingForPoint = this.calibrationPoints.get(calibrationPointIndex).secondObject();
		drawingPanel.createRenderer().drawShape(new Circle(waitingForPoint.getX(), waitingForPoint.getY(), 10),
				RGBColour.RED);
	}

}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:11,代码来源:DigitalWhiteboard.java

示例15: redrawEllipses

import org.openimaj.math.geometry.shape.Circle; //导入依赖的package包/类
private void redrawEllipses() {
	Matrix US = svd.U.times(MatrixUtils.sqrt(svd.Sdiag));
	Ellipse e = EllipseUtilities.ellipseFromCovariance((float)mean.get(0, 0), (float)mean.get(1, 0), US.times(US.transpose()), 6f);
	if(prevEllipse!=null)
		image.drawShape(prevEllipse, RGBColour.BLUE);
	image.drawShape(e, RGBColour.RED);
	image.drawShape(new Circle((float)mean.get(0, 0),(float)mean.get(1, 0),10), RGBColour.GREEN);
	this.prevEllipse = e;
	DisplayUtilities.display(image,disp);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:11,代码来源:OnePassSVDEllipse.java


注:本文中的org.openimaj.math.geometry.shape.Circle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。