<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:Mangal;
        panose-1:2 4 5 3 5 2 3 3 2 2;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Trebuchet MS";
        panose-1:2 11 6 3 2 2 2 2 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:56.7pt 42.5pt 56.7pt 85.05pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Any trivial one with 3 triangles will do.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">       <</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">Scene</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">              <</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">Transform</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">                     <</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">Shape</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">                           <</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">Appearance</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">><</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">Material</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:red;background:white;mso-highlight:white">diffuseColor</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">=</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">"</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">0
 0.5 0.5</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">"</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">/></</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">Appearance</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">                           <</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">IndexedTriangleStripSet</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:red;background:white;mso-highlight:white">index</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">=</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">"</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">0
 1 2 3 4</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">"</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">                                  <</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">Coordinate</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:red;background:white;mso-highlight:white">point</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">=</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">"</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">0
 0 0 1 0 1 1 0 0 2 0 1 2 0 0</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">"</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">/></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">                           </</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">IndexedTriangleStripSet</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">                     </</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">Shape</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">              </</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">Transform</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">       </</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">Scene</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">></span><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Roy Walmsley [mailto:roy.walmsley@ntlworld.com]
<br>
<b>Sent:</b> Wednesday, August 26, 2015 6:49 PM<br>
<b>To:</b> Alekseyev, Vsevolod (NIH/NIAID) [E] <VAlekseyev@niaid.nih.gov>; x3d-public@web3d.org<br>
<b>Cc:</b> x3d@web3d.org<br>
<b>Subject:</b> RE: [x3d-public] TriangleStripSet and ccw<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">Vsevolod,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">Great catch!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">Tomorrow I’ll raise a Mantis issue covering this and let you know the details.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">Do you have a reference to an X3D example file that can be used to test implementations?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">Roy<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif"> x3d-public [<a href="mailto:x3d-public-bounces@web3d.org">mailto:x3d-public-bounces@web3d.org</a>]
<b>On Behalf Of </b>Alekseyev, Vsevolod (NIH/NIAID) [E]<br>
<b>Sent:</b> 24 August 2015 20:58<br>
<b>To:</b> <a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a><br>
<b>Subject:</b> [x3d-public] TriangleStripSet and ccw<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal">While we’re on the topic of standard ambiguities, here’s another issue.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Imagine a TriangleStripSet. It has a sequence of points with a sliding window logic to them – the first triangle is points 0, 1, 2, the second is 1,2,3, then 2, 3, 4, etc. It’s illustrated perfectly at
<a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Images/TriangleStripSet.png">
http://www.web3d.org/documents/specifications/19775-1/V3.3/Images/TriangleStripSet.png</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The element also has a ccw flag that tells us which side of the triangle is the outer side.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Now, the issue. If the ccw logic is to be followed *for every triangle*, every second triangle would look the other way from the previous one.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Look at the image. For the first triangle, the logic for determining the outer side is – if you look at the triangle from the outside, vertices 0, 1, 2 should go counterclockwise. But if you look from the same vantage point at the second
 triangle, vertices 1, 2, 3 would go *<b>clockwise</b>* instead. Were the algorithm to go by the strict letter of the ccw rule, one would have to conclude that odd numbered triangles in the strip look one way, even numbered ones look the other way.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Fortunately, few implementors think so. Neither X3DOM nor X3D-Edit read the standard that way. My Blender X3D importer flips the vertex order for every odd triangle, too. The only implementation that does not is meshlab. Upon rendering,
 it gives a very characteristic “checkerboard” pattern – triangles that are seen from the inside are dark.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The same issue would obviously plague IndexedTriangleStripSet, but not [Indexed]TriangleFanSet.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Maybe a clarification in the standard would be in order, that ccw only applies to the *<b>first</b>* triangle in the strip, for the subsequent ones one should go by consistent orientation of adjacent triangles.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Trebuchet MS",sans-serif">Vsevolod "Seva" Alekseyev<o:p></o:p></span></b></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>