I'm not entirely sure what you're trying to accomplish here and why, but it seems like you might be able to use regions to find the centroid, instead of using a closed polyline. You might want to check the documentation on Region objects and see if they'll help you. You can create a region with lines and arcs, then simply ask it for its centroid.
Nice idea, but it's a no-go.
Tried several methods for obtaining the centroid of the newly created region (in the first image) and each method came up with a different result. None of them came up with the actual center of the room, though.
But I appreciate you thinking outside of the box. That's the kind of responses I was looking for. I fear that I have poisoned the mind of anyone who reads this thread by telling how I intended to go about accomplishing this.
The normal, manual, method that we use to determine the center of a room is simply to draw a diagonal line from the apparent intersections of the outermost corners of a room and select the midpoint of that line. I'll try to illustrate:
You see, in the example above, with a room that is not at an angle that this is fairly simple. The midpoint of my diagonal line is the location of my new snapbase. Setting my snapbase to this point, then creating a user defined hatch with a spacing of 24 inches places my ceiling grid centered in the room, just like the contractor would install it, and spaced evenly so that the lighting that I will place will have the most even distribution possible.
When the room is at an angle, however, we use a different method as shown here:
While, in this example, the diagonal line method would also work, that quickly becomes a problem when the room area gets a little more complex, like the image that CAB posted. In this situation, we would draw two lines. One of them from the midpoint of an outermost wall perpindicular to the outermost wall in the opposite direction (it doesn't matter at this point if the wall you choose is the larger or the smaller). Again, another line, perpindicular to the first. Both lines are moved to their respective midpoints and you get what is shown above, with the location of the new snapbase being the intersection of those two lines.
All of this is to achieve what we have in the following image:
The tile (grid) is equal on each opposite side of the room. The length of the tile along the wall with our bathroom and the opposing door is the same length as our tile on the opposite wall. The length of the tile on the wall with the two outgoing doors is the same length as the tile on the opposing wall of the overall room. All of our tiles are 'centered', all of our lights are placed in these tiles, and our light distribution is as even as it can be throughout the room.
Whatever method I use to determine the center of a room at an angle should also be capable of finding the center of a room that is
not at an angle. The manual method that I spoke of does just that. I know there has to be a simpler, less complicated way to get to this point.
Forget any method I have mentioned thus far and consider it your task to find the center of the room using lisp. How would you go about doing that? And, for the record, we're working in 2D.