本文整理匯總了Java中geometry.planar.FloatPoint.change_length方法的典型用法代碼示例。如果您正苦於以下問題:Java FloatPoint.change_length方法的具體用法?Java FloatPoint.change_length怎麽用?Java FloatPoint.change_length使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類geometry.planar.FloatPoint
的用法示例。
在下文中一共展示了FloatPoint.change_length方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: reposition_via
import geometry.planar.FloatPoint; //導入方法依賴的package包/類
/**
* Tries to move the via into the direction of p_to_location as far as possible
* Return the new location of the via, or null, if no move was possible.
*/
private static Point reposition_via(RoutingBoard p_board, Via p_via,
IntPoint p_to_location, int p_trace_half_width, int p_trace_layer, int p_trace_cl_class)
{
Point from_location = p_via.get_center();
if (from_location.equals(p_to_location))
{
return null;
}
double ok_length = p_board.check_trace_segment(from_location, p_to_location, p_trace_layer, p_via.net_no_arr,
p_trace_half_width, p_trace_cl_class, false);
if (ok_length <= 0)
{
return null;
}
FloatPoint float_from_location = from_location.to_float();
FloatPoint float_to_location = p_to_location.to_float();
FloatPoint new_float_to_location;
if (ok_length >= Integer.MAX_VALUE)
{
new_float_to_location = float_to_location;
}
else
{
new_float_to_location = float_from_location.change_length(float_to_location, ok_length);
}
Point new_to_location = new_float_to_location.round();
Vector delta = new_to_location.difference_by(from_location);
boolean check_ok =
MoveDrillItemAlgo.check(p_via, delta, 0, 0, null, p_board, null);
if (check_ok)
{
return new_to_location;
}
final double c_min_length = 0.3 * p_trace_half_width + 1;
ok_length = Math.min(ok_length, float_from_location.distance(float_to_location));
double curr_length = ok_length / 2;
ok_length = 0;
Point result = null;
while (curr_length >= c_min_length)
{
Point check_point = float_from_location.change_length(float_to_location, ok_length + curr_length).round();
delta = check_point.difference_by(from_location);
if (MoveDrillItemAlgo.check(p_via, delta, 0, 0, null, p_board, null))
{
ok_length += curr_length;
result = check_point;
}
curr_length /= 2;
}
return result;
}