<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 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Trebuchet MS";
        panose-1:2 11 6 3 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        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-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:2.0cm 42.5pt 2.0cm 3.0cm;}
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-GB link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>Vsevolod,<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'>Great catch!<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'>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 style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span 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 style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Roy<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 #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> x3d-public [mailto:x3d-public-bounces@web3d.org] <b>On Behalf Of </b>Alekseyev, Vsevolod (NIH/NIAID) [E]<br><b>Sent:</b> 24 August 2015 20:58<br><b>To:</b> x3d-public@web3d.org<br><b>Subject:</b> [x3d-public] TriangleStripSet and ccw<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>While we’re on the topic of standard ambiguities, here’s another issue.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>The element also has a ccw flag that tells us which side of the triangle is the outer side.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>The same issue would obviously plague IndexedTriangleStripSet, but not [Indexed]TriangleFanSet.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Trebuchet MS","sans-serif"'>Vsevolod "Seva" Alekseyev<o:p></o:p></span></b></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></body></html>