I am not sure how much I support that because there is no metric.
you can dosage: l = line3d([(1,2,3), (4,5,6)])sage: V = RR^3
sage: (V(l.points[1]) - V(l.points[0])).norm()
5.19615242270663
There could also be other natural interpretations of length here, such as the number of (non-colinear) segments.
Is this more pedagogical or are you using 3d line segments in some meaningful way?
Éric, what do you think about adding such things to SageManifolds? Could this be feasible?
Is there already a handy way to get the same result in Sage?
You can image other useful methods attached to a graphics object.
Is there already a handy way to get the same result in Sage?You can image other useful methods attached to a graphics object.
For 2d lines, it returns a Graphics object which has a length.
I have no idea what your argument is for the second part. Separations of concerns means ...
In general, I think we are best leaving the drawing classes to just drawing as a separations-of-concerns.
It sounds like we need better integration between our algebraic objects/implementations and the drawing/plotting tools. This might include more plot_* functions or specialized mixin-/sub-classes for small dimensional (sub)spaces. Likewise we might want to add some general tools for inner product spaces, such as "ind_closest_point() or shortest_distance(), with an assumption of course that we can do calculus on the vector space.
As an alternative, if we want to think of objects specifically living in Euclidean space, we have the EuclideanSpace(n) for this with specialized subclasses for 2d and 3d. Perhaps we should implement some of the features you want using objects there, such as line (segment) as a subclass of the curve? For piecewise differentiable curves, this might require some more programming.Éric, what do you think about adding such things to SageManifolds? Could this be feasible?
It is embarrassing that an idea of attaching ".length()" method to a line segment graphics object leads to SageManifolds. We don't need vectors and inner products to compute the length of a line segment.
sage: E = EuclideanSpace(3)sage: L = E.line([(1,2,3),(2,2,3)]) # not implemented yetsage: L.length()
But an intuitive way (or an object-oriented way ?) is to get the necessary information from the line segment. Thus if L is the line segment, I do p = L.mid_point(); r = L.length() / 2. Then circle(p, r) will do the work.
On Thursday, 25 August 2022 at 07:23:41 UTC-7 Kwankyu Lee wrote:But an intuitive way (or an object-oriented way ?) is to get the necessary information from the line segment. Thus if L is the line segment, I do p = L.mid_point(); r = L.length() / 2. Then circle(p, r) will do the work.That sounds like the model that geogebra uses.
I do think that having a graphical interface such as geogebra has is really a plus for these applications, though,
In my experience, the tweaking of graphics for publication is what takes by far the most time, so the more interface for that the better.
On Friday, August 26, 2022 at 2:57:15 AM UTC+9 Nils Bruin wrote:On Thursday, 25 August 2022 at 07:23:41 UTC-7 Kwankyu Lee wrote:But an intuitive way (or an object-oriented way ?) is to get the necessary information from the line segment. Thus if L is the line segment, I do p = L.mid_point(); r = L.length() / 2. Then circle(p, r) will do the work.That sounds like the model that geogebra uses.Yes. It would be a programming interface of the model.
Do keep in mind that there is a basic command-driven interface behind Geogebra as well.
which does not fully determine a circle in 3-space
It may still be that there's a market for this in sagemath/python; or it may be an enjoyable recreational project to work on. But before you set off on it, it's probably good to know what prior art is available, and it looks like at least the start of what you'd be doing is reimplementing a lot of the things geogebra already has.
On the python front, it looks like Sympy (which we already include) may have a start for you: https://docs.sympy.org/latest/modules/geometry/