wants them all to be referenced by actual namespace now.
template <class numeric_type>
bool is_floating_point(numeric_type t)
{ t = numeric_type(5.1); t = numeric_type(t * 3.0);
- return 0.001 < float(absolute_value(numeric_type(t - 15.0))); }
+ return 0.001 < float(basis::absolute_value(numeric_type(t - 15.0))); }
//! returns true if the instantiation type is an integer.
template <class numeric_type>
template <class numeric_type>
numeric_type point<numeric_type>::r() const
{
- const double sumsquar = square(x()) + square(y());
+ const double sumsquar = basis::square(x()) + basis::square(y());
return numeric_type(sqrt(sumsquar));
}
template <class numeric_type>
numeric_type point<numeric_type>::distance(const point &p2) const
{
- const double sumsquar = square(p2.x() - x()) + square(p2.y() - y());
+ const double sumsquar = basis::square(p2.x() - x()) + basis::square(p2.y() - y());
return numeric_type(sqrt(sumsquar));
}
template <class numeric_type>
numeric_type point<numeric_type>::magnitude() const
{
- const double sumsquar = square(x()) + square(y());
+ const double sumsquar = basis::square(x()) + basis::square(y());
return numeric_type(sqrt(sumsquar));
}
{
// this bit should be part of the floating point stuff...
double epsilon = 1e-10;
- return (absolute_value(x() - arg2.x()) <= epsilon)
- && (absolute_value(y() - arg2.y()) <= epsilon);
+ return (basis::absolute_value(x() - arg2.x()) <= epsilon)
+ && (basis::absolute_value(y() - arg2.y()) <= epsilon);
}
template <class numeric_type>
template <class numeric_type>
numeric_type rectangle<numeric_type>::minimum_x() const
-{ return minimum(_vertex_1.x(), _vertex_2.x()); }
+{ return basis::minimum(_vertex_1.x(), _vertex_2.x()); }
template <class numeric_type>
numeric_type rectangle<numeric_type>::minimum_y() const
-{ return minimum(_vertex_1.y(), _vertex_2.y()); }
+{ return basis::minimum(_vertex_1.y(), _vertex_2.y()); }
template <class numeric_type>
numeric_type rectangle<numeric_type>::maximum_x() const
-{ return maximum(_vertex_1.x(), _vertex_2.x()); }
+{ return basis::maximum(_vertex_1.x(), _vertex_2.x()); }
template <class numeric_type>
numeric_type rectangle<numeric_type>::maximum_y() const
-{ return maximum(_vertex_1.y(), _vertex_2.y()); }
+{ return basis::maximum(_vertex_1.y(), _vertex_2.y()); }
template <class numeric_type>
rectangle<numeric_type> rectangle<numeric_type>::order() const
numeric_type x2 = _vertex_2.x();
numeric_type y1 = _vertex_1.y();
numeric_type y2 = _vertex_2.y();
- flip_increasing(x1, x2);
- flip_increasing(y1, y2);
+ basis::flip_increasing(x1, x2);
+ basis::flip_increasing(y1, y2);
return rectangle<numeric_type>(x1, y1, x2, y2);
}
bool rectangle<numeric_type>::intersection(const rectangle &r2, rectangle &result)
{
if (disjoint(r2)) return false;
- result = rectangle<numeric_type>(maximum(minimum_x(), r2.minimum_x()),
- maximum(minimum_y(), r2.minimum_y()),
- minimum(maximum_x(), r2.maximum_x()),
- minimum(maximum_y(), r2.maximum_y()));
+ result = rectangle<numeric_type>(basis::maximum(minimum_x(), r2.minimum_x()),
+ basis::maximum(minimum_y(), r2.minimum_y()),
+ basis::minimum(maximum_x(), r2.maximum_x()),
+ basis::minimum(maximum_y(), r2.maximum_y()));
return true;
}
vertical_component vert2;
separate_vertical(targo, vert2);
bool flip_y = bool(vert1 != vert2);
- if (flip_x) swap_values(x1, x2);
- if (flip_y) swap_values(y1, y2);
+ if (flip_x) basis::swap_values(x1, x2);
+ if (flip_y) basis::swap_values(y1, y2);
//LOG(basis::astring("it becomes ") + rectangle<numeric_type>(x1, y1, x2, y2).text_form());
return rectangle<numeric_type>(x1, y1, x2, y2);
}
#include "guards.h"
#include "outcome.h"
+#include <string.h>
+
#define DEBUG_ARRAY
// uncomment for the noisier debugging version.
// get the first command out of the package.
if (!cmd.unpack(packed_form)) {
//complain.
- return false;
+ return NIL;
}
packable_tree *new_branch = NIL;
CHECK_FIELDS;
bounds_return(field, 0, elements() - 1, basis::common::OUT_OF_RANGE);
contents *to_whack = acquire(field);
- WHACK(to_whack);
+ delete to_whack;
if (data) {
basis::array<contents *>::access()[field] = (contents *)data;
_fields_used++;
{
if ( (_rows == new_rows) && (_cols == new_columns) ) return;
matrix<contents> new_this(new_rows, new_columns);
- for (int r = 0; r < minimum(new_rows, rows()); r++)
- for (int c = 0; c < minimum(new_columns, columns()); c++)
+ for (int r = 0; r < basis::minimum(new_rows, rows()); r++)
+ for (int c = 0; c < basis::minimum(new_columns, columns()); c++)
new_this[r][c] = (*this)[r][c];
*this = new_this;
}
bool set<contents>::add(const contents &to_add)
{
if (member(to_add)) return false;
- concatenate(to_add);
+ this->concatenate(to_add);
return true;
}