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


Java Point2D.getY方法代码示例

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


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

示例1: AffineMapping

import java.awt.geom.Point2D; //导入方法依赖的package包/类
public AffineMapping(Point2D A1, Point2D A2, Point2D A3, Point2D B1, Point2D B2, Point2D B3) {
	super();
	double ax1 = A1.getX(), ax2 = A2.getX(), ax3 = A3.getX();
	double ay1 = A1.getY(), ay2 = A2.getY(), ay3 = A3.getY();
	double bx1 = B1.getX(), bx2 = B2.getX(), bx3 = B3.getX();
	double by1 = B1.getY(), by2 = B2.getY(), by3 = B3.getY();
	
	double S = ax1*(ay3-ay2) + ax2*(ay1-ay3) + ax3*(ay2-ay1); // TODO: check S for zero value and throw exception!
	a00 = (ay1*(bx2-bx3) + ay2*(bx3-bx1) + ay3*(bx1-bx2)) / S;
	a01 = (ax1*(bx3-bx2) + ax2*(bx1-bx3) + ax3*(bx2-bx1)) / S;
	a10 = (ay1*(by2-by3) + ay2*(by3-by1) + ay3*(by1-by2)) / S;
	a11 = (ax1*(by3-by2) + ax2*(by1-by3) + ax3*(by2-by1)) / S;
	a02 = 
			(ax1*(ay3*bx2-ay2*bx3) + ax2*(ay1*bx3-ay3*bx1) + ax3*(ay2*bx1-ay1*bx2)) / S;
	a12 = 
			(ax1*(ay3*by2-ay2*by3) + ax2*(ay1*by3-ay3*by1) + ax3*(ay2*by1-ay1*by2)) / S;
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:18,代码来源:AffineMapping.java

示例2: pixellate

import java.awt.geom.Point2D; //导入方法依赖的package包/类
/**
 * !!! not used currently, but might be by getPixelbounds?
 */
public void pixellate(FontRenderContext renderFRC, Point2D loc, Point pxResult) {
    if (renderFRC == null) {
        renderFRC = frc;
    }

    // it is a total pain that you have to copy the transform.

    AffineTransform at = renderFRC.getTransform();
    at.transform(loc, loc);
    pxResult.x = (int)loc.getX(); // but must not behave oddly around zero
    pxResult.y = (int)loc.getY();
    loc.setLocation(pxResult.x, pxResult.y);
    try {
        at.inverseTransform(loc, loc);
    }
    catch (NoninvertibleTransformException e) {
        throw new IllegalArgumentException("must be able to invert frc transform");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:StandardGlyphVector.java

示例3: getClosestLeftNeighbour

import java.awt.geom.Point2D; //导入方法依赖的package包/类
/**
 * Returns the closest operator to the left of the given point and process.
 *
 * @param p
 *            looks for an operator to the left of this location
 * @param unit
 *            the process for the location
 * @return the closest operator or {@code null}
 */
Operator getClosestLeftNeighbour(final Point2D p, final ExecutionUnit unit) {
	Operator closest = null;
	double minDist = Double.POSITIVE_INFINITY;
	for (Operator op : unit.getOperators()) {
		Rectangle2D rect = model.getOperatorRect(op);
		if (rect.getMaxX() >= p.getX()) {
			continue;
		}
		double dx = rect.getMaxX() - p.getX();
		double dy = rect.getMaxY() - p.getY();
		double dist = dx * dx + dy * dy;
		if (dist < minDist) {
			minDist = dist;
			closest = op;
		}
	}
	return closest;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:28,代码来源:ProcessRendererController.java

示例4: calcoffset

import java.awt.geom.Point2D; //导入方法依赖的package包/类
/**
 * Return the location of the point passed in result as mapped to the
 * line indicated by index.  If doExtend is true, extend the
 * x value without pinning to the ends of the line.
 * this assumes that index is valid and references a line that has
 * non-zero length.
 */
private void calcoffset(int index, boolean doExtend, Point2D result) {
    double bx = data[index-3];
    double by = data[index-2];
    double px = result.getX() - bx;
    double py = result.getY() - by;
    double dx = data[index] - bx;
    double dy = data[index+1] - by;
    double l = data[index+2] - data[index - 1];

    // rx = A dot B / |B|
    // ry = A dot invB / |B|
    double rx = (px * dx + py * dy) / l;
    double ry = (px * -dy + py * dx) / l;
    if (!doExtend) {
        if (rx < 0) rx = 0;
        else if (rx > l) rx = l;
    }
    rx += data[index-1];
    result.setLocation(rx, ry);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:LayoutPathImpl.java

示例5: getEndPoint

import java.awt.geom.Point2D; //导入方法依赖的package包/类
/** Returns the perimeter point where the end of this edge has to connect.
 * @param vertex the end vertex
 * @param source if {@code true}, we're computing this for the edge source,
 * otherwise for the edge target
 */
private Point2D getEndPoint(CellView vertex, boolean source) {
    JVertexView vertexView = (JVertexView) vertex;
    Point2D center = getCenterPoint(vertex);
    Point2D nextPoint = getNearestPoint(source);
    // adjust the centre and next point depending on the number of
    // parallel edges, as determined by the parameter rank
    Point2D adjustedCenter;
    Point2D adjustedNextPoint;
    int parRank = source ? getParRank() : -getParRank();
    if (parRank == 0) {
        adjustedCenter = center;
        adjustedNextPoint = nextPoint;
    } else {
        // direction of the next point
        double dx = nextPoint.getX() - center.getX();
        double dy = nextPoint.getY() - center.getY();
        // direction for the offset, perpendicular to the next point
        double offDirX = dy;
        double offDirY = -dx;
        double offDist = center.distance(nextPoint);
        // calculate vertex radius in the specified direction
        Rectangle2D bounds = vertex.getBounds();
        double offMax = vertexView.getCellVisuals()
            .getNodeShape()
            .getRadius(bounds, offDirX, offDirY);
        // calculate actual offset
        double offset =
            Math.signum(parRank) * Math.min(PAR_EDGES_DISTANCE * Math.abs(parRank), offMax);
        double offX = offset * offDirX / offDist;
        double offY = offset * offDirY / offDist;
        adjustedCenter = new Point2D.Double(center.getX() + offX, center.getY() + offY);
        adjustedNextPoint =
            new Point2D.Double(nextPoint.getX() + offX, nextPoint.getY() + offY);
    }
    return vertexView.getPerimeterPoint(this, adjustedCenter, adjustedNextPoint);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:42,代码来源:JEdgeView.java

示例6: updatePoints

import java.awt.geom.Point2D; //导入方法依赖的package包/类
private void updatePoints(int x, int y) {
    Point2D inv = new Point2D.Double(x, y);

    try {
        inv = transform.inverseTransform(inv, null);
    } catch (NoninvertibleTransformException e) {
        e.printStackTrace();
    }

    x = (int)inv.getX();
    y = (int)inv.getY();

    switch (paintType) {
    default:
    case BASIC:
    case LINEAR:
        // pick the closest point to move
        if (inv.distance(startX, startY) < inv.distance(endX, endY)) {
            startX = x;
            startY = y;
        } else {
            endX = x;
            endY = y;
        }
        break;

    case RADIAL:
        // pick the closest point to move
        if (inv.distance(ctrX, ctrY) < inv.distance(focusX, focusY)) {
            ctrX = x;
            ctrY = y;
        } else {
            focusX = x;
            focusY = y;
        }
        break;
    }

    updatePaint();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:41,代码来源:MultiGradientTest.java

示例7: showMessageDialog

import java.awt.geom.Point2D; //导入方法依赖的package包/类
private void showMessageDialog() {

        Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        Point2D iconLoc = nativeGetIconLocation(getModel());

        int dialogY = (int)iconLoc.getY();
        int dialogX = (int)iconLoc.getX();
        if (dialogX + messageDialog.getWidth() > screenSize.width) {
            dialogX = screenSize.width - messageDialog.getWidth();
        }

        messageDialog.setLocation(dialogX, dialogY);
        messageDialog.setVisible(true);
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:CTrayIcon.java

示例8: PolarStereo

import java.awt.geom.Point2D; //导入方法依赖的package包/类
public PolarStereo(Point2D poleXY, double refLon, double scale, 
			int hemisphere, int ellipsoid) {
	poleX = poleXY.getX();
	poleY = poleXY.getY();
	this.refLon = refLon + 90;
	if( hemisphere==SOUTH ) this.refLon -= 180;
	this.scale = scale;
	this.hemisphere = hemisphere;
	this.ellipsoid = ellipsoid;
	init();
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:12,代码来源:PolarStereo.java

示例9: doZoom

import java.awt.geom.Point2D; //导入方法依赖的package包/类
/**
 	Zoom by factor and center on point p.
 	@param p point to center on.
 	@param factor Factor to zoom by.
 */
public void doZoom( Point2D p, double factor ) {
	AffineTransform ATrans = new AffineTransform();
	ATrans.scale( zoom, zoom );
	Insets insets = getInsets();
	Rectangle rect = getVisibleRect();
	Dimension dim = getParent().getSize();
	if( dim.width>rect.width) rect.width = dim.width;
	if( dim.height>rect.height) rect.height = dim.height;
	rect.width -= insets.left + insets.right;
	rect.height -= insets.top + insets.bottom;
	double nX = (p.getX() - insets.left - (rect.width/(2.*factor)));
	double nY = ( p.getY() - insets.top - rect.height/(2.*factor));
	Point2D newP = null;
	try {
		newP = ATrans.inverseTransform( new Point2D.Double(nX, nY), null );
	} catch (Exception ex ) {
		return;
	}
	ATrans.scale( factor, factor );
	zoom *= factor;
	newP = ATrans.transform( newP, null );
	int newX = (int)newP.getX(); // + insets.left;
	int newY = (int)newP.getY(); // + insets.top;
	invalidate();
	scrollPane.validate();
	JScrollBar sb = scrollPane.getHorizontalScrollBar();
	sb.setValue(newX);
	sb = scrollPane.getVerticalScrollBar();
	sb.setValue(newY);
	revalidate();

	//If this is MapApp Auto Focus
	if (app instanceof MapApp) {
		((MapApp) app).autoFocus();
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:42,代码来源:XMap.java

示例10: centerNetwork

import java.awt.geom.Point2D; //导入方法依赖的package包/类
/**
 * This method finds the location of the graph relative to the viewer and
 * shifts is so that it appears in the center of JUNG's VisualizationViewer.
 */
public void centerNetwork() {
	double top = Double.MAX_VALUE;
	double bottom = Double.MAX_VALUE;
	double left = Double.MAX_VALUE;
	double right = Double.MAX_VALUE;

	for (Vertex v : getVertices()) {
		Point2D p = v.getPosition();

		if (top < p.getY() || top == Double.MAX_VALUE)
			top = p.getY();
		if (bottom > p.getY() || bottom == Double.MAX_VALUE)
			bottom = p.getY();
		if (left > p.getX() || left == Double.MAX_VALUE)
			left = p.getX();
		if (right < p.getX() || right == Double.MAX_VALUE)
			right = p.getX();
	}

	double deltaX = this.getCenter().getX() - (right + left) / 2;
	double deltaY = this.getCenter().getY() - (top + bottom) / 2;
	double zoom = height / (top - bottom + RENDER_MARGIN);

	if (!Double.isInfinite(deltaX) && !Double.isInfinite(deltaY)
			&& !Double.isNaN(deltaX) && !Double.isNaN(deltaY)) {

		translate(deltaX, deltaY);
		scale(zoom, getCenter());

		graphMouse.setZoomFactor(zoom);
		graphMouse.setZoomPosition(getCenter());
	}
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:38,代码来源:NetworkRenderer.java

示例11: setGlyphPosition

import java.awt.geom.Point2D; //导入方法依赖的package包/类
public void setGlyphPosition(int ix, Point2D pos) {
    initPositions();

    int ix2 = ix << 1;
    positions[ix2] = (float)pos.getX();
    positions[ix2 + 1] = (float)pos.getY();

    clearCaches(ix);
    addFlags(FLAG_HAS_POSITION_ADJUSTMENTS);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:StandardGlyphVector.java

示例12: setViewerForFrame

import java.awt.geom.Point2D; //导入方法依赖的package包/类
private static void setViewerForFrame(QuPathViewer viewer, ViewRecordingFrame frame) {
    resizeViewer(viewer, frame.getSize());
    Rectangle imageBounds = frame.getImageBounds();
    Dimension canvasSize = frame.getSize();
    double downsampleX = (double)imageBounds.width / (double)canvasSize.width;
    double downsampleY = (double)imageBounds.height / (double)canvasSize.height;
    double downsample = 0.5D * (downsampleX + downsampleY);
    viewer.setDownsampleFactor(downsample);
    viewer.setCenterPixelLocation(
            (double)imageBounds.x + (double)imageBounds.width * 0.5D,
            (double)imageBounds.y + (double)imageBounds.height * 0.5D);

    playbackOverlay.updateIconLocations(frame);

    Point2D p2d;
    if (frame.hasCursorPosition()) {
        p2d = viewer.imagePointToComponentPoint(
                frame.getCursorPosition(),
                null,
                false);
        new Point((int)(p2d.getX() + 0.5D), (int)(p2d.getY() + 0.5D));
    }

    if (frame.hasEyePosition()) {
        p2d = frame.getEyePosition();
        PointsROI point = new PointsROI(p2d.getX(), p2d.getY());
        PathObject pathObject = new PathAnnotationObject(point);
        pathObject.setName("Eye tracking position");
        viewer.setSelectedObject(pathObject);
        logger.debug("Eye position: " + p2d);
    }
}
 
开发者ID:Alanocallaghan,项目名称:qupath-tracking-extension,代码行数:33,代码来源:ExtendedViewTrackerPlayback.java

示例13: getConnectingLines

import java.awt.geom.Point2D; //导入方法依赖的package包/类
/**
 * Gets the connecting lines.
 *
 * @return the connecting lines
 */
public static Line2D[] getConnectingLines(final Point2D point, final Point2D[] rectPoints) {
  final Line2D[] lines = new Line2D[rectPoints.length];

  for (int i = 0; i < rectPoints.length; i++) {
    lines[i] = new Line2D.Double(point.getX(), point.getY(), rectPoints[i].getX(), rectPoints[i].getY());
  }

  return lines;
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:15,代码来源:GeometricUtilities.java

示例14: getMidPoint

import java.awt.geom.Point2D; //导入方法依赖的package包/类
public static Point2D getMidPoint(final Point2D p1, final Point2D p2) {
  final Point2D mid = new Point2D.Double();
  final double x = (p1.getX() + p2.getX()) / 2;
  final double y = (p1.getY() + p2.getY()) / 2;
  mid.setLocation(x, y);
  return mid;

}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:9,代码来源:GeometricUtilities.java

示例15: rotate

import java.awt.geom.Point2D; //导入方法依赖的package包/类
public static Point2D rotate(Point2D point, double rad){
	  // R(q) = ( cos q   sin q)
      //        (-sin q   cos q)
	return new Point2D.Double( Math.cos(rad)*point.getX() - Math.sin(rad)*point.getY(),
		  			           Math.sin(rad)*point.getX() + Math.cos(rad)*point.getY());
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:7,代码来源:A.java


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