• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Float类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: LIFNeuron

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/**
 * Construct an LIF neuron with index.
 *
 * @param cellNumber : cell number
 * @param index : cell index
 * @param location : location on DVS pixels (x,y)
 * @param receptiveFieldSize : size of the receptive field
 * @param tauMP : RC time constant of the membrane potential
 * @param thresholdMP : threshold of the membrane potential to fire a spike
 * @param MPDecreaseArterFiringPercentTh : membrane potential jump after the spike in the percents of thresholdMP
 */
public LIFNeuron(int cellNumber, Point2D.Float index, Point2D.Float location, int receptiveFieldSize, float tauMP, float thresholdMP, float MPDecreaseArterFiringPercentTh) {
	// sets invariable parameters
	this.cellNumber = cellNumber;
	this.index.x = index.x;
	this.index.y = index.y;
	this.location.x = location.x;
	this.location.y = location.y;
	this.receptiveFieldSize = receptiveFieldSize;
	this.tauMP = tauMP;
	this.thresholdMP = thresholdMP;
	this.MPDecreaseArterFiringPercentTh = MPDecreaseArterFiringPercentTh;

	// resets initially variable parameters
	reset();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:27,代码来源:BlurringTunnelFilter.java


示例2: adc01normalized

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
private float adc01normalized(int count) {
            float v;
            if (!agcEnabled) {
                v = (float) ((apsIntensityGain*count)+apsIntensityOffset) / (float) 256;
            } else {
                Float filter2d = agcFilter.getValue2D();
                float offset = filter2d.x;
                float range = (filter2d.y - filter2d.x);
                v = ((count - offset)) / range;
//                System.out.println("offset="+offset+" range="+range+" count="+count+" v="+v);
            }
            if (v < 0) {
                v = 0;
            } else if (v > 1) {
                v = 1;
            }
            return v;
        }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:19,代码来源:NBFG256.java


示例3: paintRotatedCenteredShapeAtPoint

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
private void paintRotatedCenteredShapeAtPoint(Float p, Float c, Graphics2D g) {
    Shape s = getPointShape();
    double hh = s.getBounds().getHeight() / 2;
    double wh = s.getBounds().getWidth() / 2;
    double t, x, y;
    double a = c.y - p.y;
    double b = p.x - c.x;
    double sa = Math.signum(a);
    double sb = Math.signum(b);
    sa = sa == 0 ? 1 : sa;
    sb = sb == 0 ? 1 : sb;
    a = Math.abs(a);
    b = Math.abs(b);
    t = Math.atan(a / b);
    t = sa > 0 ? sb > 0 ? -t : -Math.PI + t : sb > 0 ? t : Math.PI - t;
    x = Math.sqrt(a * a + b * b) - wh;
    y = -hh;
    g.rotate(t);
    g.translate(x, y);
    g.fill(s);
    g.translate(-x, -y);
    g.rotate(-t);

}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:25,代码来源:BusyPainter.java


示例4: calcCube

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/**
 * Claclulates length of the cubic segment.
 * @param coords Segment coordinates.
 * @param cp Start point.
 * @return Length of the segment.
 */
private float calcCube(float[] coords, Float cp) {
    float x = Math.abs(cp.x - coords[4]);
    float y = Math.abs(cp.y - coords[5]);

    // trans coords from abs to rel
    float c1rx = Math.abs(cp.x - coords[0]) / x;
    float c1ry = Math.abs(cp.y - coords[1]) / y;
    float c2rx = Math.abs(cp.x - coords[2]) / x;
    float c2ry = Math.abs(cp.y - coords[3]) / y;
    float prevLength = 0, prevX = 0, prevY = 0;
    for (float t = 0.01f; t <= 1.0f; t += .01f) {
        Point2D.Float xy = getXY(t, c1rx, c1ry, c2rx, c2ry);
        prevLength += (float) Math.sqrt((xy.x - prevX) * (xy.x - prevX)
                + (xy.y - prevY) * (xy.y - prevY));
        prevX = xy.x;
        prevY = xy.y;
    }
    // prev len is a fraction num of the real path length
    float z = ((Math.abs(x) + Math.abs(y)) / 2) * prevLength;
    return z;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:28,代码来源:BusyPainter.java


示例5: getXY

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/**
 * Calculates relative position of the point on the quad curve in time t&lt;0,1&gt;.
 * @param t distance on the curve
 * @param ctrl Control point in rel coords
 * @param end End point in rel coords
 * @return Solution of the quad equation for time T in non complex space in rel coords.
 */
public static Point2D.Float getXY(float t, Point2D.Float begin, Point2D.Float ctrl, Point2D.Float end) {
    /*
     *     P1 = (x1, y1) - start point of curve
     *     P2 = (x2, y2) - end point of curve
     *     Pc = (xc, yc) - control point
     *
     *     Pq(t) = P1*(1 - t)^2 + 2*Pc*t*(1 - t) + P2*t^2 =
     *           = (P1 - 2*Pc + P2)*t^2 + 2*(Pc - P1)*t + P1
     *     t = [0:1]
     *     // thx Jim ...
     *     
     *     b0 = (1 -t)^2, b1 = 2*t*(1-t), b2 = t^2
     */
    Point2D.Float xy;
    float invT = (1 - t);
    float b0 = invT * invT;
    float b1 = 2 * t * invT ;
    float b2 = t * t;
    xy = new Point2D.Float(b0 * begin.x + (b1 * ctrl.x) + b2* end.x, b0 * begin.y +  (b1 * ctrl.y) + b2* end.y);
    
    return xy;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:30,代码来源:BusyPainter.java


示例6: InsidePolygon

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/**
 * 
 * @param ptTopL Top Left corner points for a polygon
 * @param ptTopR Top Right corner points for a polygon
 * @param ptBtmL Bottom Left corner points for a polygon
 * @param ptBtmR Bottom Right corner points for a polygon
 * @param p the point to test if its inside the polygon
 * @return true if it is inside the polygon 
 */
private boolean InsidePolygon(Point2D.Float ptTopL,
		Point2D.Float ptTopR,
		Point2D.Float ptBtmL,
		Point2D.Float ptBtmR,
		Point2D.Float p)
{
	//if the p point is inside the polygon, then the areas of the four triangles should not be negative
	if (AreaTriangle(ptTopL,ptTopR,p)<0) 
		return false;
	if (AreaTriangle(ptTopR,ptBtmR,p)<0)
		return false;
	if (AreaTriangle(ptBtmR,ptBtmL,p)<0)
		return false;
	if (AreaTriangle(ptBtmL,ptTopL,p)<0)
		return false;

	return true;
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:28,代码来源:PrimaryModulationScatterCorrectionTool.java


示例7: shear

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
private void shear(MouseEvent e){
    
    Point2D.Float startPosition = this.map3DViewer.mouseXYtoModelXY(startPoint.x, startPoint.y);
    Point2D.Float currentPosition = this.map3DViewer.mouseXYtoModelXY(e.getX(),e.getY());
    float distanceX = currentPosition.x - startPosition.x;
    float distanceY = currentPosition.y - startPosition.y;
    
    //Shear in X and Y so the clicked point stays under the mouse.
    if(startZ > 0 && startZ < 1){
        if(!shearReversed){
          //shear in the positive direction for high points
          map3DViewer.setShearX(SHEAR_COEFFICIENT * distanceX / startZ);
          map3DViewer.setShearY(SHEAR_COEFFICIENT * distanceY / startZ);
        }
        else{
          //shear in the negative direction for other points
          map3DViewer.setShearX(-SHEAR_COEFFICIENT * distanceX / startZ);
          map3DViewer.setShearY(-SHEAR_COEFFICIENT * distanceY / startZ);
          map3DViewer.setShift(startShiftX + 2*distanceX, 
                               startShiftY + 2*distanceY);
        }
    }
}
 
开发者ID:OSUCartography,项目名称:TerrainViewer,代码行数:24,代码来源:Map3DMouseHandler.java


示例8: localRelativeHeight

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
public static float localRelativeHeight(Map3DModel model, Rectangle2D.Float view, Point2D.Float position) {
  
  //number of samples across the current view
  int effectiveResolution = 100;
  //radius around which to sample for current view
  int radius = 10;
  
  float stepSizeX = view.width / effectiveResolution;
  float stepSizeY = view.height / effectiveResolution;
  
  float positionZ = model.z(position.x, position.y);
  int sampledPoints = 0;
  float sampledDiff = 0;
  
  for(int i = -radius; i <= radius; i++){
    for(int j = -radius; j <= radius; j++){
      if(Math.sqrt(Math.pow(i,2) + Math.pow(j,2)) > radius) continue;
      float sampleZ = model.z(position.x + stepSizeX * i,
                              position.y + stepSizeY * j);
      if(sampleZ == 0) continue; //typically out-of-bounds
      sampledDiff += (positionZ - sampleZ);
      sampledPoints++;
    }
  }
  return (float) sampledDiff / sampledPoints;
}
 
开发者ID:OSUCartography,项目名称:TerrainViewer,代码行数:27,代码来源:Map3DMouseHandler.java


示例9: isWithinInnerRadius

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/**
 * checks if the targer location is within the inner radius of the group.
 *
 * @param targetLoc
 * @return
 */
public boolean isWithinInnerRadius(Float targetLoc) {
	boolean ret = false;
	float innerRaidus = getInnerRadiusPixels();

	if ((Math.abs(location.x - targetLoc.x) <= innerRaidus) && (Math.abs(location.y - targetLoc.y) <= innerRaidus)) {
		ret = true;
	}

	return ret;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:17,代码来源:BlurringTunnelFilter.java


示例10: isWithinOuterRadius

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/**
 * checks if the targer location is within the outter radius of the group.
 *
 * @param targetLoc
 * @return
 */
public boolean isWithinOuterRadius(Float targetLoc) {
	boolean ret = false;
	float outterRaidus = getOutterRadiusPixels();

	if ((Math.abs(location.x - targetLoc.x) <= outterRaidus) && (Math.abs(location.y - targetLoc.y) <= outterRaidus)) {
		ret = true;
	}

	return ret;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:17,代码来源:BlurringTunnelFilter.java


示例11: isWithinAreaRadius

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/**
 * checks if the targer location is within the area radius of the group.
 *
 * @param targetLoc
 * @return
 */
public boolean isWithinAreaRadius(Float targetLoc) {
	boolean ret = false;
	float areaRaidus = getAreaRadiusPixels();

	if ((Math.abs(location.x - targetLoc.x) <= areaRaidus) && (Math.abs(location.y - targetLoc.y) <= areaRaidus)) {
		ret = true;
	}

	return ret;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:17,代码来源:BlurringTunnelFilter.java


示例12: agcGain

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
private int agcGain() {
    Float f = agcFilter.getValue2D();
    float diff = f.y - f.x;
    if (diff < 1) {
        return 1;
    }
    int gain = (int) (256 / (f.y - f.x));
    return gain;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:10,代码来源:NBFG256.java


示例13: getSizeFromShapeBounds

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/**
 * Gets the size from shape bounds.
 *
 * @return the size from shape bounds
 */
public Float getSizeFromShapeBounds()
{
	Rectangle2D rectangle = shape.getLogicalAnchor2D();
	Point2D.Float size = new Point2D.Float((float) rectangle.getWidth(), (float) rectangle.getHeight());
	return convertFloatToScaleZeroToOne(size.x, size.y);
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:12,代码来源:Convertor.java


示例14: getPositionFromShapeBounds

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/**
 * Gets the position from shape bounds.
 *
 * @return the position from shape bounds
 */
protected Float getPositionFromShapeBounds()
{
	Rectangle2D rectangle = shape.getAnchor2D();
	float xMiddle = (float) (rectangle.getX() + (rectangle.getWidth() / 2.0));
	float yMiddle = (float) (rectangle.getY() + (rectangle.getHeight() / 2.0));
	Point2D.Float positionZeroToOne = convertFloatToScaleZeroToOne(xMiddle, yMiddle);
	return positionZeroToOne;
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:14,代码来源:Convertor.java


示例15: calcLine

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/**
 * Calculates length of the linear segment.
 * @param coords Segment coordinates.
 * @param cp Start point.
 * @return Length of the segment.
 */
private float calcLine(float[] coords, Float cp) {
    float a = cp.x - coords[0];
    float b = cp.y - coords[1];
    float c = (float) Math.sqrt(a * a + b * b);
    return c;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:13,代码来源:BusyPainter.java


示例16: calcLengthOfQuad

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/**
 * Calculates length of the quadratic segment
 * @param coords Segment coordinates
 * @param cp Start point.
 * @return Length of the segment.
 */
private float calcLengthOfQuad(float[] coords, Point2D.Float cp) {
    Float ctrl = new Point2D.Float(coords[0], coords[1]);
    Float end = new Point2D.Float(coords[2], coords[3]);
    // get abs values
    // ctrl1
    float c1ax = Math.abs(cp.x - ctrl.x) ;
    float c1ay = Math.abs(cp.y - ctrl.y) ;
    // end1
    float e1ax = Math.abs(cp.x - end.x) ;
    float e1ay = Math.abs(cp.y - end.y) ;
    // get max value on each axis
    float maxX = Math.max(c1ax, e1ax);
    float maxY = Math.max(c1ay, e1ay);

    // trans coords from abs to rel
    // ctrl1
    ctrl.x = c1ax / maxX;
    ctrl.y = c1ay / maxY;
    // end1
    end.x = e1ax / maxX;
    end.y = e1ay / maxY;

    // claculate length
    float prevLength = 0, prevX = 0, prevY = 0;
    for (float t = 0.01f; t <= 1.0f; t += .01f) {
        Point2D.Float xy = getXY(t, new Float(0,0), ctrl, end);
        prevLength += (float) Math.sqrt((xy.x - prevX) * (xy.x - prevX)
                + (xy.y - prevY) * (xy.y - prevY));
        prevX = xy.x;
        prevY = xy.y;
    }
    // prev len is a fraction num of the real path length
    float a = Math.abs(coords[2] - cp.x);
    float b = Math.abs(coords[3] - cp.y);
    float dist = (float) Math.sqrt(a*a+b*b);
    return prevLength * dist;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:44,代码来源:BusyPainter.java


示例17: updateCenter

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
private final void updateCenter(final LocalPosePacket targ) {
	Point2D.Float target = new Point2D.Float(targ.getPositionX(), targ.getPositionY());
	if(target.x > (center.x + 10.0f) || target.x < (center.x - 10.0f)) {
		Kernel.getInstance().getSyslog().debug("*** Received a new target! ***");
		center = target;
	} else if(target.y > (center.y + 10.0f) || target.y < (center.y - 10.0f)) {
		Kernel.getInstance().getSyslog().debug("*** Received a new target! ***");
		center = target;
	}
	Kernel.getInstance().getSyslog().debug("*** Target location: " + center.toString() + "***");
}
 
开发者ID:drpjm,项目名称:pancakes,代码行数:12,代码来源:Encircle.java


示例18: updateCenter

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
private final void updateCenter(LocalPosePacket t) {
	Point2D.Float target = new Point2D.Float(t.getPositionX(), t.getPositionY());
	if(target.x > (center.x + 10.0f) || target.x < (center.x - 10.0f)) {
		Kernel.getInstance().getSyslog().debug("*** Received a new target! ***");
		center = target;
	} else if(target.y > (center.y + 10.0f) || target.y < (center.y - 10.0f)) {
		Kernel.getInstance().getSyslog().debug("*** Received a new target! ***");
		center = target;
	}
	Kernel.getInstance().getSyslog().debug("*** Target location: " + center.toString() + "***");
}
 
开发者ID:drpjm,项目名称:pancakes,代码行数:12,代码来源:ScanThreat.java


示例19: updateFractions

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/** This method must be called by the subclass in the constructor.
 * 
 * @param N 
 */
protected void updateFractions(int N) {
    fractions = new LengthItem[N];
    Float p = new Float();
    for (int i = 0; i < N; i++) {
        float t = (float) i / (N - 1);
        fractions[i] = new LengthItem(getXY(t, p), t);
    }
}
 
开发者ID:pojosontheweb,项目名称:selenium-utils,代码行数:13,代码来源:AbstractSplineInterpolator.java


示例20: mousePressed

import java.awt.geom.Point2D.Float; //导入依赖的package包/类
/**
 * Remember the point where the dragging starts.
 * @param e
 */
@Override
public void mousePressed(MouseEvent e) {
    this.startPoint = e.getPoint();
    this.lastPoint = e.getPoint();
    this.shearIsAnimating = false;
    
    if(shearAnimationOn && 
        map3DViewer.getCamera() == Map3DViewer.Camera.planOblique && 
        !e.isMetaDown() && !e.isAltDown() && !e.isShiftDown()){
        this.shearIsAnimating = true;
        this.currentVelocityX = 0;
        this.currentVelocityY = 0;
    }
    this.startShiftX = map3DViewer.getShiftX();
    this.startShiftY = map3DViewer.getShiftY();
    
    //FIXME: A few shearing experiments
    if(map3DViewer.getCamera() == Map3DViewer.Camera.planOblique && e.isMetaDown()){
        Point2D.Float startPosition = this.map3DViewer.mouseXYtoModelXY(lastPoint.x, lastPoint.y);
        startZ = map3DViewer.getModel().z(startPosition.x, startPosition.y);
        //(1) shearing centered around a set elevation
        //((Map3DModelVBOShader) map3DViewer.getModel()).setShearBaseline(startZ);

        //(2) shear reversal based on local max/min detector
        //shearReversed = isLocalMinMax(this.map3DViewer.getModel(), startPosition,100,0.6f) != -1;
        Rectangle2D.Float view = this.map3DViewer.getViewBounds();
        shearReversed = (localRelativeHeight(this.map3DViewer.getModel(), view, startPosition) <= 0);
        if(shearReversed)
            System.out.println("Using reverse shear.");
        else
            System.out.println("Using normal shear.");
    }
}
 
开发者ID:OSUCartography,项目名称:TerrainViewer,代码行数:38,代码来源:Map3DMouseHandler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Exclusion类代码示例发布时间:2022-05-21
下一篇:
Java User类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap