1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.1//EN" "https://www.web3d.org/specifications/x3d-3.1.dtd">
|
3 | <X3D profile='Immersive' version='3.1' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.1.xsd'> |
4 | <head> |
5 | <meta name='title' content='Arc2dComponentPrototype.x3d'/> |
6 | <meta name='description' content='X3D Geometry2D component node, implemented as prototype for backwards compatibility with VRML 97. Arc2D specifies a 2D linear circular arc.'/> |
7 | <meta name='creator' content='Christos Kalogrias, Don Brutzman, Ken Curtin, Duane Davis'/> |
8 | <meta name='created' content='14 November 2003'/> |
9 | <meta name='modified' content='20 October 2019'/> |
10 | <meta name='reference' content='https://www.web3d.org/specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/components/geometry2D.html'/> |
11 | <meta name='subject' content='Geometry2D component node (Arc2D)'/> |
12 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Basic/development/Arc2dComponentPrototype.x3d'/> |
13 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
14 | <meta name='license' content='../license.html'/> |
15 | </head> |
16 | <Scene> |
17 | <!-- ==================== --> |
18 | <WorldInfo title='Arc2dComponentPrototype.x3d'/> |
19 | <ProtoDeclare name='Arc2D'> |
20 | <ProtoInterface> |
21 | <field name='startAngle' type='SFFloat' value='0' accessType='initializeOnly'/> |
22 | <field name='endAngle' type='SFFloat' value='1.5707963265' accessType='initializeOnly'/> |
23 | <field name='radius' type='SFFloat' value='1' accessType='initializeOnly'/> |
24 |
<field name='metadata' type='SFNode' accessType='inputOutput'
appinfo='Metadata node only'/> |
25 | </ProtoInterface> |
26 | <ProtoBody> |
27 | <!-- Only the first node counts as the node type of a prototype. This node must be a geometry node. --> |
28 |
<!-- ROUTE information for ArcIndexPoints node:
[from Arc2dToFaceSet3d.arcIndexSet3d to set_coordIndex
]
-->
<IndexedLineSet DEF='ArcIndexPoints'> |
29 |
<!-- ROUTE information for Arc3DPoints node:
[from Arc2dToFaceSet3d.arcSet3d to point
]
-->
<Coordinate DEF='Arc3DPoints'/> |
30 | </IndexedLineSet> |
31 | <!-- Any nodes after initial node in a ProtoBody is not rendered. --> |
32 | <Group> |
33 | <IS> |
34 | <connect nodeField='metadata' protoField='metadata'/> |
35 | </IS> |
36 |
<!-- ROUTE information for Arc2dToFaceSet3d node:
[from arcSet3d to Arc3DPoints.point
]
[from arcIndexSet3d to ArcIndexPoints.set_coordIndex
]
-->
<Script DEF='Arc2dToFaceSet3d'> |
37 | <field name='startAngle' type='SFFloat' accessType='initializeOnly'/> |
38 | <field name='endAngle' type='SFFloat' accessType='initializeOnly'/> |
39 | <field name='radius' type='SFFloat' accessType='initializeOnly'/> |
40 | <field name='arcSet3d' type='MFVec3f' accessType='outputOnly'/> |
41 | <field name='arcIndexSet3d' type='MFInt32' accessType='outputOnly'/> |
42 | <IS> |
43 | <connect nodeField='startAngle' protoField='startAngle'/> |
44 | <connect nodeField='endAngle' protoField='endAngle'/> |
45 | <connect nodeField='radius' protoField='radius'/> |
46 | </IS> |
<![CDATA[
ecmascript: function initialize() { numOfPoints = 100; if (radius < 0) { Browser.println ('[Arc2D] Warning: invalid value, radius=' + value + ' must instead be >= 0'); } if ((startAngle < 0) || (startAngle >= 2 * Math.PI)) { Browser.println ('[Arc2D] Warning: startAngle=' + startAngle + ' must be within range [0..2pi)'); } if ((endAngle < 0) || (endAngle >= 2 * Math.PI)) { Browser.println ('[Arc2D] Warning: endAngle=' + endAngle + ' must be within range [0..2pi)'); } // equal startAngle, endAngle means draw full circle. // high out-of-range endAngle is OK for local computation. if (startAngle >= endAngle) endAngle += (2 * Math.PI); differAng = Math.abs((endAngle - startAngle))/numOfPoints; for (i = 0; i <= numOfPoints; i++) { arcSet3d[i] = new SFVec3f (radius * Math.cos(startAngle + i * differAng), radius * Math.sin(startAngle + i * differAng), 0.0); arcIndexSet3d[i] = i; } } // initialize
]]>
|
|
48 | </Script> |
49 | < ROUTE fromNode='Arc2dToFaceSet3d' fromField='arcSet3d' toNode='Arc3DPoints' toField='point'/> |
50 | < ROUTE fromNode='Arc2dToFaceSet3d' fromField='arcIndexSet3d' toNode='ArcIndexPoints' toField='set_coordIndex'/> |
51 | </Group> |
52 | </ProtoBody> |
53 | </ProtoDeclare> |
54 | </Scene> |
55 | </X3D> |
Event Graph ROUTE Table with 2 ROUTE connections total, showing X3D event-model relationships for this scene.
Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.
Arc2dToFaceSet3d
Script arcSet3d MFVec3f |
Arc3DPoints
Coordinate point MFVec3f |
|
Arc2dToFaceSet3d
Script arcIndexSet3d MFInt32 |
ArcIndexPoints
IndexedLineSet set_coordIndex MFInt32 |
<!--
Color legend: X3D terminology
<X3dNode
DEF='idName' field='value'/>
matches XML terminology
<XmlElement
DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement)
(Grey background inside box: inserted documentation)
(Magenta background: X3D Extensibility)
<ProtoDeclare
name='ProtoName'>
<field
name='fieldName'/> </ProtoDeclare>
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->