How to do buffered intersection checks on an IPoint?
Posted
by Quigrim
on Stack Overflow
See other posts from Stack Overflow
or by Quigrim
Published on 2010-05-10T10:08:23Z
Indexed on
2010/05/10
12:04 UTC
Read the original article
Hit count: 274
How would I buffer an IPoint to do an intersection check using IRelationalOperator?
I have, for arguments sake:
IPoint p1 = xxx;
IPoint p2 = yyy;
IRelationalOperator rel1 = (IRelationalOperator)p1;
if (rel.Intersects (p2))
// Do something
But now I want to add a tolerance to my check, so I assume the right way to do that is by either buffering p1 or p2. Right? How do I add such a buffer?
Note: the Intersects method I am using is an extension method I wrote to simplify my code. Here it is:
/// <summary>
/// Returns true if the IGeometry is intersected.
/// This method negates the Disjoint method.
/// </summary>
/// <param name="relOp">The rel op.</param>
/// <param name="other">The other.</param>
/// <returns></returns>
public static bool Intersects (
this IRelationalOperator relOp,
IGeometry other)
{
return (!relOp.Disjoint (other));
}
© Stack Overflow or respective owner