CAGD Kit Reference

CAGD Kit (Windows NT Release 1.0) Copyright (C) 1996, by Dmitri Bassarab.
Send bugs and/or frames to /dev/null or dima@cs.technion.ac.il
Send comments asbout the reference to mplav@cs.technion.ac.il

3D point

typedef struct { 
  GLdouble x, y, z;
} CAGD_POINT;

Supported types of segment

enum { 
  CAGD_SEGMENT_UNUSED = 0,
  CAGD_SEGMENT_POINT,
  CAGD_SEGMENT_TEXT,
  CAGD_SEGMENT_POLYLINE
};

Events to register callback functions with

enum { 
  CAGD_LBUTTONDOWN = 0,
  CAGD_LBUTTONUP,
  CAGD_MBUTTONDOWN,
  CAGD_MBUTTONUP,
  CAGD_RBUTTONDOWN,
  CAGD_RBUTTONUP,
  CAGD_MOUSEMOVE,
  CAGD_TIMER,
  CAGD_MENU,
  CAGD_LOADFILE,
  CAGD_SAVEFILE,
  CAGD_LAST
};

Callbacks used in event handling

typedef void (*CAGD_CALLBACK)(int, int, PVOID);

Id's of standard user interface controls

enum { 
  CAGD_LOAD = WM_USER,
  CAGD_SAVE,
  CAGD_EXIT,
  CAGD_ORTHO,
  CAGD_PERSP,
  CAGD_CUE,
  CAGD_SENSLESS,
  CAGD_SENSMORE,
  CAGD_FUZZLESS,
  CAGD_FUZZMORE,
  CAGD_RESET, 
  CAGD_HELP,
  CAGD_USER 		/* use this one to create your own control */
};

General purpose functions

void cagdBegin(PCSTR title, int width, int height);
void cagdMainLoop();
void cagdRedraw();
HWND cagdGetWindow();
HMODULE cagdGetModule();

Menu and dialog functions

BOOL cagdAppendMenu(HMENU hMenu, PCSTR name); BOOL cagdRemoveMenu(HMENU hMenu);
WORD cagdPostMenu(HMENU hMenu, int x, int y);
void cagdSetHelpText(PCSTR text);
BOOL cagdShowHelp();

Geometric transformations and view functions

void cagdRotate(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
void cagdTranslate(GLdouble, GLdouble, GLdouble);
void cagdScale(GLdouble, GLdouble, GLdouble);
void cagdReset();
WORD cagdGetView();
void cagdSetView(WORD which);
BOOL cagdGetDepthCue();
void cagdSetDepthCue(BOOL enable);
BOOL cagdToObject(int x, int y, CAGD_POINT where[2]);
BOOL cagdToWindow(CAGD_POINT *where, int *x, int *y);

General segment functions

void cagdSetColor(BYTE r, BYTE g, BYTE b);
void cagdGetColor(BYTE *r, BYTE *g, BYTE *b);
BOOL cagdSetSegmentColor(UINT id, BYTE r, BYTE g, BYTE b);
BOOL cagdGetSegmentColor(UINT id, BYTE r*, BYTE g*, BYTE b*);
BOOL cagdShowSegment(UINT id);
BOOL cagdHideSegment(UINT id);
BOOL cagdIsSegmentVisible(UINT id);
BOOL cagdFreeSegment(UINT id);
void cagdFreeAllSegments();
UINT cagdGetSegmentType(UINT id)
UINT cagdGetSegmentLength(UINT id);
BOOL cagdGetSegmentLocation(UINT id, CAGD_POINT *where);
void cagdPick(int x, int y);
UINT cagdPickNext();

Point segment functions

UINT cagdAddPoint(CAGD_POINT *where);
BOOL cagdReusePoint(UINT id, const CAGD_POINT *where);

Text segment functions

UINT cagdAddText(const CAGD_POINT *where, PCSTR str);
BOOL cagdReuseText(UINT id, const CAGD_POINT *where, PCSTR str);
BOOL cagdGetText(UINT id, PSTR str);

Polyline segment functions

UINT cagdAddPolyline(const CAGD_POINT *where, UINT length);
BOOL cagdReusePolyline(UINT id, const CAGD_POINT *where, UINT lenght);
BOOL cagdGetVertex(UINT id, UINT index, CAGD_POINT *where);
BOOL cagdSetVertex(UINT id, UINT index, const CAGD_POINT *where);
UINT cagdGetNearestVertex(UINT id, int x, int y);

Callback management functions

BOOL cagdRegisterCallback(UINT message, CAGD_CALLBACK cbf, PVOID cbdata);