source: trunk/src/opengl/glu/nurbs/internals/arc.h

Last change on this file was 2689, checked in by jeroen, 26 years ago

* empty log message *

File size: 5.4 KB
Line 
1/* $Id: arc.h,v 1.1 2000-02-09 08:49:48 jeroen Exp $ */
2/*
3** License Applicability. Except to the extent portions of this file are
4** made subject to an alternative license as permitted in the SGI Free
5** Software License B, Version 1.0 (the "License"), the contents of this
6** file are subject only to the provisions of the License. You may not use
7** this file except in compliance with the License. You may obtain a copy
8** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
9** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
10**
11** http://oss.sgi.com/projects/FreeB
12**
13** Note that, as provided in the License, the Software is distributed on an
14** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
15** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
16** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
17** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
18**
19** Original Code. The Original Code is: OpenGL Sample Implementation,
20** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
21** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
22** Copyright in any portions created by third parties is as indicated
23** elsewhere herein. All Rights Reserved.
24**
25** Additional Notice Provisions: The application programming interfaces
26** established by SGI in conjunction with the Original Code are The
27** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
28** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
29** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
30** Window System(R) (Version 1.3), released October 19, 1998. This software
31** was created using the OpenGL(R) version 1.2.1 Sample Implementation
32** published by SGI, but has not been independently verified as being
33** compliant with the OpenGL(R) version 1.2.1 Specification.
34*/
35
36/*
37 * arc.h
38 *
39 * $Date: 2000-02-09 08:49:48 $ $Revision: 1.1 $
40 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/internals/arc.h,v 1.1 2000-02-09 08:49:48 jeroen Exp $
41 */
42
43#ifndef __gluarc_h_
44#define __gluarc_h_
45
46#include "myassert.h"
47#include "bufpool.h"
48#include "mystdio.h"
49#include "types.h"
50#include "pwlarc.h"
51#include "trimvertex.h"
52
53class Bin;
54class Arc;
55class BezierArc;
56
57typedef class Arc *Arc_ptr;
58
59enum arc_side { arc_none = 0, arc_right, arc_top, arc_left, arc_bottom };
60
61
62class Arc: public PooledObj { /* an arc, in two list, the trim list and bin */
63
64public:
65 static const int bezier_tag;
66 static const int arc_tag;
67 static const int tail_tag;
68 Arc_ptr prev; /* trim list pointer */
69 Arc_ptr next; /* trim list pointer */
70 Arc_ptr link; /* bin pointers */
71 BezierArc * bezierArc; /* associated bezier arc*/
72 PwlArc * pwlArc; /* associated pwl arc*/
73 long type; /* curve type */
74 long nuid;
75
76 inline Arc( class Arc *, PwlArc * );
77 inline Arc( arc_side, long );
78
79 Arc_ptr append( Arc_ptr );
80 int check( void );
81 int isMonotone( void );
82 int isDisconnected( void );
83 int numpts( void );
84 void markverts( void );
85 void getextrema( Arc_ptr[4] );
86 void print( void );
87 void show( void );
88 void makeSide( PwlArc *, arc_side );
89 inline int isTessellated() { return pwlArc ? 1 : 0; }
90 inline long isbezier() { return type & bezier_tag; }
91 inline void setbezier() { type |= bezier_tag; }
92 inline void clearbezier() { type &= ~bezier_tag; }
93 inline long npts() { return pwlArc->npts; }
94 inline TrimVertex * pts() { return pwlArc->pts; }
95 inline REAL * tail() { return pwlArc->pts[0].param; }
96 inline REAL * head() { return next->pwlArc->pts[0].param; }
97 inline REAL * rhead() { return pwlArc->pts[pwlArc->npts-1].param; }
98 inline long ismarked() { return type & arc_tag; }
99 inline void setmark() { type |= arc_tag; }
100 inline void clearmark() { type &= (~arc_tag); }
101 inline void clearside() { type &= ~(0x7 << 8); }
102 inline void setside( arc_side s ) { clearside(); type |= (((long)s)<<8); }
103 inline arc_side getside() { return (arc_side) ((type>>8) & 0x7); }
104 inline int getitail() { return type & tail_tag; }
105 inline void setitail() { type |= tail_tag; }
106 inline void clearitail() { type &= (~tail_tag); }
107};
108
109/*--------------------------------------------------------------------------
110 * Arc - initialize a new Arc with the same type and uid of
111 * a given Arc and a given pwl arc
112 *--------------------------------------------------------------------------
113 */
114
115inline
116Arc::Arc( class Arc *j, PwlArc *p )
117{
118 bezierArc = NULL;
119 pwlArc = p;
120 type = j->type;
121 nuid = j->nuid;
122}
123
124/*--------------------------------------------------------------------------
125 * Arc - initialize a new Arc with the same type and uid of
126 * a given Arc and a given pwl arc
127 *--------------------------------------------------------------------------
128 */
129
130inline
131Arc::Arc( arc_side side, long _nuid )
132{
133 bezierArc = NULL;
134 pwlArc = NULL;
135 type = 0;
136 setside( side );
137 nuid = _nuid;
138}
139
140#endif /* __gluarc_h_ */
Note: See TracBrowser for help on using the repository browser.