Le 22/05/2011 21:49, Phil Steitz a écrit :
On 5/22/11 5:00 AM, Luc Maisonobe wrote:
Hello,
The current o.a.c.math.geometry.euclidean packages are
inconsistent. The oned and twod packages define respectively
Point1D and Point2D classes, with namings akin to affine spaces
and the threed package defines a Vector3D class, akin to vector
spaces.
I would suggest, for the sake of type safety, to provide in all
packages both a PointxD and a VectorxD class, one corresponding to
affine spaces and the other one to vectorial spaces. Of course,
there would be conversions between the two classes (for example
the difference between two points is a vector, adding a vector to
a point is a point but adding to vectors is a vector).
This would improve readability, avoid errors and allow overriding
some methods (like addition for vectors in the example above) and
constructors (like Line(Point, Point) and Line(Point, Vector)).
I need this to have a generic way to build an hyperplane, from a
point and a normal vector without types clashing.
Can you explain a little more why a) you need a generic way to build
hyperplanes (i.e., what dimensions)?
For now, there are hyperplane implementations in 3 dimensions: the class
Plane for 3D, the class Line for 2D (beware there is a name class with
another class Line in 3D, I will fix this), and the class OrientedPoint
in 1D. I will also need implementations on the 2D sphere (think
longitude/latitude) and 1D sphere (think planar angle).
I first thought one way to build an hyperplane that does work in all
dimensions is to specify one arbitrary point in the hyperplane, and one
normal vector, so a generic build method that could be declared in an
interface would look like:
Hyperplane<Space> buildHyperplane(Point<Space> point,
Vector<Space> normal);
I thought it would be easier to read as abvode rather than use the same
type for both arguments.
Thinking further about it, it will probably work only in Euclidean
spaces, not on the 2D or 1D sphere, so I think I can go back to simple
VectorxD.
For consistency purposes however, I will probably rename the classes in
lower dimensions to Vector1D and Vector2D.
Luc
Assuming this is really needed, then +1; otherwise I am not sure we
need VectorxD for x = 1, 2.
Phil
What do you think ?
Luc
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]