سؤال

the following code is in X3D works. It gives out a cone image. My question is, where did the image get the details for the height of the cone or the design of a cone? I gave it only points (via coordinate point) and how to connect them (via coordIndex). The way I look at it, this should have given me a flat rectangle.

Can anyone help understand what is really going on in this codes. Thanks.

P.S: Probably not the best place to ask but can I know how to open x3d files. Back in class I was able to read it by just saving a text file as x3d extension (similar to a html file fashion where no extra tools is needed to open it). Anything other than a flux player that could help me out here? Thanks.

<X3D>
<Scene>
<Shape>

    <IndexedFaceSet solid="false"
        coordIndex="0 3 4 1 -1
                    1 4 5 2 -1
                    3 6 7 4 -1
                    4 7 8 5 -1">
       <Coordinate 
        point= "0 0 0, 1 0 0, 2 0 0
                0 0 1, 1 3 1, 2 0 1
                0 0 2, 1 0 2, 2 0 2" />
    </IndexedFaceSet>

    <Appearance>
        <Material diffuseColor='1 0 0' />
    </Appearance>

</Shape>
</Scene>
</X3D>
هل كانت مفيدة؟

المحلول

actually what you have there is a weird pyramid, not a cone. I don't know how you look at it but there are 9 points, one of them being in a different plan than the others [1 3 1] therefore you cannot get a flat rectangle. The [1 3 1] point is the top of the pyramid.

if you are not sure about it draw a cartesian coordinate system on a paper and then add 9 dots, each coresponding to the coordinate points that you have ([0 0 0], [1 0 0],...)

now connect the dots as the coordIndex specifies. You will get some kind of a pyramid, with some unconnected points in the base.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top