1#VRML V2.0 utf8 2# X3D-to-VRML-97 XSL translation autogenerated by X3dToVrml97.xslt 3# http://www.web3d.org/x3d/content/X3dToVrml97.xslt 4# Generated using XSLT processor: SAXON 8.7 from Saxonica 5 6# [X3D] VRML V3.0 utf8 7# PROFILE Immersive 8# [X3D] version=3.0 9# [X3D] noNamespaceSchemaLocation=http://www.web3d.org/specifications/x3d-3.0.xsd 10# [head] 11 12# META "title" "Geometry2dComponentPrototypes.x3d" 13# META "description" "X3D Geometry2D component nodes, implemented as prototypes for backwards compatibility with VRML 97. Arc2D specifies a 2D linear circular arc. ArcClose2D specifies a portion of a circle. Circle2D specifies a 2D circular line. Disk2D specifies a 2D circular disk. Polyline2D specifies 2D line segments. Polypoint2D specifies 2D points. Rectangle2D specifies a 2D rectangle. TriangleSet2D specifies 2D triangles. 2D nodes are considered particularly helpful for building user interfaces such as Heads-Up Displays (HUDs)." 14# META "creator" "Christos Kalogrias, Don Brutzman, Ken Curtin, Duane Davis" 15# META "created" "14 November 2003" 16# META "modified" "25 February 2007" 17# META "reference" "Geometry2dComponentExamples.x3d" 18# META "reference" "http://www.web3d.org/spec_editors/abstract/Part01/components/geometry2D.html" 19# META "subject" "Geometry2D component nodes (Arc2D ArcClose2D Circle2D Disk2D Polyline2D Polypoint2D Rectangle2D TriangleSet2D)" 20# META "identifier" "http://www.web3d.org/x3d/content/examples/Basic/development/Geometry2dComponentPrototypes.x3d" 21# META "generator" "X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit" 22# META "license" "../license.html" 23# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 24# 25# <html> 26# <head> 27# <title>NPS MOVES Software License</title> 28# <meta name="description" content="NPS MOVES Software License" /> 29# <meta name="author" content="Donald P. Brutzman" /> 30# <meta name="created" content="4 March 2005" /> 31# <meta name="revised" content="17 December 2006" /> 32# <meta name="reference" content="http://www.oreilly.com/catalog/osfreesoft" /> 33# <meta name="reference" content="http://opensource.org/licenses/bsd-license.php" /> 34# <meta name="reference" content="http://xchat.movesinstitute.org/bugzilla/show_bug.cgi?id=32" /> 35# <link rel="icon" href="http://www.web3D.org/x3d/content/examples/images/X3DtextIcon16.png" title="X3D" type="image/png"/> 36# </head> 37# <body> 38# <p>Copyright (c) 1995-2008 held by the author(s). All rights reserved.</p> 39# 40# <p>Redistribution and use in source and binary forms, with or without 41# modification, are permitted provided that the following conditions 42# are met:</p> 43# 44# <ul> 45# <li> 46# Redistributions of source code must retain the above copyright 47# notice, this list of conditions and the following disclaimer. 48# </li> 49# <li> 50# Redistributions in binary form must reproduce the above copyright 51# notice, this list of conditions and the following disclaimer 52# in the documentation and/or other materials provided with the 53# distribution. 54# </li> 55# <li> 56# Neither the names of the 57# <a href="http://www.nps.edu">Naval Postgraduate School (NPS)</a> 58# <a href="http://www.MovesInstitute.org">Modeling Virtual Environments and Simulation (MOVES) Institute</a> 59# nor the names of its contributors may be used to endorse or 60# promote products derived from this software without specific 61# prior written permission. 62# </li> 63# </ul> 64# 65# <p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 66# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 67# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 68# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 69# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 70# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 71# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 72# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 73# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 74# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 75# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 76# POSSIBILITY OF SUCH DAMAGE.</p> 77# 78# </body> 79# </html> 80 81# [Scene] ========== ========== ========== 82 83# ==================== 84PROTO Arc2D [ 85 field SFFloat startAngle 0 86 field SFFloat endAngle 1.5707963265 87 field SFFloat radius 1 88 exposedField SFNode metadata NULL # [appinfo] Metadata node only 89 90 # default NULL 91 92] { 93 ### Warning: <ProtoDeclare name='Arc2D'/> ProtoBody child following first child will not be rendered, since the first child determines node type. (Authors can silence this warning by placing a comment as second child.) 94 DEF ArcIndexPoints IndexedLineSet { 95 coord DEF Arc3DPoints Coordinate { 96 } 97 } 98 Group { 99 metadata IS metadata 100 children [ 101 DEF Arc2dToFaceSet3d Script { 102 field SFFloat startAngle IS startAngle 103 field SFFloat endAngle IS endAngle 104 field SFFloat radius IS radius 105 eventOut MFVec3f arcSet3d 106 eventOut MFInt32 arcIndexSet3d 107 108 url [ "javascript: 109// ### X3D Browser.print() not supported by all VRML97 viewers, instead simply use print() 110 111 112function initialize() 113{ 114 numOfPoints = 100; 115 116 if (radius < 0) 117 { 118 print ('[Arc2D] Warning: invalid value, radius=' + value + ' must instead be >= 0'); 119 } 120 121 if ((startAngle < 0) || (startAngle >= 2 * Math.PI)) 122 { 123 print ('[Arc2D] Warning: startAngle=' + startAngle + ' must be within range [0..2pi)'); // (] 124 } 125 126 if ((endAngle < 0) || (endAngle >= 2 * Math.PI)) 127 { 128 print ('[Arc2D] Warning: endAngle=' + endAngle + ' must be within range [0..2pi)'); // (] 129 } 130 131 // equal startAngle, endAngle means draw full circle. 132 // high out-of-range endAngle is OK for local computation. 133 if (startAngle >= endAngle) 134 endAngle = endAngle + 2 * Math.PI; 135 136 differAng = Math.abs((endAngle - startAngle)) / numOfPoints; 137 138 for (i = 0; i <= numOfPoints; i++) 139 { 140 arcSet3d[i] = new SFVec3f (radius * Math.cos(startAngle + i * differAng), radius * Math.sin(startAngle + i * differAng), 0.0); 141 arcIndexSet3d[i] = i; 142 } 143 144} // initialize 145 146 147" ] 148 } 149 ] 150 ROUTE Arc2dToFaceSet3d.arcSet3d TO Arc3DPoints.point 151 ROUTE Arc2dToFaceSet3d.arcIndexSet3d TO ArcIndexPoints.set_coordIndex 152 } 153} 154