Boost logo

Geometry :

Subject: [geometry] nsphere concept
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2013-05-22 13:36:35


I have some thoughts about the nsphere that I'd like to share. For now I
think of two changes:

1. The name which I, like the author of comments, find not really
suitable could be changed. I propose to change it to "ball" because:

- in maths it's not only a 3D object, when we consider n-dimensional
metric spaces it's n-dimensional.

- it is also a name of a non-math object (e.g. play ball) just like a Box

- it's shorter

2. Currently the implemented model has following template parameters:

template <typename Point, typename Radius>
class nsphere;

Is it really needed to define Radius as a separate type? It might at
least have a default:

template <
   typename Point,
   typename Radius = coordinate_type<Point>::type
class ball;

Another thing is a separate radius_type but I guess there might be cases
where this is helpful.

3. Access

To get/set radius one may call get_radius<0>(geom) and
set_radius<0>(geom) respectively which is ok since for ellipses and
ellipsoids one must specify radius index.

However I find the centre point access non-intuitive. Correct me if I'm
wrong but it seems that now the nsphere is accessed like a Point? So to
get a centre's cordinate one may call:


which is a little ambiguous.

Why not use an access method already used in the case of the Box - get
with index? Like this:

get<centre, I>(sph)
get<radius, I>(sph)

The first one would return coordinate_type and the second one
radius_type which could be different.

What do you think?


Geometry list run by mateusz at