{
double *pvec;
char *p, c;
+ double z;
if (posptr == NULL)
return FALSE;
for (i = 0; i < Ndim; i++)
pvec[i] = pvec[i] / PSinputscale;
}
- if (Ndim > 2)
- jitter3d(np, nG);
+ if (Ndim > 2) {
+ if (N_z && (p = agxget(np, N_z->index)) &&
+ (sscanf(p,"%lf",&z) == 1)) {
+ if (PSinputscale > 0.0) {
+ pvec[2] = z / PSinputscale;
+ }
+ else
+ pvec[2] = z;
+ jitter_d(np, nG, 3);
+ }
+ else
+ jitter3d(np, nG);
+ }
if ((c == '!')
|| (pinptr && mapbool(agxget(np, pinptr->index))))
ND_pinned(np) = P_PIN;
kkNeato(g, nG, layoutModel);
}
+/* addZ;
+ * If dimension == 3 and z attribute is declared,
+ * attach z value to nodes if not defined.
+ */
+static void
+addZ (Agraph_t* g)
+{
+ node_t* n;
+ char buf[BUFSIZ];
+
+ if ((Ndim >= 3) && N_z) {
+ for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
+ sprintf(buf, "%d", POINTS(ND_pos(n)[2]));
+ agxset(n, N_z->index, buf);
+ }
+ }
+}
+
/* neato_layout:
*/
void neato_layout(Agraph_t * g)
neato_init_graph(g);
if (Nop) {
+ addZ (g);
if (init_nop(g)) {
agerr(AGPREV, "as required by the -n flag\n");
exit(1);
free(bp);
}
compute_bb(g);
+ addZ (g);
spline_edges(g);
/* cleanup and remove component subgraphs */
} else {
neatoLayout(g, layoutMode, model);
adjustNodes(g);
+ addZ (g);
spline_edges(g);
}
}
extern void initial_positions(graph_t *, int);
extern int init_port(Agnode_t *, Agedge_t *, char *, boolean);
extern void jitter3d(Agnode_t *, int);
+ extern void jitter_d(Agnode_t *, int, int);
extern Ppoly_t *makeObstacle(node_t * n, double SEP);
extern void makeSelfArcs(path * P, edge_t * e, int stepx);
extern void makeSpline(edge_t *, Ppoly_t **, int, boolean);
}
}
-void jitter3d(node_t * np, int nG)
+void jitter_d(node_t * np, int nG, int n)
{
int k;
- for (k = 2; k < Ndim; k++)
+ for (k = n; k < Ndim; k++)
ND_pos(np)[k] = nG * drand48();
}
+void jitter3d(node_t * np, int nG)
+{
+ jitter_d(np, nG, 2);
+}
+
void randompos(node_t * np, int nG)
{
ND_pos(np)[0] = nG * drand48();