<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<![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 = 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
]]>
<![CDATA[
ecmascript: function initialize() { if (radius < 0) { Browser.println ('[ArcClose2D] Warning: invalid value, radius=' + value + ' must instead be >= 0'); } if ((startAngle < 0) || (startAngle >= 2 * Math.PI)) { Browser.println ('[ArcClose2D] Warning: startAngle=' + startAngle + ' must be within range [0..2pi)'); //(] } if ((endAngle< 0) || (endAngle>= 2 * Math.PI)) { Browser.println ('[ArcClose2D] 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 = endAngle + 2*Math.PI; numOfPoints = 100; differAng = Math.abs((endAngle - startAngle))/numOfPoints; for ( i=0 ; i<=numOfPoints ; i++) { if ( i == numOfPoints) arcSet3d[i] = new SFVec3f (0.0, 0.0, 0.0); else arcSet3d[i] = new SFVec3f ( radius*Math.cos(startAngle + i*differAng), radius*Math.sin(startAngle + i*differAng), 0.0 ); } k=0; if (closureType =='PIE') for ( i=0 ; i<numOfPoints ; i++) { pointIndex[k] = numOfPoints; pointIndex[k+1] = i; pointIndex[k+2] = i + 1; pointIndex[k+3] = numOfPoints; pointIndex[k+4] = -1; k=k+5; } else for ( i=0 ; i<numOfPoints-1 ; i++) { pointIndex[k] = 0; pointIndex[k+1] = i; pointIndex[k+2] = i + 1; pointIndex[k+3] = 0; pointIndex[k+4] = -1; k=k+5; } } // initialize
]]>
<![CDATA[
ecmascript: function initialize() { if (radius < 0) { Browser.println ('[ArcCloseUnfilled2D] Warning: invalid value, radius=' + value + ' must instead be >= 0'); } if ((startAngle < 0) || (startAngle >= 2 * Math.PI)) { Browser.println ('[ArcCloseUnfilled2D] Warning: startAngle=' + startAngle + ' must be within range [0..2pi)'); //(] } if ((endAngle< 0) || (endAngle>= 2 * Math.PI)) { Browser.println ('[ArcCloseUnfilled2D] 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 = endAngle + 2*Math.PI; numOfPoints = 100; differAng = Math.abs((endAngle - startAngle))/numOfPoints; for ( i=0 ; i<=numOfPoints +1 ; i++) { if ( i == numOfPoints +1) arcSet3d[i] = new SFVec3f (0.0, 0.0, 0.0); else arcSet3d[i] = new SFVec3f ( radius*Math.cos(startAngle + i*differAng), radius*Math.sin(startAngle + i*differAng), 0.0 ); } if (closureType =='CHORD') { for ( i=0 ; i<=numOfPoints +1 ; i++) { if ( i == numOfPoints +1) pointIndex[i] = 0.0; else pointIndex[i] = i; } } else { for ( i=0 ; i<=numOfPoints +1 ; i++) { pointIndex[i] = i; } pointIndex[i] = 0.0; } } // initialize
]]>
<![CDATA[
ecmascript: function initialize() { if (radius < 0) { Browser.println ('[Circle2D] Warning: invalid value, radius=' + value + ' must instead be >= 0'); } numOfPoints = 100; differAng = 2*Math.PI/numOfPoints; for ( i=0 ; i<=numOfPoints ; i++) { circSet3d[i] = new SFVec3f ( radius*Math.cos(i*differAng), radius*Math.sin(i*differAng), 0.0 ); circIndexSet3d[i] = i; } } // initialize
]]>
<![CDATA[
ecmascript: function initialize() { if (innerRadius < 0) { Browser.println ('[Disk2D] Warning: invalid value, innerRadius=' + value + ' must instead be >= 0'); } if (outerRadius < 0) { Browser.println ('[Disk2D] Warning: invalid value, outerRadius=' + value + ' must instead be >= 0'); } numOfPoints = 100.0; diskSet3d = new MFVec3f(); diskIndexSet3d = new MFInt32(); differAng = 2 * Math.PI/numOfPoints; for ( i=0 ; i<2*numOfPoints ; i++) { if ( i<numOfPoints) diskSet3d[i] = new SFVec3f ( innerRadius*Math.cos(i*differAng), innerRadius*Math.sin(i*differAng), 0.0 ); else diskSet3d[i] = new SFVec3f ( outerRadius*Math.cos((i-numOfPoints-1.0)*differAng), outerRadius*Math.sin((i-numOfPoints-1.0)*differAng), 0.0 ); } k=0; for (i=0 ; i<numOfPoints ; i++) { diskIndexSet3d[k] = i; diskIndexSet3d[k+1] = i + numOfPoints; diskIndexSet3d[k+2] = i + numOfPoints + 1; diskIndexSet3d[k+3] = i; diskIndexSet3d[k+4] = -1; diskIndexSet3d[k+5] = i+1; diskIndexSet3d[k+6] = i ; diskIndexSet3d[k+7] = i + numOfPoints +1; diskIndexSet3d[k+8] = i +1; diskIndexSet3d[k+9] = -1; if (i == numOfPoints-1) { diskIndexSet3d[k] = i; diskIndexSet3d[k+1] = i + numOfPoints; diskIndexSet3d[k+2] = numOfPoints; diskIndexSet3d[k+3] = i; diskIndexSet3d[k+4] = -1; diskIndexSet3d[k+5] = 0; diskIndexSet3d[k+6] = i; diskIndexSet3d[k+7] = numOfPoints; diskIndexSet3d[k+8] = 0; diskIndexSet3d[k+9] = -1; } k=k+10; } } // initialize
]]>
<![CDATA[
ecmascript: function initialize() { for ( i=0 ; i<lineSegments.length ; i++) { lineSegments3D[i] = new SFVec3f ( lineSegments[i].x, lineSegments[i].y, 0.0 ); lineSegmentsIndex[i] = i; } lineSegmentsIndex[i] = -1; } // initialize
]]>
<![CDATA[
ecmascript: function initialize() { for ( i=0 ; i<point.length ; i++) { points3D[i] = new SFVec3f ( point[i].x, point[i].y, 0.0 ); } } // initialize
]]>
<![CDATA[
ecmascript: function initialize() { xDim = size[0]; yDim = size[1]; pointSet3d[0] = new SFVec3f ( (-xDim / 2.0), (yDim / 2.0), 0.0 ); pointSet3d[1] = new SFVec3f ( (-xDim / 2.0), (-yDim / 2.0), 0.0 ); pointSet3d[2] = new SFVec3f ( (xDim / 2.0), (-yDim / 2.0), 0.0 ); pointSet3d[3] = new SFVec3f ( (xDim / 2.0), (yDim / 2.0), 0.0 ); } // initialize
]]>
<![CDATA[
ecmascript: function initialize() { xDim = size[0]; yDim = size[1]; pointSet3d[0] = new SFVec3f ( (-xDim / 2.0), (yDim / 2.0), 0.0 ); pointSet3d[1] = new SFVec3f ( (-xDim / 2.0), (-yDim / 2.0), 0.0 ); pointSet3d[2] = new SFVec3f ( (xDim / 2.0), (-yDim / 2.0), 0.0 ); pointSet3d[3] = new SFVec3f ( (xDim / 2.0), (yDim / 2.0), 0.0 ); } // initialize
]]>
<![CDATA[
ecmascript: function initialize() { numbOfTriangles = Math.floor(vertices.length/3); for ( i=0 ; i<3*numbOfTriangles ; i++) { triangleSet3D[i] = new SFVec3f ( vertices[i].x, vertices[i].y, 0.0 ); } k=0; for (i=0; i<numbOfTriangles; i++) { triangleSetIndex[k] = k - i ; triangleSetIndex[k+1] = k - i + 1 ; triangleSetIndex[k+2] = k - i + 2 ; triangleSetIndex[k+3] = -1 ; k=k+4; } } // initialize
]]>
Event Graph ROUTE Table entries with 17 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 |
ArcClose2dToFaceSet3d
Script arcSet3d MFVec3f |
ArcClose2DFaceCoordinate
Coordinate point MFVec3f |
|
ArcClose2dToFaceSet3d
Script pointIndex MFInt32 |
ArcPointFaceIndex
IndexedFaceSet set_coordIndex MFInt32 |
ArcClose2dToLineSet3d
Script arcSet3d MFVec3f |
ArcClose2DLineCoordinate
Coordinate point MFVec3f |
|
ArcClose2dToLineSet3d
Script pointIndex MFInt32 |
ArcPointLineIndex
IndexedLineSet set_coordIndex MFInt32 |
Circ2dToLineSet3d
Script circSet3d MFVec3f |
Circ3DPoints
Coordinate point MFVec3f |
|
Circ2dToLineSet3d
Script circIndexSet3d MFInt32 |
Circ3DPointsIndex
IndexedLineSet set_coordIndex MFInt32 |
Disk2dToFaceSet3d
Script diskSet3d MFVec3f |
Disk3DPoints
Coordinate point MFVec3f |
|
Disk2dToFaceSet3d
Script diskIndexSet3d MFInt32 |
DiskPointsIndex
IndexedFaceSet set_coordIndex MFInt32 |
LineSegments2dToLineSet3d
Script lineSegments3D MFVec3f |
LineSegments3DPoints
Coordinate point MFVec3f |
|
LineSegments2dToLineSet3d
Script lineSegmentsIndex MFInt32 |
LinesSegmentsIndexPoints
IndexedLineSet set_coordIndex MFInt32 |
Points2dToLineSet3d
Script points3D MFVec3f |
Points3D
Coordinate point MFVec3f |
Rect2dToFaceSet3d
Script pointSet3d MFVec3f |
RectanglePoints
Coordinate point MFVec3f |
Rect2dToLineSet3d
Script pointSet3d MFVec3f |
RectanglePointsLine
Coordinate point MFVec3f |
TriangleSet2dToLineSet3d
Script triangleSet3D MFVec3f |
TriangleSet3DPoints
Coordinate point MFVec3f |
|
TriangleSet2dToLineSet3d
Script triangleSetIndex MFInt32 |
TriangleSetIndexPoints
IndexedFaceSet set_coordIndex MFInt32 |
<!--
Online at
https://www.web3d.org/x3d/content/examples/Basic/development/Geometry2dComponentPrototypesIndex.html
-->
<!--
Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/development/Geometry2dComponentPrototypes.x3d
-->
<!--
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. -->