本文整理汇总了Java中geometry.planar.IntOctagon类的典型用法代码示例。如果您正苦于以下问题:Java IntOctagon类的具体用法?Java IntOctagon怎么用?Java IntOctagon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntOctagon类属于geometry.planar包,在下文中一共展示了IntOctagon类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get_instance
import geometry.planar.IntOctagon; //导入依赖的package包/类
/**
* Returns a new instance of PullTightAlgo.
* If p_only_net_no > 0, only traces with net number p_not_no are optimized.
* If p_stoppable_thread != null, the agorithm can be requested to be stopped.
* If p_time_limit > 0; the algorithm will be stopped after p_time_limit Milliseconds.
*/
static PullTightAlgo get_instance(RoutingBoard p_board,
int[] p_only_net_no_arr, IntOctagon p_clip_shape, int p_min_translate_dist,
Stoppable p_stoppable_thread, int p_time_limit, Point p_keep_point, int p_keep_point_layer)
{
PullTightAlgo result;
AngleRestriction angle_restriction = p_board.rules.get_trace_angle_restriction();
if (angle_restriction == AngleRestriction.NINETY_DEGREE)
{
result = new PullTightAlgo90(p_board, p_only_net_no_arr, p_stoppable_thread, p_time_limit,
p_keep_point, p_keep_point_layer);
}
else if (angle_restriction == AngleRestriction.FORTYFIVE_DEGREE)
{
result = new PullTightAlgo45(p_board, p_only_net_no_arr, p_stoppable_thread, p_time_limit,
p_keep_point, p_keep_point_layer);
}
else
{
result = new PullTightAlgoAnyAngle(p_board, p_only_net_no_arr, p_stoppable_thread, p_time_limit,
p_keep_point, p_keep_point_layer);
}
result.curr_clip_shape = p_clip_shape;
result.min_translate_dist = Math.max(p_min_translate_dist, 100);
return result;
}
示例2: insert_trace
import geometry.planar.IntOctagon; //导入依赖的package包/类
/**
* Inserts a trace into the board, whose geometry is described by
* a Polyline. p_clearance_class is the index in the clearance_matix,
* which describes the required clearance restrictions to other items.
*/
public void insert_trace(Polyline p_polyline, int p_layer,
int p_half_width, int[] p_net_no_arr, int p_clearance_class, FixedState p_fixed_state)
{
PolylineTrace new_trace =
insert_trace_without_cleaning(p_polyline, p_layer, p_half_width,
p_net_no_arr, p_clearance_class, p_fixed_state);
if (new_trace == null)
{
return;
}
IntOctagon clip_shape = null;
if (this instanceof RoutingBoard)
{
ChangedArea changed_area = ((RoutingBoard) this).changed_area;
if (changed_area != null)
{
clip_shape = changed_area.get_area(p_layer);
}
}
new_trace.normalize(clip_shape);
}
示例3: split_traces
import geometry.planar.IntOctagon; //导入依赖的package包/类
/**
* Looks for traces of the input net on the input layer, so that p_location is on the trace polygon,
* and splits these traces. Returns false, if no trace was split.
*/
public boolean split_traces(Point p_location, int p_layer, int p_net_no)
{
ItemSelectionFilter filter = new ItemSelectionFilter(ItemSelectionFilter.SelectableChoices.TRACES);
Collection<Item> picked_items = this.pick_items(p_location, p_layer, filter);
IntOctagon location_shape = TileShape.get_instance(p_location).bounding_octagon();
boolean trace_split = false;
for (Item curr_item : picked_items)
{
Trace curr_trace = (Trace) curr_item;
if (curr_trace.contains_net(p_net_no))
{
Collection<PolylineTrace> split_pieces = curr_trace.split(location_shape);
if (split_pieces.size() != 1)
{
trace_split = true;
}
}
}
return trace_split;
}
示例4: touching_pins_at_end_corners
import geometry.planar.IntOctagon; //导入依赖的package包/类
/**
* Looks up touching pins at the first corner and the last corner of the trace.
* Used to avoid acid traps.
*/
Set<Pin> touching_pins_at_end_corners()
{
Set<Pin> result = new TreeSet<Pin>();
if (this.board == null)
{
return result;
}
Point curr_end_point = this.first_corner();
for (int i = 0; i < 2; ++i)
{
IntOctagon curr_oct = curr_end_point.surrounding_octagon();
curr_oct = curr_oct.enlarge(this.half_width);
Set<Item> curr_overlaps = this.board.overlapping_items_with_clearance(curr_oct, this.layer, new int[0], this.clearance_class_no());
for (Item curr_item : curr_overlaps)
{
if ((curr_item instanceof Pin) && curr_item.shares_net(this))
{
result.add((Pin)curr_item);
}
}
curr_end_point = this.last_corner();
}
return result;
}
示例5: opt_changed_area
import geometry.planar.IntOctagon; //导入依赖的package包/类
/**
* Optimizes the route in the internally marked area.
* If p_net_no > 0, only traces with net number p_net_no are optimized.
* If p_clip_shape != null the optimizing is restricted to p_clip_shape.
* p_trace_cost_arr is used for optimizing vias and may be null.
* If p_stoppable_thread != null, the agorithm can be requested to be stopped.
* If p_time_limit > 0; the algorithm will be stopped after p_time_limit Milliseconds.
* If p_keep_point != null, traces on layer p_keep_point_layer containing p_keep_point
* will also contain this point after optimizing.
*/
public void opt_changed_area(int[] p_only_net_no_arr, IntOctagon p_clip_shape, int p_accuracy, ExpansionCostFactor[] p_trace_cost_arr,
Stoppable p_stoppable_thread, int p_time_limit, Point p_keep_point, int p_keep_point_layer)
{
if (changed_area == null)
{
return;
}
if (p_clip_shape != IntOctagon.EMPTY)
{
PullTightAlgo pull_tight_algo =
PullTightAlgo.get_instance(this, p_only_net_no_arr, p_clip_shape,
p_accuracy, p_stoppable_thread, p_time_limit, p_keep_point, p_keep_point_layer);
pull_tight_algo.opt_changed_area(p_trace_cost_arr);
}
join_graphics_update_box(changed_area.surrounding_box());
changed_area = null;
}
示例6: insert_incomplete_room
import geometry.planar.IntOctagon; //导入依赖的package包/类
/**
* Inserts a new incomplete room with an octagon shape.
*/
private void insert_incomplete_room(AutorouteEngine p_autoroute_engine, int p_lx, int p_ly, int p_rx, int p_uy,
int p_ulx, int p_lrx, int p_llx, int p_urx)
{
IntOctagon new_incomplete_room_shape = new IntOctagon(p_lx, p_ly, p_rx, p_uy, p_ulx, p_lrx, p_llx, p_urx);
new_incomplete_room_shape = new_incomplete_room_shape.normalize();
if (new_incomplete_room_shape.dimension() == 2)
{
IntOctagon new_contained_shape = this.room_shape.intersection(new_incomplete_room_shape);
if (!new_contained_shape.is_empty())
{
int door_dimension = new_contained_shape.dimension();
if (door_dimension > 0)
{
FreeSpaceExpansionRoom new_room =
p_autoroute_engine.add_incomplete_expansion_room(new_incomplete_room_shape, this.from_room.get_layer(), new_contained_shape);
ExpansionDoor new_door = new ExpansionDoor(this.completed_room, new_room, door_dimension);
this.completed_room.add_door(new_door);
new_room.add_door(new_door);
}
}
}
}
示例7: to_int
import geometry.planar.IntOctagon; //导入依赖的package包/类
/**
* calculates the smallest IntOctagon containing this octagon.
*/
IntOctagon to_int()
{
if (rx < lx || uy < ly || lrx < ulx || urx < llx)
{
return IntOctagon.EMPTY;
}
return new IntOctagon ((int)Math.floor(lx), (int)Math.floor(ly),
(int)Math.ceil(rx), (int)Math.ceil(uy),
(int)Math.floor(ulx), (int)Math.ceil(lrx),
(int)Math.floor(llx), (int)Math.ceil(urx));
}
示例8: forced_via
import geometry.planar.IntOctagon; //导入依赖的package包/类
/**
* Shoves aside traces, so that a via with the input parameters can be
* inserted without clearance violations. If the shove failed, the database may be damaged, so that an undo
* becomes necessesary. Returns false, if the forced via failed.
*/
public boolean forced_via(ViaInfo p_via_info, Point p_location, int[] p_net_no_arr,
int p_trace_clearance_class_no, int[] p_trace_pen_halfwidth_arr,
int p_max_recursion_depth, int p_max_via_recursion_depth,
int p_tidy_width, int p_pull_tight_accuracy, int p_pull_tight_time_limit)
{
clear_shove_failing_obstacle();
this.start_marking_changed_area();
boolean result = ForcedViaAlgo.insert(p_via_info, p_location, p_net_no_arr,
p_trace_clearance_class_no, p_trace_pen_halfwidth_arr,
p_max_recursion_depth, p_max_via_recursion_depth, this);
if (result)
{
IntOctagon tidy_clip_shape;
if (p_tidy_width < Integer.MAX_VALUE)
{
tidy_clip_shape = p_location.surrounding_octagon().enlarge(p_tidy_width);
}
else
{
tidy_clip_shape = null;
}
int[] opt_net_no_arr;
if (p_max_recursion_depth <= 0)
{
opt_net_no_arr = p_net_no_arr;
}
else
{
opt_net_no_arr = new int[0];
}
this.opt_changed_area(opt_net_no_arr, tidy_clip_shape,
p_pull_tight_accuracy, null, null, p_pull_tight_time_limit);
}
return result;
}
示例9: obstacle_segment_touches_inside
import geometry.planar.IntOctagon; //导入依赖的package包/类
/**
* Checks, if the border line segment with index p_obstacle_border_line_no intersects with the inside
* of p_room_shape.
*/
private static boolean obstacle_segment_touches_inside(IntOctagon p_obstacle_shape,
int p_obstacle_border_line_no, IntOctagon p_room_shape)
{
int curr_border_line_no = p_obstacle_border_line_no;
int curr_obstacle_corner_x = p_obstacle_shape.corner_x(p_obstacle_border_line_no);
int curr_obstacle_corner_y = p_obstacle_shape.corner_y(p_obstacle_border_line_no);
for (int j = 0; j < 5; ++j)
{
if (p_room_shape.side_of_border_line(curr_obstacle_corner_x, curr_obstacle_corner_y,
curr_border_line_no) != Side.ON_THE_LEFT)
{
return false;
}
curr_border_line_no = (curr_border_line_no + 1) % 8;
}
int next_obstacle_border_line_no = (p_obstacle_border_line_no + 1) % 8;
int next_obstacle_corner_x = p_obstacle_shape.corner_x(next_obstacle_border_line_no);
int next_obstacle_corner_y = p_obstacle_shape.corner_y(next_obstacle_border_line_no);
curr_border_line_no = (p_obstacle_border_line_no + 5) % 8;
for (int j = 0; j < 3; ++j)
{
if (p_room_shape.side_of_border_line(next_obstacle_corner_x, next_obstacle_corner_y,
curr_border_line_no) != Side.ON_THE_LEFT)
{
return false;
}
curr_border_line_no = (curr_border_line_no + 1) % 8;
}
return true;
}
示例10: transform_to_board
import geometry.planar.IntOctagon; //导入依赖的package包/类
public geometry.planar.Shape transform_to_board(CoordinateTransform p_coordinate_transform)
{
FloatPoint [] corner_arr = new FloatPoint[this.coordinate_arr.length / 2];
double [] curr_point = new double [2];
for (int i = 0; i < corner_arr.length; ++i)
{
curr_point[0] = this.coordinate_arr[2 * i];
curr_point[1] = this.coordinate_arr[2 * i + 1];
corner_arr[i] = p_coordinate_transform.dsn_to_board(curr_point);
}
double offset = p_coordinate_transform.dsn_to_board(this.width) / 2;
if (corner_arr.length <= 2)
{
IntOctagon bounding_oct = FloatPoint.bounding_octagon(corner_arr);
return bounding_oct.enlarge(offset);
}
IntPoint [] rounded_corner_arr = new IntPoint[corner_arr.length];
for (int i = 0; i < corner_arr.length; ++i)
{
rounded_corner_arr[i] = corner_arr[i].round();
}
geometry.planar.Shape result = new geometry.planar.PolygonShape(rounded_corner_arr);
if (offset > 0)
{
result = result.bounding_tile().enlarge(offset);
}
return result;
}
示例11: transform_to_board_rel
import geometry.planar.IntOctagon; //导入依赖的package包/类
public geometry.planar.Shape transform_to_board_rel(CoordinateTransform p_coordinate_transform)
{
FloatPoint [] corner_arr = new FloatPoint[this.coordinate_arr.length / 2];
double [] curr_point = new double [2];
for (int i = 0; i < corner_arr.length; ++i)
{
curr_point[0] = this.coordinate_arr[2 * i];
curr_point[1] = this.coordinate_arr[2 * i + 1];
corner_arr[i] = p_coordinate_transform.dsn_to_board_rel(curr_point);
}
double offset = p_coordinate_transform.dsn_to_board(this.width) / 2;
if (corner_arr.length <= 2)
{
IntOctagon bounding_oct = FloatPoint.bounding_octagon(corner_arr);
return bounding_oct.enlarge(offset);
}
IntPoint [] rounded_corner_arr = new IntPoint[corner_arr.length];
for (int i = 0; i < corner_arr.length; ++i)
{
rounded_corner_arr[i] = corner_arr[i].round();
}
geometry.planar.Shape result = new geometry.planar.PolygonShape(rounded_corner_arr);
if (offset > 0)
{
result = result.bounding_tile().enlarge(offset);
}
return result;
}
示例12: door_is_small
import geometry.planar.IntOctagon; //导入依赖的package包/类
/**
* Checks, if the width p_door is big enough for a trace with width p_trace_width.
*/
private boolean door_is_small(ExpansionDoor p_door, double p_trace_width)
{
if (p_door.dimension == 1 || p_door.first_room instanceof CompleteFreeSpaceExpansionRoom && p_door.second_room instanceof CompleteFreeSpaceExpansionRoom)
{
TileShape door_shape = p_door.get_shape();
if (door_shape.is_empty())
{
if (this.autoroute_engine.board.get_test_level().ordinal() >= board.TestLevel.ALL_DEBUGGING_OUTPUT.ordinal())
{
System.out.println("MazeSearchAlgo:check_door_width door_shape is empty");
}
return true;
}
double door_length;
AngleRestriction angle_restriction = autoroute_engine.board.rules.get_trace_angle_restriction();
if (angle_restriction == AngleRestriction.NINETY_DEGREE)
{
IntBox door_box = door_shape.bounding_box();
door_length = door_box.max_width();
}
else if (angle_restriction == AngleRestriction.FORTYFIVE_DEGREE)
{
IntOctagon door_oct = door_shape.bounding_octagon();
door_length = door_oct.max_width();
}
else
{
FloatLine door_line_segment = door_shape.diagonal_corner_segment();
door_length = door_line_segment.b.distance(door_line_segment.a);
}
if (door_length < p_trace_width)
{
return true;
}
}
return false;
}
示例13: add_sorted_neighbour
import geometry.planar.IntOctagon; //导入依赖的package包/类
private void add_sorted_neighbour(IntOctagon p_neighbour_shape, IntOctagon p_intersection)
{
SortedRoomNeighbour new_neighbour = new SortedRoomNeighbour(p_neighbour_shape, p_intersection);
if (new_neighbour.last_touching_side >= 0)
{
sorted_neighbours.add(new_neighbour);
}
}
示例14: get_trace_exit_directions
import geometry.planar.IntOctagon; //导入依赖的package包/类
/**
* Calculates the allowed trace exit directions of the shape of this padstack on layer p_layer.
* If the length of the pad is smaller than p_factor times the height of the pad,
* connection also to the long side is allowed.
*/
public java.util.Collection<Direction> get_trace_exit_directions(int p_layer, double p_factor)
{
java.util.Collection<Direction> result = new java.util.LinkedList<Direction>();
if (p_layer < 0 || p_layer >= shapes.length)
{
return result;
}
ConvexShape curr_shape = shapes[p_layer];
if (curr_shape == null)
{
return result;
}
if (!(curr_shape instanceof IntBox || curr_shape instanceof IntOctagon))
{
return result;
}
IntBox curr_box = curr_shape.bounding_box();
boolean all_dirs = false;
if (Math.max(curr_box.width(), curr_box.height()) <
p_factor * Math.min(curr_box.width(), curr_box.height()))
{
all_dirs = true;
}
if (all_dirs || curr_box.width() >= curr_box.height())
{
result.add(Direction.RIGHT);
result.add(Direction.LEFT);
}
if (all_dirs || curr_box.width() <= curr_box.height())
{
result.add(Direction.UP);
result.add(Direction.DOWN);
}
return result;
}