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


Java FloatPoint类代码示例

本文整理汇总了Java中geometry.planar.FloatPoint的典型用法代码示例。如果您正苦于以下问题:Java FloatPoint类的具体用法?Java FloatPoint怎么用?Java FloatPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: search_from_side

import geometry.planar.FloatPoint; //导入依赖的package包/类
private void search_from_side()
{
    if (this.from_side != null && this.from_side.no  >= 0)
    {
        return; // from side is already legal
    }
    EntryPoint curr_node = this.list_anchor;
    int curr_fromside_no = 0;
    FloatPoint curr_entry_approx = null;
    while (curr_node != null)
    {
        if (curr_node.trace.shares_net_no(this.own_net_nos))
        {
            curr_fromside_no = curr_node.edge_no;
            curr_entry_approx = curr_node.entry_approx;
            break;
        }
        curr_node = curr_node.next;
    }
    this.from_side = new CalcFromSide(curr_fromside_no, curr_entry_approx);
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:22,代码来源:ShapeTraceEntries.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

示例3: swap_pin

import geometry.planar.FloatPoint; //导入依赖的package包/类
public InteractiveState swap_pin(FloatPoint p_location)
{
    ItemSelectionFilter selection_filter = new ItemSelectionFilter(ItemSelectionFilter.SelectableChoices.PINS);
    Collection<Item> picked_items = hdlg.pick_items(p_location, selection_filter);
    InteractiveState result = this;
    if (picked_items.size() > 0)
    {
        Item first_item = picked_items.iterator().next();
        if (!(first_item instanceof board.Pin))
        {
            System.out.println("MenuState.swap_pin: Pin expected");
            return this;
        }
        board.Pin selected_pin = (board.Pin) first_item;
        result = PinSwapState.get_instance(selected_pin, this, hdlg, this.logfile);
    }
    else
    {
        hdlg.screen_messages.set_status_message(resources.getString("no_pin_selected"));
    }
    hdlg.repaint();
    return result;
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:24,代码来源:MenuState.java

示例4: left_button_clicked

import geometry.planar.FloatPoint; //导入依赖的package包/类
/**
 * Actions to be taken in the current interactive state
 * when the left mouse butten is clicked.
 */
public void left_button_clicked(Point2D p_point)
{
    if (board_is_read_only)
    {
        if (this.interactive_action_thread != null)
        {
            // The left button is used to stop the interactive action thread.
            this.interactive_action_thread.request_stop();
        }
        return;
    }
    if (interactive_state != null && graphics_context != null)
    {
        FloatPoint location =
                graphics_context.coordinate_transform.screen_to_board(p_point);
        InteractiveState return_state =
                interactive_state.left_button_clicked(location);
        if (return_state != interactive_state && return_state != null)
        {
            set_interactive_state(return_state);
            repaint();
        }
    }
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:29,代码来源:BoardHandling.java

示例5: join

import geometry.planar.FloatPoint; //导入依赖的package包/类
/**
 * enlarges the octagon on p_layer, so that it contains p_point
 */
public void join (FloatPoint p_point, int p_layer)
{
    MutableOctagon curr = arr[p_layer];
    curr.lx = Math.min(p_point.x, curr.lx);
    curr.ly = Math.min(p_point.y, curr.ly);
    curr.rx = Math.max(curr.rx, p_point.x);
    curr.uy = Math.max(curr.uy, p_point.y);

    double tmp = p_point.x - p_point.y;
    curr.ulx = Math.min(curr.ulx, tmp);
    curr.lrx = Math.max(curr.lrx, tmp);

    tmp = p_point.x + p_point.y;
    curr.llx = Math.min(curr.llx, tmp);
    curr.urx = Math.max(curr.urx, tmp);
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:20,代码来源:ChangedArea.java

示例6: mark_all_changed_area

import geometry.planar.FloatPoint; //导入依赖的package包/类
/**
 * marks the whole board as changed
 */
public void mark_all_changed_area()
{
    start_marking_changed_area();
    FloatPoint[] board_corners = new FloatPoint[4];
    board_corners[0] = bounding_box.ll.to_float();
    board_corners[1] = new FloatPoint(bounding_box.ur.x, bounding_box.ll.y);
    board_corners[2] = bounding_box.ur.to_float();
    board_corners[3] = new FloatPoint(bounding_box.ll.x, bounding_box.ur.y);
    for (int i = 0; i < get_layer_count(); ++i)
    {
        for (int j = 0; j < 4; ++j)
        {
            join_changed_area(board_corners[j], i);
        }
    }
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:20,代码来源:RoutingBoard.java

示例7: screen_to_board

import geometry.planar.FloatPoint; //导入依赖的package包/类
/**
 * Transform a java.awt.geom.Point2D to a geometry.planar.FloatPoint
 */
public FloatPoint screen_to_board(Point2D p_point)
{
    double x, y;
    if (this.mirror_left_right)
    {
        x = design_box_with_offset.width() -(p_point.getX() - display_x_offset) / scale_factor - 1;
    }
    else
    {
        x =  (p_point.getX() + display_x_offset)/ scale_factor;
    }
    if (this.mirror_top_bottom)
    {
        y = design_box_with_offset.height() -(p_point.getY() - display_y_offset) / scale_factor - 1;
    }
    else
    {
        y =  (p_point.getY() + display_y_offset)/ scale_factor;
    }
    FloatPoint result = new FloatPoint(x, y);
    return result.rotate(-this.rotation, this.rotation_pole);
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:26,代码来源:CoordinateTransform.java

示例8: draw

import geometry.planar.FloatPoint; //导入依赖的package包/类
public void draw(java.awt.Graphics p_graphics)
{
    super.draw(p_graphics);
    if (route == null)
    {
        return;
    }
    // draw a line from the routing end point to the cursor
    FloatPoint [] draw_points = new FloatPoint[2];
    draw_points[0] = route.get_last_corner().to_float();
    draw_points[1] = hdlg.get_current_mouse_position();
    java.awt.Color draw_color = hdlg.graphics_context.get_hilight_color();
    double display_width = hdlg.get_trace_halfwidth(route.net_no_arr[0], hdlg.settings.layer);
    int clearance_draw_width = 50;
    double radius_with_clearance = display_width;
    rules.NetClass default_net_class = hdlg.get_routing_board().rules.get_default_net_class();
    int cl_class = default_net_class.default_item_clearance_classes.get(rules.DefaultItemClearanceClasses.ItemClass.TRACE);
    radius_with_clearance +=  hdlg.get_routing_board().clearance_value(cl_class, cl_class, hdlg.settings.layer);
    hdlg.graphics_context.draw(draw_points, display_width, draw_color, p_graphics, 0.5);
    // draw the clearance boundary around the end point
    hdlg.graphics_context.draw_circle(draw_points[1], radius_with_clearance, clearance_draw_width, draw_color, p_graphics, 0.5);
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:23,代码来源:StitchRouteState.java

示例9: 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

示例10: line_outside_update_box

import geometry.planar.FloatPoint; //导入依赖的package包/类
/**
 * filter lines, which cannot touch the update_box to improve the
 * performance of the draw function by avoiding unnessesary calls
 * of draw (line)
 */
private boolean line_outside_update_box(FloatPoint p_1,
        FloatPoint p_2, double p_update_offset, IntBox p_update_box)
{
    if (p_1 == null || p_2 == null)
    {
        return true;
    }
    if (Math.max(p_1.x, p_2.x) < p_update_box.ll.x - p_update_offset)
    {
        return true;
    }
    if (Math.max(p_1.y, p_2.y) < p_update_box.ll.y - p_update_offset )
    {
        return true;
    }
    if (Math.min(p_1.x, p_2.x) > p_update_box.ur.x + p_update_offset)
    {
        return true;
    }
    if (Math.min(p_1.y, p_2.y) > p_update_box.ur.y + p_update_offset)
    {
        return true;
    }
    return false;
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:31,代码来源:GraphicsContext.java

示例11: right_turn_next_corner

import geometry.planar.FloatPoint; //导入依赖的package包/类
/**
 * Calculates as first line the left side tangent from p_from_corner to
 * the circle with center p_to_corner and radius p_dist.
 * As second line the right side tangent from p_to_corner to the circle
 * with center p_next_corner and radius 2 * p_dist is constructed.
 * The second line is than translated by the distance p_dist to the left.
 * Returned is the intersection of the first and the second line.
 */
private FloatPoint right_turn_next_corner(FloatPoint p_from_corner, double p_dist, FloatPoint p_to_corner, FloatPoint p_next_corner)
{
    FloatPoint curr_tangential_point = p_from_corner.left_tangential_point(p_to_corner, p_dist);
    if (curr_tangential_point == null)
    {
        if (this.test_level.ordinal() >=  TestLevel.ALL_DEBUGGING_OUTPUT.ordinal())
        {
            System.out.println("LocateFoundConnectionAlgo.right_turn_next_corner: left tangential point is null");
        }
        return p_from_corner;
    }
    FloatLine first_line = new FloatLine(p_from_corner, curr_tangential_point);
    curr_tangential_point = p_to_corner.right_tangential_point(p_next_corner, 2 * p_dist + c_tolerance);
    if (curr_tangential_point == null)
    {
        if (this.test_level.ordinal() >=  TestLevel.ALL_DEBUGGING_OUTPUT.ordinal())
        {
            System.out.println("LocateFoundConnectionAlgo.right_turn_next_corner: right tangential point is null");
        }
        return p_from_corner;
    }
    FloatLine second_line = new FloatLine(p_to_corner, curr_tangential_point);
    second_line = second_line.translate(p_dist);
    return first_line.intersection(second_line);
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:34,代码来源:LocateFoundConnectionAlgoAnyAngle.java

示例12: add_corner

import geometry.planar.FloatPoint; //导入依赖的package包/类
/**
 * adds a FloatPoint to the logfile
 */
public void add_corner(FloatPoint p_corner)
{
    if (write_enabled)
    {
        if (p_corner == null)
        {
            System.out.println("logfile.add_corner: p_corner is null");
            return;
        }
        try
        {
            this.file_writer.write((new Double(p_corner.x)).toString());
            this.file_writer.write(" ");
            this.file_writer.write((new Double(p_corner.y)).toString());
            this.file_writer.write("\n");
        }
        catch (IOException e2)
        {
            System.out.println("unable to write to logfile while adding corner");
        }
    }
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:26,代码来源:Logfile.java

示例13: draw_boundary

import geometry.planar.FloatPoint; //导入依赖的package包/类
/**
 * Draws the boundary of p_shape.
 */
public void draw_boundary(Shape p_shape, double p_draw_half_width, Color p_color,  Graphics p_g, double p_translucency_factor)
{
    if (p_shape instanceof PolylineShape)
    {
        FloatPoint[] draw_corners = p_shape.corner_approx_arr();
        if (draw_corners.length <= 1)
        {
            return;
        }
        FloatPoint[] closed_draw_corners = new FloatPoint[draw_corners.length + 1];
        System.arraycopy(draw_corners, 0, closed_draw_corners, 0, draw_corners.length);
        closed_draw_corners[closed_draw_corners.length - 1] = draw_corners [0];
        this.draw( closed_draw_corners, p_draw_half_width, p_color, p_g, p_translucency_factor);
    }
    else if (p_shape instanceof Circle)
    {
        Circle curr_circle = (Circle) p_shape;
        this.draw_circle(curr_circle.center.to_float(), curr_circle.radius, p_draw_half_width,
                p_color, p_g, p_translucency_factor);
    }
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:25,代码来源:GraphicsContext.java

示例14: fill_area

import geometry.planar.FloatPoint; //导入依赖的package包/类
/**
 * Fill the interiour of a list of polygons.
 * Used for example with an area consisting of a border polygon and some holes.
 */
public void fill_area(FloatPoint[][] p_point_lists, Graphics p_g, Color p_color, double p_translucency_factor)
{
    if (p_color == null)
    {
        return;
    }
    GeneralPath draw_path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
    for (int j = 0; j < p_point_lists.length; ++j)
    {
        Polygon draw_polygon = new Polygon();
        FloatPoint[] curr_point_list = p_point_lists[j];
        for(int i= 0; i < curr_point_list.length; i++)
        {
            Point2D curr_corner = coordinate_transform.board_to_screen(curr_point_list[i]);
            draw_polygon.addPoint((int)Math.round(curr_corner.getX()),
                    (int)Math.round(curr_corner.getY()));
        }
        draw_path.append(draw_polygon, false);
    }
    Graphics2D g2 = (Graphics2D)p_g;
    g2.setColor(p_color);
    set_translucency(g2, p_translucency_factor);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.fill(draw_path);
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:30,代码来源:GraphicsContext.java

示例15: toggle_select_action

import geometry.planar.FloatPoint; //导入依赖的package包/类
/**
 * Picks item at p_point.
 * Removes it from the selected_items list, if it is already in there,
 * otherwise adds it to the list.
 * Changes to the selected items state, if something was selected.
 */
public void toggle_select_action(Point2D p_point)
{
    if (board_is_read_only || !(interactive_state instanceof SelectedItemState))
    {
        return;
    }
    FloatPoint location =
            graphics_context.coordinate_transform.screen_to_board(p_point);
    InteractiveState return_state =
            ((SelectedItemState) interactive_state).toggle_select(location);
    if (return_state != this.interactive_state)
    {
        set_interactive_state(return_state);
        repaint();
    }
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:23,代码来源:BoardHandling.java


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