public void test110_ZoomShift() { // final double s = 1.0 / RockLocationDisplayBase.SCALE; final double[] flat = new double[6]; final Point2D dst = new Point2D.Double(); final Point2D src = new Point2D.Double(); final AffineTransform mat = new AffineTransform(); final Rectangle2D wc = new Rectangle2D.Double(1, 2, 3, 4); Rectangle dc = new Rectangle(-1, -2, 3, 4); final Point2D fix = new Point2D.Double(1, 2); ZoomerFixPoint zom = new ZoomerFixPoint("1:1", wc, fix); mat.setToIdentity(); zom.computeWc2Dc(dc, Orientation.N, true, false, mat); mat.getMatrix(flat); assertEquals("", -0.0010, flat[0], 1e-9); assertEquals("", 0, flat[1], 1e-9); assertEquals("", 0, flat[2], 1e-9); assertEquals("", -0.0010, flat[3], 1e-9); assertEquals("", 1.0, flat[4], 1e-9); assertEquals("", 6, flat[5], 1e-9); src.setLocation(fix); mat.transform(src, dst); assertEquals(new Point2D.Double(0.999, 5.998), dst); src.setLocation(3, 4); mat.transform(src, dst); assertEquals(new Point2D.Double(0.997, 5.996), dst); }
/** * Moves a Steiner Point towards the furthest neighbor * * @param source * @param target */ private void moveTowards(Point source, Point target) { Point2D s = new Point2D.Double(); Point2D t = new Point2D.Double(); Point2D previousLocation = new Point2D.Double(); s.setLocation(source.x, source.y); previousLocation.setLocation(source.x, source.y); t.setLocation(target.x, target.y); // in each step move 1 unit forward towards the target double step_size = 1; // previous PCR : Stop moving when previousPCR is better than current one. double previousPCR = source.getPCR(); int distance = (int) Math.floor(GraphUtils.euclideanDistance(source.x, source.y, target.x, target.y)); for (int i = 0; i < distance; i += step_size) { Point2D currentLocation = GraphUtils.getCoordinates(source.x, source.y, target.x, target.y, step_size); source.x = currentLocation.getX(); source.y = currentLocation.getY(); double currentPCR = source.getPCR(); if (currentPCR < previousPCR) { previousPCR = currentPCR; previousLocation = currentLocation; } else { // move backwards source.x = previousLocation.getX(); source.y = previousLocation.getY(); } } }
public void run(double frac) { System.err.println("auto-centering" + frac); if (frac == 0.0) { int xbias = 0, ybias = 0; switch (m_orientation) { case Constants.ORIENT_LEFT_RIGHT: xbias = m_bias; break; case Constants.ORIENT_RIGHT_LEFT: xbias = -m_bias; break; case Constants.ORIENT_TOP_BOTTOM: ybias = m_bias; break; case Constants.ORIENT_BOTTOM_TOP: ybias = -m_bias; break; } Rectangle2D vb = m_vis.getBounds(TREE); m_cur.setLocation(getWidth() / 2, getHeight() / 2); getAbsoluteCoordinate(m_cur, m_start); m_end.setLocation(vb.getX() + xbias, vb.getY() + ybias); } else { m_cur.setLocation( m_start.getX() + frac * (m_end.getX() - m_start.getX()), m_start.getY() + frac * (m_end.getY() - m_start.getY())); panToAbs(m_cur); } }
private PBounds addNode(HierarchyNodeView from, HierarchyNodeView toNode, boolean addChildren) { PBounds bounds = toNode.node.getBounds(); final PSWTPath path = new PSWTPath(); Point2D to = toNode.node.getCenter(); Point2D fromP = from.node.getCenter(); if (!addChildren) { fromP.setLocation(fromP.getX(), fromP.getY() - (from.node.getHeight() / 2.0)); to.setLocation(to.getX(), to.getY() + (toNode.node.getHeight() / 2.0)); } else { fromP.setLocation(fromP.getX(), fromP.getY() + (from.node.getHeight() / 2.0)); to.setLocation(to.getX(), to.getY() - (toNode.node.getHeight() / 2.0)); } path.setPathToPolyline(new Point2D[] {fromP, to}); getLayer().addChild(path); path.moveToBack(); path.addInputEventListener( new PBasicInputEventHandler() { @Override public void mouseEntered(PInputEvent event) { path.setStrokeColor(Color.LIGHT_GRAY); } @Override public void mouseExited(PInputEvent event) { path.setStrokeColor(Color.BLACK); } }); return bounds; }
public static void main(String[] args) { Scanner scanRadius = new Scanner(System.in); Scanner scanCenter = new Scanner(System.in); Point2D centerA = new Point2D.Double(); Point2D centerB = new Point2D.Double(); double x, y, radiusA = 0, radiusB = 0; for (char i = 'A'; i <= 'B'; i++) { System.out.print("\nCircle " + i); System.out.print("\nEnter center cordinates:" + "\n(x): "); x = scanCenter.nextDouble(); System.out.print("(y): "); y = scanCenter.nextDouble(); System.out.print("Enter radius: "); if (i == 'A') { radiusA = scanCenter.nextDouble(); centerA.setLocation(x, y); } else if (i == 'B') { radiusB = scanCenter.nextDouble(); centerB.setLocation(x, y); } } scanRadius.close(); scanCenter.close(); double distance = distance(centerA, centerB); if (distance == (radiusA + radiusB)) System.out.println("\nThe two circles are touching"); else if ((distance < Math.abs(radiusA - radiusB))) System.out.println("\nOne circle encloses another"); else if (distance < (radiusA + radiusB)) System.out.println("\nThe two circles overlap"); else if (distance > (radiusA + radiusB)) System.out.println("\nThe two circles are separate"); }
public void run(double frac) { TupleSet ts = m_vis.getFocusGroup(Visualization.FOCUS_ITEMS); // System.err.println("auto-panning"+frac); if (ts.getTupleCount() == 0) return; if (frac == 0.0) { int xbias = 0, ybias = 0; switch (m_orientation) { case Constants.ORIENT_LEFT_RIGHT: xbias = m_bias; break; case Constants.ORIENT_RIGHT_LEFT: xbias = -m_bias; break; case Constants.ORIENT_TOP_BOTTOM: ybias = m_bias; break; case Constants.ORIENT_BOTTOM_TOP: ybias = -m_bias; break; } VisualItem vi = (VisualItem) ts.tuples().next(); m_cur.setLocation(getWidth() / 2, getHeight() / 2); getAbsoluteCoordinate(m_cur, m_start); m_end.setLocation(vi.getX() + xbias, vi.getY() + ybias); } else { m_cur.setLocation( m_start.getX() + frac * (m_end.getX() - m_start.getX()), m_start.getY() + frac * (m_end.getY() - m_start.getY())); panToAbs(m_cur); } }
protected int adjustEndingPointByMultipleEdge(EdgeItem e, Point2D start, Point2D end) { int edgeIndex = getEdgeIndex(e); if (edgeIndex < 0) { return edgeIndex; } m_edgeTrans.setToTranslation(end.getX(), end.getY()); m_edgeTrans.rotate(-HALF_PI + Math.atan2(end.getY() - start.getY(), end.getX() - start.getX())); if (edgeIndex % 2 == 1) { end.setLocation(4 + edgeIndex, 0); } else { end.setLocation(-4 - (edgeIndex - 1), 0); } m_edgeTrans.transform(end, end); return edgeIndex; }
public void setPositionXY(int[] positionRad) { Vector<Point2D> points = new Vector<Point2D>(); for (int laser = (0 + degreesToHide); laser <= (539 - degreesToHide); laser++) { Point2D point = new Point(); int invertedLaser = 541 - 2 - laser; point.setLocation( positionRad[invertedLaser] * Math.cos(invertedLaser * 0.00872664626 + ANGLE_DEPART), positionRad[invertedLaser] * Math.sin(invertedLaser * 0.00872664626 + ANGLE_DEPART)); if (point.getX() == 0 && point.getY() == 0) { point.setLocation(10000, 10000); } points.add(point); } positionXY = points; }
protected Point2D constrainCtrlPoint(int index, int side, Point2D ctrl) { if ((index == 0 && side == RIGHT_CONTROLPOINT && startFigure() != null) || (index == segments.size() && side == LEFT_CONTROLPOINT && endFigure() != null)) { // we are constraining the start-controlPoint Point2D start = getPointAt(index); Point2D end = getPointAt(index == 0 ? 1 : segments.size() - 1); double xdiff = start.getX() - end.getX(); xdiff *= xdiff; double ydiff = start.getY() - end.getY(); ydiff *= ydiff; double distance = Math.sqrt(xdiff + ydiff); Orientation orientation; if (index == 0) { distance *= getStartFactor(); orientation = ((TagConnector) getStartConnector()).getOrientation(); } else { distance *= getEndFactor(); orientation = ((TagConnector) getEndConnector()).getOrientation(); } switch (orientation) { case TOP: distance = -distance; // Fall through case BOTTOM: ctrl.setLocation(start.getX(), start.getY() + distance); break; case LEFT: distance = -distance; // Fall through case RIGHT: ctrl.setLocation(start.getX() + distance, start.getY()); break; } } return ctrl; }
/** * Function to check if a direction and frame intersects * * @param direction * @param frame * @return */ public boolean intersects(Line2D direction, Line2D frame) { double d = (frame.getY2() - frame.getY1()) * (direction.getX2() - direction.getX1()) - (frame.getX2() - frame.getX1()) * (direction.getY2() - direction.getY1()); double n_a = (frame.getX2() - frame.getX1()) * (direction.getY1() - frame.getY1()) - (frame.getY2() - frame.getY1()) * (direction.getX1() - frame.getX1()); double n_b = (direction.getX2() - direction.getX1()) * (direction.getY1() - frame.getY1()) - (direction.getY2() - direction.getY1()) * (direction.getX1() - frame.getX1()); if (d == 0) return false; double ua = n_a / d; double ub = n_b / d; if (ua >= 0d && ua <= 1d && ub >= 0d && ub <= 1d) { intersection = new Point2D.Double(); intersection.setLocation( direction.getX1() + (ua * (direction.getX2() - direction.getX1())), direction.getY1() + (ua * (direction.getY2() - direction.getY1()))); return true; } return false; }
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { if (dstPt == null) { dstPt = new Point2D.Double(); } dstPt.setLocation(srcPt.getX(), srcPt.getY()); return dstPt; }
private static Point2D vectorToLocation( double angle, double length, Point2D sourceLocation, Point2D targetLocation) { targetLocation.setLocation( sourceLocation.getX() + Math.sin(angle) * length, sourceLocation.getY() + Math.cos(angle) * length); return targetLocation; }
public void mouseMoved(MouseEvent e) { // check if the mouse is over something hot: // - a speed handle // - a rock tmp.setLocation(e.getX(), e.getY()); panel.findHotDc(tmp, hot); }
/** * Inverse transform from projected coordinates to latitude/longitude in radians. * * @see * org.geotools.referencing.operation.projection.MapProjection#inverseTransformNormalized(double, * double, java.awt.geom.Point2D) */ @Override protected Point2D inverseTransformNormalized(double x, double y, Point2D ptDst) throws ProjectionException { double lambda = 0; double phi = 0; double c = hypot(x, y); if (c < EPS10) { phi = latitudeOfOrigin; lambda = 0; } else { if (mode == Mode.OBLIQUE || mode == Mode.EQUATORIAL) { double x2 = x * semiMajor; double y2 = y * semiMajor; double azi1 = atan2(x2, y2); double s12 = sqrt(x2 * x2 + y2 * y2); GeodesicData g = geodesic.Direct( toDegrees(latitudeOfOrigin), toDegrees(centralMeridian), toDegrees(azi1), s12); phi = toRadians(g.lat2); lambda = toRadians(g.lon2); lambda -= centralMeridian; } else { // Polar phi = inv_mlfn((mode == Mode.NORTH_POLAR) ? (Mp - c) : (Mp + c)); lambda = atan2(x, (mode == Mode.NORTH_POLAR) ? -y : y); } } if (ptDst == null) { return new Point2D.Double(lambda, phi); } else { ptDst.setLocation(lambda, phi); return ptDst; } }
/** * Forward project a point. If the point is not within the viewable hemisphere, return flags in * AzimuthVar variable if specified. * * @param phi double latitude in radians * @param lambda double longitude in radians * @param p Point2D * @param azVar AzimuthVar or null * @return Point2D pt */ protected Point2D _forward(double phi, double lambda, Point2D p, AzimuthVar azVar) { double c = hemisphere_distance(centerY, centerX, phi, lambda); // normalize invalid point to the edge of the sphere if (c > HEMISPHERE_EDGE) { double az = GreatCircle.sphericalAzimuth(centerY, centerX, phi, lambda); if (azVar != null) { azVar.invalid_forward = true; // set the invalid // flag azVar.current_azimuth = (float) az; // record azimuth // of this // point } return edge_point(p, az); } double kPrime = 1 / Math.cos(c); double cosPhi = Math.cos(phi); double sinPhi = Math.sin(phi); double lambdaMinusCtrLon = lambda - centerX; double cosLambdaMinusCtrLon = Math.cos(lambdaMinusCtrLon); double sinLambdaMinusCtrLon = Math.sin(lambdaMinusCtrLon); double x = (scaled_radius * kPrime * cosPhi * sinLambdaMinusCtrLon) + wx; double y = hy - (scaled_radius * kPrime * (cosCtrLat * sinPhi - sinCtrLat * cosPhi * cosLambdaMinusCtrLon)); p.setLocation(x, y); return p; }
protected void makeSawtooth() { // TODO Auto-generated method stub // 规定一个取点间隙 for (int i = 0; i < sawtooth.size(); i++) { Point2D point = sawtooth.get(i); point.setLocation(point.getX() + vx[0], point.getY() + vy[0]); } try { int x = (int) pointList.get(sawtoothIndex).getX() - (int) pointList.get(sawtoothIndex + grap).getX(); int y = (int) pointList.get(sawtoothIndex).getY() - (int) pointList.get(sawtoothIndex + grap).getY(); double rate = Math.random() / 2; int formerX = (int) pointList.get(sawtoothIndex + grap / 2).getX(); int formerY = (int) pointList.get(sawtoothIndex + grap / 2).getY(); if ((sawtoothIndex % (2 * grap)) == 0) { rate = -rate; } pointList.get(sawtoothIndex + grap / 2).setLocation(formerX + rate * y, formerY - rate * x); sawtooth.add(pointList.get(sawtoothIndex)); sawtooth.add(pointList.get(sawtoothIndex + grap / 2)); sawtooth.add(pointList.get(sawtoothIndex + grap)); sawtoothIndex = sawtoothIndex + grap; } catch (Exception ex) { } }
/** * Rotates a two-dimensional vector by the angle alpha. * * @param p point * @param alpha angle in radian * @return q point rotated around origin */ public static Point2D rotate(Point2D p, double alpha) { double sina = Math.sin(alpha); double cosa = Math.cos(alpha); Point2D q = new Point2D.Double(); q.setLocation(p.getX() * cosa - p.getY() * sina, p.getX() * sina + p.getY() * cosa); return q; }
/** * Transforms the specified (<var>λ</var>,<var>φ</var>) coordinates (units in radians) * and stores the result in {@code ptDst} (linear distance on a unit sphere). */ protected Point2D transformNormalized(double lam, double phi, final Point2D ptDst) throws ProjectionException { double c, d; double x, y; if ((d = acos(cos(phi) * cos(c = 0.5 * lam))) != 0) { /* basic Aitoff */ x = 2. * d * cos(phi) * sin(c) * (y = 1. / sin(d)); y *= d * sin(phi); } else { x = y = 0; } if (mode == ProjectionMode.Winkel) { x = (x + lam * cosphi1) * 0.5; y = (y + phi) * 0.5; } if (ptDst != null) { ptDst.setLocation(x, y); return ptDst; } else { return new Point2D.Double(x, y); } }
private void expandLocationToInclude(Point2D pt) { Point2D pt0 = getLocationPt(0); Point2D pt2 = getLocationPt(2); int leftmostPtIndex = (pt0.getX() < pt2.getX() ? 0 : 2); int rightmostPtIndex = 2 - leftmostPtIndex; int topmostPtIndex = (pt0.getY() < pt2.getY() ? 0 : 2); int bottommostPtIndex = 2 - topmostPtIndex; Point2D leftmostPt = getLocationPt(leftmostPtIndex); Point2D rightmostPt = getLocationPt(rightmostPtIndex); Point2D topmostPt; Point2D bottommostPt; if (topmostPtIndex == leftmostPtIndex) { topmostPt = leftmostPt; bottommostPt = rightmostPt; } else { topmostPt = rightmostPt; bottommostPt = leftmostPt; } Location newLocation = new Location(getLocation()); boolean locationChanged = false; if (pt.getX() < leftmostPt.getX()) { leftmostPt.setLocation(pt.getX(), leftmostPt.getY()); newLocation.setPt(leftmostPtIndex, leftmostPt); locationChanged = true; } if (pt.getX() > rightmostPt.getX()) { rightmostPt.setLocation(pt.getX(), rightmostPt.getY()); newLocation.setPt(rightmostPtIndex, rightmostPt); locationChanged = true; } if (pt.getY() < topmostPt.getY()) { topmostPt.setLocation(topmostPt.getX(), pt.getY()); newLocation.setPt(topmostPtIndex, topmostPt); locationChanged = true; } if (pt.getY() > bottommostPt.getY()) { bottommostPt.setLocation(bottommostPt.getX(), pt.getY()); newLocation.setPt(bottommostPtIndex, bottommostPt); locationChanged = true; } if (locationChanged) { internalSetLocation(newLocation); } }
public void onScannedRobot(ScannedRobotEvent e) { oldRobotLocation.setLocation(robotLocation); robotLocation.setLocation(getX(), getY()); enemyAbsoluteBearing = getHeadingRadians() + e.getBearingRadians(); enemyDistance = e.getDistance(); oldEnemyLocation.setLocation(enemyLocation); toLocation(enemyAbsoluteBearing, enemyDistance, robotLocation, enemyLocation); deltaBearing = Utils.normalRelativeAngle( absoluteBearing(oldRobotLocation, enemyLocation) - absoluteBearing(oldRobotLocation, oldEnemyLocation)); currentAimFactors = aimFactors[aimDirectionSegment()][ Math.min( (int) (enemyDistance / (getBattleFieldWidth() / DISTANCE_SEGMENTS)), DISTANCE_SEGMENTS - 1)][ Math.min( (int) (enemyLocation.getY() / (getBattleFieldHeight() / VERTICAL_SEGMENTS)), VERTICAL_SEGMENTS - 1)]; setTurnGunRightRadians( Utils.normalRelativeAngle( enemyAbsoluteBearing + maxEnemyBearing * sign(deltaBearing) * mostVisitedFactor() - getGunHeadingRadians())); if (getEnergy() > 3.1) { Bullet bullet = setFireBullet(3); if (bullet != null) { Wave wave = new Wave(); wave.wTime = getTime(); wave.bearingDelta = deltaBearing; wave.oldRLocation.setLocation(robotLocation); wave.oldELocation.setLocation(enemyLocation); wave.wAimFactors = currentAimFactors; addCustomEvent(wave); } } setAhead(getY() > enemyLocation.getY() ? -50 : 50); setTurnRadarRightRadians( Utils.normalRelativeAngle(enemyAbsoluteBearing - getRadarHeadingRadians()) * 2); }
private void insertConnectionPointToNode(Connection c, int outcode, int index) { Point2D newpoint = new Point2D.Double(); Point2D segmentPoint = getConnection().getPoints().get(index); if (outcode == Rectangle2D.OUT_BOTTOM) { newpoint.setLocation(segmentPoint.getX(), c.getAbsoluteY2()); addEditPoint(index, newpoint); } else if (outcode == Rectangle2D.OUT_TOP) { newpoint.setLocation(segmentPoint.getX(), c.getAbsoluteY1()); addEditPoint(index, newpoint); } else if (outcode == Rectangle2D.OUT_LEFT) { newpoint.setLocation(c.getAbsoluteX1(), segmentPoint.getY()); addEditPoint(index, newpoint); } else if (outcode == Rectangle2D.OUT_RIGHT) { newpoint.setLocation(c.getAbsoluteX2(), segmentPoint.getY()); addEditPoint(index, newpoint); } }
private static MeshCoords transformSector(AffineTransform transform, Sector sector) { java.awt.geom.Point2D p = new java.awt.geom.Point2D.Double(); java.awt.geom.Point2D ll = new java.awt.geom.Point2D.Double(); java.awt.geom.Point2D ur = new java.awt.geom.Point2D.Double(); p.setLocation(sector.getMinLongitude().degrees, sector.getMinLatitude().degrees); transform.transform(p, ll); p.setLocation(sector.getMaxLongitude().degrees, sector.getMaxLatitude().degrees); transform.transform(p, ur); return new MeshCoords( (float) ur.getY(), // Top (float) ll.getX(), // Left (float) ll.getY(), // Bottom (float) ur.getX()); // Right }
@Override public Point2D calculate(Point2D point) { double x = point.getX(); double y = point.getY(); double r = Math.sqrt(x * x + y * y) + 0.000001; double t = Math.atan2(x, y); point.setLocation(Math.sin(t) / r * _coefficient, r * Math.cos(t) * _coefficient); return point; }
public DiagramElement(DiagramElement element) { this.stroke = element.stroke; this.paint = element.paint; this.size = element.size; position.setLocation( position.getX() - size.getWidth() / 2, position.getY() - size.getHeight() / 2); this.position = element.position; this.scale = 1; this.rotation = 0; }
@Override public Point2D calculate(Point2D point) { double x = point.getX(); double y = point.getY(); double r = Math.sqrt(x * x + y * y); double t = Math.atan2(x, y); double pot = Math.pow(r, Math.sin(t)); point.setLocation(pot * Math.cos(t) * _coefficient, pot * Math.sin(t) * _coefficient); return point; }
public DiagramElement(Point2D position, Dimension size, Stroke stroke, Paint paint) { setStroke(stroke); this.paint = paint; this.size = size; position.setLocation( position.getX() - size.getWidth() / 2, position.getY() - size.getHeight() / 2); this.position = position; this.scale = 1; this.rotation = 0; }
@Override public Point2D calculate(Point2D point) { double x = point.getX(); double y = point.getY(); double r = Math.sqrt(x * x + y * y); double p = _parameters.get(0) * _parameters.get(0) + 0.000001; double theta = Math.atan2(x, y); double t = r - 2 * p * Math.floor((r + p) / 2 * p) + r * (1 - p); point.setLocation(t * Math.sin(theta) * _coefficient, t * Math.cos(theta) * _coefficient); return point; }
private void traceBallPath() { int abort = leftSide ? HEADING_LEFT : HEADING_RIGHT; // if(false) // fakeBall.ballVelX*paddle.direction>0 && int cycles = 0; while (heading != abort) { if (++cycles > 100) { // System.out.println( this.getClass().getName() + ": to manny cycles, something went // wrong\n prevent infinite loop ..."); break; } remainingTime = Float.MAX_VALUE; boolean positiveX = Math.cos(fakeBall.heading) > 0; boolean positiveY = Math.sin(fakeBall.heading) > 0; Vector3D path = Vector3D.crossProduct( new Vector3D(fakeBall.x, fakeBall.y, 1), new Vector3D( fakeBall.x + Math.cos(fakeBall.heading), fakeBall.y + Math.sin(fakeBall.heading), 1)); if (positiveX) { if (acceptIfCloser(path, right)) { heading = HEADING_RIGHT; } } else { if (acceptIfCloser(path, left)) { heading = HEADING_LEFT; } } if (positiveY) { if (acceptIfCloser(path, bottom)) { heading = HEADING_BOTTOM; } } else { if (acceptIfCloser(path, top)) { heading = HEADING_TOP; } } if (heading == HEADING_TOP || heading == HEADING_BOTTOM) fakeBall.horizontalBounce(); else if (heading == HEADING_LEFT || heading == HEADING_RIGHT) fakeBall.verticalBounce(); else break; fakeBall.x = (float) hitPoint.getX(); fakeBall.y = (float) hitPoint.getY(); } requiredPaddlePos.setLocation(fakeBall.x, fakeBall.y); }
/** * Computes the source point corresponding to the supplied point. * * @param destPt the position in destination image coordinates to map to source image coordinates. * @return a <code>Point2D</code> of the same class as <code>destPt</code>. * @throws IllegalArgumentException if <code>destPt</code> is <code>null</code>. * @since JAI 1.1.2 */ public Point2D mapDestPoint(Point2D destPt) { if (destPt == null) { throw new IllegalArgumentException(JaiI18N.getString("Generic0")); } Point2D pt = (Point2D) destPt.clone(); pt.setLocation(destPt.getX() * 4.0, destPt.getY() * 4.0); return pt; }
/** * Computes the destination point corresponding to the supplied point. * * @param sourcePt the position in source image coordinates to map to destination image * coordinates. * @return a <code>Point2D</code> of the same class as <code>sourcePt</code>. * @throws IllegalArgumentException if <code>sourcePt</code> is <code>null</code>. * @since JAI 1.1.2 */ public Point2D mapSourcePoint(Point2D sourcePt) { if (sourcePt == null) { throw new IllegalArgumentException(JaiI18N.getString("Generic0")); } Point2D pt = (Point2D) sourcePt.clone(); pt.setLocation(sourcePt.getX() / 4.0, sourcePt.getY() / 4.0); return pt; }