1 package jogamp.opengl.glu.nurbs; 2 3 /* 4 ** License Applicability. Except to the extent portions of this file are 5 ** made subject to an alternative license as permitted in the SGI Free 6 ** Software License B, Version 2.0 (the "License"), the contents of this 7 ** file are subject only to the provisions of the License. You may not use 8 ** this file except in compliance with the License. You may obtain a copy 9 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 10 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: 11 ** 12 ** http://oss.sgi.com/projects/FreeB 13 ** 14 ** Note that, as provided in the License, the Software is distributed on an 15 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS 16 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND 17 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A 18 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. 19 ** 20 ** Original Code. The Original Code is: OpenGL Sample Implementation, 21 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, 22 ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. 23 ** Copyright in any portions created by third parties is as indicated 24 ** elsewhere herein. All Rights Reserved. 25 ** 26 ** Additional Notice Provisions: The application programming interfaces 27 ** established by SGI in conjunction with the Original Code are The 28 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released 29 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version 30 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X 31 ** Window System(R) (Version 1.3), released October 19, 1998. This software 32 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation 33 ** published by SGI, but has not been independently verified as being 34 ** compliant with the OpenGL(R) version 1.2.1 Specification. 35 */ 36 37 /** 38 * Trimming arc 39 * @author Tomas Hrasky 40 * 41 */ 42 public class Arc { 43 /** 44 * Corresponding picewise-linear arc 45 */ 46 public PwlArc pwlArc; 47 48 /** 49 * Arc type 50 */ 51 private long type; 52 53 /** 54 * Arc link in linked list 55 */ 56 public Arc link; 57 58 /** 59 * Previous arc 60 */ 61 Arc prev; 62 63 /** 64 * Next arc 65 */ 66 Arc next; 67 68 /** 69 * Corresponding berizer type arc 70 */ 71 private final BezierArc bezierArc; 72 73 /** 74 * Makes new arc at specified side 75 * 76 * @param side 77 * which side doeas this arc form 78 */ Arc(final int side)79 public Arc(final int side) { 80 bezierArc = null; 81 pwlArc = null; 82 type = 0; 83 setside(side); 84 // nuid=_nuid 85 } 86 87 /** 88 * Sets side the arc is at 89 * 90 * @param side 91 * arc side 92 */ setside(final int side)93 private void setside(final int side) { 94 // DONE 95 clearside(); 96 type |= side << 8; 97 } 98 99 /** 100 * Unsets side 101 */ clearside()102 private void clearside() { 103 // DONE 104 type &= ~(0x7 << 8); 105 } 106 107 // this one replaces enum arc_side 108 /** 109 * Side not specified 110 */ 111 public static final int ARC_NONE = 0; 112 113 /** 114 * Arc on right 115 */ 116 public static final int ARC_RIGHT = 1; 117 118 /** 119 * Arc on top 120 */ 121 public static final int ARC_TOP = 2; 122 123 /** 124 * Arc on left 125 */ 126 public static final int ARC_LEFT = 3; 127 128 /** 129 * Arc on bottom 130 */ 131 public static final int ARC_BOTTOM = 4; 132 133 /** 134 * Bezier type flag 135 */ 136 private static final long BEZIER_TAG = 1 << 13; 137 138 /** 139 * Arc type flag 140 */ 141 private static final long ARC_TAG = 1 << 3; 142 143 /** 144 * Tail type tag 145 */ 146 private static final long TAIL_TAG = 1 << 6; 147 148 /** 149 * Appends arc to the list 150 * 151 * @param jarc 152 * arc to be append 153 * @return this 154 */ append(final Arc jarc)155 public Arc append(final Arc jarc) { 156 // DONE 157 if (jarc != null) { 158 next = jarc.next; 159 prev = jarc; 160 next.prev = this; 161 prev.next = this; 162 } else { 163 next = this; 164 prev = this; 165 } 166 167 return this; 168 } 169 170 /** 171 * Unused 172 * 173 * @return true 174 */ check()175 public boolean check() { 176 return true; 177 } 178 179 /** 180 * Sets bezier type flag 181 */ setbezier()182 public void setbezier() { 183 // DONE 184 type |= BEZIER_TAG; 185 186 } 187 188 /** 189 * Returns tail of linked list coords 190 * 191 * @return tail coords 192 */ tail()193 public float[] tail() { 194 // DONE 195 return pwlArc.pts[0].param; 196 } 197 198 /** 199 * Returns head of linked list coords 200 * 201 * @return head coords 202 */ head()203 public float[] head() { 204 // DONE 205 return next.pwlArc.pts[0].param; 206 } 207 208 /** 209 * Returns whether arc is marked with arc_tag 210 * 211 * @return is arc marked with arc_tag 212 */ ismarked()213 public boolean ismarked() { 214 // DONE 215 return ((type & ARC_TAG) > 0) ? true : false; 216 } 217 218 /** 219 * Cleans arc_tag flag 220 */ clearmark()221 public void clearmark() { 222 // DONE 223 type &= (~ARC_TAG); 224 } 225 226 /** 227 * Sets arc_tag flag 228 */ setmark()229 public void setmark() { 230 // DONE 231 type |= ARC_TAG; 232 } 233 234 /** 235 * sets tail tag 236 */ setitail()237 public void setitail() { 238 // DONE 239 type |= TAIL_TAG; 240 } 241 242 /** 243 * Returns whether arc is marked tail 244 * 245 * @return is tail 246 */ getitail()247 public boolean getitail() { 248 return false; 249 } 250 251 /** 252 * Unsets tail tag 253 */ clearitail()254 public void clearitail() { 255 // DONE 256 type &= (~TAIL_TAG); 257 } 258 } 259