Subject: Re: [geometry] Concept for CalculationType
From: Barend Gehrels (barend_at_[hidden])
Date: 2014-05-27 15:55:55
Andrew Hundt wrote On 27-5-2014 21:42:
> I'm trying to learn how to implement simple algorithms generically.
> Is there a concept for CalculationType? It is used in
> matrix_transformers.hpp, but I couldn't find a concept definition.
There is indeed no concept defined, maybe we should do that indeed.
CalculationType should be a numeric type. Can be a type provided by
default (float,double,long double, or it can sometimes be an integer
type) or a high precision type (gmp,ttmath). We should add that not all
algorithms are yet tested with these types - most are tested by ttmath,
but not on the Regression Matrix (and on my personal system it is a
> I'm trying to create a 2d rotate_translate_transformer which rotates a
> geometry in place then translates it to a specified location, so I'm
> trying to modify the implementations in matrix_transformers.hpp.
> I'm considering having it take a point and an angle rather than
> x,y,angle. For comparison, the translate_transformer takes an x and y.
> Does this seem advisable?
I see - this is a bit arbitrary. A point (x,y) is usually a point, while
translate is over a vector, therefore x(-diff),y(-diff). But indeed, of
course, it can also be represented as a point.
> Would it be best to make the point a separate template parameter from
> If I didn't use a point, should there be one CalculationType template
> parameter for x,y,angle, or should x,y be one type and angle an
> additional type?
Usually the angle is of a different type than x,y. Because angle is in
radians, always a FP type, and x,y might be (but not necessarily) an
integer type. So if it is a general implemenation, and apparently it is,
I would advice that.
Geometry list run by mateusz at loskot.net