Skip to content

Commit

Permalink
Reformat C++ files.
Browse files Browse the repository at this point in the history
  • Loading branch information
johncbowman committed Feb 9, 2009
1 parent 46c4f8d commit a68637e
Show file tree
Hide file tree
Showing 99 changed files with 2,299 additions and 2,299 deletions.
84 changes: 42 additions & 42 deletions Delaunay.cc
Expand Up @@ -42,7 +42,7 @@ inline double hypot2(double *x)
///////////////////////////////////////////////////////////////////////////////

Int Triangulate(Int nv, XYZ pxyz[], ITRIANGLE v[], Int &ntri,
bool presort, bool postsort)
bool presort, bool postsort)
{
Int emax = 200;

Expand Down Expand Up @@ -108,7 +108,7 @@ Int Triangulate(Int nv, XYZ pxyz[], ITRIANGLE v[], Int &ntri,
*/
for(Int j = 0; j < ntri; j++) {
if(complete[j])
continue;
continue;
ITRIANGLE *vj=v+j;

double *a=pxyz[vj->p1].p;
Expand All @@ -117,40 +117,40 @@ Int Triangulate(Int nv, XYZ pxyz[], ITRIANGLE v[], Int &ntri,

if(incircle(a,b,c,d) <= 0.0) { // Point d is inside or on circumcircle
/* Check that we haven't exceeded the edge list size */
if(nedge + 3 >= emax) {
emax += 100;
IEDGE *p_EdgeTemp = new IEDGE[emax];
for (Int i = 0; i < nedge; i++) {
p_EdgeTemp[i] = edges[i];
}
delete[] edges;
edges = p_EdgeTemp;
}
ITRIANGLE *vj=v+j;
Int p1=vj->p1;
Int p2=vj->p2;
Int p3=vj->p3;
edges[nedge].p1 = p1;
edges[nedge].p2 = p2;
edges[++nedge].p1 = p2;
edges[nedge].p2 = p3;
edges[++nedge].p1 = p3;
edges[nedge].p2 = p1;
++nedge;
ntri--;
v[j] = v[ntri];
complete[j] = complete[ntri];
j--;
if(nedge + 3 >= emax) {
emax += 100;
IEDGE *p_EdgeTemp = new IEDGE[emax];
for (Int i = 0; i < nedge; i++) {
p_EdgeTemp[i] = edges[i];
}
delete[] edges;
edges = p_EdgeTemp;
}
ITRIANGLE *vj=v+j;
Int p1=vj->p1;
Int p2=vj->p2;
Int p3=vj->p3;
edges[nedge].p1 = p1;
edges[nedge].p2 = p2;
edges[++nedge].p1 = p2;
edges[nedge].p2 = p3;
edges[++nedge].p1 = p3;
edges[nedge].p2 = p1;
++nedge;
ntri--;
v[j] = v[ntri];
complete[j] = complete[ntri];
j--;
} else {
double A=hypot2(a);
double B=hypot2(b);
double C=hypot2(c);
double a0=orient2d(a,b,c);
// Is d[0] > xc+r for circumcircle abc of radius r about (xc,yc)?
if(d[0]*a0 < 0.5*orient2d(A,a[1],B,b[1],C,c[1]))
complete[j]=
incircle(a[0]*a0,a[1]*a0,b[0]*a0,b[1]*a0,c[0]*a0,c[1]*a0,
d[0]*a0,0.5*orient2d(a[0],A,b[0],B,c[0],C)) > 0.0;
double A=hypot2(a);
double B=hypot2(b);
double C=hypot2(c);
double a0=orient2d(a,b,c);
// Is d[0] > xc+r for circumcircle abc of radius r about (xc,yc)?
if(d[0]*a0 < 0.5*orient2d(A,a[1],B,b[1],C,c[1]))
complete[j]=
incircle(a[0]*a0,a[1]*a0,b[0]*a0,b[1]*a0,c[0]*a0,c[1]*a0,
d[0]*a0,0.5*orient2d(a[0],A,b[0],B,c[0],C)) > 0.0;
}
}
/*
Expand All @@ -160,12 +160,12 @@ Int Triangulate(Int nv, XYZ pxyz[], ITRIANGLE v[], Int &ntri,
*/
for(Int j = 0; j < nedge - 1; j++) {
for(Int k = j + 1; k < nedge; k++) {
if((edges[j].p1 == edges[k].p2) && (edges[j].p2 == edges[k].p1)) {
edges[j].p1 = -1;
edges[j].p2 = -1;
edges[k].p1 = -1;
edges[k].p2 = -1;
}
if((edges[j].p1 == edges[k].p2) && (edges[j].p2 == edges[k].p1)) {
edges[j].p1 = -1;
edges[j].p2 = -1;
edges[k].p1 = -1;
edges[k].p2 = -1;
}
}
}
/*
Expand All @@ -175,7 +175,7 @@ Int Triangulate(Int nv, XYZ pxyz[], ITRIANGLE v[], Int &ntri,
*/
for(Int j = 0; j < nedge; j++) {
if(edges[j].p1 < 0 || edges[j].p2 < 0)
continue;
continue;
v[ntri].p1 = edges[j].p1;
v[ntri].p2 = edges[j].p2;
v[ntri].p3 = i;
Expand Down
2 changes: 1 addition & 1 deletion Delaunay.h
Expand Up @@ -22,7 +22,7 @@ struct XYZ{
};

Int Triangulate(Int nv, XYZ pxyz[], ITRIANGLE v[], Int &ntri,
bool presort=true, bool postsort=true);
bool presort=true, bool postsort=true);

#endif

Expand Down
2 changes: 1 addition & 1 deletion absyn.h
Expand Up @@ -14,7 +14,7 @@

// Forward declaration for markPos.
namespace trans {
class coenv;
class coenv;
}

namespace absyntax {
Expand Down
18 changes: 9 additions & 9 deletions access.cc
Expand Up @@ -39,15 +39,15 @@ static void bltinError(position pos)
void bltinAccess::encode(action act, position pos, coder &e)
{
switch (act) {
case READ:
e.encode(inst::constpush,(item)(vm::callable*)new vm::bfunc(f));
break;
case WRITE:
bltinError(pos);
break;
case CALL:
e.encode(inst::builtin, f);
break;
case READ:
e.encode(inst::constpush,(item)(vm::callable*)new vm::bfunc(f));
break;
case WRITE:
bltinError(pos);
break;
case CALL:
e.encode(inst::builtin, f);
break;
}
}

Expand Down
14 changes: 7 additions & 7 deletions application.cc
Expand Up @@ -32,23 +32,23 @@ bool castable(env &e, formal& target, formal& source) {

score castScore(env &e, formal& target, formal& source) {
return equivalent(target.t,source.t) ? EXACT :
(!target.Explicit &&
e.castable(target.t,source.t, symbol::castsym)) ? CAST : FAIL;
(!target.Explicit &&
e.castable(target.t,source.t, symbol::castsym)) ? CAST : FAIL;
}

defaultArg::defaultArg(types::ty *t)
: arg(new absyntax::callExp(position(),
new absyntax::varEntryExp(position(),
new function(t),
run::pushDefault)),
new absyntax::varEntryExp(position(),
new function(t),
run::pushDefault)),
t)
{}

void restArg::transMaker(coenv &e, Int size, bool rest) {
// Push the number of cells and call the array maker.
e.c.encode(inst::intpush, size);
e.c.encode(inst::builtin, rest ? run::newAppendedArray :
run::newInitializedArray);
run::newInitializedArray);
}

void restArg::trans(coenv &e, temp_vector &temps)
Expand Down Expand Up @@ -207,7 +207,7 @@ bool application::matchArgument(env &e, formal &source,
// Match here, or failing that use a default and try to match at the next
// spot.
return matchAtSpot(index, e, source, a, evalIndex) ||
(matchDefault() && matchArgument(e, source, a, evalIndex));
(matchDefault() && matchArgument(e, source, a, evalIndex));
}

bool application::matchNamedArgument(env &e, formal &source,
Expand Down
6 changes: 3 additions & 3 deletions application.h
Expand Up @@ -74,7 +74,7 @@ struct restArg : public gc {
: rest(0) {}

virtual ~restArg()
{}
{}

// Encodes the instructions to make an array from size elements on the stack.
static void transMaker(coenv &e, Int size, bool rest);
Expand Down Expand Up @@ -187,7 +187,7 @@ class application : public gc {
rest(0),
rf(0),
index(0)
{ assert(sig); initRest(); }
{ assert(sig); initRest(); }

application(types::function *t)
: sig(t->getSignature()),
Expand All @@ -196,7 +196,7 @@ class application : public gc {
rest(0),
rf(0),
index(0)
{ assert(sig); initRest(); }
{ assert(sig); initRest(); }

types::formal &getTarget() {
return sig->getFormal(index);
Expand Down

0 comments on commit a68637e

Please sign in to comment.