## The Design of Software (CLOSED)A public forum for discussing the design of software, from the user interface to the code architecture. Now closed. |
||

The "Design of Software" discussion group has been merged with the main
Joel on Software discussion group.
The archives will remain online indefinitely. |
Is there a mathematician in the house? I need some help with a fairly juicy programming+geometry problem. More details here:
http://successfulsoftware.net/2008/07/18/a-mathematical-digression/
Have you though about trying to invert the problem? As far as I know people typically don't have tables fabricated to size so the feature as planed is mildly useless IMO. Why not allow users to input multiple table sizes and then add chairs to their table sizes till you can't add no more(then go back and even out the space.)
Brian Friday, July 18, 2008
Auto-sizing a table according to the number of seats by works great as a quick default. I don't intend to change the approach.
Try solving for A+D B+D This will give you the ellipse that passes through the center of the chair ring. The circumference is exactly N*D using your circumference equation and your assumption about the ratio of A/B then it should be easy to solve.
Next for laying out the chairs place one chair anywhere. The next chair can be found with a triangle. where one side is length D(it connects the centers of the two circles) one side length D/2(it goes from the center of the circle to the ellipse) use pythagorean to solve for the third side. using the location of I-1 and the hypotenuse of the triangle there should be two points of intersection with the ellipse. From there it should be easy to locate the third point which is the center of the circle.
Brian Saturday, July 19, 2008
>The circumference is exactly N*D
Only for infinitely large N. >use pythagorean to solve for the third side Are you sure it is a right angle triangle? It might be, but I'm not sure.
>Only for infinitely large N.
And only if all the circles touch. There is a little loss since the ellipse is curved instead of straight lines through the circles. The loss will be based on D not N.
Brian Saturday, July 19, 2008
Actually I think you are right about the triangles I don't think you can assume the right angle.
Brian Saturday, July 19, 2008
I have to ask, N starting at 1?? Would that be for the annual Anti-Social Society Dinner? :)
sgf Saturday, July 19, 2008
It strikes me that this is the kind of problem that's best solved empirically. In the physical world, oval tables aren't available in infinitely variable elliptical sizes. They aren't even necessarily ellipses.
It should be sufficient to construct a curve with a few data points (generated by using actual tables and actual chairs) and then extrapolate or interpolate as needed. It may seem inelegant, but I'm not sure how much elegance there is in assuming the existence of furniture that has no physical properties.
I'd submit that the fact that you can't figure out how to model them suggests that they may not be simpler to model.
I think we are pretty much there actually. A couple of people have come up with heuristic approaches that work reasonably well. I think an analytic approach that solved the quartic for the intersection of a circle and an ellipse would be more accurate and faster.
It is an interesting problem anyway (IMHO). |

Powered by FogBugz