本文整理汇总了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));
}
示例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);
}
示例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());
}
示例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;
}
示例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();
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例10: adjustPoint
import java.awt.geom.Point2D; //导入方法依赖的package包/类
protected void adjustPoint(Point2D.Float pt) {
}
示例11: getCharMetrics
import java.awt.geom.Point2D; //导入方法依赖的package包/类
Point2D.Float getCharMetrics(char ch) {
return delegateStrike.getCharMetrics(ch);
}
示例12: getGlyphImageBounds
import java.awt.geom.Point2D; //导入方法依赖的package包/类
void getGlyphImageBounds(int glyphcode, Point2D.Float pt,
Rectangle result) {
}
示例13: coordinate
import java.awt.geom.Point2D; //导入方法依赖的package包/类
public static Point2D coordinate(float x, float y) {
return new Point2D.Float(x, y);
}
示例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);
}
示例15: getGlyphMetrics
import java.awt.geom.Point2D; //导入方法依赖的package包/类
Point2D.Float getGlyphMetrics(int glyphCode) {
return null;
}