|
Geometry : |
Subject: Re: [geometry] nsphere concept
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2013-05-31 17:28:58
Barend Gehrels wrote:
>>
>> Indexes names are slightly different and of course may be changed. For
>> now it's like this:
>>
>> bg::get<bg::center_point, 0>(b);
>> bg::get<bg::center_point, 1>(b);
>> bg::get<bg::radius_value, 0>(b);
>>
>> There is one problem though. get() and set() assume that the type of
>> returned value is always coordinate_type. So radius type will be
>> converted if it's different.
>
> Yeah, that is true. I realized that also at that time. The get<Index,
> Dimension> was created for a box and after that reused for the nsphere
> concept.
>
> By the way, I did not yet react on that, but nsphere was the outcome of
> an intensive discussion about the naming of such a thing...
>
> OK, one solution is to make an explicit traits class for this. So not
> just bg::get but get_radius, or something like that.
>
> We also have to take into account the ellipse (2 axis) and ellipsoid (3
> axis) or a higher dimensional shape. So Radius might have a dimension.
> However, your proposal supports that.
> And it might not be axis aligned... (we then go further than our box,
> which is axis aligned).
>
Yes, I saw how nsphere is implemented and accessed. I find it
nonintuitive because N-th radius is returned by get_radius<N>() and N-th
center point coordinate is returned by get<N>(). Other geometries which
contain some points like box or segment uses indexed access, e.g. get<0,
N>(). I feel that it would be more suitable for nsphere/ball too.
My only concern is returning different types for different indexes
because it would probably slightly change the concept of indexed get<>().
>> What is the reason of this? Would it be reasonable to use some type
>> defined in
>>
>> core_dispatch::indexed_access
>>
>> e.g.
>>
>> core_dispatch::indexed_access<G, I, D>::value_type
>
> That is another option.
>
And it would be quite simple to achieve backwards compatibility. Default
core_dispatch::indexed_access would define value_type as
coordinate_type<Geometry>::type and pass it to traits::indexed_access.
Regards,
Adam
Geometry list run by mateusz at loskot.net