Gsoc-14 3-Dimensional Geometry.

163 views
Skip to first unread message

Akshay

unread,
Feb 18, 2014, 2:32:07 PM2/18/14
to sy...@googlegroups.com
Hello,
The current geometry module supports a 2-d space for all its entites like Points,Lines , Rays,Segments..My idea is to extend this to include a 3-d functionality for all the entities and include a new class for Planes as they are an important part of 3-d geometry.Please post your reviews on this as this is not in the ideas page.

Thanks,
Akshay.

Christophe Bal

unread,
Feb 18, 2014, 2:58:23 PM2/18/14
to sympy-list
Hello,
as a simple user, I think the support of conic and quadratic is also needed for 2D and 3D geometry.

There is also a need to allow a way to put a 2D context into the 3D one.

Christophe BAL


--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Akshay

unread,
Feb 18, 2014, 3:34:20 PM2/18/14
to sy...@googlegroups.com
Yes i think so too, and even there is a scope of implementing Parabolae and Hyperbolae classses in the current geometry module.

Akshay

unread,
Feb 23, 2014, 4:39:30 PM2/23/14
to sy...@googlegroups.com
@asmeurer Could you post your reviews on this one?

Aaron Meurer

unread,
Feb 23, 2014, 10:08:56 PM2/23/14
to sy...@googlegroups.com
I think it's a good idea, though you'd need to convince me that
there's enough work in it for a whole summer.

Aaron Meurer

On Sun, Feb 23, 2014 at 3:39 PM, Akshay <akshayn...@gmail.com> wrote:
> @asmeurer Could you post your reviews on this one?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/059df165-8bfc-4866-9012-b6ff43a77ed9%40googlegroups.com.

Chris Smith

unread,
Feb 24, 2014, 12:35:28 AM2/24/14
to sy...@googlegroups.com


On Tuesday, February 18, 2014 1:32:07 PM UTC-6, Akshay wrote:
Hello,
The current geometry module supports a 2-d space for all its entites like Points,Lines , Rays,Segments..My idea is to extend this to include a 3-d functionality for all the entities and include a new class for Planes as they are an important part of 3-d geometry.Please post your reviews on this as this is not in the ideas page.


I have not used 3-D geometry very much. One thing I wonder is how tractable 3-D solutions are when they contain symbols instead of numbers.

Another thing to think about is the ability to maybe have a global setting for precision for the coordinates. I imagine this would be a pretty major undertaking, however, making sure that the things that should work do (and knowing what things won't work).

There are already 3-d libraries (and GeoGebra includes a CAS); we should focus on what is most sympy-ish; thus we haven't focused on clipping since there are libraries that handle this, too, that are much more mature than what we have. 

Just an idea (random): I found David Eck's xModels to be a nice program to work with in creating 3d shapes (http://math.hws.edu/TMCM/java/xModels/info.html).

I don't have a lot of ideas for this -- I'm a pretty light weight geometry user; the most exciting thing I did this year with geometry was learn about the simple way to calculate the distance from a point to a line using similar triangles -- and that was something I learned by using sympy to give me the simplified expression in symbolic form.

Akshay

unread,
Feb 24, 2014, 2:01:20 AM2/24/14
to sy...@googlegroups.com
@asmeurer Thanks for the reply. First of all the current geometry module supports entities like point,line,rays,segment in 2d.To extend it to 3d the algorithms for all the existing methods need to be written from scratch as they can't be extended as such, and also have to include a new plane class which would include most of the important functionality in 3d.Apart from that the existing conics only include circle and ellipse so I would like to include the left out ones parabola and hyperbola(including rectangular).


Akshay

unread,
Feb 24, 2014, 2:03:28 AM2/24/14
to sy...@googlegroups.com
@smichr I agree that there are a lot of visualisation libraries for geometry but there are very few computational geometry libraries especially in python(atleast that's what google        said). With sympy's features we could make a more flexible 3d module for example using symbols and restricting it's value to only positive,we have already blocked imaginary    points so that is one less thing to worry about and making use of vector module in  some  algorithms.

Ondřej Čertík

unread,
Mar 4, 2014, 2:03:09 PM3/4/14
to sympy
Hi Akshay,

I think in general it is a good idea to be able to work with 3D
geometric objects. Why don't you start by writing some very quick
prototype, as part of your proposal.
For example intersection of 2 lines in 3D, or a plane and a line.
Write up the functions/classes necessary for that. That should give
you a good idea what work
this involves and should give you ideas how to write the proposal.

Ondrej
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/45ffeb28-a20f-406a-b81a-e5dc29975ef6%40googlegroups.com.

Akshay

unread,
Mar 4, 2014, 2:28:48 PM3/4/14
to sy...@googlegroups.com
@ondrej Thanks for the quick reply .
 As you pointed out I have been working on the prototype for past few days and for the intersection of two lines it looks something like this:
a = Line(Point(1,2,3),Point(2,3,4))
b = Line(Point(5,5,5),Point(-8,-6,-3)) 
a.interection(b) = Point(-1.5, -0.5, 0.5)

a.arbitrary_point() = Point(t+1,t+2,t+3)
b.arbitrary_point('z') = Point(-13*z +5, -11*z+5, -8z+5)
c=Line(Point(2,3), Point(3,5))  # Here the default value of z is taken as 0
a.intersection(c)
Point(2,3,4)

Apart from this I have been thinking about a class which does this   
x,y,z = map(Symbol, 'xyz')
p1,p2,p3 = Point(x, y), Point(y, z), Point(2*x*y, y)
Point.is_collinear(p1, p2, p3) this returns false but it is better to return this
Points are collinear if z - y - 2*y*z + 2*y**2 == 0
This class should support the following methods at least:
is_similar is_parallel is_concyclic is_perpendicular encloses_point is_tangent is_convex contains collinear





Ondřej Čertík

unread,
Mar 4, 2014, 3:20:35 PM3/4/14
to sympy
Hi Akshay,
Very good. I think this makes sense.

Ondrej

Christophe Bal

unread,
Mar 4, 2014, 3:21:03 PM3/4/14
to sympy-list
Hello.

In your prototype, you have written :

b.arbitrary_point('z') = Point(-13*z +5, -11*z+5, -8z+5)
c=Line(Point(2,3), Point(3,5))  # Here the default value of z is taken as 0

Why don't you work with a symbolic variable z ? 

You will also have to take care of point in segment for example.


--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.

Akshay

unread,
Mar 4, 2014, 3:32:27 PM3/4/14
to sy...@googlegroups.com
c=Line(Point(2,3), Point(3,5))  # Here the default value of z is taken as 0
I meant that the z co-ordinate of the point is taken as 0.

Christophe Bal

unread,
Mar 4, 2014, 5:12:22 PM3/4/14
to sympy-list
Sorry for my message, I was drunk... ;-)


2014-03-04 21:32 GMT+01:00 Akshay <akshayn...@gmail.com>:

c=Line(Point(2,3), Point(3,5))  # Here the default value of z is taken as 0
I meant that the z co-ordinate of the point is taken as 0.

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.

Chase Relock

unread,
Mar 4, 2014, 5:18:08 PM3/4/14
to sy...@googlegroups.com
This isn't my proposal, but I do think there is a lot that can be done here.
There are a great deal of tools and results in Algebraic Geometry that can be implemented for 3d (and n-d of course). I recommend THIS BOOK as a good introduction to the subject with a lot of results. Reduction of quadric surfaces is a good example as is finding the fundamental forms of surfaces.

Akshay

unread,
Mar 4, 2014, 5:39:14 PM3/4/14
to sy...@googlegroups.com
Thanks for the book , I'll surely go through it. 

Christophe Bal

unread,
Mar 5, 2014, 4:26:43 AM3/5/14
to sympy-list
I've a little suggestion about planar object into a 3D scene.

O = Point(2, 3, 4)
I = Point(4, 5, 4)
J = Point(2, 3, 7)
line = Line(Point(2,3), Point(3,5)) # z-plane by default
line2 = putin((O, I, J), line) # Let's go in another plane

This allows to easily put a planar scene in any plane rather in the fixed z-plane. The function could use a list of 2D-objects and returns the corresponding new objects build.

Christophe, a simple user.

Christophe Bal

unread,
Mar 5, 2014, 4:45:32 AM3/5/14
to sympy-list
z-plane must be changed to xy-plane. Sorry for this.

Akshay

unread,
Mar 5, 2014, 11:30:06 AM3/5/14
to sy...@googlegroups.com

Ondřej Čertík

unread,
Mar 5, 2014, 12:49:16 PM3/5/14
to sympy
Thanks, I like the explicit examples. Put there a section with your
estimate how long it would take you to implement it.

Ondrej

Akshay

unread,
Mar 5, 2014, 1:43:52 PM3/5/14
to sy...@googlegroups.com
I have added the tentative timeline, Do have a look.

Ondřej Čertík

unread,
Mar 5, 2014, 1:50:49 PM3/5/14
to sympy
Thanks. Just curious --- why do you think you'll need 4 weeks to
implement the Line class?

The intersection should be just a matter of a simple formula:

http://mathworld.wolfram.com/Line-LineIntersection.html

On Wed, Mar 5, 2014 at 11:43 AM, Akshay <akshayn...@gmail.com> wrote:
> I have added the tentative timeline, Do have a look.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/a2f4a78f-1677-4e5a-a01a-6b6e4cf7f540%40googlegroups.com.

Akshay

unread,
Mar 5, 2014, 2:17:02 PM3/5/14
to sy...@googlegroups.com
I actually expected this question :).Anyway that was the formula for the intersection of 2 lines in 2-d but now we have both 2-d and 3-d and also apart from that there are segments and rays so we have to consider the intersection of line and line in 2-d and 3-d and line and ray in 2-d 3-d and so on(http://docs.sympy.org/latest/_modules/sympy/geometry/line.html#LinearEntity.intersection Current code in 2-d).There are some additional 15-20 methods which have to implemented from scratch in the line module in both 2-d and 3-d.

Ondřej Čertík

unread,
Mar 5, 2014, 3:22:08 PM3/5/14
to sympy
I know it can get tricky to do intersection in 3D, but on the link I
sent, it is described
under "In three dimensions,...".

See also this:

http://stackoverflow.com/questions/10551555/need-an-algorithm-for-3d-vectors-intersection/10554546#10554546

One has to code this, using symbolic algebra, but once you have it,
the rest seems straightforward. I would think
it would take a few days to get it right.

Ondrej

Akshay

unread,
Mar 5, 2014, 4:57:29 PM3/5/14
to sy...@googlegroups.com
Only problem is this is not hard but tedious as there are a lot of permutations line , segment and rays(2-d and 3-d) and note that there are no ready made formulas for rays and segments unlike lines .Maybe his might not take the amount of time I mentioned ,If time is left I would like to include all these new geometric entities in the plotting module.Does that sound good?
 

Akshay

unread,
Mar 17, 2014, 1:44:18 PM3/17/14
to sy...@googlegroups.com
@certik
I have updated my proposal at https://github.com/sympy/sympy/wiki/GSoC-2014-Application--Akshay--Geometry-Module. Please take some time to review it.
Thanks
Akshay

Akshay

unread,
Mar 18, 2014, 2:19:35 PM3/18/14
to sy...@googlegroups.com
@certik @asmeurer Could you please review my proposal at melange and post your comments as the application deadline is fast approaching? Here is the link to my proposal at wiki https://github.com/sympy/sympy/wiki/GSoC-2014-Application--Akshay--Geometry-Module.

Thanks,
Akshay

Akshay

unread,
Mar 20, 2014, 2:23:19 PM3/20/14
to sy...@googlegroups.com
@certik @asmeurer I have made the changes you suggested. I have put everything that i thought of in the application https://github.com/sympy/sympy/wiki/GSoC-2014-Application--Akshay--Geometry-Module.Do you have any more suggestions?

Thanks,
Akshay
Reply all
Reply to author
Forward
0 new messages