Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
poly.c File Reference
#include <cgraph/alloc.h>
#include <cgraph/streq.h>
#include <neatogen/neato.h>
#include <assert.h>
#include <string.h>
#include <math.h>
#include <neatogen/poly.h>
#include <common/geom.h>
#include <neatogen/mem.h>
#include <stdbool.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 Pin   1
 
#define Qin   2
 
#define Unknown   0
 
#define advance(A, B, N)   (B++, A = (A+1)%N)
 

Functions

static bool ISBOX (const Poly *p)
 
static bool ISCIRCLE (const Poly *p)
 
void polyFree (void)
 
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 int edgesIntersect (Point *P, Point *Q, int n, int m)
 
static int inPoly (Point vertex[], int n, Point q)
 
static bool inBox (Point p, Point origin_point, Point corner)
 
static void transCopy (Point *inp, int cnt, Point off, Point *outp)
 
int polyOverlap (Point p, Poly *pp, Point q, Poly *qp)
 

Variables

static const int BOX = 1
 
static const int CIRCLE = 2
 
static size_t maxcnt = 0
 
static Pointtp1 = NULL
 
static Pointtp2 = NULL
 
static Pointtp3 = NULL
 

Macro Definition Documentation

◆ advance

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

Definition at line 303 of file poly.c.

◆ Pin

#define Pin   1

Definition at line 299 of file poly.c.

◆ PUTPT

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

Definition at line 126 of file poly.c.

◆ Qin

#define Qin   2

Definition at line 300 of file poly.c.

◆ Unknown

#define Unknown   0

Definition at line 301 of file poly.c.

Function Documentation

◆ bbox()

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

Definition at line 49 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 44 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 int edgesIntersect ( Point P,
Point Q,
int  n,
int  m 
)
static

Definition at line 305 of file poly.c.

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

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 107 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 421 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 67 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 int inPoly ( Point  vertex[],
int  n,
Point  q 
)
static

Definition at line 364 of file poly.c.

References gv_calloc(), maxcnt, NULL, tp3, 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 25 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 79 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 26 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 128 of file poly.c.

References agerrorf(), bbox(), BOX, CIRCLE, Poly::corner, genRound(), gv_calloc(), isBox(), Poly::kind, boxf::LL, makeScaledTransPoint(), maxcnt, 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 218 of file poly.c.

References agerrorf(), bbox(), BOX, CIRCLE, Poly::corner, genRound(), gv_calloc(), inflatePts(), isBox(), Poly::kind, boxf::LL, makeScaledPoint(), maxcnt, 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 99 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 92 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 293 of file poly.c.

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

Referenced by polyOverlap().

Here is the caller graph for this function:

◆ polyFree()

void polyFree ( void  )

Definition at line 33 of file poly.c.

References free(), maxcnt, NULL, tp1, tp2, and tp3.

Referenced by freeNodes().

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

◆ polyOverlap()

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

Definition at line 438 of file poly.c.

References addpt(), Poly::corner, dx, dy, edgesIntersect(), gv_calloc(), inBox(), inPoly(), ISBOX(), ISCIRCLE(), maxcnt, NULL, Poly::nverts, Poly::origin, pintersect(), tp1, tp2, 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 void transCopy ( Point inp,
int  cnt,
Point  off,
Point outp 
)
static

Definition at line 426 of file poly.c.

References cnt(), 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 22 of file poly.c.

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

◆ CIRCLE

const int CIRCLE = 2
static

Definition at line 23 of file poly.c.

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

◆ maxcnt

size_t maxcnt = 0
static

Definition at line 28 of file poly.c.

Referenced by inPoly(), makeAddPoly(), makePoly(), polyFree(), and polyOverlap().

◆ tp1

Point* tp1 = NULL
static

Definition at line 29 of file poly.c.

Referenced by polyFree(), and polyOverlap().

◆ tp2

Point* tp2 = NULL
static

Definition at line 30 of file poly.c.

Referenced by polyFree(), and polyOverlap().

◆ tp3

Point* tp3 = NULL
static

Definition at line 31 of file poly.c.

Referenced by inPoly(), and polyFree().