Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
con1.c
Package: gsnake.rar [view]
Upload User: shhuayu888
Upload Date: 2013-03-28
Package Size: 1788k
Code Size: 5k
Category:
Windows Develop
Development Platform:
Unix_Linux
- /****************************************************************************
- File Name : con1.c
- Purpose : 1 Initializing of open and closed contour
- 2. Display of contour
- 3. Internal energy calculation
- Date : Aug 31,1995
- GSNAKE API is jointly developed by the Information Technology Institute (ITI), Singapore, and the School of Applied Science, Nanyang Technological
- University (NTU), Singapore.
- These software programs are available to the user without any license or royalty fees. Permission is hereby granted to use, copy, modify, and distribute this software and its documentation for any purpose. ITI and NTU gives no warranty, express, implied, or statuary for the software and/or documentation provided, including, without limitation, waranty of merchantibility and warranty of fitness for a particular purpose. The software provided hereunder is on an "as is" basis, and ITI and NTU has no obligation to provide maintenance, support, updates, enhancements, or modifications.
- GSNAKE API is available for any UNIX compatible system. User feedback, bugs, or software and manual suggestions should be sent via electronic mail to one of the following, who may or may not act on them as he/she desires :
- asschan@ntu.ac.sg
- kflai@iti.gov.sg
- ***************************************************************************/
- #include "gsnake.h"
- #include "xwindow.h"
- void testmain(SNAKEMODE , int , int , int , int,double, short, int );
- void printhelp();
- void getparam(int ac, char** av, int *Mfactor,SNAKEMODE *smode,short *Numpt,
- int *sx, int *sy, int *ex, int *ey, double *radius);
- main(int argc,char **argv)
- {
- int magnify = 1;
- SNAKEMODE mode = _CLOSED;
- short numpoint = 8;
- int sx,sy,ex,ey;
- double rad = 15.0;
- sx=50;
- sy = 50;
- ex = 80;
- ey = 80;
- if (argc==1) printhelp();
- else {
- getparam(argc,argv,&magnify,&mode,&numpoint,&sx,&sy,
- &ex,&ey, &rad);
- printf("%d %d %d",sx,sy,numpoint);
- testmain(mode, sx,sy,ex,ey,rad,numpoint,magnify);
- return(0);
- }
- }
- void testmain( SNAKEMODE smode, /* snake mode */
- int Sx, int Sy, /* starting point of a line */
- int Ex, int Ey, /* ending point of a line */
- double Radius, /* radius of circle */
- short num_points, /* number of snaxels */
- int mag ) /* magnification factor */
- {
- CONTOUR mycontour; /* CONTOUR object */
- SNAXEL *sptr; /* SNAXEL objcet */
- register short i = 0;
- /* Initialize an arbitrary close snake */
- if (smode == _CLOSED)
- mycontour.init(Sy, Sx, Radius, num_points);
- else
- mycontour.init(Sx, Sy, Ex, Ey, num_points);
- /* The average length of snaxel must be calculated first. */
- mycontour.computeAvgLength();
- printf("nContour information : n");
- mycontour.print();
- printf("nPress enter to display contour.");
- getchar();
- mycontour.display(mag);
- /* Internal energy of snake without deformation should be 0 */
- printf("nInternal energy.");
- for(sptr=mycontour.getHead(); sptr; sptr=sptr->getNext(), i++)
- printf("nEmodel of snaxel %d = %f",
- i, mycontour.EInternal(sptr));
- printf("nPress enter to continue");
- getchar();
- printf("nEnd of test.n");
- }
- void getparam(int ac, char** av, int *Mfactor,SNAKEMODE *smode,short *Numpt,
- int *sx, int *sy, int *ex, int *ey, double *radius)
- {
- register int i;
- char *inputstr;
- for (i=1; i<ac; i++)
- {
- if( *av[i] != '-' )
- continue; /* illegal input */
- inputstr = av[i]+2;
- switch( *(av[i]+1) ) {
- case 'm' :
- inputstr=av[i]+3;
- switch (*(av[i]+2)) {
- case 'c': *smode = _CLOSED; break;
- case 'o': *smode = _OPENED;break;
- }
- break;
- case 'U' :
- inputstr=av[i]+3;
- switch (*(av[i]+2)) {
- case 'x': *sx = atoi(inputstr); break;
- case 'y': *sy = atoi(inputstr);break;
- }
- break;
- case 'V' :
- inputstr=av[i]+3;
- switch (*(av[i]+2)) {
- case 'x': *ex = atoi(inputstr); break;
- case 'y': *ey = atoi(inputstr);break;
- }
- break;
- case 'M' :
- *Mfactor=atoi(inputstr);
- break;
- case 'N' :
- *Numpt=atoi(inputstr);
- break;
- case 'R' :
- *radius=atof(inputstr);
- break;
- default: break;
- }
- }
- }
- void printhelp()
- {
- printf("nnInitialization of arbitrary contour");
- printf("n Usage :OOcon1 [ option ]");
- printf("n [ option ]");
- printf("n -m/o/c :Gsnake mode ( o-opened / c-closed )");
- printf("n -M :Magnification factor, default 1 ");
- printf("n -N :Number of snaxels, default 8");
- printf("n -U :Starting point of a line or centre of a circle,");
- printf("n :Default x = 50, y = 50");
- printf("n -V :Ending point of a line");
- printf("n :Default x = 80, y = 80");
- printf("n -R :Radius of a circle, default 15.0nn");
- }