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


Java MutableDouble.setValue方法代码示例

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


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

示例1: searchJams

import org.apache.commons.lang3.mutable.MutableDouble; //导入方法依赖的package包/类
public static StopModel searchJams(TrafficJamModel[] jams, String lineID, int direction, MutableInt jammedStopIndex, MutableDouble jammedStopDelay, String[] jammedStopTitle)
{
	for(TrafficJamModel jam : jams)
	{
		for(int i = 0 ; i < jam.slowVehicles.length; i++)
		{
			if(jam.slowVehicles[i].lineID.equals(lineID))
			{
				if(jam.slowVehicles[i].direction == direction){
					jammedStopIndex.setValue(i);
					jammedStopDelay.setValue(jam.cumulativeDelays[i]);
					jammedStopTitle[0] = jam.vehicleStops[i].name;
					return jam.vehicleStops[i];
				}
			}
		}
	}
	return null;
}
 
开发者ID:liarosge,项目名称:apps4thess,代码行数:20,代码来源:TrafficJamModel.java

示例2: updateNearestPoint

import org.apache.commons.lang3.mutable.MutableDouble; //导入方法依赖的package包/类
private void updateNearestPoint(
        @Nonnull Body body, @Nonnull Point2D point, @Nonnull Mutable<Point2D> nearestPoint,
        @Nonnull MutableDouble distanceToNearestPoint) {
    double distanceToPoint = body.getDistanceTo(point);

    if (distanceToPoint >= epsilon
            && (nearestPoint.get() == null || distanceToPoint < distanceToNearestPoint.doubleValue())) {
        nearestPoint.set(point);
        distanceToNearestPoint.setValue(distanceToPoint);
    }
}
 
开发者ID:Russian-AI-Cup,项目名称:notreal2d,代码行数:12,代码来源:RectangleAndArcCollider.java

示例3: updateFarthestPoint

import org.apache.commons.lang3.mutable.MutableDouble; //导入方法依赖的package包/类
private static void updateFarthestPoint(
        @Nonnull Body body, @Nonnull Point2D point, @Nonnull Mutable<Point2D> farthestPoint,
        @Nonnull MutableDouble distanceToFarthestPoint, double startAngle, double finishAngle) {
    double distanceToPoint = body.getDistanceTo(point);

    if (GeometryUtil.isAngleBetween(new Vector2D(body.getPosition(), point).getAngle(), startAngle, finishAngle)
            && (farthestPoint.get() == null || distanceToPoint > distanceToFarthestPoint.doubleValue())) {
        farthestPoint.set(point);
        distanceToFarthestPoint.setValue(distanceToPoint);
    }
}
 
开发者ID:Russian-AI-Cup,项目名称:notreal2d,代码行数:12,代码来源:RectangleAndArcCollider.java

示例4: interpolate_gradient

import org.apache.commons.lang3.mutable.MutableDouble; //导入方法依赖的package包/类
/**
 * Interpolate gradient.
 *
 * @param gradx
 *            the gradx
 * @param grady
 *            the grady
 * @param px
 *            the px
 * @param py
 *            the py
 * @param width
 *            the width
 * @param gx
 *            the gx
 * @param gy
 *            the gy
 */
/*
 * Interpolate the gradient of the gradient images gradx and grady with width
 * width at the point (px,py) using linear interpolation, and return the result
 * in (gx,gy).
 */
private void interpolate_gradient(float[] gradx, float[] grady, double px, double py, int width, MutableDouble gx,
		MutableDouble gy) {
	int gix, giy, gpos;
	double gfx, gfy, gx1, gy1, gx2, gy2, gx3, gy3, gx4, gy4;

	gix = (int) Math.floor(px);
	giy = (int) Math.floor(py);

	gfx = px % 1.0;
	;
	gfy = py % 1.0;
	gpos = LinesUtil.LINCOOR(gix, giy, width);
	gx1 = gradx[gpos];
	gy1 = grady[gpos];
	gpos = LinesUtil.LINCOOR(gix + 1, giy, width);
	gx2 = gradx[gpos];
	gy2 = grady[gpos];
	gpos = LinesUtil.LINCOOR(gix, giy + 1, width);
	gx3 = gradx[gpos];
	gy3 = grady[gpos];
	gpos = LinesUtil.LINCOOR(gix + 1, giy + 1, width);
	gx4 = gradx[gpos];
	gy4 = grady[gpos];
	gx.setValue((1 - gfy) * ((1 - gfx) * gx1 + gfx * gx2) + gfy * ((1 - gfx) * gx3 + gfx * gx4));
	gy.setValue((1 - gfy) * ((1 - gfx) * gy1 + gfx * gy2) + gfy * ((1 - gfx) * gy3 + gfx * gy4));
}
 
开发者ID:thorstenwagner,项目名称:ij-ridgedetection,代码行数:50,代码来源:Link.java

示例5: line_corrections

import org.apache.commons.lang3.mutable.MutableDouble; //导入方法依赖的package包/类
/**
 * Line corrections.
 *
 * @param sigma
 *            the sigma
 * @param w_est
 *            the w est
 * @param r_est
 *            the r est
 * @param w
 *            the w
 * @param h
 *            the h
 * @param correct
 *            the correct
 * @param w_strong
 *            the w strong
 * @param w_weak
 *            the w weak
 * @return true, if successful
 */
/*
 * Return the correct line width w and asymmetry h, and a line position
 * correction correct for a line with extracted width w_est and extracted
 * gradient ratio r_est for a given sigma. Furthermore, return the line width on
 * the weak and strong side of the line. These values are obtained by bilinear
 * interpolation from the table ctable.
 */
static boolean line_corrections(double sigma, double w_est, double r_est, MutableDouble w, MutableDouble h,
		MutableDouble correct, MutableDouble w_strong, MutableDouble w_weak) {
	int i_we, i_re;
	boolean is_valid;
	double a, b;

	w_est = w_est / sigma;
	if (w_est < 2 || w_est > 6 || r_est < 0 || r_est > 1) {
		w.setValue(0);
		h.setValue(0);
		correct.setValue(0);
		w_strong.setValue(0);
		w_weak.setValue(0);
		return true;
	}
	i_we = (int) Math.floor((w_est - 2) * 10);
	i_re = (int) Math.floor(r_est * 20);
	if (i_we == 40)
		i_we = 39;
	if (i_re == 20)
		i_re = 19;
	is_valid = getCTable(i_re, i_we).is_valid && getCTable(i_re, (i_we + 1)).is_valid
			&& getCTable((i_re + 1), i_we).is_valid && getCTable((i_re + 1), (i_we + 1)).is_valid;
	a = (w_est - 2) * 10 - i_we;
	b = r_est * 20 - i_re;

	w.setValue(BILINEAR(a, b, i_re, i_we, 0) * sigma);
	h.setValue(BILINEAR(a, b, i_re, i_we, 1));
	correct.setValue(BILINEAR(a, b, i_re, i_we, 2) * sigma);
	w_strong.setValue(BILINEAR(a, b, i_re, i_we, 3) * sigma);
	w_weak.setValue(BILINEAR(a, b, i_re, i_we, 4) * sigma);

	return !is_valid;
}
 
开发者ID:thorstenwagner,项目名称:ij-ridgedetection,代码行数:63,代码来源:Correct.java

示例6: closest_point

import org.apache.commons.lang3.mutable.MutableDouble; //导入方法依赖的package包/类
/**
 * Closest point.
 *
 * @param lx
 *            the lx
 * @param ly
 *            the ly
 * @param dx
 *            the dx
 * @param dy
 *            the dy
 * @param px
 *            the px
 * @param py
 *            the py
 * @param cx
 *            the cx
 * @param cy
 *            the cy
 * @param t
 *            the t
 */
/*
 * Calculate the closest point to (px,py) on the line (lx,ly) + t*(dx,dy) and
 * return the result in (cx,cy), plus the parameter in t.
 */
private void closest_point(double lx, double ly, double dx, double dy, double px, double py, MutableDouble cx,
		MutableDouble cy, MutableDouble t) {
	double mx, my, den, nom, tt;
	mx = px - lx;
	my = py - ly;
	den = dx * dx + dy * dy;
	nom = mx * dx + my * dy;
	if (den != 0)
		tt = nom / den;
	else
		tt = 0;
	cx.setValue(lx + tt * dx);
	cy.setValue(ly + tt * dy);
	t.setValue(tt);
}
 
开发者ID:thorstenwagner,项目名称:ij-ridgedetection,代码行数:42,代码来源:Link.java

示例7: solve_linear

import org.apache.commons.lang3.mutable.MutableDouble; //导入方法依赖的package包/类
/**
 * Solve the linear equation a*x+b=0 and return the result in t and the number
 * of solutions in num.
 *
 * @param a
 *            the a
 * @param b
 *            the b
 * @param t
 *            the t
 * @param num
 *            the num
 */
public void solve_linear(double a, double b, MutableDouble t, MutableInt num) {

	if (a == 0.0) { //
		num.setValue(0);
		return;
	} else {
		num.setValue(1);
		t.setValue(-b / a);
		return;
	}
}
 
开发者ID:thorstenwagner,项目名称:ij-ridgedetection,代码行数:25,代码来源:Position.java


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