void (*codefn) (GVJ_t * job, node_t * n); /* emits graphics code for node */
} shape_functions;
- typedef enum { SH_UNSET, SH_POLY, SH_RECORD, SH_POINT, SH_EPSF,
- SH_USER } shape_kind;
+ typedef enum { SH_UNSET, SH_POLY, SH_RECORD, SH_POINT, SH_EPSF} shape_kind;
typedef struct shape_desc { /* read-only shape descriptor */
char *name; /* as read from graph file */
*
* The polygon has its vertices in CW order.
*
- * N.B. Point, epsf and user shapes are not handled. Point should
- * be easy, and user shapes are boxes. FIX
*/
Ppoly_t *makeObstacle(node_t * n, double SEP)
{
box b;
point pt;
field_t *fld;
+ epsf_t *desc;
switch (shapeOf(n)) {
case SH_POLY:
+ case SH_POINT:
obs = NEW(Ppoly_t);
poly = (polygon_t *) ND_shape_info(n);
if (poly->sides >= 3) {
obs->ps[2] = recPt(b.UR.x, b.UR.y, pt, SEP);
obs->ps[3] = recPt(b.UR.x, b.LL.y, pt, SEP);
break;
+ case SH_EPSF:
+ desc = (epsf_t *) (ND_shape_info(n));
+ obs = NEW(Ppoly_t);
+ obs->pn = 4;
+ obs->ps = N_NEW(4, Ppoint_t);
+ /* CW order */
+ pt = ND_coord_i(n);
+ obs->ps[0] = recPt(-ND_lw_i(n), -ND_ht_i(n), pt, SEP);
+ obs->ps[1] = recPt(-ND_lw_i(n), ND_ht_i(n), pt, SEP);
+ obs->ps[2] = recPt(ND_rw_i(n), ND_ht_i(n), pt, SEP);
+ obs->ps[3] = recPt(ND_rw_i(n), -ND_ht_i(n), pt, SEP);
+ break;
default:
obs = NULL;
break;