2

I'm new to x3d and have no idea how to create flat area like on picture in x3d? polygon Here are the coordinates of dots:
2360,1746,2246,1746,2139,1746,2139,1611,1923,1611,1923,2053,2246,2053,2246,1984,2371,1984,2371,2053,2462,2053,2462,1993,2496,1993,2496,2053,2555,2053,2556,1746

Can anybody help me with that?
And which way is better: extrusion or faceset or indexedfaceset?
Thanks.

Update:

I've tried this

    <shape>
      <appearance alphaclipthreshold="0.1" sorttype="auto">
        <material specularcolor="0,0,0" shininess="0.2" emissivecolor="0,0,0" ambientintensity="0.2" diffusecolor="1 1 0.94" transparency="0"></material>
      </appearance>
      <indexedfaceset>
        <coordinate point="2360 1746 2246 1746 2139 1746 2139 1611 1923 1611 1923 2053 2246 2053 2246 1984 2371 1984 2371 2053 2462 2053 2462 1993 2496 1993 2496 2053 2555 2053 2556 1746"></coordinate>
      </indexedfaceset>
    </shape>

And this:

    <Shape>
      <Appearance alphaClipThreshold="0.1" sortType="auto">
        <Material ambientIntensity="0.2" shininess="0.2" transparency="0.0" emissiveColor="#000000" specularColor="#2A2A2A" diffuseColor="#3F7EBD"></Material>
      </Appearance>
      <Extrusion scale="1,1" orientation="0,0,0,0" height="0.1" crossSection="2360,1746,2246,1746,2139,1746,2139,1611,1923,1611,1923,2053,2246,2‌053,2246,1984,2371,1984,2371,2053,2462,2053,2462,1993,2496,1993,2496,2053,2555,20‌​53,2556,1746"></Extrusion> </Shape>

And result was either blank or some random-looking picture.
Any ideas?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Somerussian
  • 381
  • 4
  • 17
  • 1
    This isn't a code writing service. Give it a try, say what you've tried, what the problems were, how you tried to resolve them etc.. Please post at least a little bit of code that you've written to draw this figure. – Aleksander Lidtke Sep 13 '15 at 11:15
  • hi OK, thanks. Could you please edit the question and put this in there? It will make it a lot more legible. Also, what were the issues with the approaches you've tried? – Aleksander Lidtke Sep 14 '15 at 07:50
  • The result was either blank or some random-looking picture. Any ideas? – Somerussian Sep 14 '15 at 08:07
  • I've no idea, never used the software/programming language you mention. I'm just helping you format the question so as to get attention from the people who may know the answer ;) Good luck. – Aleksander Lidtke Sep 14 '15 at 12:47

1 Answers1

2

You have multiple issues. For a good reference, I recommend X3D: Extensible 3D graphics for web authors. An IndexedFaceSet is actually NOT one of the easier X3D nodes to start with.

First, the IndexedFaceSet use camel case, e.g., IndexedFaceSet. Second, an IndexedFaceSet geometry has two, not one, key components to set the geometry. One is the coordinate point list, as you have. But that's an unordered list of points. as part of the IndexedFaceSet element you have to specify the vertices by point number, with each face ending with a "-1" to signal the end. Preferably in counter-clockwise order (otherwise you need to set ccw="false").

Also, if your polygon is not convex (yours isn't), you need to set convex = "false" as the default is true.

Remember too that X3D is indeed 3D. Your point list has to provide x, y AND z coordinates, even though an indexed face set is a plane, since it could be at any orientation in 3D space. You only provided two coordinates per point.

Here's a simple example:

<X3D>
<Scene>
<Shape>
  <IndexedFaceSet ccw = "true" colorPerVertex = "false" solid = "false" convex = "false" coordIndex='0 1 2 3 4 5 6 7 -1'>
    <Color color='0 0 1'/>
    <coordinate point='-4 -4 0 -1 -4 0 -1 1 0 1 1 0 1 -4 0 4 -4 0 4 3 0 -4 3 0'></coordinate>
  </IndexedFaceSet>
</Shape>
</Scene>
</X3D> 
ViennaMike
  • 2,207
  • 1
  • 24
  • 38
  • Thanks ViennaMike for explanation, but I still can't fix my bug. – Somerussian Sep 21 '15 at 08:39
  • My script generates many objects: walls and floors - out of one set of coordinates. Most of them looks ok, but some - not. Here's an example: walls (good) - http://awesomescreenshot.com/0f1596yf70 and floor (bad) - http://awesomescreenshot.com/071596yiff . Code of these figures is here: http://akenoo.ru/tc/dev/x3d_test.txt Can anybody help? – Somerussian Sep 21 '15 at 08:47