Java 类java.awt.geom.Point2D.Float 实例源码
项目:jaer
文件:BlurringTunnelFilter.java
/**
* 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();
}
项目:jaer
文件:NBFG256.java
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;
}
项目:swingx
文件:BusyPainter.java
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);
}
项目:swingx
文件:BusyPainter.java
/**
* 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;
}
项目:swingx
文件:BusyPainter.java
/**
* Calculates relative position of the point on the quad curve in time t<0,1>.
* @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;
}
项目:CONRAD
文件:PrimaryModulationScatterCorrectionTool.java
/**
*
* @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;
}
项目:aibench-project
文件:BusyPainter.java
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);
}
项目:aibench-project
文件:BusyPainter.java
/**
* 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;
}
项目:aibench-project
文件:BusyPainter.java
/**
* Calculates relative position of the point on the quad curve in time t<0,1>.
* @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;
}
项目:TerrainViewer
文件:Map3DMouseHandler.java
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);
}
}
}
项目:TerrainViewer
文件:Map3DMouseHandler.java
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;
}
项目:TerrainViewer
文件:Map3DMouseHandler.java
public static float localRelativeHeight(Map3DModel model, Point2D.Float position, int radius) {
float s = (Math.max(model.getCols(), model.getRows()) - 1);
int col = (int)Math.round(position.x * s);
int row = (int)Math.round(position.y * s);
float positionZ = model.z(col, row);
int sampledPoints = 0;
float sampledDiff = 0;
int gtPoints = 0;
int ltPoints = 0;
for(int i=col - radius; i < col + radius; i++){
for(int j=row - radius; j < row + radius; j++){
if(Math.sqrt(Math.pow(col - i,2) + Math.pow(row - j,2)) > radius) continue;
float sampleZ = model.z(i,j);
if(sampleZ == 0) continue; //typically out-of-bounds
if(sampleZ > positionZ) gtPoints++;
if(sampleZ < positionZ) ltPoints++;
sampledDiff += (positionZ - sampleZ);
sampledPoints++;
}
}
return (float) sampledDiff / sampledPoints;
}
项目:jaer
文件:BlurringTunnelFilter.java
/**
* 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;
}
项目:jaer
文件:BlurringTunnelFilter.java
/**
* 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;
}
项目:jaer
文件:BlurringTunnelFilter.java
/**
* 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;
}
项目:jaer
文件:NBFG256.java
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;
}
项目:synergynet3.1
文件:Convertor.java
/**
* 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);
}
项目:synergynet3.1
文件:Convertor.java
/**
* 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;
}
项目:swingx
文件:BusyPainter.java
/**
* 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;
}
项目:swingx
文件:BusyPainter.java
/**
* 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;
}
项目:pancakes
文件:Encircle.java
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() + "***");
}
项目:pancakes
文件:ScanThreat.java
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() + "***");
}
项目:aibench-project
文件:BusyPainter.java
/**
* 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;
}
项目:aibench-project
文件:BusyPainter.java
/**
* 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;
}
项目:selenium-utils
文件:AbstractSplineInterpolator.java
/** 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);
}
}
项目:TerrainViewer
文件:Map3DMouseHandler.java
/**
* 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.");
}
}
项目:TerrainViewer
文件:Map3DMouseHandler.java
/**
* FIXME: Hackish method for determining whether the specified point is
* a local minimum or maximum. Samples z values for all points in a radius
* around some position. If more than the fraction specified in 'threshold'
* are greater than the z value at the point, return -1 (local min). If more
* than that fraction are below the point, return 1 (local max). Otherwise
* return 0;
* @param position
* @param radius
* @param threshold
* @return
*/
public static int isLocalMinMax(Map3DModel model, Point2D.Float position, int radius, float threshold) {
//FIXME: Naive first stab - ACTUALLY DOESN'T WORK
float s = (Math.max(model.getCols(), model.getRows()) - 1);
int col = (int)Math.round(position.x * s);
int row = (int)Math.round(position.y * s);
float positionZ = model.z(col, row);
int sampledPoints = 0;
int gtPoints = 0;
int ltPoints = 0;
for(int i=col - radius; i < col + radius; i++){
for(int j=row - radius; j < row + radius; j++){
float sampleZ = model.z(i,j);
if(sampleZ == 0) continue; //typically out-of-bounds
if(sampleZ > positionZ) gtPoints++;
if(sampleZ < positionZ) ltPoints++;
sampledPoints++;
}
}
float gtFraction = (float) gtPoints / sampledPoints;
float ltFraction = (float) ltPoints / sampledPoints;
//System.out.println(gtFraction + " : " + ltFraction);
if(ltFraction >= threshold && gtFraction < threshold) return 1;
if(gtFraction >= threshold && ltFraction < threshold) return -1;
else return 0;
}
项目:morenaments-euc
文件:Voronoi.java
public void createGrid() {
/* 249 */ this.grid.reset();
/* 250 */ Point2D.Float tmp = new Point2D.Float();
/* 251 */ for (int t = 0; t < this.group.countTransforms(); ++t) {
/* 252 */ AffineTransform tr = this.group.getTransform(t);
/* 253 */ tr.transform((Point2D)this.cell.get(0), tmp);
/* 254 */ this.grid.moveTo(tmp.x, tmp.y);
/* 255 */ for (int i = 1; i < this.cell.size(); ++i) {
/* 256 */ tr.transform((Point2D)this.cell.get(i), tmp);
/* 257 */ this.grid.lineTo(tmp.x, tmp.y);
/* */ }
/* 259 */ this.grid.closePath();
/* */ }
/* */ }
项目:morenaments-euc
文件:Voronoi.java
private void createCompactGrid() {
/* 273 */ this.compactGrid.reset();
/* 274 */ PathIterator pi = getGrid().getPathIterator(null);
/* 275 */ float a = 0.0F; float b = 0.0F; float a0 = 0.0F; float b0 = 0.0F;
/* 276 */ float[] coords = new float[6];
/* 277 */ Point2D.Float pos = new Point2D.Float(-1.0F, -1.0F);
/* 278 */ while (!(pi.isDone())) {
/* 279 */ switch (pi.currentSegment(coords))
/* */ {
/* */ case 0:
/* 281 */ a0 = a = coords[0];
/* 282 */ b0 = b = coords[1];
/* 283 */ break;
/* */ case 1:
/* 285 */ addCompactLine(pos, a, b, coords[0], coords[1]);
/* 286 */ a = coords[0];
/* 287 */ b = coords[1];
/* 288 */ break;
/* */ case 4:
/* 290 */ addCompactLine(pos, a, b, a0, b0);
/* 291 */ a = a0;
/* 292 */ b = b0;
/* 293 */ break;
/* */ case 2:
/* */ case 3:
/* */ default:
/* 295 */ throw new IllegalStateException("non-linear grid path");
/* */ }
/* 297 */ pi.next();
/* */ }
/* */ }
项目:sejda
文件:PdfScaler.java
private static COSArray transformPoints(float[] points, Matrix transform) {
COSArray newPoints = new COSArray();
for (int i = 0; i < points.length; i++) {
Float newPoint = transform.transformPoint(points[i], points[++i]);
newPoints.add(new COSFloat(newPoint.x));
newPoints.add(new COSFloat(newPoint.y));
}
return newPoints;
}
项目:jaer
文件:BlurringTunnelFilter.java
@Override
synchronized public void initFilter() {
int prev_numOfNeuronsX = numOfNeuronsX;
int prev_numOfNeuronsY = numOfNeuronsY;
if(receptiveFieldSizePixels < 2) {
receptiveFieldSizePixels = 2;
}
halfReceptiveFieldSizePixels = receptiveFieldSizePixels/2;
// calculate the required number of neurons
if ((mychip.getSizeX() % halfReceptiveFieldSizePixels) == 0) {
numOfNeuronsX = mychip.getSizeX() / halfReceptiveFieldSizePixels - 1;
} else {
numOfNeuronsX = mychip.getSizeX() / halfReceptiveFieldSizePixels;
}
if ((mychip.getSizeY() % halfReceptiveFieldSizePixels) == 0) {
numOfNeuronsY = mychip.getSizeY() / halfReceptiveFieldSizePixels - 1;
} else {
numOfNeuronsY = mychip.getSizeY() / halfReceptiveFieldSizePixels;
}
lastTime = 0;
// firingNeurons.clear();
neuronGroups.clear();
numOfGroup = 0;
// initialize all neurons
if (((numOfNeuronsX > 0) && (numOfNeuronsY > 0)) &&
((prev_numOfNeuronsX != numOfNeuronsX) || (prev_numOfNeuronsY != numOfNeuronsY))) {
if (!lifNeurons.isEmpty()) {
lifNeurons.clear();
}
for (int j = 0; j < numOfNeuronsY; j++) {
for (int i = 0; i < numOfNeuronsX; i++) {
// creates a new neuron
int neuronNumber = i+(j*numOfNeuronsX);
Point2D.Float neuronIndex = new Point2D.Float(i, j);
Point2D.Float neuronLocationPixels = new Point2D.Float((i+1)*halfReceptiveFieldSizePixels, (j+1)*halfReceptiveFieldSizePixels);
LIFNeuron newNeuron = new LIFNeuron(neuronNumber, neuronIndex, neuronLocationPixels,
receptiveFieldSizePixels, MPTimeConstantUs, MPThreshold,
MPJumpAfterFiringPercentTh);
newNeuron.setMP(MPInitialPercnetTh*MPThreshold);
if (i == 0) {
if (j == 0) {
newNeuron.setLocationType(LocationType.CORNER_00);
} else if (j == (numOfNeuronsY - 1)) {
newNeuron.setLocationType(LocationType.CORNER_01);
} else {
newNeuron.setLocationType(LocationType.EDGE_0Y);
}
} else if (i == (numOfNeuronsX - 1)) {
if (j == 0) {
newNeuron.setLocationType(LocationType.CORNER_10);
} else if (j == (numOfNeuronsY - 1)) {
newNeuron.setLocationType(LocationType.CORNER_11);
} else {
newNeuron.setLocationType(LocationType.EDGE_1Y);
}
} else {
if (j == 0) {
newNeuron.setLocationType(LocationType.EDGE_X0);
} else if (j == (numOfNeuronsY - 1)) {
newNeuron.setLocationType(LocationType.EDGE_X1);
} else {
newNeuron.setLocationType(LocationType.INSIDE);
}
}
lifNeurons.add(newNeuron.getCellNumber(), newNeuron);
}
}
}
}
项目:jaer
文件:NBFG256.java
void applyAGCValues() {
Float f = agcFilter.getValue2D();
setApsIntensityOffset(agcOffset());
setApsIntensityGain(agcGain());
}
项目:OpenJSharp
文件:PhysicalStrike.java
/**
* {@inheritDoc}
*/
@Override
Float getCharMetrics(char ch){
return new Float(getCodePointAdvance(ch), 0);
}
项目:OpenJSharp
文件:PhysicalStrike.java
/**
* {@inheritDoc}
*/
@Override
void getGlyphImageBounds(int glyphcode, Float pt, Rectangle result){
throw new NotYetImplementedError();
}
项目:OpenJSharp
文件:PhysicalStrike.java
/**
* {@inheritDoc}
*/
@Override
Float getGlyphMetrics(int glyphcode){
return getCharMetrics((char)glyphcode);
}
项目:OpenJSharp
文件:PhysicalStrike.java
/**
* {@inheritDoc}
*/
@Override
java.awt.geom.Rectangle2D.Float getGlyphOutlineBounds(int glyphCode){
throw new NotYetImplementedError();
}
项目:scelight
文件:ObjectUnit.java
@Override
public Float getPos() {
return pos;
}
项目:scelight
文件:MapObjects.java
@Override
public List< Float > getStartLocationList() {
return startLocationList;
}
项目:scelight
文件:User.java
@Override
public Float getStartLocation() {
return startLocation;
}
项目:swingx
文件:BusyPainter.java
protected static Shape getScaledDefaultTrajectory(int height) {
return new Ellipse2D.Float(((height * 8) / 26) / 2, ((height * 8) / 26) / 2, height
- ((height * 8) / 26), height - ((height * 8) / 26));
}