| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
|
| 3 | <X3D profile='Immersive' version='3.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'> |
| 4 | <head> |
| 5 | <meta name='title' content=' Geometry2dComponentPrototypes.x3d '/> |
| 6 | <meta name='description' content='X3D Geometry2D component nodes, implemented as prototypes for developmental use to provide 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 point array. Rectangle2D specifies a 2D rectangle. TriangleSet2D specifies 2D triangles. 2D nodes are considered particularly helpful for CADPart geometry and building user interfaces such as Heads-Up Displays (HUDs).'/> |
| 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=' warning ' content=' These examples are complete but only used for developmental testing, not regular X3D authoring. '/> |
| 11 | <meta name='reference' content=' Geometry2dComponentExternProtos.x3d '/> |
| 12 | <meta name='reference' content=' Geometry2dComponentExamples.x3d '/> |
| 13 | <meta name='reference' content=' https://www.web3d.org/specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/components/geometry2D.html '/> |
| 14 | <meta name='subject' content='Geometry2D component nodes (Arc2D ArcClose2D Circle2D Disk2D Polyline2D Polypoint2D Rectangle2D TriangleSet2D)'/> |
| 15 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Basic/development/Geometry2dComponentPrototypes.x3d '/> |
| 16 | <meta name='generator' content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 17 | <meta name='license' content='../license.html'/> |
| 18 | </head> |
| 19 | <Scene> |
| 20 | <!-- ==================== --> |
| 21 | <WorldInfo title='Geometry2dComponentPrototypes.x3d'/> |
| 22 | <ProtoDeclare name='Arc2D'> |
| 23 | <ProtoInterface> |
| 24 | <field name='startAngle' type='SFFloat' value='0' accessType='initializeOnly'/> |
| 25 | <field name='endAngle' type='SFFloat' value='1.5707963265' accessType='initializeOnly'/> |
| 26 | <field name='radius' type='SFFloat' value='1' accessType='initializeOnly'/> |
| 27 |
<field name='metadata' type='SFNode' accessType='inputOutput'
appinfo='Metadata node only'> |
| 28 | <!-- default NULL --> |
| 29 | </field> |
| 30 | </ProtoInterface> |
| 31 | <ProtoBody> |
| 32 | <!-- Only the first node counts as the node type of a prototype. This node must be a geometry node. --> |
| 33 |
<!-- ROUTE information for ArcIndexPoints node:
[from Arc2dToFaceSet3d.arcIndexSet3d to set_coordIndex
]
-->
<IndexedLineSet DEF='ArcIndexPoints'> |
| 34 |
<!-- ROUTE information for Arc3DPoints node:
[from Arc2dToFaceSet3d.arcSet3d to point
]
-->
<Coordinate DEF='Arc3DPoints'/> |
| 35 | </IndexedLineSet> |
| 36 | <!-- Any nodes after initial node in a ProtoBody is not rendered. --> |
| 37 | <Group> |
| 38 | <IS> |
| 39 | <connect nodeField='metadata' protoField='metadata'/> |
| 40 | </IS> |
| 41 |
<!-- ROUTE information for Arc2dToFaceSet3d node:
[from arcSet3d to Arc3DPoints.point
]
[from arcIndexSet3d to ArcIndexPoints.set_coordIndex
]
-->
<Script DEF='Arc2dToFaceSet3d'> |
| 42 | <field name='startAngle' type='SFFloat' accessType='initializeOnly'/> |
| 43 | <field name='endAngle' type='SFFloat' accessType='initializeOnly'/> |
| 44 | <field name='radius' type='SFFloat' accessType='initializeOnly'/> |
| 45 | <field name='arcSet3d' type='MFVec3f' accessType='outputOnly'/> |
| 46 | <field name='arcIndexSet3d' type='MFInt32' accessType='outputOnly'/> |
| 47 | <IS> |
| 48 | <connect nodeField='startAngle' protoField='startAngle'/> |
| 49 | <connect nodeField='endAngle' protoField='endAngle'/> |
| 50 | <connect nodeField='radius' protoField='radius'/> |
| 51 | </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 = 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
]]>
|
|
| 53 | </Script> |
| 54 | < ROUTE fromNode='Arc2dToFaceSet3d' fromField='arcSet3d' toNode='Arc3DPoints' toField='point'/> |
| 55 | < ROUTE fromNode='Arc2dToFaceSet3d' fromField='arcIndexSet3d' toNode='ArcIndexPoints' toField='set_coordIndex'/> |
| 56 | </Group> |
| 57 | </ProtoBody> |
| 58 | </ProtoDeclare> |
| 59 | <!-- ==================== --> |
| 60 | <ProtoDeclare name='ArcClose2D'> |
| 61 | <ProtoInterface> |
| 62 | <field name='startAngle' type='SFFloat' value='0' accessType='initializeOnly'/> |
| 63 | <field name='endAngle' type='SFFloat' value='1.5707963265' accessType='initializeOnly'/> |
| 64 | <field name='radius' type='SFFloat' value='1' accessType='initializeOnly'/> |
| 65 | <field name='closureType' type='SFString' value='PIE' accessType='initializeOnly'/> |
| 66 | <field name='solid' type='SFBool' value='false' accessType='initializeOnly'/> |
| 67 |
<field name='metadata' type='SFNode' accessType='inputOutput'
appinfo='Metadata node only'> |
| 68 | <!-- default NULL --> |
| 69 | </field> |
| 70 | </ProtoInterface> |
| 71 | <ProtoBody> |
| 72 |
<!-- ROUTE information for ArcPointFaceIndex node:
[from ArcClose2dToFaceSet3d.pointIndex to set_coordIndex
]
-->
<IndexedFaceSet DEF='ArcPointFaceIndex'> |
| 73 |
<!-- ROUTE information for ArcClose2DFaceCoordinate node:
[from ArcClose2dToFaceSet3d.arcSet3d to point
]
-->
<Coordinate DEF='ArcClose2DFaceCoordinate'/> |
| 74 | </IndexedFaceSet> |
| 75 | <Group> |
| 76 |
<!-- ROUTE information for ArcClose2dToFaceSet3d node:
[from arcSet3d to ArcClose2DFaceCoordinate.point
]
[from pointIndex to ArcPointFaceIndex.set_coordIndex
]
-->
<Script DEF='ArcClose2dToFaceSet3d'> |
| 77 | <field name='closureType' type='SFString' accessType='initializeOnly'/> |
| 78 | <field name='startAngle' type='SFFloat' accessType='initializeOnly'/> |
| 79 | <field name='endAngle' type='SFFloat' accessType='initializeOnly'/> |
| 80 | <field name='radius' type='SFFloat' accessType='initializeOnly'/> |
| 81 | <field name='arcSet3d' type='MFVec3f' accessType='outputOnly'/> |
| 82 | <field name='pointIndex' type='MFInt32' accessType='outputOnly'/> |
| 83 | <IS> |
| 84 | <connect nodeField='closureType' protoField='closureType'/> |
| 85 | <connect nodeField='startAngle' protoField='startAngle'/> |
| 86 | <connect nodeField='endAngle' protoField='endAngle'/> |
| 87 | <connect nodeField='radius' protoField='radius'/> |
| 88 | </IS> |
<![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
]]>
|
|
| 90 | </Script> |
| 91 | < ROUTE fromNode='ArcClose2dToFaceSet3d' fromField='arcSet3d' toNode='ArcClose2DFaceCoordinate' toField='point'/> |
| 92 | < ROUTE fromNode='ArcClose2dToFaceSet3d' fromField='pointIndex' toNode='ArcPointFaceIndex' toField='set_coordIndex'/> |
| 93 | </Group> |
| 94 | </ProtoBody> |
| 95 | </ProtoDeclare> |
| 96 | <!-- ArcClose2DUnfilled also provided since FillProperties not available in VRML 97 --> |
| 97 | <ProtoDeclare name='ArcClose2DUnfilled'> |
| 98 | <ProtoInterface> |
| 99 | <field name='startAngle' type='SFFloat' value='0' accessType='initializeOnly'/> |
| 100 | <field name='endAngle' type='SFFloat' value='1.5707963265' accessType='initializeOnly'/> |
| 101 | <field name='radius' type='SFFloat' value='1' accessType='initializeOnly'/> |
| 102 | <field name='closureType' type='SFString' value='PIE' accessType='initializeOnly'/> |
| 103 | <field name='solid' type='SFBool' value='false' accessType='initializeOnly'/> |
| 104 |
<field name='metadata' type='SFNode' accessType='inputOutput'
appinfo='Metadata node only'> |
| 105 | <!-- default NULL --> |
| 106 | </field> |
| 107 | </ProtoInterface> |
| 108 | <ProtoBody> |
| 109 |
<!-- ROUTE information for ArcPointLineIndex node:
[from ArcClose2dToLineSet3d.pointIndex to set_coordIndex
]
-->
<IndexedLineSet DEF='ArcPointLineIndex'> |
| 110 |
<!-- ROUTE information for ArcClose2DLineCoordinate node:
[from ArcClose2dToLineSet3d.arcSet3d to point
]
-->
<Coordinate DEF='ArcClose2DLineCoordinate'/> |
| 111 | </IndexedLineSet> |
| 112 | <Group> |
| 113 |
<!-- ROUTE information for ArcClose2dToLineSet3d node:
[from arcSet3d to ArcClose2DLineCoordinate.point
]
[from pointIndex to ArcPointLineIndex.set_coordIndex
]
-->
<Script DEF='ArcClose2dToLineSet3d'> |
| 114 | <field name='closureType' type='SFString' accessType='initializeOnly'/> |
| 115 | <field name='startAngle' type='SFFloat' accessType='initializeOnly'/> |
| 116 | <field name='endAngle' type='SFFloat' accessType='initializeOnly'/> |
| 117 | <field name='radius' type='SFFloat' accessType='initializeOnly'/> |
| 118 | <field name='arcSet3d' type='MFVec3f' accessType='outputOnly'/> |
| 119 | <field name='pointIndex' type='MFInt32' accessType='outputOnly'/> |
| 120 | <IS> |
| 121 | <connect nodeField='closureType' protoField='closureType'/> |
| 122 | <connect nodeField='startAngle' protoField='startAngle'/> |
| 123 | <connect nodeField='endAngle' protoField='endAngle'/> |
| 124 | <connect nodeField='radius' protoField='radius'/> |
| 125 | </IS> |
<![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
]]>
|
|
| 127 | </Script> |
| 128 | < ROUTE fromNode='ArcClose2dToLineSet3d' fromField='arcSet3d' toNode='ArcClose2DLineCoordinate' toField='point'/> |
| 129 | < ROUTE fromNode='ArcClose2dToLineSet3d' fromField='pointIndex' toNode='ArcPointLineIndex' toField='set_coordIndex'/> |
| 130 | </Group> |
| 131 | </ProtoBody> |
| 132 | </ProtoDeclare> |
| 133 | <!-- ==================== --> |
| 134 | <ProtoDeclare name='Circle2D'> |
| 135 | <ProtoInterface> |
| 136 | <field name='radius' type='SFFloat' value='1' accessType='initializeOnly'/> |
| 137 | <field name='solid' type='SFBool' value='false' accessType='initializeOnly'/> |
| 138 |
<field name='metadata' type='SFNode' accessType='inputOutput'
appinfo='Metadata node only'> |
| 139 | <!-- default NULL --> |
| 140 | </field> |
| 141 | </ProtoInterface> |
| 142 | <ProtoBody> |
| 143 |
<!-- ROUTE information for Circ3DPointsIndex node:
[from Circ2dToLineSet3d.circIndexSet3d to set_coordIndex
]
-->
<IndexedLineSet DEF='Circ3DPointsIndex'> |
| 144 |
<!-- ROUTE information for Circ3DPoints node:
[from Circ2dToLineSet3d.circSet3d to point
]
-->
<Coordinate DEF='Circ3DPoints'/> |
| 145 | </IndexedLineSet> |
| 146 | <Group> |
| 147 |
<!-- ROUTE information for Circ2dToLineSet3d node:
[from circSet3d to Circ3DPoints.point
]
[from circIndexSet3d to Circ3DPointsIndex.set_coordIndex
]
-->
<Script DEF='Circ2dToLineSet3d'> |
| 148 | <field name='radius' type='SFFloat' accessType='initializeOnly'/> |
| 149 | <field name='circSet3d' type='MFVec3f' accessType='outputOnly'/> |
| 150 | <field name='circIndexSet3d' type='MFInt32' accessType='outputOnly'/> |
| 151 | <IS> |
| 152 | <connect nodeField='radius' protoField='radius'/> |
| 153 | </IS> |
<![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
]]>
|
|
| 155 | </Script> |
| 156 | < ROUTE fromNode='Circ2dToLineSet3d' fromField='circSet3d' toNode='Circ3DPoints' toField='point'/> |
| 157 | < ROUTE fromNode='Circ2dToLineSet3d' fromField='circIndexSet3d' toNode='Circ3DPointsIndex' toField='set_coordIndex'/> |
| 158 | </Group> |
| 159 | </ProtoBody> |
| 160 | </ProtoDeclare> |
| 161 | <!-- ==================== --> |
| 162 | <ProtoDeclare name='Disk2D'> |
| 163 | <ProtoInterface> |
| 164 | <field name='innerRadius' type='SFFloat' value='0' accessType='initializeOnly'/> |
| 165 | <field name='outerRadius' type='SFFloat' value='1' accessType='initializeOnly'/> |
| 166 | <field name='solid' type='SFBool' value='false' accessType='initializeOnly'/> |
| 167 |
<field name='metadata' type='SFNode' accessType='inputOutput'
appinfo='Metadata node only'> |
| 168 | <!-- default NULL --> |
| 169 | </field> |
| 170 | </ProtoInterface> |
| 171 | <ProtoBody> |
| 172 |
<!-- ROUTE information for DiskPointsIndex node:
[from Disk2dToFaceSet3d.diskIndexSet3d to set_coordIndex
]
-->
<IndexedFaceSet DEF='DiskPointsIndex'> |
| 173 |
<!-- ROUTE information for Disk3DPoints node:
[from Disk2dToFaceSet3d.diskSet3d to point
]
-->
<Coordinate DEF='Disk3DPoints'/> |
| 174 | </IndexedFaceSet> |
| 175 | <Group> |
| 176 |
<!-- ROUTE information for Disk2dToFaceSet3d node:
[from diskSet3d to Disk3DPoints.point
]
[from diskIndexSet3d to DiskPointsIndex.set_coordIndex
]
-->
<Script DEF='Disk2dToFaceSet3d'> |
| 177 | <field name='innerRadius' type='SFFloat' accessType='initializeOnly'/> |
| 178 | <field name='outerRadius' type='SFFloat' accessType='initializeOnly'/> |
| 179 | <field name='diskSet3d' type='MFVec3f' accessType='outputOnly'/> |
| 180 | <field name='diskIndexSet3d' type='MFInt32' accessType='outputOnly'/> |
| 181 | <IS> |
| 182 | <connect nodeField='innerRadius' protoField='innerRadius'/> |
| 183 | <connect nodeField='outerRadius' protoField='outerRadius'/> |
| 184 | </IS> |
<![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
]]>
|
|
| 186 | </Script> |
| 187 | < ROUTE fromNode='Disk2dToFaceSet3d' fromField='diskSet3d' toNode='Disk3DPoints' toField='point'/> |
| 188 | < ROUTE fromNode='Disk2dToFaceSet3d' fromField='diskIndexSet3d' toNode='DiskPointsIndex' toField='set_coordIndex'/> |
| 189 | </Group> |
| 190 | </ProtoBody> |
| 191 | </ProtoDeclare> |
| 192 | <!-- ==================== --> |
| 193 | <ProtoDeclare name='Polyline2D'> |
| 194 | <ProtoInterface> |
| 195 | <field name='lineSegments' type='MFVec2f' accessType='initializeOnly'/> |
| 196 | <field name='solid' type='SFBool' value='false' accessType='initializeOnly'/> |
| 197 |
<field name='metadata' type='SFNode' accessType='inputOutput'
appinfo='Metadata node only'/> |
| 198 | </ProtoInterface> |
| 199 | <ProtoBody> |
| 200 |
<!-- ROUTE information for LinesSegmentsIndexPoints node:
[from LineSegments2dToLineSet3d.lineSegmentsIndex to set_coordIndex
]
-->
<IndexedLineSet DEF='LinesSegmentsIndexPoints'> |
| 201 |
<!-- ROUTE information for LineSegments3DPoints node:
[from LineSegments2dToLineSet3d.lineSegments3D to point
]
-->
<Coordinate DEF='LineSegments3DPoints'/> |
| 202 | </IndexedLineSet> |
| 203 | <Group> |
| 204 |
<!-- ROUTE information for LineSegments2dToLineSet3d node:
[from lineSegments3D to LineSegments3DPoints.point
]
[from lineSegmentsIndex to LinesSegmentsIndexPoints.set_coordIndex
]
-->
<Script DEF='LineSegments2dToLineSet3d'> |
| 205 | <field name='lineSegments' type='MFVec2f' accessType='initializeOnly'/> |
| 206 | <field name='lineSegments3D' type='MFVec3f' accessType='outputOnly'/> |
| 207 | <field name='lineSegmentsIndex' type='MFInt32' accessType='outputOnly'/> |
| 208 | <IS> |
| 209 | <connect nodeField='lineSegments' protoField='lineSegments'/> |
| 210 | </IS> |
<![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
]]>
|
|
| 212 | </Script> |
| 213 | < ROUTE fromNode='LineSegments2dToLineSet3d' fromField='lineSegments3D' toNode='LineSegments3DPoints' toField='point'/> |
| 214 | < ROUTE fromNode='LineSegments2dToLineSet3d' fromField='lineSegmentsIndex' toNode='LinesSegmentsIndexPoints' toField='set_coordIndex'/> |
| 215 | </Group> |
| 216 | </ProtoBody> |
| 217 | </ProtoDeclare> |
| 218 | <!-- ==================== --> |
| 219 | <ProtoDeclare name='Polypoint2D'> |
| 220 | <ProtoInterface> |
| 221 | <field name='point' type='MFVec2f' accessType='initializeOnly'/> |
| 222 |
<field name='metadata' type='SFNode' accessType='inputOutput'
appinfo='Metadata node only'> |
| 223 | <!-- default NULL --> |
| 224 | </field> |
| 225 | </ProtoInterface> |
| 226 | <ProtoBody> |
| 227 | <PointSet> |
| 228 |
<!-- ROUTE information for Points3D node:
[from Points2dToLineSet3d.points3D to point
]
-->
<Coordinate DEF='Points3D'/> |
| 229 | </PointSet> |
| 230 | <Group> |
| 231 |
<!-- ROUTE information for Points2dToLineSet3d node:
[from points3D to Points3D.point
]
-->
<Script DEF='Points2dToLineSet3d'> |
| 232 | <field name='point' type='MFVec2f' accessType='initializeOnly'/> |
| 233 | <field name='points3D' type='MFVec3f' accessType='outputOnly'/> |
| 234 | <IS> |
| 235 | <connect nodeField='point' protoField='point'/> |
| 236 | </IS> |
<![CDATA[
ecmascript:
function initialize()
{
for ( i=0 ; i<point.length ; i++)
{
points3D[i] = new SFVec3f ( point[i].x, point[i].y, 0.0 );
}
} // initialize
]]>
|
|
| 238 | </Script> |
| 239 | < ROUTE fromNode='Points2dToLineSet3d' fromField='points3D' toNode='Points3D' toField='point'/> |
| 240 | </Group> |
| 241 | </ProtoBody> |
| 242 | </ProtoDeclare> |
| 243 | <!-- ==================== --> |
| 244 | <ProtoDeclare name='Rectangle2D' appinfo='Default filled matching default FillProperties filled=true.'> |
| 245 | <ProtoInterface> |
| 246 | <field name='size' type='SFVec2f' value='2 2' accessType='initializeOnly'/> |
| 247 | <field name='solid' type='SFBool' value='false' accessType='initializeOnly'/> |
| 248 |
<field name='metadata' type='SFNode' accessType='inputOutput'
appinfo='Metadata node only'> |
| 249 | <!-- default NULL --> |
| 250 | </field> |
| 251 | </ProtoInterface> |
| 252 | <ProtoBody> |
| 253 | <IndexedFaceSet solid='false' coordIndex='0 1 2 0 -1 2 3 0 2'> |
| 254 |
<!-- ROUTE information for RectanglePoints node:
[from Rect2dToFaceSet3d.pointSet3d to point
]
-->
<Coordinate DEF='RectanglePoints'/> |
| 255 | </IndexedFaceSet> |
| 256 | <Group> |
| 257 |
<!-- ROUTE information for Rect2dToFaceSet3d node:
[from pointSet3d to RectanglePoints.point
]
-->
<Script DEF='Rect2dToFaceSet3d'> |
| 258 | <field name='size' type='SFVec2f' accessType='initializeOnly'/> |
| 259 | <field name='pointSet3d' type='MFVec3f' accessType='outputOnly'/> |
| 260 | <field name='fillNoFillSelection' type='SFInt32' accessType='outputOnly'/> |
| 261 | <IS> |
| 262 | <connect nodeField='size' protoField='size'/> |
| 263 | </IS> |
<![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
]]>
|
|
| 265 | </Script> |
| 266 | < ROUTE fromNode='Rect2dToFaceSet3d' fromField='pointSet3d' toNode='RectanglePoints' toField='point'/> |
| 267 | </Group> |
| 268 | </ProtoBody> |
| 269 | </ProtoDeclare> |
| 270 | <!-- Rectangle2DUnfilled also provided since FillProperties not available in VRML 97 --> |
| 271 | <ProtoDeclare name='Rectangle2DUnfilled'> |
| 272 | <ProtoInterface> |
| 273 | <field name='size' type='SFVec2f' value='2 2' accessType='initializeOnly'/> |
| 274 | <field name='solid' type='SFBool' value='false' accessType='initializeOnly'/> |
| 275 |
<field name='metadata' type='SFNode' accessType='inputOutput'
appinfo='Metadata node only'> |
| 276 | <!-- default NULL --> |
| 277 | </field> |
| 278 | </ProtoInterface> |
| 279 | <ProtoBody> |
| 280 | <IndexedLineSet coordIndex='0 1 2 3 0'> |
| 281 |
<!-- ROUTE information for RectanglePointsLine node:
[from Rect2dToLineSet3d.pointSet3d to point
]
-->
<Coordinate DEF='RectanglePointsLine'/> |
| 282 | </IndexedLineSet> |
| 283 | <Group> |
| 284 |
<!-- ROUTE information for Rect2dToLineSet3d node:
[from pointSet3d to RectanglePointsLine.point
]
-->
<Script DEF='Rect2dToLineSet3d'> |
| 285 | <field name='size' type='SFVec2f' accessType='initializeOnly'/> |
| 286 | <field name='pointSet3d' type='MFVec3f' accessType='outputOnly'/> |
| 287 | <field name='fillNoFillSelection' type='SFInt32' accessType='outputOnly'/> |
| 288 | <IS> |
| 289 | <connect nodeField='size' protoField='size'/> |
| 290 | </IS> |
<![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
]]>
|
|
| 292 | </Script> |
| 293 | < ROUTE fromNode='Rect2dToLineSet3d' fromField='pointSet3d' toNode='RectanglePointsLine' toField='point'/> |
| 294 | </Group> |
| 295 | </ProtoBody> |
| 296 | </ProtoDeclare> |
| 297 | <!-- ==================== --> |
| 298 | <ProtoDeclare name='TriangleSet2D'> |
| 299 | <ProtoInterface> |
| 300 | <field name='vertices' type='MFVec2f' accessType='initializeOnly'/> |
| 301 | <field name='solid' type='SFBool' value='false' accessType='initializeOnly'/> |
| 302 |
<field name='metadata' type='SFNode' accessType='inputOutput'
appinfo='Metadata node only'> |
| 303 | <!-- default NULL --> |
| 304 | </field> |
| 305 | </ProtoInterface> |
| 306 | <ProtoBody> |
| 307 |
<!-- ROUTE information for TriangleSetIndexPoints node:
[from TriangleSet2dToLineSet3d.triangleSetIndex to set_coordIndex
]
-->
<IndexedFaceSet DEF='TriangleSetIndexPoints' solid='false'> |
| 308 |
<!-- ROUTE information for TriangleSet3DPoints node:
[from TriangleSet2dToLineSet3d.triangleSet3D to point
]
-->
<Coordinate DEF='TriangleSet3DPoints'/> |
| 309 | </IndexedFaceSet> |
| 310 | <Group> |
| 311 |
<!-- ROUTE information for TriangleSet2dToLineSet3d node:
[from triangleSet3D to TriangleSet3DPoints.point
]
[from triangleSetIndex to TriangleSetIndexPoints.set_coordIndex
]
-->
<Script DEF='TriangleSet2dToLineSet3d'> |
| 312 | <field name='vertices' type='MFVec2f' accessType='initializeOnly'/> |
| 313 | <field name='triangleSet3D' type='MFVec3f' accessType='outputOnly'/> |
| 314 | <field name='triangleSetIndex' type='MFInt32' accessType='outputOnly'/> |
| 315 | <IS> |
| 316 | <connect nodeField='vertices' protoField='vertices'/> |
| 317 | </IS> |
<![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
]]>
|
|
| 319 | </Script> |
| 320 | < ROUTE fromNode='TriangleSet2dToLineSet3d' fromField='triangleSet3D' toNode='TriangleSet3DPoints' toField='point'/> |
| 321 | < ROUTE fromNode='TriangleSet2dToLineSet3d' fromField='triangleSetIndex' toNode='TriangleSetIndexPoints' toField='set_coordIndex'/> |
| 322 | </Group> |
| 323 | </ProtoBody> |
| 324 | </ProtoDeclare> |
| 325 | <!-- ==================== --> |
| 326 | <Background groundColor='0.25 0.25 0.25' skyColor='0.25 0.25 0.25'/> |
| 327 | <Anchor DEF='LinkToExamples' description='link to examples' url=' "Geometry2dComponentExternProtos.x3d" "https://www.web3d.org/x3d/content/examples/Basic/development/Geometry2dComponentExternProtos.x3d" "Geometry2dComponentExamples.wrl" "https://www.web3d.org/x3d/content/examples/Basic/development/Geometry2dComponentExamples.wrl" '> |
| 328 | <Shape> |
| 329 | <Appearance> |
| 330 | <Material diffuseColor='0.8 0.6 0.2'/> |
| 331 | </Appearance> |
| 332 | <Text string='"Geometry2dComponentPrototypes" "is a developmental file." "Click this text to view" "Geometry2dComponentExamples"'> |
| 333 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.75'/> |
| 334 | </Text> |
| 335 | </Shape> |
| 336 | </Anchor> |
| 337 | </Scene> |
| 338 | </X3D> |
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 |
|
LinkToExamples
Anchor |
description='link to examples' User-interaction hint for this node. |
<!--
Color-coding 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.
-->