Things Are Coming Along

The current update is basically focused at what's been done, and what's left to do. I've mostly finished off line, ray, segment, points, ellipses and circles. Most of what's left to do is in ellipse (intersection primarily). Now all that is left to do is Polygon (general, regular, and triangles as a specific case). Note that I have a pretty extensive set of test cases in place for what I have done. I have been doing these test cases incrementally because it's easiest this way. Once everything is done though, I will start working on a much more complex set of test cases to truly test the module.

After these things are done I'll take a step back, look at what is done and see how to improve the overall interface. Once that is done I will look into optimizations of existing code. Finally, to finish off I will look into some more advanced geometry applications. One thing I'm waiting on is simplification to be done in SymPy (which I believe is ratsimp's eventual purpose). This is because a lot of comparisons are happening which compare some expression to zero, and even though some things should be zero they are not coming out that way because proper simplification of expressions is not happening. Right now I'm just expanding things and hoping they come out to zero (which in most cases they do).

Now, for some decisions that have been made:
  • Line/Ray/Segment inherit from LinearEntity. This allowed me to write less code while still having everything meaningful. At first I was going to have Ray/Segment inherit from Line but this doesn't make sense.
  • In terms of everything, many functions depend on others so that optimizing will generally take place in less places. For example, for Line I have random_point and arbitrary_point functions. Instead of rewriting code I make random_point get an arbitrary point and then make substitutions
I'm hoping to update design.png soon to reflect what I have done. Work starts tomorrow but I'm hoping to have most of the basic functionality finished by the end of this weekend.


Ondrej Certik said...

Hi Jason, I am glad that you made a progress. Could you please put your code somewhere, so that we can look at it and play with it?

If it is good, let's get it into sympy.modules, you will submit a few patches and then you will get a svn access, so that your newest code is always in the sympy's svn.

Also, please put all expressions that you need to simplify and they don't to the issues, so that we can work on it.

You can create a function simplify, that will just call expand(), combine(), ratsimp(), etc. However, usually you already know what you need to do, in order to simplify it. If not, send your case to the mailinglist/issue.


Gedge said...

Hmm, how about I finish my work on the Polygon/Triangle stuff first and then put everything on the Web so it's available to view and play with.

As for your last comment, that's what I have done. Right now I call my own "simplify" that calls expand() on the expression passed in. Eventually I want to avoid expand() because there's always the possibility that someone will have a point with a coordinate equal to (x+1)**100, for example. I'll also look into expressions that aren't simplifying and post them to the issues page.

Ondrej Certik said...

Generally I think it's better if you share your code immediatelly, as we can then collaborate better, however do as you want.

Yes, the (x+1)**100 is exactly the reason why to be careful with expand().

Yes, please post the expressions that are not simplifying to the issues.

Gedge said...

Well, I already had a start on triangles/polygons, so I figured the tiny wait wouldn't be too big of a deal so that something "incomplete" wasn't put up. I should be finished before the day is over. I'll be adding a new blog entry later today that will point to the code.