<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.1//EN" "http://www.web3d.org/specifications/x3d-3.1.dtd"><X3D profile='Immersive' version='3.1' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation=' http://www.web3d.org/specifications/x3d-3.1.xsd '>
<![CDATA[
ecmascript:
function initialize()
{
numOfPoints = 100;
if (radius < 0)
{
Browser.print ('[Arc2D] Warning: invalid value, radius=' + value + ' must instead be >= 0');
}
if ((startAngle < 0) || (startAngle >= 2 * Math.PI))
{
Browser.print ('[Arc2D] Warning: startAngle=' + startAngle + ' must be within range [0..2pi)');
}
if ((endAngle < 0) || (endAngle >= 2 * Math.PI))
{
Browser.print ('[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
]]>
<!-- Tag color codes: <Node DEF='idName' attribute='value'/> <Prototype name='ProtoName'> <field name='fieldName'/> </Prototype> -->