本文整理汇总了Java中geometry.planar.Line.translate方法的典型用法代码示例。如果您正苦于以下问题:Java Line.translate方法的具体用法?Java Line.translate怎么用?Java Line.translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geometry.planar.Line
的用法示例。
在下文中一共展示了Line.translate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enter_through_small_door
import geometry.planar.Line; //导入方法依赖的package包/类
/**
* Checks, if the next room can be entered if the door of p_list_element is small.
* If p_ignore_item != null, p_ignore_item and all other items directly connected to p_ignore_item
* are ignored in the check.
*/
private boolean enter_through_small_door(MazeListElement p_list_element, Item p_ignore_item)
{
if (p_list_element.door.get_dimension() != 1)
{
return false;
}
TileShape door_shape = p_list_element.door.get_shape();
// Get the line of the 1 dimensional door.
Line door_line = null;
FloatPoint prev_corner = door_shape.corner_approx(0);
int corner_count = door_shape.border_line_count();
for (int i = 1; i < corner_count; ++i)
{
// skip lines of lenghth 0
FloatPoint next_corner = door_shape.corner_approx(i);
if (next_corner.distance_square(prev_corner) > 1)
{
door_line = door_shape.border_line(i - 1);
break;
}
prev_corner = next_corner;
}
if (door_line == null)
{
return false;
}
IntPoint door_center = door_shape.centre_of_gravity().round();
int curr_layer = p_list_element.next_room.get_layer();
int check_radius =
this.ctrl.compensated_trace_half_width[curr_layer] + AutorouteEngine.TRACE_WIDTH_TOLERANCE;
// create a perpendicular line segment of length 2 * check_radius through the door center
Line[] line_arr = new Line[3];
line_arr[0] = door_line.translate(check_radius);
line_arr[1] = new Line(door_center, door_line.direction().turn_45_degree(2));
line_arr[2] = door_line.translate(-check_radius);
Polyline check_polyline = new Polyline(line_arr);
TileShape check_shape = check_polyline.offset_shape(check_radius, 0);
int[] ignore_net_nos = new int[1];
ignore_net_nos[0] = this.ctrl.net_no;
Set<SearchTreeObject> overlapping_objects = new TreeSet<SearchTreeObject>();
this.autoroute_engine.autoroute_search_tree.overlapping_objects(check_shape, curr_layer,
ignore_net_nos, overlapping_objects);
for (SearchTreeObject curr_object : overlapping_objects)
{
if (!(curr_object instanceof Item) || curr_object == p_ignore_item)
{
continue;
}
Item curr_item = (Item) curr_object;
if (!curr_item.shares_net(p_ignore_item))
{
return false;
}
Set<Item> curr_contacts = curr_item.get_normal_contacts();
if (!curr_contacts.contains(p_ignore_item))
{
return false;
}
}
return true;
}