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


Java FloatPoint.change_length方法代码示例

本文整理汇总了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;
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:66,代码来源:OptViaAlgo.java


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