#include "spice.h"
#include "sced.h"
#include "scedmacs.h"
Go to the source code of this file.
static void clip_bottom |
( |
| ) |
|
|
static |
static void clip_bottom |
( |
long |
bottom | ) |
|
|
static |
Definition at line 429 of file polyclip.c.
433 struct pair *pa, *
pp, *pfirst, *plast, *pnext;
435 long x, y, xnext, ynext;
438 for (list =
Polybuf; list < end; list++) {
447 if (pp->
pa_y < bottom)
466 if (ynext >= bottom && y < bottom) {
469 x += (xnext - x)*(((
double)(bottom - y))/(ynext - y));
471 x += ((bottom - y) * (xnext - x))/(ynext - y);
475 if (x != xnext || y != ynext) {
493 if (pp->
pa_y < bottom) {
505 x += (xnext - x)*(((
double)(bottom - y))/(ynext - y));
507 x += ((bottom - y) * (xnext - x))/(ynext - y);
511 if (x != xnext || y != ynext) {
524 if (pfirst->
pa_next != plast) {
547 end->pl_start =
NULL;
static struct plist * Newpoly
static struct pair * Newlink
static struct plist * Polybuf
static void clip_left |
( |
| ) |
|
|
static |
static void clip_left |
( |
long |
left | ) |
|
|
static |
Definition at line 302 of file polyclip.c.
306 struct pair *pa, *
pp, *pfirst, *plast, *pnext;
308 long x, y, xnext, ynext;
311 for (list =
Polybuf; list < end; list++) {
339 if (xnext >= left && x < left) {
342 y += (ynext - y)*(((
double)(left - x))/(xnext - x));
344 y += ((left - x) * (ynext - y))/(xnext - x);
348 if (x != xnext || y != ynext) {
366 if (pp->
pa_x < left) {
378 y += (ynext - y)*(((
double)(left - x))/(xnext - x));
380 y += ((left - x) * (ynext - y))/(xnext - x);
384 if (x != xnext || y != ynext) {
397 if (pfirst->
pa_next != plast) {
420 end->pl_start =
NULL;
static struct plist * Newpoly
static struct pair * Newlink
static struct plist * Polybuf
static void clip_right |
( |
| ) |
|
|
static |
static void clip_right |
( |
long |
right | ) |
|
|
static |
Definition at line 175 of file polyclip.c.
179 struct pair *pa, *
pp, *pfirst, *plast, *pnext;
181 long x, y, xnext, ynext;
184 for (list =
Polybuf; list < end; list++) {
193 if (pp->
pa_x > right)
212 if (xnext <= right && x > right) {
215 y += (ynext - y)*(((
double)(right - x))/(xnext - x));
217 y += ((right-x)*(ynext-y))/(xnext-x);
221 if (x != xnext || y != ynext) {
239 if (pp->
pa_x > right) {
251 y += (ynext - y)*(((
double)(right - x))/(xnext - x));
253 y += ((right-x)*(ynext-y))/(xnext-x);
257 if (x != xnext || y != ynext) {
270 if (pfirst->
pa_next != plast) {
293 end->pl_start =
NULL;
static struct plist * Newpoly
static struct pair * Newlink
static struct plist * Polybuf
static void clip_top |
( |
long |
top | ) |
|
|
static |
Definition at line 556 of file polyclip.c.
560 struct pair *pa, *
pp, *pfirst, *plast, *pnext;
562 long x, y, xnext, ynext;
565 for (list =
Polybuf; list < end; list++) {
593 if (ynext <= top && y > top) {
596 x += (xnext - x)*(((
double)(top - y))/(ynext - y));
598 x += ((top - y) * (xnext - x))/(ynext - y);
602 if (x != xnext || y != ynext) {
620 if (pp->
pa_y > top) {
632 x += (xnext - x)*(((
double)(top - y))/(ynext - y));
634 x += ((top - y) * (xnext - x))/(ynext - y);
638 if (x != xnext || y != ynext) {
651 if (pfirst->
pa_next != plast) {
674 end->pl_start =
NULL;
static struct plist * Newpoly
static struct pair * Newlink
static struct plist * Polybuf
static void linkpolys |
( |
| ) |
|
|
static |
static void linkpolys |
( |
struct plist * |
base, |
|
|
int |
XorY |
|
) |
| |
|
static |
Definition at line 683 of file polyclip.c.
688 struct plist tmp, *b, *bb;
695 for (b = base; b <
Newpoly; b += 2) {
705 (b+1)->pl_pair =
NULL;
706 if (b->
pl_start != (b+1)->pl_start) {
707 for (bb = b+2; bb <
Newpoly; bb++) {
717 if ((b+1)->pl_pair != (b+1)->
pl_start) {
724 (b+1)->pl_pair =
NULL;
725 if (b->
pl_start != (b+1)->pl_start) {
726 for (bb = b+2; bb <
Newpoly; bb++) {
727 if (bb->
pl_start == (b+1)->pl_start) {
static struct plist * Newpoly
Definition at line 772 of file polyclip.c.
792 Linkbuf = (
struct pair *)
797 for (i = 0; i < num; i++) {
798 (Linkbuf+i)->
pa_next = ((Linkbuf+i)->pa_next - oldbuf) + Linkbuf;
799 (Linkbuf+i)->
pa_prev = ((Linkbuf+i)->pa_prev - oldbuf) + Linkbuf;
802 for (i = 0; i < num; i++) {
803 (Polybuf+i)->pl_pair = ((Polybuf+i)->pl_pair - oldbuf) + Linkbuf;
static struct plist * Newpoly
static struct pair * Newlink
static struct plist * Polybuf
static struct pair * Linkbuf
Definition at line 810 of file polyclip.c.
829 Polybuf = (
struct plist *)
static struct plist * Newpoly
static struct plist * Polybuf
Definition at line 135 of file polyclip.c.
static struct plist * Newpoly
static struct pair * Newlink
static struct plist * Polybuf
static struct pair * Linkbuf
static struct plist * Polycurrent
static int polycmpX |
( |
char * |
p1, |
|
|
char * |
p2 |
|
) |
| |
|
static |
Definition at line 740 of file polyclip.c.
748 return (((
struct plist *)p1)->pl_pair->pa_x -
749 ((
struct plist *)p2)->pl_pair->pa_x);
static int polycmpY |
( |
char * |
p1, |
|
|
char * |
p2 |
|
) |
| |
|
static |
Definition at line 754 of file polyclip.c.
762 return (((
struct plist *)p1)->pl_pair->pa_y -
763 ((
struct plist *)p2)->pl_pair->pa_y);
void PolygonClip |
( |
POLYGON * |
poly, |
|
|
long |
left, |
|
|
long |
bottom, |
|
|
long |
right, |
|
|
long |
top |
|
) |
| |
Definition at line 71 of file polyclip.c.
101 for (i = 0; i < n; i += 2) {
110 if (pa->
pa_x != poly->
xy[i] || pa->
pa_y != poly->
xy[i+1]) {
static struct plist * Newpoly
static struct pair * Newlink
static void clip_bottom()
static struct plist * Polybuf
static struct pair * Linkbuf
static struct plist * Polycurrent
struct plist* Polycurrent |
|
static |