[X3D-Public] UNIT questions

Michalis Kamburelis michalis.kambi at gmail.com
Sat Jan 21 19:29:25 PST 2012


Hi,

I implemented in view3dscene initial support for UNIT clauses. This is a 
new feature in X3D 3.3, allows you to specify conversion for units. 
view3dscene now parses it (in classic and XML encoding), and conversion 
of angles in all relevant fields (SFRotation, MFRotation, creaseAngle, 
some others) is done. So e.g. you can specify angles in degrees instead 
of radians. Internally, the engine still uses radians everywhere.

Some questions:

1. Can someone take a look at my example files, 
http://svn.code.sf.net/p/castle-engine/code/trunk/demo_models/x3d/units.x3dv 
(classic encoding) and 
http://svn.code.sf.net/p/castle-engine/code/trunk/demo_models/x3d/units.x3d 
(XML encoding) and confirm they are Ok?

In particular, check the magic line to specify angles in degrees (in 
classing encoding):

   UNIT angle degrees 0.017453293 # pi / 180

I didn't find any example files using UNIT on the Internet, so my whole 
understanding of the idea comes from reading the specification. 
Hopefully I understood it correctly :) Thanks for any clarification in 
advance.

If you're interested in trying view3dscene on these files, see our 
snapshots on http://michalis.ii.uni.wroc.pl/castle-engine-snapshots/ .

2. Are derived types (acceleration, angular_rate, area, speed, volume) 
allowed as UNIT category? Or only base types (angle, force, length, 
mass) are allowed as category?

*Almost* everywhere it's said that only the (four) base types are allowed:

- 
http://www.web3d.org/files/specifications/19775-1/V3.3/Part01/concepts.html 
says "The initial *base* units for the entire hierarchy of an X3D world 
may be changed to another default *base* unit by using one or more UNIT 
statements as specified in 7 Core component." (emphasis mine)

- 
http://www.web3d.org/files/specifications/19775-1/V3.3/Part01/components/core.html 
says "where <category> is a string specifying one of the categories in 
Table 4.2". Also "At most one UNIT statement shall be provided for each 
base unit type." (suggesting only base types are allowed, as table 4.2 
lists only base types)

- http://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html 
(although not part of spec) says "X3D version 3.3 now supports 
scene-wide definition of alternate measurement <unit/> for angle 
(default radians), length (default meters), mass (default kilograms) and 
force (default newtons)." (suggesting only base types are allowed)

- *However*: x3d-3.3.dtd on 
http://www.web3d.org/files/specifications/19776-1/V3.3/Part01/DTD.html#x3d-3.3.dtd 
and 
http://www.web3d.org/files/specifications/19776-1/V3.3/Part01/x3d-3.3.dtd contains 
this text:

<!-- TODO confirm inclusion of derived unit categories from Table 4.3 -->
<!ENTITY % unitCategories 
"(acceleration|angle|angular_rate|area|force|length|mass|speed|volume)">

Looks like this requires correction, unitCategories should only contain 
four base types, and TODO above should be closed?

Regards,
Michalis



More information about the X3D-Public mailing list