當前位置: 首頁>>代碼示例>>Java>>正文


Java FloatPoint.distance方法代碼示例

本文整理匯總了Java中geometry.planar.FloatPoint.distance方法的典型用法代碼示例。如果您正苦於以下問題:Java FloatPoint.distance方法的具體用法?Java FloatPoint.distance怎麽用?Java FloatPoint.distance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在geometry.planar.FloatPoint的用法示例。


在下文中一共展示了FloatPoint.distance方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: nearest_end_point

import geometry.planar.FloatPoint; //導入方法依賴的package包/類
/**
 * returns the endpoint of this trace with the shortest distance
 * to p_from_point
 */
public Point nearest_end_point(Point p_from_point)
{
    Point p1 = first_corner();
    Point p2 = last_corner();
    FloatPoint from_point = p_from_point.to_float();
    double d1 = from_point.distance(p1.to_float());
    double d2 = from_point.distance(p2.to_float());
    Point result;
    if (d1 < d2)
    {
        result = p1;
    }
    else
    {
        result = p2;
    }
    return result;
}
 
開發者ID:andrasfuchs,項目名稱:BioBalanceDetector,代碼行數:23,代碼來源:Trace.java

示例2: try_neckdown_at_end

import geometry.planar.FloatPoint; //導入方法依賴的package包/類
/**
 * If the routed ends at a pin and the route failed with the normal trace width,
 * another try with the smalllest pin width is done.
 * Returns the ok_point of the try, which is p_from_corner, if the try failed.
 */
private Point try_neckdown_at_end(Point p_from_corner, Point p_to_corner)
{
    if (!(this.nearest_target_item instanceof board.Pin))
    {
        return p_from_corner;
    }
    board.Pin target_pin = (board.Pin) this.nearest_target_item;
    if (!target_pin.is_on_layer(this.layer))
    {
        return p_from_corner;
    }
    FloatPoint pin_center = target_pin.get_center().to_float();
    double curr_clearance =
            this.board.rules.clearance_matrix.value(this.clearance_class, target_pin.clearance_class_no(), this.layer);
    double pin_neck_down_distance =
            2 * (0.5 * target_pin.get_max_width(this.layer) + curr_clearance);
    if (pin_center.distance(p_from_corner.to_float()) >= pin_neck_down_distance)
    {
        return p_from_corner;
    }
    int neck_down_halfwidth = target_pin.get_trace_neckdown_halfwidth(this.layer);
    if (neck_down_halfwidth >= this.pen_half_width_arr[this.layer])
    {
        return p_from_corner;
    }
    TimeLimit time_limit = new TimeLimit(CHECK_FORCED_TRACE_TIME_LIMIT);
    Point ok_point = board.insert_forced_trace_segment(p_from_corner,
            p_to_corner, neck_down_halfwidth, layer, net_no_arr, clearance_class,
            max_shove_trace_recursion_depth, max_shove_via_recursion_depth,
            max_spring_over_recursion_depth, trace_tidy_width,
            pull_tight_accuracy, !is_stitch_mode, time_limit);
    return ok_point;
}
 
開發者ID:andrasfuchs,項目名稱:BioBalanceDetector,代碼行數:39,代碼來源:Route.java

示例3: Pin

import geometry.planar.FloatPoint; //導入方法依賴的package包/類
Pin(board.Pin p_board_pin)
{
    this.board_pin = p_board_pin;
    FloatPoint pin_location = p_board_pin.get_center().to_float();
    this.distance_to_component_center = pin_location.distance(gravity_center_of_smd_pins);
}
 
開發者ID:andrasfuchs,項目名稱:BioBalanceDetector,代碼行數:7,代碼來源:BatchFanout.java

示例4: try_neckdown_at_start

import geometry.planar.FloatPoint; //導入方法依賴的package包/類
/**
 * If the routed starts at a pin and the route failed with the normal trace width,
 * another try with the smalllest pin width is done.
 * Returns the ok_point of the try, which is this.prev_point, if the try failed.
 */
private Point try_neckdown_at_start(IntPoint p_to_corner)
{
    if (!(this.start_item instanceof board.Pin))
    {
        return this.prev_corner;
    }
    board.Pin start_pin = (board.Pin) this.start_item;
    if (!start_pin.is_on_layer(this.layer))
    {
        return this.prev_corner;
    }
    FloatPoint pin_center = start_pin.get_center().to_float();
    double curr_clearance =
            this.board.rules.clearance_matrix.value(this.clearance_class, start_pin.clearance_class_no(), this.layer);
    double pin_neck_down_distance =
            2 * (0.5 * start_pin.get_max_width(this.layer) + curr_clearance);
    if (pin_center.distance(this.prev_corner.to_float()) >= pin_neck_down_distance)
    {
        return this.prev_corner;
    }

    int neck_down_halfwidth = start_pin.get_trace_neckdown_halfwidth(this.layer);
    if (neck_down_halfwidth >= this.pen_half_width_arr[this.layer])
    {
        return this.prev_corner;
    }

    // check, that the neck_down started inside the pin shape
    if (!this.prev_corner.equals(start_pin.get_center()))
    {
        Item picked_item = this.board.pick_nearest_routing_item(this.prev_corner, this.layer, null);
        if (picked_item instanceof Trace)
        {
            if (((Trace) picked_item).get_half_width() > neck_down_halfwidth)
            {
                return this.prev_corner;
            }
        }
    }
    TimeLimit time_limit = new TimeLimit(CHECK_FORCED_TRACE_TIME_LIMIT);
    Point ok_point = board.insert_forced_trace_segment(prev_corner,
            p_to_corner, neck_down_halfwidth, layer, net_no_arr, clearance_class, max_shove_trace_recursion_depth,
            max_shove_via_recursion_depth, max_spring_over_recursion_depth, trace_tidy_width,
            pull_tight_accuracy, !is_stitch_mode, time_limit);
    return ok_point;
}
 
開發者ID:andrasfuchs,項目名稱:BioBalanceDetector,代碼行數:52,代碼來源:Route.java


注:本文中的geometry.planar.FloatPoint.distance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。