32template <
class contents>
86 contents to_internal(contents initial,
angular_units unit)
const;
88 contents from_internal(contents initial,
angular_units unit)
const;
100 :
angle<double>(init, unit) {}
108template <
class contents>
111template <
class contents>
113{
angle<contents> to_return(*
this); to_return *= -1;
return to_return; }
115template <
class contents>
119template <
class contents>
123template <
class contents>
127 to_return *= to_multiply;
131template <
class contents>
133{
angle<contents> to_return(*
this); to_return /= to_divide;
return to_return; }
135template <
class contents>
137{ _theta += a._theta;
return *
this; }
139template <
class contents>
141{ _theta -= a._theta;
return *
this; }
143template <
class contents>
145{ _theta *= f;
return *
this; }
147template <
class contents>
149{ _theta /= f;
return *
this; }
151template <
class contents>
154template <
class contents>
157template <
class contents>
160template <
class contents>
166 return temp.length();
169template <
class contents>
173template <
class contents>
177template <
class contents>
187template <
class contents>
188contents angle<contents>::from_internal(contents a,
angular_units unit)
const
197template <
class contents>
199{ _theta = to_internal(a, unit); }
201template <
class contents>
203{
return from_internal(_theta, unit); }
205template <
class contents>
209 contents d = adjacent / hypotenuse;
210 retval = basis::common::BAD_INPUT;
212 retval = basis::common::OKAY;
216template <
class contents>
220 contents d = opposite / hypotenuse;
221 retval = basis::common::BAD_INPUT;
223 retval = basis::common::OKAY;
227template <
class contents>
231 retval = basis::common::BAD_INPUT;
232 if ( (adjacent == 0.0) && (opposite == 0.0) )
return angle<contents>();
233 retval = basis::common::OKAY;
A very common template for a dynamic array of bytes.
Outcomes describe the state of completion for an operation.
A base class for objects that can pack into an array of bytes.
contents cosine() const
returns the cos function of this angle.
angle operator*(contents to_multiply) const
angle & operator/=(contents to_divide)
angle & operator+=(const angle &to_add)
virtual void pack(basis::byte_array &packed_form) const
packs the angle for shipping in bytes.
contents sine() const
returns the sin function of this angle.
contents get(angular_units unit) const
retrieves the current angular measure.
static angle arcsine(contents opposite, contents hypotenuse, basis::outcome &retval)
returns the asin of the angle.
static angle arctangent(contents opposite, contents adjacent, basis::outcome &retval)
returns the atan of the angle.
void set(contents a, angular_units unit)
sets the angle to a new rotation "a" in the "unit".
contents tangent() const
returns the tan function of this angle.
virtual bool unpack(basis::byte_array &packed_form)
unpacks the angle from the "packed_form".
angle(contents inital_rotation=0, angular_units unit=RADIANS)
constructs a new angle with "initial_rotation" in the "unit".
angle operator-(void) const
returns the negation of this angle.
angle operator+(const angle &to_add) const
angle & operator*=(contents to_multiply)
static angle arccosine(contents adjacent, contents hypotenuse, basis::outcome &retval)
returns the acos of the angle.
DEFINE_CLASS_NAME("angle")
angle & operator-=(const angle &to_subtract)
angle operator/(contents to_divide) const
virtual int packed_size() const
Estimates the space needed for the packed structure.
double_angle provides a non-templated class for forward declarations.
double_angle(double init=0, angular_units unit=RADIANS)
double_angle(const angle< double > &to_copy)
#define PI_APPROX
An approximation of the fundamental circular constant.
#define bounds_return(value, low, high, to_return)
Verifies that "value" is between "low" and "high", inclusive.
Contains all of our objects for geometry and avoids name clashes.
angular_units
Represents a geometric angle.
void attach(byte_array &packed_form, const byte_array &to_attach)
Packs a byte_array "to_attach" into "packed_form".
bool detach(byte_array &packed_form, byte_array &to_detach)
Unpacks a byte_array "to_detach" from "packed_form".