當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。