clip.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "clip.h"

Go to the source code of this file.

Classes

struct  LOC_cohen_sutherland_line_clip

Defines

#define TRUE   -1
#define FALSE   0

Typedefs

typedef long outcode

Enumerations

enum  edge { LEFT, RIGHT, BOTTOM, TOP }

Functions

void CompOutCode (double x, double y, outcode *code, struct LOC_cohen_sutherland_line_clip *LINK)
ClipResult cohen_sutherland_line_clip_i (int *x0_, int *y0_, int *x1_, int *y1_, int xmin_, int xmax_, int ymin_, int ymax_)
ClipResult cohen_sutherland_line_clip_d (double *x0, double *y0, double *x1, double *y1, double xmin_, double xmax_, double ymin_, double ymax_)


Define Documentation

#define FALSE   0
 

Definition at line 35 of file clip.c.

#define TRUE   -1
 

Definition at line 34 of file clip.c.


Typedef Documentation

typedef long outcode
 

Definition at line 40 of file clip.c.


Enumeration Type Documentation

enum edge
 

Enumerator:
LEFT 
RIGHT 
BOTTOM 
TOP 

Definition at line 37 of file clip.c.


Function Documentation

ClipResult cohen_sutherland_line_clip_d double *  x0,
double *  y0,
double *  x1,
double *  y1,
double  xmin_,
double  xmax_,
double  ymin_,
double  ymax_
 

cohen_sutherland_line_clip_d: : x coordinate of first point. : y coordinate of first point. : x coordinate of second point. : y coordinate of second point. : x coordinate of lower left edge of clipping rectangle. : y coordinate of lower left edge of clipping rectangle. : x coordinate of upper right edge of clipping rectangle. : y coordinate of lower left edge of clipping rectangle.

cohen_sutherland_line_clip_d() will clip a line from first point (, ) to (, ) so that it fits into the given min/max bounds of the rectange (, ) - (, ). The line input coordinates will be modified if necessary for clipping.

Returns: ClipResult.

Definition at line 100 of file clip.c.

References BOTTOM, CompOutCode(), FALSE, LEFT, NotClipped, RIGHT, TOP, TRUE, WasClipped, LOC_cohen_sutherland_line_clip::xmax, LOC_cohen_sutherland_line_clip::xmin, LOC_cohen_sutherland_line_clip::ymax, and LOC_cohen_sutherland_line_clip::ymin.

ClipResult cohen_sutherland_line_clip_i int *  x0_,
int *  y0_,
int *  x1_,
int *  y1_,
int  xmin_,
int  xmax_,
int  ymin_,
int  ymax_
 

Definition at line 62 of file clip.c.

References cohen_sutherland_line_clip_d().

void CompOutCode double  x,
double  y,
outcode code,
struct LOC_cohen_sutherland_line_clip LINK
 

Definition at line 48 of file clip.c.

References BOTTOM, LEFT, RIGHT, TOP, LOC_cohen_sutherland_line_clip::xmax, and LOC_cohen_sutherland_line_clip::ymax.


Generated on Sat Apr 1 09:04:31 2006 for GXSM by  doxygen 1.4.6