Hi, I would like to gauge interest in adding a very lightweight library implementing a class for handling planar angles and related operations to Boost. The library sources and several examples of usage can be found here: https://github.com/matus-chochlik/angle It does not conform to Boost conventions yet, nor is there any documentation, but the library is very simple to use: There is a template angles::angle<T> representing planar angles, using type T to store the angle value in radians. Conversions for 10 common angle units are included and new units can easily be added. The library also implements construction functions and user-defined literal operators allowing to specify angles in various units and also implements overloads of functions like sin, cos, etc. The only external header that this library includes is standard `cmath`. Here follow some examples of usage: using namespace angles; for(angle<double> a; a < 4_turns; a += 45_deg) { std::cout << a.tounit::degree() << std::endl; } for(angle<double> a=-quarters(2); a <= quarters(2); a += gradians(50)) { std::cout << a.tounit::turn() << std::endl; } for(angle<double> a; a < turns(1); a += degrees(15)) { std::cout << sin(a) << std::endl; } assert(turns(1) == quarters(4)); assert(degrees(90) == gradians(100)); assert(degrees(45) == quarters(0.5)); assert(degrees(2) == minutes(120)); assert(minutes(4) == seconds(240)); assert(degrees(1) == seconds(3600)); assert(turns(0.5) == gradians(200)); assert(pi(1) == quarters(2)); assert( 3_o_clock == 90_deg); assert( 6_o_clock == 200_gon); assert( 7_o_clock == 210_deg); assert( 9_o_clock == 300_gon); assert(11_o_clock == 1_turns - 30_deg); assert(12_o_clock == 2_pi); Please let me know if you are interested in the 'Boostification' of this library or if you have any ideas on how it could be improved. Best regards, Matus
I am interested, I have used similar libraries with great effects.
On Tue, Jun 17, 2014 at 10:12 PM, Matus Chochlik
Hi,
I would like to gauge interest in adding a very lightweight library implementing a class for handling planar angles and related operations to Boost.
The library sources and several examples of usage can be found here:
https://github.com/matus-chochlik/angle
It does not conform to Boost conventions yet, nor is there any documentation, but the library is very simple to use:
There is a template angles::angle<T> representing planar angles, using type T to store the angle value in radians. Conversions for 10 common angle units are included and new units can easily be added. The library also implements construction functions and user-defined literal operators allowing to specify angles in various units and also implements overloads of functions like sin, cos, etc.
The only external header that this library includes is standard `cmath`.
Here follow some examples of usage:
using namespace angles;
for(angle<double> a; a < 4_turns; a += 45_deg) { std::cout << a.tounit::degree() << std::endl; }
for(angle<double> a=-quarters(2); a <= quarters(2); a += gradians(50)) { std::cout << a.tounit::turn() << std::endl; }
for(angle<double> a; a < turns(1); a += degrees(15)) { std::cout << sin(a) << std::endl; }
assert(turns(1) == quarters(4)); assert(degrees(90) == gradians(100)); assert(degrees(45) == quarters(0.5)); assert(degrees(2) == minutes(120)); assert(minutes(4) == seconds(240)); assert(degrees(1) == seconds(3600)); assert(turns(0.5) == gradians(200)); assert(pi(1) == quarters(2));
assert( 3_o_clock == 90_deg); assert( 6_o_clock == 200_gon); assert( 7_o_clock == 210_deg); assert( 9_o_clock == 300_gon); assert(11_o_clock == 1_turns - 30_deg); assert(12_o_clock == 2_pi);
Please let me know if you are interested in the 'Boostification' of this library or if you have any ideas on how it could be improved.
Best regards,
Matus
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
how would this differ from boost units? Robert Ramey -- View this message in context: http://boost.2283326.n4.nabble.com/interest-Is-there-interest-in-planar-angl... Sent from the Boost - Dev mailing list archive at Nabble.com.
participants (3)
-
Klaim - Joël Lamotte
-
Matus Chochlik
-
Robert Ramey