Graphviz 14.1.1~dev.20251209.0353
Loading...
Searching...
No Matches
poly.c File Reference
#include <neatogen/neato.h>
#include <assert.h>
#include <string.h>
#include <math.h>
#include <neatogen/poly.h>
#include <common/geom.h>
#include <stdbool.h>
#include <util/alloc.h>
#include <util/streq.h>
Include dependency graph for poly.c:

Go to the source code of this file.

Macros

#define PUTPT(P, X, Y)   ((P).x=(X),(P).y=(Y))
 
#define advance(A, B, N)   (B++, A = (A+1)%N)
 

Functions

static bool ISBOX (const Poly *p)
 
static bool ISCIRCLE (const Poly *p)
 
void breakPoly (Poly *pp)
 
static void bbox (Point *verts, size_t cnt, Point *o, Point *c)
 
static void inflatePts (Point *verts, size_t cnt, double xmargin, double ymargin)
 
static int isBox (Point *verts, size_t cnt)
 
static Point makeScaledTransPoint (double x, double y, double dx, double dy)
 
static Point makeScaledPoint (double x, double y)
 
static PointgenRound (Agnode_t *n, size_t *sidep, double xm, double ym)
 
int makeAddPoly (Poly *pp, Agnode_t *n, double xmargin, double ymargin)
 
int makePoly (Poly *pp, Agnode_t *n, double xmargin, double ymargin)
 
static int pintersect (Point originp, Point cornerp, Point originq, Point cornerq)
 
static bool edgesIntersect (Point *P, Point *Q, int n, int m)
 
static bool inPoly (Point vertex[], int n, Point q)
 
static bool inBox (Point p, Point origin_point, Point corner)
 
static PointtransCopy (Point *inp, int cnt, Point off)
 
bool polyOverlap (Point p, Poly *pp, Point q, Poly *qp)
 

Variables

static const int BOX = 1
 
static const int CIRCLE = 2
 

Macro Definition Documentation

◆ advance

#define advance (   A,
  B,
  N 
)    (B++, A = (A+1)%N)

Definition at line 278 of file poly.c.

◆ PUTPT

#define PUTPT (   P,
  X,
  Y 
)    ((P).x=(X),(P).y=(Y))

Definition at line 109 of file poly.c.

Function Documentation

◆ bbox()

static void bbox ( Point verts,
size_t  cnt,
Point o,
Point c 
)
static

Definition at line 32 of file poly.c.

References cnt(), Point::x, and Point::y.

Referenced by makeAddPoly(), and makePoly().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ breakPoly()

void breakPoly ( Poly pp)

Definition at line 27 of file poly.c.

References free(), and Poly::verts.

Referenced by freeNodes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ edgesIntersect()

static bool edgesIntersect ( Point P,
Point Q,
int  n,
int  m 
)
static

Definition at line 280 of file poly.c.

References A, advance, area_2(), B, cross(), leftOf(), and subpt().

Referenced by polyOverlap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ genRound()

static Point * genRound ( Agnode_t n,
size_t *  sidep,
double  xm,
double  ym 
)
static

Definition at line 90 of file poly.c.

References agget(), DFLT_SAMPLE, gv_calloc(), M_PI, ND_height, ND_width, Point::x, and Point::y.

Referenced by makeAddPoly(), and makePoly().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inBox()

static bool inBox ( Point  p,
Point  origin_point,
Point  corner 
)
static

Definition at line 389 of file poly.c.

References Point::x, and Point::y.

Referenced by polyOverlap().

Here is the caller graph for this function:

◆ inflatePts()

static void inflatePts ( Point verts,
size_t  cnt,
double  xmargin,
double  ymargin 
)
static

Definition at line 50 of file poly.c.

References cnt(), Point::x, and Point::y.

Referenced by makePoly().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inPoly()

static bool inPoly ( Point  vertex[],
int  n,
Point  q 
)
static

Definition at line 333 of file poly.c.

References free(), gv_calloc(), Point::x, and Point::y.

Referenced by polyOverlap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ISBOX()

static bool ISBOX ( const Poly p)
static

Definition at line 24 of file poly.c.

References BOX, and Poly::kind.

Referenced by polyOverlap().

Here is the caller graph for this function:

◆ isBox()

static int isBox ( Point verts,
size_t  cnt 
)
static

Definition at line 62 of file poly.c.

References cnt().

Referenced by makeAddPoly(), and makePoly().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ISCIRCLE()

static bool ISCIRCLE ( const Poly p)
static

Definition at line 25 of file poly.c.

References CIRCLE, and Poly::kind.

Referenced by polyOverlap().

Here is the caller graph for this function:

◆ makeAddPoly()

int makeAddPoly ( Poly pp,
Agnode_t n,
double  xmargin,
double  ymargin 
)

Definition at line 111 of file poly.c.

References agerrorf(), bbox(), BOX, CIRCLE, Poly::corner, genRound(), gv_calloc(), isBox(), Poly::kind, boxf::LL, makeScaledTransPoint(), ND_clust, ND_height, ND_shape, ND_shape_info, ND_width, Poly::nverts, Poly::origin, PS2INCH, PUTPT, SH_POINT, SH_POLY, SH_RECORD, shapeOf(), streq(), boxf::UR, Poly::verts, pointf_s::x, Point::x, pointf_s::y, and Point::y.

Referenced by makeInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makePoly()

int makePoly ( Poly pp,
Agnode_t n,
double  xmargin,
double  ymargin 
)

Definition at line 199 of file poly.c.

References agerrorf(), bbox(), BOX, CIRCLE, Poly::corner, genRound(), gv_calloc(), inflatePts(), isBox(), Poly::kind, boxf::LL, makeScaledPoint(), ND_clust, ND_height, ND_shape, ND_shape_info, ND_width, Poly::nverts, Poly::origin, PS2INCH, PUTPT, SH_POINT, SH_POLY, SH_RECORD, shapeOf(), streq(), boxf::UR, Poly::verts, pointf_s::x, Point::x, pointf_s::y, and Point::y.

Referenced by makeInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeScaledPoint()

static Point makeScaledPoint ( double  x,
double  y 
)
static

Definition at line 82 of file poly.c.

References PS2INCH, Point::x, and Point::y.

Referenced by makePoly().

Here is the caller graph for this function:

◆ makeScaledTransPoint()

static Point makeScaledTransPoint ( double  x,
double  y,
double  dx,
double  dy 
)
static

Definition at line 75 of file poly.c.

References dx, dy, PS2INCH, Point::x, and Point::y.

Referenced by makeAddPoly().

Here is the caller graph for this function:

◆ pintersect()

static int pintersect ( Point  originp,
Point  cornerp,
Point  originq,
Point  cornerq 
)
static

Definition at line 272 of file poly.c.

References Point::x, and Point::y.

Referenced by polyOverlap().

Here is the caller graph for this function:

◆ polyOverlap()

bool polyOverlap ( Point  p,
Poly pp,
Point  q,
Poly qp 
)

Definition at line 406 of file poly.c.

References addpt(), Poly::corner, dx, dy, edgesIntersect(), free(), inBox(), inPoly(), ISBOX(), ISCIRCLE(), Poly::nverts, Poly::origin, pintersect(), transCopy(), Poly::verts, Point::x, and Point::y.

Referenced by countOverlap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ transCopy()

static Point * transCopy ( Point inp,
int  cnt,
Point  off 
)
static

Definition at line 394 of file poly.c.

References cnt(), gv_calloc(), out(), Point::x, and Point::y.

Referenced by polyOverlap().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ BOX

const int BOX = 1
static

Definition at line 21 of file poly.c.

Referenced by ISBOX(), makeAddPoly(), and makePoly().

◆ CIRCLE

const int CIRCLE = 2
static

Definition at line 22 of file poly.c.

Referenced by ISCIRCLE(), makeAddPoly(), and makePoly().