Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] Creating a velocity unit
From: Andrew Hundt (athundt_at_[hidden])
Date: 2013-02-21 10:54:38


I previously had a similar question where I had to define my own unit that
may be helpful to you:
http://stackoverflow.com/questions/4322133/converting-units-in-boost-units-from-angular-velocity-to-degrees-per-second

Cheers!
Andrew Hundt

On Wed, Feb 20, 2013 at 10:11 PM, Steven Watanabe <watanabesj_at_[hidden]>wrote:

> AMDG
>
> On 02/20/2013 06:32 PM, Ryan wrote:
> > Boost Community,
> >
> > I'm trying to create a custom velocity unit. I would like to create a
> unit
> > that is in nautical miles per hour to represent my speed value. If I use
> > pound_force.hpp as an example of units with more than one dimension I can
> > create the following.
> >
> > BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(metric,
> > nautical_mile_per_hour, "nautical mile per hour", "nmi h^-1", factor,
> > si::velocity, ???);
> >
> > If this is the right track, what id would I use and how do I know that it
> > is unique?
> >
> > This seems forced. I would rather define this unit in terms of meters
> per
> > second. Nautical miles is already in terms of meters and hours is also
> > defined as a scale of seconds. Can I somehow use these two already
> defined
> > units to create the new unit? How would I do this?
> >
>
> You probably don't need to define a base unit.
> Just use:
>
> typedef decltype(
> nautical_mile_base_unit::unit_type() /
> hour_base_unit::unit_type()) nautical_miles_per_hour;
>
> In Christ,
> Steven Watanabe
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net