Author Topic: Determining if most of the area of a block lies within a certain polygon  (Read 2716 times)

0 Members and 1 Guest are viewing this topic.

murrdpirate

  • Guest
I'm using SelectWindowPolygon and a specified collection of points to select all the blocks that are entirely within the polygon.  I also want to select objects that lie on the boundary, but only if they are mostly within the polygon, so I can't use SelectCrossingPolygon.

I was thinking that a good approach would be to use SelectFence to get all of the blocks on the border and use GetObjectSnapPoints to get the border of each block.  Then somehow get the portion of the block's area that exists within the polygon and compare it to the block's total area.  This last part is what I don't know how to do.

Any ideas?  Alternative approaches are good too.  Thanks!

Peter Jamtgaard

  • Guest
Just some thoughts

Shrink wrapping a boundary around your blocks either programatically or by physically drawing it would help you determine the inside/outside area.

I know using a ray from a point inside of a block, rotating it 360 degrees and use the intersectwith method to get the farthest intersection for an angle might a good place to start the programatic solution for determining the boundary.


Peter


GTVic

  • Guest
If you have a polygon that outlines the block then you could find/create a function to get the centroid of that polygon and then test if the centroid is in the area.

LE3

  • Guest
Don't know what exactly you are trying to do, have posted here a code in C# to test for point inside of a closed polygon, will do a search for it, and posted back...
Found it here:
http://www.theswamp.org/index.php?topic=17222.msg209140#msg209140

See if helps.

Peter Jamtgaard

  • Guest

Kean has a neat function for determining the boundary of selected objects this month on through the interface.

"Tracing a boundary defined by AutoCAD geometry using .NET"

http://through-the-interface.typepad.com/through_the_interface/2010/06/index.html

Peter

LE3

  • Guest
Have not installed a2001 yet, but that looks like a great addition.

I see it is asking for an internal point definition, so appears that it is the gbpoly function ported to C#?... or do you simple define a single internal point in the geometry and generates all the possible closed areas?

If it does that, nice.


Kean has a neat function for determining the boundary of selected objects this month on through the interface.

"Tracing a boundary defined by AutoCAD geometry using .NET"

http://through-the-interface.typepad.com/through_the_interface/2010/06/index.html

Peter

murrdpirate

  • Guest
Sorry to post and run, but I study for/take the GRE this past weekend.  Why must engineers be tested for verbal skills?  :-(

Originally, I was looking into whether I could select blocks based on their insertion point, but I found that some of the blocks had their insertion point on the perimeter of the block and the perimeter of the polygon. 

Thanks everyone for your suggestions.  They all sound like they should work and some of them look like they might help me with some other stuff I'm trying to do.  I'm getting back into this thing today so I'll let you all know what I find.