JVJvx

This page discusses a sample JVX geometry file in detail. The discussed example can be downloaded as a separate file without comments.

The JavaView JVX File Format

The JavaView JVX file format is an xml format. It was developed for storing geometric shapes platform and application independent, and with a special emphasis on the automatic validation of the syntactic and semantic correctness of a JVX file. Below is an example which can also be downloaded and viewed with JavaView. Further examples are contained in the model collection of JavaView, or can be generated with JavaView.

The formal specification of the JVX file format is publicly available. The DTD specification of JVX allows the automatic validation of a JVX file, for example, using the validation service at www.javaview.de/validator/. Every model submitted to EG-Models is automatically validated against the DTD specification.
Example JVX file (without comments) jvxSample.jvx
DTD specification of JVX jvx.dtd

Header Tags

meta tag

A meta tag must have one of the attributes generator or date. The meta tag with generator attribute is for some information about what program was used for producing this xml description file and with the date attribute it is for giving the date when this xml description file was produced.

version tag

A version tag can have a type attribute which is optional. The type attribute can be dump (default), beta or final. This is useful for distinguishing between different versions of a model.

title tag

The title tag is necessary. It should contain a short prezise name for this model.

authors tag

The authors tag is for bundling some author tags. Inside them there are five tags. One for the first name, one for the last name, one for some information about the affiliation of this author, one for his e-mail address and one optional url tag for an internet address. The affiliation tag embraces two tags organization and address. The organization is for the company, university or similar, and the address is for the postal address of this author.

description tag

The description tag encloses the abstract tag which contains a single line verbal description of the geometry.

Geometry Tags

geometries tag

The geometries tag keeps the geometries of a model together where each one is embraced by a geometry tag.

geometry tag

A geometry tag has a name attribute for the name of the geometry. The geometry tag must contain a pointSet tag, possibly either a lineSet or a faceSet tag, and optionally some additional vectorField tags.

pointSet tag

The pointSet tag must have a dim attribute with the dimension of the ambient space and can have optional point, color and normal attributes with the values show (default for point) or hide (default for color and normal). The meaning of the color attribute is to define if the individual colors should be used (color="show") or the global color (color="hide").

The purpose of the pointSet tag is to bind the point coordinates (points tag) with their individual properties. That is for each point possibly its color (colors tag), its normal (normals tag) and the corresponding coordinate inside a texture (textures tag). The origins of the normals are in the center of the points.

It is also possible to define a global color and thickness for all points of the geometry inside the points tag.

lineSet tag

The lineSet tag can have optional arrow, line, color and normal attributes with the values show (default for line) or hide (default for arrow, color and normal). The arrow attribute influences the drawing of an arrow at the end of each line. The meaning of the color attribute is to define if the individual colors should be used (color="show") or the global color (color="hide").

The purpose of the lineSet tag is to bind the lines (lines tag) with their individual properties. That is for each line possibly its color (colors tag) and its normal (normals tag). The origins of the normals are in the middle of the lines.

It is also possible to define a global color and thickness for all lines of the geometry inside the lines tag.

faceSet tag

The faceSet tag can have optional face, edge, color, colorBackGlobal, colorBackGlobal, normal, normalArrow, texture, backface, boundary attributes with the values show (default for face, edge and backface) or hide (default for color, colorBackGlobal, colorBackLocal, normal, normalArrow, texture and boundary). The meaning of the color attribute is to define if the individual colors should be used (color="show") or the global color (color="hide"). Color of backface elements is enabled if either the global color attribute colorBackGlobal or the individual color attribute is set this show. The attribute backface allows to disable drawing of elements whose element normal points away from the camera. Note, this requires element normals to be available. The attribute boundary determines if boundary curves are shown. This requires the neighbour adjacency relation.

The purpose of the faceSet tag is to bind the face indices (faces tag) with their individual properties. That is for each face possibly its neighbours (neighbours tag), its color (colors tag), its normal (normals tag) and its texture (textures tag). The origins of the normals are in the center of the faces.

The optional edges tag can be used to define a couple of edges that should be somehow related to the faces (otherwise it is better to define a separate geometry and use the lineSet tag instead). The edges tag consists of a list of e tags with each having one edge's vertex indices and optional single thickness and color tags. The first tag is for the thickness of the edge measured in pixels. And the second tag gives the same color to all of the listed edges.

The e tag takes the vertex indices of the endpoints of a single edge. The indices are separated by blanks. The tag attribute can be used for marking this edge. By giving different marks to different lines it is possible to make distinguishable groups. For example: tag="head", tag="arm", tag="23", ...

vectorField tag

The vectorField tag can have optional name, arrow and base attributes. The name attribute is for the case a descriptive label for the vector field is wanted. The arrow attribute influences the drawing of an arrow at the end of each field vector and can be show or hide (default). If the geometry contains a face set it is possible to define if with the base attribute if the origins of the vectors should be in the middle of the points (base="vertex" - default) or in the center of the faces (base="element").

Inside the vectorField tag is one vectors tag and possibly one colors tag. With the colors tag every vector can get its own color.

points tag

The points tag consists of a list of p tags with each having one point's coordinates and optional thickness, color and colorTag tags. The first tag is for the thickness of the points measured in pixels. The second tag gives the same color to all of the listed points. And the last tag defines the color that all marked points should have.

The vertices are indexed from 0 to numVertices-1 in the order they appear in the points tag. This is relevant when referencing indexed vertices in the lines or faces tag.

The p tag takes the coordinate of one single point. The coordinate components are separated by blanks. The tag attribute can be used for marking this point. By giving different marks to different points it is possible to make distinguishable groups. For example: tag="head", tag="arm", tag="23", ...

lines tag

The lines tag consists of a list of l tags with each having one line's vertex indices. The lines tag may have optional thickness, color and colorTag tags The first tag is for the thickness of the lines measured in pixels. The second tag gives the same color to all of the listed lines. And the last tag defines the color that all marked lines should have.

The l tag takes the vertex indices of the endpoints of a single line. The indices are separated by blanks. The vertices are indexed from 0 to numVertices-1 in the order they appear in the points tag. The tag attribute can be used for marking this line. By giving different marks to different lines it is possible to make distinguishable groups. For example: tag="head", tag="arm", tag="23", ... The arrow attribute can be used for defining if this line should be drawn with an arrow at its end (arrow="show", default is arrow="hide"). (pending)

Each l tag may have an arbitrary number of vertices larger than 1.

faces tag

The faces tag consists of a list of f tags with each having one face's vertex indices. The faces tag may have optional single color and colorTag tags. The first tag gives the same color to all of the listed faces. And the last tag defines the color that all marked faces should have.

The f tag takes the vertex indices of the edge points of a single face. The indices are separated by blanks. The vertices are indexed from 0 to numVertices-1 in the order they appear in the points tag. The tag attribute can be used for marking this face. By giving different marks to different faces it is possible to make distinguishable groups. For example: tag="head", tag="arm", tag="23", ...

Each f tag may have an arbitrary number of vertices larger than 2 and less than 300.

normals tag

The normals tag consists of a list of n tags with each having one point's normal coordinates and optional single thickness, length and color tags. The first tag is for the thickness of the normals measured in pixels. The second tag sets their length in pixels. And the last gives the same color to all of the listed normals.

Note, there must be a 1-1 correspondence between the set of n tags and the corresponding set of p tags or l tags or f tags.

vectors tag

The vectors tag consists of a list of v tags with each having one vector's coordinates and optional single thickness, length and color tags. The first tag is for the thickness of the vectors measured in pixels. The second tag sets their length in pixels. And the last gives the same color to all of the listed vectors.

Note, there must be a 1-1 correspondence between the set of v tags and the corresponding set of p tags or l tags or f tags.

colors tag

The colors tag consists of a list of c tags with each having one point, line or element color value. The optional type attribute determines the way the values are defined inside the c tags. There must be one value for type="grey", three values for type="rgb" (default) or four values for type="rgba" separated by blanks and each within 0 and 255.

Note, there must be a 1-1 correspondence between the set of c tags and the corresponding set of p tags or l tags or f tags.

textures tag

The textures tag must have a dim attribute with the dimension of the ambient space. Inside there are t tags for the texture coordinates and possibly one image tag. The latter is optional because later on there will be an extension to the jvx file format for procedural textures. Inside the t tags the coordinate components are separated by blanks.

The image tag just contains an url tag for an internet address and has one repeat attribute with the possible values no for no repeating (default), s for horizontal repeating, t for vertical repeating and st for horizontal and vertical repeating.

If the texture belongs to a point set then there must be one texture coordinate for each point. If it belongs to a face set then there must be one texture coordinate for each face vertex. That is if the face set consists of a rectangle and a triangle then there must be four texture coordinates for the rectangle and afterwards three texture coordinates for the triangle.

Note, there must be a 1-1 correspondence between the set of t tags and the corresponding set of p tags or l tags or f tags.

neighbours tag

The neighbours tag consists of a list of nb tags. Each nb tag takes a blank separated list of all indices of elements that are adjacent along a common edge of this element, or -1 at a boundary edge with no adjacent element.

Note, there must be a 1-1 correspondence between the set of nb tags and the corresponding set of f tags. Further, there must be a 1-1 correspondence between the indices in each f and nb tag.

The semantics of the neighbours is as follows: There is a 1-1 correspondence between the set of vertex indices in a face tag and a neighbour tag : each entry in the face tag is the index of a vertex, and the entry in the neighbour tag is the index of the adjacent face at the edge after next.

This means that for triangle meshes the neighbour entry refers to the adjacent face at the opposite edge. At boundary edges the neighbour entry is -1. The index of the faces ranges from 0 to numFaces-1 where the faces are indexed in the sequence of their appearance.

color and colorTag tag

The difference between these two tags is that the color tag is used for defining a color for a set of usual components while the colorTag tag is used for marked componenents. The optional type attribute of both determines the way the values are defined inside them. There must be one value for type="grey", three values for type="rgb" (default) or four values for type="rgba" separated by blanks and each within 0 and 255.

Example

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE jvx-model SYSTEM "http://www.javaview.de/rsrc/jvx.dtd">
<jvx-model>
   <[[#meta_tag][meta]] generator="JavaView v.2.00" />                  - optional -
   <meta date="Thu Jan 18 00:10:21 GMT+01:00 2001" />    - optional -
   <version type="final">2.00</version>                  - optional -
   <title>deLoreon Surface</title>
   <authors>                                             - optional -
      <author>
         <firstname>Emmett</firstname>
         <lastname>Brown</lastname>
         <affiliation>
            <organization>Time Travel Labs</organization>
            <address>
               <line>parking lot</line>
               <line>12345 Twin Pines Mall</line>        - optional -
                         - here may follow additional address lines -
            </address>
         </affiliation>
         <email>Brown@TimeTravelLabs.org</email>
         <url>http://www.TimeTravelLabs.org/</url>       - optional -
      </author>
                           - here may follow additional author tags -
   </authors>
   <description>                                         - optional -
      <abstract>Very difficult 2.5 dimensional surface.</abstract>
      <detail>                                           - optional -
         This surface was evolved while working on the
         verification of the concept of a flux capacitor
         and it was necessary to increase the energy to
         exactly 1.21 giga watts of electricity.
      </detail>
      <keywords>                                         - optional -
         <keyword>flux capacitor</keyword>
         <keyword>deLoreon</keyword>                     - optional -
         <keyword>plutonium</keyword>                    - optional -
                              - here may follow additional keywords -
      </keywords>
      <msc2000>                                          - optional -
         <primary>83E99</primary>
         <secondary>86A15</secondary>                    - optional -
                        - here may follow additional secondary tags -
      </msc2000>
      <software>Geometry Creator 3.14</software>         - optional -
   </description>
               - There are several possible forms for geometries:   -
               -  * point set + vector fields + material            -
               -  * point set + line set + vector fields + material -
               -  * point set + face set + vector fields + material -
   <geometries>
      <geometry name="flux">        - pointSet+vectorField+material -
         <pointSet dim="3" point="show" color="show">
            <points>                                     - optional -
               <p>-0.7 0.  1.4</p>                       - optional -
               <p>-0.4 0.  0.7</p>                       - optional -
               <p>-0.1 0.  0. </p>                       - optional -
               <p>-0.1 0. -0.7</p>                       - optional -
               <p>-0.1 0. -1.4</p>                       - optional -
               <p> 0.1 0. -1.4</p>                       - optional -
               <p> 0.1 0. -0.7</p>                       - optional -
               <p> 0.1 0.  0. </p>                       - optional -
               <p> 0.4 0.  0.7</p>                       - optional -
               <p> 0.7 0.  1.4</p>                       - optional -
                                - here may follow additional p tags -
               <thickness>5</thickness>                  - optional -
            </points>
            <colors>                                     - optional -
               <c>255   0   0</c>                        - optional -
               <c>255 127   0</c>                        - optional -
               <c>255 255   0</c>                        - optional -
               <c>127 255   0</c>                        - optional -
               <c>  0 255   0</c>                        - optional -
               <c>  0 255   0</c>                        - optional -
               <c>  0 255 127</c>                        - optional -
               <c>  0 255 255</c>                        - optional -
               <c>127 255 255</c>                        - optional -
               <c>255 255 255</c>                        - optional -
            </colors>
                                    - here may follow a normals tag -
                                   - here may follow a textures tag -
         </pointSet>
         <vectorField name="forward flux" arrow="show" base="vertex">
            <vectors>
               <v>0.08 0. -0.18</v>                      - optional -
               <v>0.08 0. -0.18</v>                      - optional -
               <v>0.   0. -0.2 </v>                      - optional -
               <v>0.   0. -0.2 </v>                      - optional -
               <v>0.2  0.  0.  </v>                      - optional -
               <v>0.   0.  0.2 </v>                      - optional -
               <v>0.   0.  0.2 </v>                      - optional -
               <v>0.08 0.  0.18</v>                      - optional -
               <v>0.08 0.  0.18</v>                      - optional -
               <v>0.08 0.  0.18</v>                      - optional -
               <color>255 255 0</color>                  - optional -
            </vectors>
         </vectorField>
         <vectorField>                                   - optional -
            <vectors>
               <v>-0.08 0.  0.18</v>                     - optional -
               <v>-0.08 0.  0.18</v>                     - optional -
               <v>-0.08 0.  0.18</v>                     - optional -
               <v> 0.   0.  0.2 </v>                     - optional -
               <v> 0.   0.  0.2 </v>                     - optional -
               <v>-0.2  0.  0.  </v>                     - optional -
               <v> 0.   0. -0.2 </v>                     - optional -
               <v> 0.   0. -0.2 </v>                     - optional -
               <v>-0.08 0. -0.18</v>                     - optional -
               <v>-0.08 0. -0.18</v>                     - optional -
               <color>255 0 255</color>                  - optional -
            </vectors>
         </vectorField>
                      - here may follow additional vectorField tags -
      </geometry>
                             - following geometry tags are optional -
      <geometry name="case">- pointSet+lineSet+vectorField+material -
         <pointSet dim="3" point="hide">
            <points>                                     - optional -
               <p>-0.8 -.2 -2.</p>                       - optional -
               <p> 0.8 -.2 -2.</p>                       - optional -
               <p> 0.8  .2 -2.</p>                       - optional -
               <p>-0.8  .2 -2.</p>                       - optional -
               <p>-1.  -.2  2.</p>                       - optional -
               <p> 1.  -.2  2.</p>                       - optional -
               <p> 1.   .2  2.</p>                       - optional -
               <p>-1.   .2  2.</p>                       - optional -
                                - here may follow additional p tags -
            </points>
         </pointSet>
         <lineSet line="show">
            <lines>
               <l>0 1</l>                                - optional -
               <l>1 2</l>                                - optional -
               <l>2 3</l>                                - optional -
               <l>3 0</l>                                - optional -
               <l>0 4</l>                                - optional -
               <l>1 5</l>                                - optional -
               <l>2 6</l>                                - optional -
               <l>3 7</l>                                - optional -
               <l>4 5</l>                                - optional -
               <l>5 6</l>                                - optional -
               <l>6 7</l>                                - optional -
               <l>7 4</l>                                - optional -
                                - here may follow additional l tags -
               <color>255 255 0</color>                  - optional -
            </lines>
         </lineSet>
                            - here may follow some vectorField tags -
      </geometry>
                            - pointSet+faceSet+vectorField+material -
      <geometry name="backplate">
         <pointSet dim="3" point="hide">
            <points>                                     - optional -
               <p>-1.5 1.0 -2.5</p>                      - optional -
               <p> 1.5 1.0 -2.5</p>                      - optional -
               <p> 1.5 1.2 -2.5</p>                      - optional -
               <p>-1.5 1.2 -2.5</p>                      - optional -
               <p>-1.5 1.0  2.5</p>                      - optional -
               <p> 1.5 1.0  2.5</p>                      - optional -
               <p> 1.5 1.2  2.5</p>                      - optional -
               <p>-1.5 1.2  2.5</p>                      - optional -
                                - here may follow additional p tags -
            </points>
         </pointSet>
         <faceSet face="show" edge="hide">
            <faces>
               <f>3 2 1 0</f>                            - optional -
               <f>4 5 6 7</f>                            - optional -
               <f>0 1 5 4</f>                            - optional -
               <f>2 3 7 6</f>                            - optional -
               <f>0 4 7 3</f>                            - optional -
               <f>1 2 6 5</f>                            - optional -
                                - here may follow additional f tags -
               <color>63 63 255</color>
            </faces>
         </faceSet>
      </geometry>
                         - here may follow additional geometry tags -
   </geometries>
</jvx-model>

Comments

 
Topic attachments
I Attachment Action Size Date Who Comment
jvx.dtddtd jvx.dtd manage 37.7 K 28 May 2015 - 09:55 MartinSkrodzki DTD specification of JVX
jvxSample.jvxjvx jvxSample.jvx manage 5.1 K 28 May 2015 - 09:54 MartinSkrodzki Example JVX file (without comments)
Topic revision: r1 - 28 May 2015, MartinSkrodzki
 
  • Printable version of this topic (p) Printable version of this topic (p)