本文整理汇总了C#中System.Edge.AddIntersections方法的典型用法代码示例。如果您正苦于以下问题:C# Edge.AddIntersections方法的具体用法?C# Edge.AddIntersections怎么用?C# Edge.AddIntersections使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Edge
的用法示例。
在下文中一共展示了Edge.AddIntersections方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddIntersections
/// <summary>
/// This method is called by clients of the EdgeIntersector class to test for and add
/// intersections for two segments of the edges being intersected.
/// Note that clients (such as MonotoneChainEdges) may choose not to intersect
/// certain pairs of segments for efficiency reasons.
/// </summary>
/// <param name="e0"></param>
/// <param name="segIndex0"></param>
/// <param name="e1"></param>
/// <param name="segIndex1"></param>
public void AddIntersections(Edge e0, int segIndex0, Edge e1, int segIndex1)
{
// if (e0 == e1 && segIndex0 == segIndex1)
if (ReferenceEquals(e0, e1) && segIndex0 == segIndex1)
return; // Diego Guidi say's: Avoid overload equality, i use references equality, otherwise TOPOLOGY ERROR!
NumTests++;
Coordinate p00 = e0.Coordinates[segIndex0];
Coordinate p01 = e0.Coordinates[segIndex0 + 1];
Coordinate p10 = e1.Coordinates[segIndex1];
Coordinate p11 = e1.Coordinates[segIndex1 + 1];
_li.ComputeIntersection(p00, p01, p10, p11);
/*
* Always record any non-proper intersections.
* If includeProper is true, record any proper intersections as well.
*/
if (_li.HasIntersection)
{
if (_recordIsolated)
{
e0.Isolated = false;
e1.Isolated = false;
}
_numIntersections++;
// if the segments are adjacent they have at least one trivial intersection,
// the shared endpoint. Don't bother adding it if it is the
// only intersection.
if (!IsTrivialIntersection(e0, segIndex0, e1, segIndex1))
{
_hasIntersection = true;
if (_includeProper || !_li.IsProper)
{
e0.AddIntersections(_li, segIndex0, 0);
e1.AddIntersections(_li, segIndex1, 1);
}
if (_li.IsProper)
{
_properIntersectionPoint = (Coordinate) _li.GetIntersection(0).Clone();
_hasProper = true;
if (!IsBoundaryPoint(_li, _bdyNodes))
_hasProperInterior = true;
}
}
}
}
示例2: AddIntersections
/// <summary>
/// This method is called by clients of the EdgeIntersector class to test for and add
/// intersections for two segments of the edges being intersected.
/// Note that clients (such as MonotoneChainEdges) may choose not to intersect
/// certain pairs of segments for efficiency reasons.
/// </summary>
/// <param name="e0"></param>
/// <param name="segIndex0"></param>
/// <param name="e1"></param>
/// <param name="segIndex1"></param>
public void AddIntersections(Edge e0, int segIndex0, Edge e1, int segIndex1)
{
if ( e0 == e1 && segIndex0 == segIndex1) return;
_numTests++;
Coordinate p00 = e0.Coordinates[segIndex0];
Coordinate p01 = e0.Coordinates[segIndex0 + 1];
Coordinate p10 = e1.Coordinates[segIndex1];
Coordinate p11 = e1.Coordinates[segIndex1 + 1];
_lineIntersector.ComputeIntersection( p00, p01, p10, p11);
if ( _lineIntersector.HasIntersection() )
{
if ( _recordIsolated )
{
e0.SetIsIsolated( false );
e1.SetIsIsolated( false );
}
//intersectionFound = true;
_numIntersections++;
// if the segments are adjacent they have at least one trivial intersection,
// the shared endpoint. Don't bother adding it if it is the
// only intersection.
if ( !IsTrivialIntersection( e0, segIndex0, e1, segIndex1) )
{
_hasIntersection = true;
if ( _includeProper || ! _lineIntersector.IsProper() )
{
//Debug.println(_lineIntersector);
e0.AddIntersections( _lineIntersector, segIndex0, 0 );
e1.AddIntersections( _lineIntersector, segIndex1, 1 );
}
if ( _lineIntersector.IsProper() )
{
_properIntersectionPoint = (Coordinate) _lineIntersector.GetIntersection(0).Clone();
_hasProper = true;
if ( !IsBoundaryPoint( _lineIntersector, _bdyNodes) )
{
_hasProperInterior = true;
}
}
} // if ( !IsTrivialIntersection( e0, segIndex0, e1, segIndex1) )
} // if ( _lineIntersector.HasIntersection() )
}