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


Java Point2D.Float方法代码示例

本文整理汇总了Java中java.awt.geom.Point2D.Float方法的典型用法代码示例。如果您正苦于以下问题:Java Point2D.Float方法的具体用法?Java Point2D.Float怎么用?Java Point2D.Float使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.Point2D的用法示例。


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

示例1: updateIcons

import java.awt.geom.Point2D; //导入方法依赖的package包/类
public static void updateIcons(JTree tree) {
    Font defaultFont = UIManager.getFont("Tree.font");
    Font currentFont = tree.getFont();

    double newScale = (double)
            currentFont.getSize2D() / defaultFont.getSize2D();

    DefaultTreeCellRenderer renderer =
            (DefaultTreeCellRenderer) tree.getCellRenderer();
    renderer.setOpenIcon(
            scale(UIManager.getIcon("Tree.openIcon"), newScale, tree));
    renderer.setClosedIcon(
            scale(UIManager.getIcon("Tree.closedIcon"), newScale, tree));
    renderer.setLeafIcon(
            scale(UIManager.getIcon("Tree.leafIcon"), newScale, tree));

    Collection<Integer> iconSizes = Arrays.asList(
            renderer.getOpenIcon().getIconHeight(),
            renderer.getClosedIcon().getIconHeight(),
            renderer.getLeafIcon().getIconHeight());

    // Convert points to pixels
    Point2D p = new Point2D.Float(0, currentFont.getSize2D());
    FontRenderContext context =
            tree.getFontMetrics(currentFont).getFontRenderContext();
    context.getTransform().transform(p, p);
    int fontSizeInPixels = (int) Math.ceil(p.getY());

    tree.setRowHeight(
            Math.max(fontSizeInPixels, Collections.max(iconSizes) + 2));
}
 
开发者ID:phweda,项目名称:MFM,代码行数:32,代码来源:SwingUtils.java

示例2: drawFrame

import java.awt.geom.Point2D; //导入方法依赖的package包/类
private void drawFrame(GraphicsDecorator g, Shape shape, Color color, Point2D.Float pos) {
    Shape old_clip = g.getClip();
    AffineTransform old = g.getTransform();
    AffineTransform t = g.getTransform();
    t.concatenate(AffineTransform.getTranslateInstance(pos.x, pos.y));
    g.setTransform(t);
    g.setColor(color);
    Stroke old_stroke = g.getStroke();
    g.setStroke(new BasicStroke(10.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND));
    Area a = new Area(g.getClip());
    a.subtract(new Area(shape));
    g.setClip(a);
    g.draw(shape);
    g.setTransform(old);
    g.setStroke(old_stroke);
    g.setClip(old_clip);
}
 
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:18,代码来源:ViwnVertexRenderer.java

示例3: pivotPoint

import java.awt.geom.Point2D; //导入方法依赖的package包/类
/**
 * Pivot the given point around the pivot point from oldAngle to newAngle
 * @param oldAngle
 * @param newAngle
 */
private void pivotPoint(Point p, double oldAngle, double newAngle) {
  Point2D pivot2D = new Point2D.Double(pivotX, pivotY);
  AffineTransform t = AffineTransform.getRotateInstance(oldAngle);
  t.transform(pivot2D, pivot2D);
  t = AffineTransform.getRotateInstance(newAngle - oldAngle, pivot2D.getX(), pivot2D.getY());
  Point2D newPos2D = new Point2D.Float(0, 0);
  t.transform(newPos2D, newPos2D);
  p.x += (int) Math.round(newPos2D.getX());
  p.y += (int) Math.round(newPos2D.getY());
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:16,代码来源:Pivot.java

示例4: getBallVelocity

import java.awt.geom.Point2D; //导入方法依赖的package包/类
public Point2D.Float getBallVelocity() {
	Point2D.Float position = new Point2D.Float();
	if ( currentBestFilter != null ) {
		final double[] mu = currentBestFilter.getMu();
		position.setLocation(mu[2], mu[3]);
	}
	return position;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:9,代码来源:KalmanEventFilter.java

示例5: Organism

import java.awt.geom.Point2D; //导入方法依赖的package包/类
Organism(Micro_Sim processing, Point2D.Float startingPosition) {
    super(processing);
    position = startingPosition;
    moveTo = position;
    rotation = 20;
    mRates = new MutationRates();
}
 
开发者ID:Majiick,项目名称:MicroSim,代码行数:8,代码来源:Organism.java

示例6: Start

import java.awt.geom.Point2D; //导入方法依赖的package包/类
public void Start() {
    if (Helper.PercentageChance(80)) {
        triggers.add(new EyeTrigger(this, processing));
    } else {
        triggers.add(new ChronoTrigger(this, processing));
    }

    size = new Point2D.Float(5, 5);
    tag = "Driver";

    if (distance == 0) {
        distance = ThreadLocalRandom.current().nextInt(10, 120);
    }
}
 
开发者ID:Majiick,项目名称:MicroSim,代码行数:15,代码来源:Driver.java

示例7: generateCalibrationString

import java.awt.geom.Point2D; //导入方法依赖的package包/类
private void generateCalibrationString() {
	if ((cameraMatrix == null) || cameraMatrix.isNull() || cameraMatrix.empty()) {
		calibrationString = SINGLE_CAMERA_CALIBRATION_UNCALIBRATED;
		calibrated = false;
		return;
	}

	DoubleBufferIndexer cameraMatrixIndexer = cameraMatrix.createIndexer();

	// Average focal lengths for X and Y axis (fx, fy).
	focalLengthPixels = (float) (cameraMatrixIndexer.get(0, 0) + cameraMatrixIndexer.get(1, 1)) / 2;

	// Go from pixels to millimeters, by multiplying by pixel size (in mm).
	focalLengthMm = chip.getPixelWidthUm() * 1e-3f * focalLengthPixels;

	principlePoint = new Point2D.Float((float) cameraMatrixIndexer.get(0, 2), (float) cameraMatrixIndexer.get(1, 2));
	StringBuilder sb = new StringBuilder();
	if (imageCounter > 0) {
		sb.append(String.format("Using %d images", imageCounter));
		if (!saved) {
			sb.append("; not yet saved\n");
		} else {
			sb.append("; saved\n");
		}
	} else {
		sb.append(String.format("Path:%s\n", shortenDirPath(dirPath)));
	}
	sb.append(String.format("focal length avg=%.1f pixels=%.2f mm\nPrincipal point (green cross)=%.1f,%.1f, Chip size/2=%.0f,%.0f\n",
		focalLengthPixels, focalLengthMm,
		principlePoint.x, principlePoint.y,
		(float) chip.getSizeX() / 2, (float) chip.getSizeY() / 2));
	calibrationString = sb.toString();
	calibrated = true;
	textRendererScaleSet = false;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:36,代码来源:StereoCalibrationDualViewFilter.java

示例8: getBorderPoint

import java.awt.geom.Point2D; //导入方法依赖的package包/类
public static Point2D getBorderPoint(Vertex v, double angrad, double scale) {
	double x, y;
	Point2D b = null;

	if (v.getShape().equalsIgnoreCase(Constants.SHAPE_DISK)) {
		x = v.getPosition().getX() - v.getSize() * Math.cos(angrad) / scale;
		y = v.getPosition().getY() - v.getSize() * Math.sin(angrad) / scale;

		b = new Point2D.Float();
		b.setLocation(x, y);

	} else if (v.getShape().equalsIgnoreCase(Constants.SHAPE_SQUARE)) {
		double size = v.getSize();
		double r = size;
		double pi = Math.PI;

		if (rangeContains(angrad, 0, 0.25 * pi)
				|| rangeContains(angrad, 1.75 * pi, 2 * pi)) {
			r = size / Math.cos(angrad);
		} else if (rangeContains(angrad, 0.25 * pi, 0.75 * pi)) {
			r = size / Math.sin(angrad);
		} else if (rangeContains(angrad, 0.75 * pi, 1.25 * pi)) {
			r = -size / Math.cos(angrad);
		} else {
			r = -size / Math.sin(angrad);
		}

		r /= scale;

		x = v.getPosition().getX() - r * Math.cos(angrad);
		y = v.getPosition().getY() - r * Math.sin(angrad);

		b = new Point2D.Float();
		b.setLocation(x, y);
	}

	return b;
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:39,代码来源:Utilities.java

示例9: getBirthLocation

import java.awt.geom.Point2D; //导入方法依赖的package包/类
/** Returns birth location of cluster: initially the first event and later, after cluster
 * becomes visible, it is the location when it becomes visible, which is presumably less noisy.
 * @return x,y location. */
public Point2D.Float getBirthLocation() {
    return birthLocation;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:7,代码来源:BasicCluster.java

示例10: adjustPoint

import java.awt.geom.Point2D; //导入方法依赖的package包/类
protected void adjustPoint(Point2D.Float pt) {
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:3,代码来源:PhysicalStrike.java

示例11: getCharMetrics

import java.awt.geom.Point2D; //导入方法依赖的package包/类
Point2D.Float getCharMetrics(char ch) {
    return delegateStrike.getCharMetrics(ch);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:DelegateStrike.java

示例12: getGlyphImageBounds

import java.awt.geom.Point2D; //导入方法依赖的package包/类
void getGlyphImageBounds(int glyphcode, Point2D.Float pt,
                         Rectangle result) {
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:4,代码来源:NativeStrike.java

示例13: coordinate

import java.awt.geom.Point2D; //导入方法依赖的package包/类
public static Point2D coordinate(float x, float y) {
	return new Point2D.Float(x, y);
}
 
开发者ID:mobitopp,项目名称:connection-scan,代码行数:4,代码来源:Data.java

示例14: getSmoothPoints

import java.awt.geom.Point2D; //导入方法依赖的package包/类
/**
 * Returns the list of smooth points with given step size
 */
public LinkedList<Point2D.Float> getSmoothPoints(float stepSize) {
    return smoothTrack.allPoints(stepSize);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:7,代码来源:SlotcarTrack.java

示例15: getGlyphMetrics

import java.awt.geom.Point2D; //导入方法依赖的package包/类
Point2D.Float getGlyphMetrics(int glyphCode) {
    return null;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:4,代码来源:NativeStrike.java


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