1 #include <../../nrnconf.h> 30 #if defined(HAVE_FENV_H) && defined(HAVE_FESETROUND) 32 static int round_mode[] = {FE_DOWNWARD, FE_TONEAREST, FE_TOWARDZERO, FE_UPWARD};
35 #if defined(HAVE_FENV_H) && defined(HAVE_FESETROUND) 36 int oldmode = fegetround();
38 if (oldmode == FE_TONEAREST) {
40 }
else if (oldmode == FE_TOWARDZERO) {
42 }
else if (oldmode == FE_UPWARD) {
44 }
else if (oldmode == FE_DOWNWARD) {
49 if (mode > 0 && mode < 5) {
50 nrn_assert(fesetround(round_mode[mode-1]) == 0);
95 for (
int i=1;
i < count; ++
i) {
105 for (
int i=1;
i < count; ++
i) {
127 Coord dx, dy, dx2, dy2;
133 norm2 = dx2*dx2 + dy2*dy2;
134 norm = dx*dx + dy*dy;
135 dot = dx*dx2 + dy*dy2;
136 d = norm - dot*dot/
norm2;
138 if (d <= epsilon*epsilon) {
151 Coord dx, dy, dx2, dy2;
157 norm2 = dx2*dx2 + dy2*dy2;
158 norm = dx*dx + dy*dy;
159 dot = dx*dx2 + dy*dy2;
160 if (norm2 == 0) {norm2 = 1.;}
161 d = norm - dot*dot/
norm2;
173 Coord dx, dy, dx2, dy2;
178 norm2 = dx2*dx2 + dy2*dy2;
179 norm = dx*dx + dy*dy;
184 dot = dx*dx2 + dy*dy2;
187 }
else if (dot > norm2) {
190 return sqrt(dx*dx + dy*dy);
192 dx = norm - dot*dot/
norm2;
204 Coord l = x1, b = y1, r = x2,
t = y2;
253 }
else if ((i%3) == 0) {
276 y1 = d*double(
int(x1/d - .5));
277 y2 = d*double(
int(x2/d + .5));
278 ntic =
int((y2 - y1)/d + .5);
286 int i =
int((y2 - y1)/d + .5);
292 }
else if (i%4 == 0) {
295 }
else if (i%5 == 0) {
309 int i =
int(d/e + .5);
311 y1 = 5*e*
ceil(x1/e/5 - .01);
312 y2 = 5*e*
floor(x2/e/5 + .01);
314 y1 = e*
ceil(x1/e - .01);
315 y2 = e*
floor(x2/e + .01);
317 i =
int((y2 - y1)/e + .5);
323 }
else if (i%4 == 0) {
326 }
else if (i%5 == 0) {
static void * cons(Object *)
static Member_func members[]
static void round_range(Coord x1, Coord x2, double &y1, double &y2, int &ntic)
static float distance_to_line_segment(Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2)
static double inside(void *)
static bool equal(float x, float y, float e)
static double distance_to_line_segment(void *)
static bool near_line_segment(Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2, float epsilon)
static bool unit_normal(Coord x, Coord y, Coord *perp)
static void round_range_down(Coord x1, Coord x2, double &y1, double &y2, int &ntic)
static double anint(double)
const Requirement & x_requirement() const
static bool inside(Coord x, Coord min, Coord max)
static double round(float &x1, float &x2, int direction, int digits)
static void minmax(Coord &min, Coord &max)
static float distance_to_line(Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2)
static float norm2(Coord x, Coord y)
static float min(int count, const float *)
static double distance_to_line(void *)
const Requirement & y_requirement() const
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
static bool near_line(Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2, float epsilon)
static double feround(void *)
static void destruct(void *)
static float max(int count, const float *)
static void box(Requisition &, Coord &x1, Coord &y1, Coord &x2, Coord &y2)
double chkarg(int, double low, double high)