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


Java FloatPoint.weighted_distance方法代碼示例

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


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

示例1: expand_to_door_section

import geometry.planar.FloatPoint; //導入方法依賴的package包/類
/**
 * Return true, if the door section was successfully expanded.
 */
private boolean expand_to_door_section(ExpandableObject p_door, int p_section_no,
                                       FloatLine p_shape_entry, MazeListElement p_from_element,
                                       int p_add_costs, MazeSearchElement.Adjustment p_adjustment)
{
    if (p_door.get_maze_search_element(p_section_no).is_occupied || p_shape_entry == null)
    {
        return false;
    }
    CompleteExpansionRoom next_room = p_door.other_room(p_from_element.next_room);
    int layer = p_from_element.next_room.get_layer();
    FloatPoint shape_entry_middle = p_shape_entry.a.middle_point(p_shape_entry.b);
    double expansion_value = p_from_element.expansion_value + p_add_costs
            + shape_entry_middle.weighted_distance(p_from_element.shape_entry.a.middle_point(p_from_element.shape_entry.b),
            ctrl.trace_costs[layer].horizontal, ctrl.trace_costs[layer].vertical);
    double sorting_value = expansion_value + this.destination_distance.calculate(shape_entry_middle, layer);
    boolean room_ripped = p_add_costs > 0 && p_adjustment == MazeSearchElement.Adjustment.NONE || p_from_element.already_checked && p_from_element.room_ripped;

    MazeListElement new_element =
            new MazeListElement(p_door, p_section_no, p_from_element.door, p_from_element.section_no_of_door,
            expansion_value, sorting_value, next_room, p_shape_entry, room_ripped, p_adjustment, false);
    this.maze_expansion_list.add(new_element);
    return true;
}
 
開發者ID:andrasfuchs,項目名稱:BioBalanceDetector,代碼行數:27,代碼來源:MazeSearchAlgo.java

示例2: expand_to_drill_page

import geometry.planar.FloatPoint; //導入方法依賴的package包/類
/**
 * A drill page is inserted between an expansion roomm and the drill to expand
 * in order to prevent performance problems with rooms with big shapes containing many drills.
 */
private void expand_to_drill_page(DrillPage p_drill_page, MazeListElement p_from_element)
{

    int layer = p_from_element.next_room.get_layer();
    FloatPoint from_element_shape_entry_middle = p_from_element.shape_entry.a.middle_point(p_from_element.shape_entry.b);
    FloatPoint nearest_point =
            p_drill_page.shape.nearest_point(from_element_shape_entry_middle);
    double expansion_value = p_from_element.expansion_value + ctrl.min_normal_via_cost;
    double sorting_value =
            expansion_value + nearest_point.weighted_distance(from_element_shape_entry_middle,
            ctrl.trace_costs[layer].horizontal, ctrl.trace_costs[layer].vertical) + this.destination_distance.calculate(nearest_point, layer);
    MazeListElement new_element =
            new MazeListElement(p_drill_page, layer, p_from_element.door, p_from_element.section_no_of_door,
            expansion_value, sorting_value, p_from_element.next_room, p_from_element.shape_entry,
            p_from_element.room_ripped, MazeSearchElement.Adjustment.NONE, false);
    this.maze_expansion_list.add(new_element);
}
 
開發者ID:andrasfuchs,項目名稱:BioBalanceDetector,代碼行數:22,代碼來源:MazeSearchAlgo.java


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