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


Java Float类代码示例

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


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


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