本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}