本文整理汇总了C#中RECT.intersect方法的典型用法代码示例。如果您正苦于以下问题:C# RECT.intersect方法的具体用法?C# RECT.intersect怎么用?C# RECT.intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RECT
的用法示例。
在下文中一共展示了RECT.intersect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: evaluate
// Evaluate the partition cost by considering the areas covered
// by the new sub-regions.
internal virtual float evaluate(char axis, node new_node1, node new_node2, float curr_cut, RECT pmbr)
{
int si, ci;
float[] min = new float[2];
float[] max = new float[2];
float area;
CELL curr_cell;
RECT r1, r2;
// Set the sweeping index.
if (axis == 'x')
{
si = 0;
ci = 1;
}
else
{
si = 1;
ci = 0;
}
if (new_node1.getlength() != 0)
{
// Find the coordinates of the mbr of the first sub-region.
curr_cell = new_node1.head;
// Initialize the coordinates.
min[si] = curr_cell.current.mbr.low[si];
min[ci] = curr_cell.current.mbr.low[ci];
if (curr_cell.current.mbr.high[si] < curr_cut)
{
max[si] = curr_cell.current.mbr.high[si];
}
else
{
max[si] = curr_cut;
}
max[ci] = curr_cell.current.mbr.high[ci];
curr_cell = curr_cell.next;
// Update the coordinates of the mbr by considering the
// cells one by one.
while (curr_cell != null)
{
if (curr_cell.current.mbr.low[si] < min[si])
{
min[si] = curr_cell.current.mbr.low[si];
}
if (curr_cell.current.mbr.low[ci] < min[ci])
{
min[ci] = curr_cell.current.mbr.low[ci];
}
if (curr_cell.current.mbr.high[si] >= curr_cut)
{
max[si] = curr_cut;
}
else if (curr_cell.current.mbr.high[si] > max[si])
{
max[si] = curr_cell.current.mbr.high[si];
}
if (curr_cell.current.mbr.high[ci] > max[ci])
{
max[ci] = curr_cell.current.mbr.high[ci];
}
curr_cell = curr_cell.next;
}
}
else
{
min[si] = 0;
min[ci] = 0;
max[si] = 0;
max[si] = 0;
}
// Calculate the area covered by the first sub-region.
r1 = new RECT(min[0], min[1], max[0], max[1]);
r2 = r1.intersect(pmbr);
area = r2.area();
if (new_node2.getlength() != 0)
{
// Find the coordinates of the mbr of the second sub-region.
curr_cell = new_node2.head;
// Initialize the coordinates.
if (curr_cell.current.mbr.low[si] > curr_cut)
{
min[si] = curr_cell.current.mbr.low[si];
}
else
//.........这里部分代码省略.........