32 template <
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) {}
108 template <
class contents>
111 template <
class contents>
113 {
angle<contents> to_return(*
this); to_return *= -1;
return to_return; }
115 template <
class contents>
117 {
angle<contents> to_return(*
this); to_return += a;
return to_return; }
119 template <
class contents>
121 {
angle<contents> to_return(*
this); to_return -= a;
return to_return; }
123 template <
class contents>
127 to_return *= to_multiply;
131 template <
class contents>
133 {
angle<contents> to_return(*
this); to_return /= to_divide;
return to_return; }
135 template <
class contents>
137 { _theta += a._theta;
return *
this; }
139 template <
class contents>
141 { _theta -= a._theta;
return *
this; }
143 template <
class contents>
145 { _theta *=
f;
return *
this; }
147 template <
class contents>
149 { _theta /=
f;
return *
this; }
151 template <
class contents>
154 template <
class contents>
157 template <
class contents>
160 template <
class contents>
169 template <
class contents>
173 template <
class contents>
177 template <
class contents>
187 template <
class contents>
188 contents angle<contents>::from_internal(contents a,
angular_units unit)
const
197 template <
class contents>
199 { _theta = to_internal(a, unit); }
201 template <
class contents>
203 {
return from_internal(_theta, unit); }
205 template <
class contents>
209 contents d = adjacent / hypotenuse;
210 retval = basis::common::BAD_INPUT;
212 retval = basis::common::OKAY;
216 template <
class contents>
220 contents d = opposite / hypotenuse;
221 retval = basis::common::BAD_INPUT;
223 retval = basis::common::OKAY;
227 template <
class contents>
231 retval = basis::common::BAD_INPUT;
232 if ( (adjacent == 0.0) && (opposite == 0.0) )
return angle<contents>();
233 retval = basis::common::OKAY;
int length() const
Returns the current reported length of the allocated C array.
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".
void pack(basis::byte_array &packed_form, const set< contents > &to_pack)
provides a way to pack any set that stores packable objects.
bool detach(byte_array &packed_form, byte_array &to_detach)
Unpacks a byte_array "to_detach" from "packed_form".