summaryrefslogtreecommitdiff
path: root/graphics/asymptote/prc
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/asymptote/prc')
-rw-r--r--graphics/asymptote/prc/Makefile42
-rw-r--r--graphics/asymptote/prc/PRC.h512
-rw-r--r--graphics/asymptote/prc/PRCTools/Makefile48
-rw-r--r--graphics/asymptote/prc/PRCTools/bitData.cc258
-rw-r--r--graphics/asymptote/prc/PRCTools/bitData.h62
-rw-r--r--graphics/asymptote/prc/PRCTools/bitSearchDouble.cc67
-rw-r--r--graphics/asymptote/prc/PRCTools/bitSearchUI.cc65
-rw-r--r--graphics/asymptote/prc/PRCTools/describeMain.cc45
-rw-r--r--graphics/asymptote/prc/PRCTools/describePRC.cc2272
-rw-r--r--graphics/asymptote/prc/PRCTools/describePRC.h117
-rw-r--r--graphics/asymptote/prc/PRCTools/extractSections.cc46
-rw-r--r--graphics/asymptote/prc/PRCTools/iPRCFile.cc220
-rw-r--r--graphics/asymptote/prc/PRCTools/iPRCFile.h88
-rw-r--r--graphics/asymptote/prc/PRCTools/inflation.cc90
-rw-r--r--graphics/asymptote/prc/PRCTools/inflation.h31
-rw-r--r--graphics/asymptote/prc/PRCTools/inflationMain.cc55
-rw-r--r--graphics/asymptote/prc/PRCTools/makePRC.cc187
-rw-r--r--graphics/asymptote/prc/PRCbitStream.cc404
-rw-r--r--graphics/asymptote/prc/PRCbitStream.h87
-rw-r--r--graphics/asymptote/prc/PRCdouble.cc2121
-rw-r--r--graphics/asymptote/prc/PRCdouble.h140
-rw-r--r--graphics/asymptote/prc/oPRCFile.cc1921
-rw-r--r--graphics/asymptote/prc/oPRCFile.h1364
-rw-r--r--graphics/asymptote/prc/test.asy5
-rw-r--r--graphics/asymptote/prc/test.cc954
-rw-r--r--graphics/asymptote/prc/writePRC.cc2085
-rw-r--r--graphics/asymptote/prc/writePRC.h1472
27 files changed, 14758 insertions, 0 deletions
diff --git a/graphics/asymptote/prc/Makefile b/graphics/asymptote/prc/Makefile
new file mode 100644
index 0000000000..23dd32aa3b
--- /dev/null
+++ b/graphics/asymptote/prc/Makefile
@@ -0,0 +1,42 @@
+# Makefile.
+
+CFLAGS = -O3 -g -Wall
+CXX = g++
+
+MAKEDEPEND = $(CFLAGS) -O0 -M -DDEPEND
+
+FILES = PRCbitStream oPRCFile PRCdouble writePRC
+
+all: $(FILES:=.o)
+
+#test: $(FILES:=.o) test.o
+# $(CXX) $(CFLAGS) -o test $(FILES:=.o) test.o -lz
+
+#test_tess: $(FILES:=.o) test_tess.o
+# $(CXX) $(CFLAGS) -o test_tess $(FILES:=.o) test_tess.o -lz
+
+#test_mesh: $(FILES:=.o) test_mesh.o
+# $(CXX) $(CFLAGS) -o test_mesh $(FILES:=.o) test_mesh.o -lz
+
+.SUFFIXES: .c .cc .o .d
+.cc.o:
+ $(CXX) $(CFLAGS) $(INCL) -o $@ -c $<
+.cc.d:
+ @echo Creating $@; \
+ rm -f $@; \
+ ${CXX} $(MAKEDEPEND) $(INCL) $(MDOPTS) $< > $@.$$$$ 2>/dev/null && \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+.c.d:
+ @echo Creating $@; \
+ rm -f $@; \
+ ${CC} $(MAKEDEPEND) $(INCL) $(MDOPTS) $< > $@.$$$$ 2>/dev/null && \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+ifeq (,$(findstring clean,${MAKECMDGOALS}))
+-include $(FILES:=.d)
+endif
+
+clean:
+ rm -f *.o *.d test test_tess
diff --git a/graphics/asymptote/prc/PRC.h b/graphics/asymptote/prc/PRC.h
new file mode 100644
index 0000000000..9ce6ea70e0
--- /dev/null
+++ b/graphics/asymptote/prc/PRC.h
@@ -0,0 +1,512 @@
+#ifndef __PRC_H
+#define __PRC_H
+
+#ifdef _MSC_VER
+#if _MSC_VER >= 1600
+#include <stdint.h>
+#else
+typedef signed char int8_t;
+typedef signed short int16_t;
+typedef signed long int32_t;
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned long uint32_t;
+#endif // _MSC_VER >= 1600
+#else
+#include <inttypes.h>
+#endif // _MSC_VER
+
+//const uint32_t PRCVersion=7094; // For Adobe Reader 8 or later
+const uint32_t PRCVersion=8137; // For Adobe Reader 9 or later
+
+// from Adobe's documentation
+
+#define PRC_TYPE_Unknown ( (uint32_t)-1 )
+
+#define PRC_TYPE_ROOT 0 // This type does not correspond to any entity
+
+#define PRC_TYPE_ROOT_PRCBase ( PRC_TYPE_ROOT + 1 ) // Abstract root type for any PRC entity.
+#define PRC_TYPE_ROOT_PRCBaseWithGraphics ( PRC_TYPE_ROOT + 2 ) // Abstract root type for any PRC entity which can bear graphics.
+
+#define PRC_TYPE_CRV ( PRC_TYPE_ROOT + 10 ) // Types for PRC geometrical curves
+#define PRC_TYPE_SURF ( PRC_TYPE_ROOT + 75 ) // Types for PRC geometrical surfaces
+#define PRC_TYPE_TOPO ( PRC_TYPE_ROOT + 140 ) // Types for PRC topology
+#define PRC_TYPE_TESS ( PRC_TYPE_ROOT + 170 ) // Types for PRC tessellation
+#define PRC_TYPE_MISC ( PRC_TYPE_ROOT + 200 ) // Types for PRC global data
+#define PRC_TYPE_RI ( PRC_TYPE_ROOT + 230 ) // Types for PRC representation items
+#define PRC_TYPE_ASM ( PRC_TYPE_ROOT + 300 ) // Types for PRC assembly
+#define PRC_TYPE_MKP ( PRC_TYPE_ROOT + 500 ) // Types for PRC markup
+#define PRC_TYPE_GRAPH ( PRC_TYPE_ROOT + 700 ) // Types for PRC graphics
+#define PRC_TYPE_MATH ( PRC_TYPE_ROOT + 900 ) // Types for PRC mathematical operators
+
+#define PRC_TYPE_CRV_Base ( PRC_TYPE_CRV + 1 ) // Abstract type for all geometric curves.
+#define PRC_TYPE_CRV_Blend02Boundary ( PRC_TYPE_CRV + 2 ) // Boundary Curve.
+#define PRC_TYPE_CRV_NURBS ( PRC_TYPE_CRV + 3 ) // Non Uniform BSpline curve.
+#define PRC_TYPE_CRV_Circle ( PRC_TYPE_CRV + 4 ) // Circle.
+#define PRC_TYPE_CRV_Composite ( PRC_TYPE_CRV + 5 ) // Array of oriented curves.
+#define PRC_TYPE_CRV_OnSurf ( PRC_TYPE_CRV + 6 ) // Curve defined by a UV curve on a surface.
+#define PRC_TYPE_CRV_Ellipse ( PRC_TYPE_CRV + 7 ) // Ellipse.
+#define PRC_TYPE_CRV_Equation ( PRC_TYPE_CRV + 8 ) // curve described by specific law elements
+#define PRC_TYPE_CRV_Helix ( PRC_TYPE_CRV + 9 ) // Helix curve.
+#define PRC_TYPE_CRV_Hyperbola ( PRC_TYPE_CRV + 10 ) // Hyperbola.
+#define PRC_TYPE_CRV_Intersection ( PRC_TYPE_CRV + 11 ) // Intersection between 2 surfaces.
+#define PRC_TYPE_CRV_Line ( PRC_TYPE_CRV + 12 ) // Line.
+#define PRC_TYPE_CRV_Offset ( PRC_TYPE_CRV + 13 ) // Offset curve.
+#define PRC_TYPE_CRV_Parabola ( PRC_TYPE_CRV + 14 ) // Parabola.
+#define PRC_TYPE_CRV_PolyLine ( PRC_TYPE_CRV + 15 ) // Polyedric curve.
+#define PRC_TYPE_CRV_Transform ( PRC_TYPE_CRV + 16 ) // Transformed curve.
+
+#define PRC_TYPE_SURF_Base ( PRC_TYPE_SURF + 1 ) // Abstract type for all geometric surfaces.
+#define PRC_TYPE_SURF_Blend01 ( PRC_TYPE_SURF + 2 ) // Blend surface.
+#define PRC_TYPE_SURF_Blend02 ( PRC_TYPE_SURF + 3 ) // Blend Surface.
+#define PRC_TYPE_SURF_Blend03 ( PRC_TYPE_SURF + 4 ) // Blend Surface.
+#define PRC_TYPE_SURF_NURBS ( PRC_TYPE_SURF + 5 ) // Non Uniform BSpline surface.
+#define PRC_TYPE_SURF_Cone ( PRC_TYPE_SURF + 6 ) // Cone.
+#define PRC_TYPE_SURF_Cylinder ( PRC_TYPE_SURF + 7 ) // Cylinder.
+#define PRC_TYPE_SURF_Cylindrical ( PRC_TYPE_SURF + 8 ) // Surface who is defined in cylindrical space.
+#define PRC_TYPE_SURF_Offset ( PRC_TYPE_SURF + 9 ) // Offset surface.
+#define PRC_TYPE_SURF_Pipe ( PRC_TYPE_SURF + 10 ) // Pipe.
+#define PRC_TYPE_SURF_Plane ( PRC_TYPE_SURF + 11 ) // Plane.
+#define PRC_TYPE_SURF_Ruled ( PRC_TYPE_SURF + 12 ) // Ruled surface.
+#define PRC_TYPE_SURF_Sphere ( PRC_TYPE_SURF + 13 ) // Sphere.
+#define PRC_TYPE_SURF_Revolution ( PRC_TYPE_SURF + 14 ) // Surface of revolution.
+#define PRC_TYPE_SURF_Extrusion ( PRC_TYPE_SURF + 15 ) // Surface of extrusion.
+#define PRC_TYPE_SURF_FromCurves ( PRC_TYPE_SURF + 16 ) // Surface from two curves.
+#define PRC_TYPE_SURF_Torus ( PRC_TYPE_SURF + 17 ) // Torus.
+#define PRC_TYPE_SURF_Transform ( PRC_TYPE_SURF + 18 ) // Transformed surface.
+#define PRC_TYPE_SURF_Blend04 ( PRC_TYPE_SURF + 19 ) // defined for future use.
+
+#define PRC_TYPE_TOPO_Context ( PRC_TYPE_TOPO + 1 ) // Self-containing set of topological entities.
+#define PRC_TYPE_TOPO_Item ( PRC_TYPE_TOPO + 2 ) // Abstract root type for any topological entity (body or single item).
+#define PRC_TYPE_TOPO_MultipleVertex ( PRC_TYPE_TOPO + 3 ) // Vertex whose position is the average of all edges' extremity positions to whom it belongs.
+#define PRC_TYPE_TOPO_UniqueVertex ( PRC_TYPE_TOPO + 4 ) // Vertex with one set of coordinates (absolute position).
+#define PRC_TYPE_TOPO_WireEdge ( PRC_TYPE_TOPO + 5 ) // Edge belonging to a wire body / single wire body.
+#define PRC_TYPE_TOPO_Edge ( PRC_TYPE_TOPO + 6 ) // Edge belonging to a brep data.
+#define PRC_TYPE_TOPO_CoEdge ( PRC_TYPE_TOPO + 7 ) // Usage of an edge in a loop.
+#define PRC_TYPE_TOPO_Loop ( PRC_TYPE_TOPO + 8 ) // Array of co edges which delimits a face.
+#define PRC_TYPE_TOPO_Face ( PRC_TYPE_TOPO + 9 ) // Topological face delimiting a shell.
+#define PRC_TYPE_TOPO_Shell ( PRC_TYPE_TOPO + 10 ) // Topological shell (open or closed).
+#define PRC_TYPE_TOPO_Connex ( PRC_TYPE_TOPO + 11 ) // Topological region delimited by one or several shells.
+#define PRC_TYPE_TOPO_Body ( PRC_TYPE_TOPO + 12 ) // Abstract root type for any topological body.
+#define PRC_TYPE_TOPO_SingleWireBody ( PRC_TYPE_TOPO + 13 ) // Single wire body.
+#define PRC_TYPE_TOPO_BrepData ( PRC_TYPE_TOPO + 14 ) // Main entry to solid and surface topology (regular form).
+#define PRC_TYPE_TOPO_SingleWireBodyCompress ( PRC_TYPE_TOPO + 15 ) // Single wire body. (ultra compressed form).
+#define PRC_TYPE_TOPO_BrepDataCompress ( PRC_TYPE_TOPO + 16 ) // Main entry to solid and surface topology (ultra compressed form).
+#define PRC_TYPE_TOPO_WireBody ( PRC_TYPE_TOPO + 17 ) // This type is the main entry to wire topology.
+
+#define PRC_TYPE_TESS_Base ( PRC_TYPE_TESS + 1 ) // Abstract root type for any tessellated entity.
+#define PRC_TYPE_TESS_3D ( PRC_TYPE_TESS + 2 ) // Tessellated faceted data; regular form.
+#define PRC_TYPE_TESS_3D_Compressed ( PRC_TYPE_TESS + 3 ) // Tessellated faceted data; highly compressed form.
+#define PRC_TYPE_TESS_Face ( PRC_TYPE_TESS + 4 ) // Tessellated face.
+#define PRC_TYPE_TESS_3D_Wire ( PRC_TYPE_TESS + 5 ) // Tessellated wireframe.
+#define PRC_TYPE_TESS_Markup ( PRC_TYPE_TESS + 6 ) // Tessellated markup.
+
+#define PRC_TYPE_MISC_Attribute ( PRC_TYPE_MISC + 1 ) // Entity attribute.
+#define PRC_TYPE_MISC_CartesianTransformation ( PRC_TYPE_MISC + 2 ) // Cartesian transformation.
+#define PRC_TYPE_MISC_EntityReference ( PRC_TYPE_MISC + 3 ) // Entity reference.
+#define PRC_TYPE_MISC_MarkupLinkedItem ( PRC_TYPE_MISC + 4 ) // Link between a markup and an entity.
+#define PRC_TYPE_MISC_ReferenceOnPRCBase ( PRC_TYPE_MISC + 5 ) // Reference pointing on a regular entity (not topological).
+#define PRC_TYPE_MISC_ReferenceOnTopology ( PRC_TYPE_MISC + 6 ) // Reference pointing on a topological entity.
+#define PRC_TYPE_MISC_GeneralTransformation ( PRC_TYPE_MISC + 7 ) // General transformation.
+
+#define PRC_TYPE_RI_RepresentationItem ( PRC_TYPE_RI + 1 ) // Basic abstract type for representation items.
+#define PRC_TYPE_RI_BrepModel ( PRC_TYPE_RI + 2 ) // Basic type for surfaces and solids.
+#define PRC_TYPE_RI_Curve ( PRC_TYPE_RI + 3 ) // Basic type for curves.
+#define PRC_TYPE_RI_Direction ( PRC_TYPE_RI + 4 ) // Optional point + vector.
+#define PRC_TYPE_RI_Plane ( PRC_TYPE_RI + 5 ) // Construction plane, as opposed to planar surface.
+#define PRC_TYPE_RI_PointSet ( PRC_TYPE_RI + 6 ) // Set of points.
+#define PRC_TYPE_RI_PolyBrepModel ( PRC_TYPE_RI + 7 ) // Basic type to polyhedral surfaces and solids.
+#define PRC_TYPE_RI_PolyWire ( PRC_TYPE_RI + 8 ) // Polyedric wireframe entity.
+#define PRC_TYPE_RI_Set ( PRC_TYPE_RI + 9 ) // Logical grouping of arbitrary number of representation items.
+#define PRC_TYPE_RI_CoordinateSystem ( PRC_TYPE_RI + 10 ) // Coordinate system.
+
+#define PRC_TYPE_ASM_ModelFile ( PRC_TYPE_ASM + 1 ) // Basic entry type for PRC.
+#define PRC_TYPE_ASM_FileStructure ( PRC_TYPE_ASM + 2 ) // Basic structure for PRC files.
+#define PRC_TYPE_ASM_FileStructureGlobals ( PRC_TYPE_ASM + 3 ) // Basic structure for PRC files : globals.
+#define PRC_TYPE_ASM_FileStructureTree ( PRC_TYPE_ASM + 4 ) // Basic structure for PRC files : tree.
+#define PRC_TYPE_ASM_FileStructureTessellation ( PRC_TYPE_ASM + 5 ) // Basic structure for PRC files : tessellation.
+#define PRC_TYPE_ASM_FileStructureGeometry ( PRC_TYPE_ASM + 6 ) // Basic structure for PRC files : geometry.
+#define PRC_TYPE_ASM_FileStructureExtraGeometry ( PRC_TYPE_ASM + 7 ) // Basic structure for PRC files : extra geometry data.
+#define PRC_TYPE_ASM_ProductOccurence ( PRC_TYPE_ASM + 10 ) // Basic contruct for assemblies.
+#define PRC_TYPE_ASM_PartDefinition ( PRC_TYPE_ASM + 11 ) // Basic construct for parts.
+#define PRC_TYPE_ASM_Filter ( PRC_TYPE_ASM + 20 )
+
+#define PRC_TYPE_MKP_View ( PRC_TYPE_MKP + 1 ) // Grouping of markup by views.
+#define PRC_TYPE_MKP_Markup ( PRC_TYPE_MKP + 2 ) // Basic type for simple markups.
+#define PRC_TYPE_MKP_Leader ( PRC_TYPE_MKP + 3 ) // basic type for markup leader
+#define PRC_TYPE_MKP_AnnotationItem ( PRC_TYPE_MKP + 4 ) // Usage of a markup.
+#define PRC_TYPE_MKP_AnnotationSet ( PRC_TYPE_MKP + 5 ) // Group of annotations.
+#define PRC_TYPE_MKP_AnnotationReference ( PRC_TYPE_MKP + 6 ) // Logical grouping of annotations for reference.
+
+#define PRC_TYPE_GRAPH_Style ( PRC_TYPE_GRAPH + 1 ) // Display style.
+#define PRC_TYPE_GRAPH_Material ( PRC_TYPE_GRAPH + 2 ) // Display material properties.
+#define PRC_TYPE_GRAPH_Picture ( PRC_TYPE_GRAPH + 3 ) // Picture.
+#define PRC_TYPE_GRAPH_TextureApplication ( PRC_TYPE_GRAPH + 11 ) // Texture application.
+#define PRC_TYPE_GRAPH_TextureDefinition ( PRC_TYPE_GRAPH + 12 ) // Texture definition.
+#define PRC_TYPE_GRAPH_TextureTransformation ( PRC_TYPE_GRAPH + 13 ) // Texture transformation.
+#define PRC_TYPE_GRAPH_LinePattern ( PRC_TYPE_GRAPH + 21 ) // One dimensional display style.
+#define PRC_TYPE_GRAPH_FillPattern ( PRC_TYPE_GRAPH + 22 ) // Abstract class for two-dimensional display style.
+#define PRC_TYPE_GRAPH_DottingPattern ( PRC_TYPE_GRAPH + 23 ) // Two-dimensional filling with dots.
+#define PRC_TYPE_GRAPH_HatchingPattern ( PRC_TYPE_GRAPH + 24 ) // Two-dimensional filling with hatches.
+#define PRC_TYPE_GRAPH_SolidPattern ( PRC_TYPE_GRAPH + 25 ) // Two-dimensional filling with particular style (color, material, texture).
+#define PRC_TYPE_GRAPH_VPicturePattern ( PRC_TYPE_GRAPH + 26 ) // Two-dimensional filling with vectorised picture.
+#define PRC_TYPE_GRAPH_AmbientLight ( PRC_TYPE_GRAPH + 31 ) // Scene ambient illumination.
+#define PRC_TYPE_GRAPH_PointLight ( PRC_TYPE_GRAPH + 32 ) // Scene point illumination.
+#define PRC_TYPE_GRAPH_DirectionalLight ( PRC_TYPE_GRAPH + 33 ) // Scene directional illumination.
+#define PRC_TYPE_GRAPH_SpotLight ( PRC_TYPE_GRAPH + 34 ) // Scene spot illumination.
+#define PRC_TYPE_GRAPH_SceneDisplayParameters ( PRC_TYPE_GRAPH + 41 ) // Parameters for scene visualisation.
+#define PRC_TYPE_GRAPH_Camera ( PRC_TYPE_GRAPH + 42 ) //
+
+#define PRC_TYPE_MATH_FCT_1D ( PRC_TYPE_MATH + 1 ) // Basic type for one degree equation object.
+#define PRC_TYPE_MATH_FCT_1D_Polynom ( PRC_TYPE_MATH_FCT_1D + 1 ) // Polynomial equation.
+#define PRC_TYPE_MATH_FCT_1D_Trigonometric ( PRC_TYPE_MATH_FCT_1D + 2 ) // Cosinus based equation.
+#define PRC_TYPE_MATH_FCT_1D_Fraction ( PRC_TYPE_MATH_FCT_1D + 3 ) // Fraction between 2 one degree equation object.
+#define PRC_TYPE_MATH_FCT_1D_ArctanCos ( PRC_TYPE_MATH_FCT_1D + 4 ) // Specific equation.
+#define PRC_TYPE_MATH_FCT_1D_Combination ( PRC_TYPE_MATH_FCT_1D + 5 ) // Combination of one degree equation object.
+#define PRC_TYPE_MATH_FCT_3D ( PRC_TYPE_MATH + 10 ) // Basic type for 3rd degree equation object.
+#define PRC_TYPE_MATH_FCT_3D_Linear ( PRC_TYPE_MATH_FCT_3D + 1 ) // Linear transformation ( with a matrix ).
+#define PRC_TYPE_MATH_FCT_3D_NonLinear ( PRC_TYPE_MATH_FCT_3D + 2 ) // Specific transformation.
+
+#define PRC_PRODUCT_FLAG_DEFAULT 0x0001
+#define PRC_PRODUCT_FLAG_INTERNAL 0x0002
+#define PRC_PRODUCT_FLAG_CONTAINER 0x0004
+#define PRC_PRODUCT_FLAG_CONFIG 0x0008
+#define PRC_PRODUCT_FLAG_VIEW 0x0010
+
+#define PRC_TRANSFORMATION_Identity 0x00
+#define PRC_TRANSFORMATION_Translate 0x01
+#define PRC_TRANSFORMATION_Rotate 0x02
+#define PRC_TRANSFORMATION_Mirror 0x04
+#define PRC_TRANSFORMATION_Scale 0x08
+#define PRC_TRANSFORMATION_NonUniformScale 0x10
+#define PRC_TRANSFORMATION_NonOrtho 0x20
+#define PRC_TRANSFORMATION_Homogeneous 0x40
+
+#define PRC_FACETESSDATA_Polyface 0x0001
+#define PRC_FACETESSDATA_Triangle 0x0002
+#define PRC_FACETESSDATA_TriangleFan 0x0004
+#define PRC_FACETESSDATA_TriangleStripe 0x0008
+#define PRC_FACETESSDATA_PolyfaceOneNormal 0x0010
+#define PRC_FACETESSDATA_TriangleOneNormal 0x0020
+#define PRC_FACETESSDATA_TriangleFanOneNormal 0x0040
+#define PRC_FACETESSDATA_TriangleStripeOneNormal 0x0080
+#define PRC_FACETESSDATA_PolyfaceTextured 0x0100
+#define PRC_FACETESSDATA_TriangleTextured 0x0200
+#define PRC_FACETESSDATA_TriangleFanTextured 0x0400
+#define PRC_FACETESSDATA_TriangleStripeTextured 0x0800
+#define PRC_FACETESSDATA_PolyfaceOneNormalTextured 0x1000
+#define PRC_FACETESSDATA_TriangleOneNormalTextured 0x2000
+#define PRC_FACETESSDATA_TriangleFanOneNormalTextured 0x4000
+#define PRC_FACETESSDATA_TriangleStripeOneNormalTextured 0x8000
+#define PRC_FACETESSDATA_NORMAL_Single 0x40000000
+#define PRC_FACETESSDATA_NORMAL_Mask 0x3FFFFFFF
+#define PRC_FACETESSDATA_WIRE_IsNotDrawn 0x4000 // Indicates that the edge should not be drawn (its neighbor will be drawn).
+#define PRC_FACETESSDATA_WIRE_IsClosing 0x8000 // Indicates that this is the last edge of a loop.
+
+#define PRC_3DWIRETESSDATA_IsClosing 0x10000000 // Indicates that the first point is implicitely repeated after the last one to close the wire edge.
+#define PRC_3DWIRETESSDATA_IsContinuous 0x20000000 // Indicates that the last point of the preceding wire should be linked with the first point of the current one.
+
+#define PRC_TEXTURE_MAPPING_DIFFUSE 0x0001 // Diffuse texture mapping attribute. Default value.
+#define PRC_TEXTURE_MAPPING_BUMP 0x0002 // Bump texture mapping attribute.
+#define PRC_TEXTURE_MAPPING_OPACITY 0x0004 // Opacity texture mapping attribute.
+#define PRC_TEXTURE_MAPPING_SPHERICAL_REFLECTION 0x0008 // Spherical reflection texture mapping attribute (used for environment mapping).
+#define PRC_TEXTURE_MAPPING_CUBICAL_REFLECTION 0x0010 // Cubical reflection texture mapping attribute (used for environment mapping).
+#define PRC_TEXTURE_MAPPING_REFRACTION 0x0020 // Refraction texture mapping attribute.
+#define PRC_TEXTURE_MAPPING_SPECULAR 0x0040 // Specular texture mapping attribute.
+#define PRC_TEXTURE_MAPPING_AMBIENT 0x0080 // Ambient texture mapping attribute.
+#define PRC_TEXTURE_MAPPING_EMISSION 0x0100 // Emission texture mapping attribute.
+
+#define PRC_TEXTURE_APPLYING_MODE_NONE 0x00 // let the application choose
+#define PRC_TEXTURE_APPLYING_MODE_LIGHTING 0x01 // use lighting mode
+#define PRC_TEXTURE_APPLYING_MODE_ALPHATEST 0x02 // use alpha test
+#define PRC_TEXTURE_APPLYING_MODE_VERTEXCOLOR 0x04 // combine a texture with one-color-per-vertex mode
+
+#define PRC_TEXTURE_MAPPING_COMPONENTS_RED 0x0001 // Red texture mapping component.
+#define PRC_TEXTURE_MAPPING_COMPONENTS_GREEN 0x0002 // Green texture mapping component.
+#define PRC_TEXTURE_MAPPING_COMPONENTS_BLUE 0x0004 // Blue texture mapping component.
+#define PRC_TEXTURE_MAPPING_COMPONENTS_RGB 0x0007 // RGB texture mapping component.
+#define PRC_TEXTURE_MAPPING_COMPONENTS_ALPHA 0x0008 // Alpha texture mapping component.
+#define PRC_TEXTURE_MAPPING_COMPONENTS_RGBA 0x000F // RGBA texture mapping component.
+
+enum EPRCModellerAttributeType {
+ KEPRCModellerAttributeTypeNull = 0,
+ KEPRCModellerAttributeTypeInt = 1,
+ KEPRCModellerAttributeTypeReal = 2,
+ KEPRCModellerAttributeTypeTime = 3,
+ KEPRCModellerAttributeTypeString = 4
+};
+
+enum EPRCPictureDataFormat {
+ KEPRCPicture_PNG,
+ KEPRCPicture_JPG,
+ KEPRCPicture_BITMAP_RGB_BYTE,
+ KEPRCPicture_BITMAP_RGBA_BYTE,
+ KEPRCPicture_BITMAP_GREY_BYTE,
+ KEPRCPicture_BITMAP_GREYA_BYTE
+};
+
+enum EPRCProductLoadStatus {
+ KEPRCProductLoadStatus_Unknown = 0,
+ KEPRCProductLoadStatus_Error,
+ KEPRCProductLoadStatus_NotLoaded,
+ KEPRCProductLoadStatus_NotLoadable,
+ KEPRCProductLoadStatus_Loaded
+};
+
+enum EPRCExtendType {
+ KEPRCExtendTypeNone = 0, // Discontinuous position.
+ KEPRCExtendTypeExt1 = 2, // Same as EPRCExtendTypeCInfinity.
+ KEPRCExtendTypeExt2 = 4, // Same as EPRCExtendTypeG1R for surface, and EPRCExtendTypeG1 for curve.
+ KEPRCExtendTypeG1 = 6, // Continuous in direction but not magnitude of first derivative.
+ KEPRCExtendTypeG1R = 8, // Surface extended with a ruled surface that connects with G1-continuity.
+ KEPRCExtendTypeG1_G2 = 10, // Extended by reflection, yielding a G2 continuous extension.
+ KEPRCExtendTypeCInfinity = 12 // Unlimited continuity.
+};
+
+enum EPRCKnotType { // Knot vector type
+ KEPRCKnotTypeUniformKnots, // Uniform knot vector.
+ KEPRCKnotTypeUnspecified, // Unspecified knot type.
+ KEPRCKnotTypeQuasiUniformKnots, // Quasi-uniform knot vector.
+ KEPRCKnotTypePiecewiseBezierKnots // Extrema with multiplicities of degree +1.
+}; // Note : this value is currently unused and should be set to KEPRCKnotTypeUnspecified.
+
+
+enum EPRCBSplineSurfaceForm {
+ KEPRCBSplineSurfaceFormPlane, // Planar surface.
+ KEPRCBSplineSurfaceFormCylindrical, // Cylindrical surface.
+ KEPRCBSplineSurfaceFormConical, // Conical surface.
+ KEPRCBSplineSurfaceFormSpherical, // Spherical surface.
+ KEPRCBSplineSurfaceFormRevolution, // Surface of revolution.
+ KEPRCBSplineSurfaceFormRuled, // Ruled surface.
+ KEPRCBSplineSurfaceFormGeneralizedCone, // Cone.
+ KEPRCBSplineSurfaceFormQuadric, // Quadric surface.
+ KEPRCBSplineSurfaceFormLinearExtrusion, // Surface of extrusion.
+ KEPRCBSplineSurfaceFormUnspecified, // Unspecified surface.
+ KEPRCBSplineSurfaceFormPolynomial // Polynomial surface.
+};
+
+enum EPRCBSplineCurveForm { // NURBS curve form
+ KEPRCBSplineCurveFormUnspecified, // Unspecified curve form.
+ KEPRCBSplineCurveFormPolyline, // Polygon.
+ KEPRCBSplineCurveFormCircularArc, // Circle arc.
+ KEPRCBSplineCurveFormEllipticArc, // Elliptical arc.
+ KEPRCBSplineCurveFormParabolicArc, // Parabolic arc.
+ KEPRCBSplineCurveFormHyperbolicArc // Hyperbolic arc.
+}; // Note : this value is currently unused and should be set to KEPRCBSplineCurveFormUnspecified.
+
+enum EPRCTextureMappingType { // Defines how to retrieve mapping coordinates.
+ KEPRCTextureMappingType_Unknown, // Let the application choose.
+ KEPRCTextureMappingType_Stored, // Use the mapping coordinates that are stored on a 3D tessellation object
+ KEPRCTextureMappingType_Parametric, // Retrieve the UV coordinates on the surface as mapping coordinates
+ KEPRCTextureMappingType_Operator // Use the defined Texture mapping operator to calculate mapping coordinates
+};
+
+enum EPRCTextureFunction { // Defines how to paint a texture on the surface being rendered.
+ KEPRCTextureFunction_Unknown, // Let the application choose.
+ KEPRCTextureFunction_Modulate, // Combine lighting with texturing. This is the default value.
+ KEPRCTextureFunction_Replace, // Replace the object color with texture color data.
+ KEPRCTextureFunction_Blend, // Reserved for future use.
+ KEPRCTextureFunction_Decal // Reserved for future use.
+};
+
+enum EPRCTextureMappingOperator { // The operator to use when computing mapping coordinates.
+ KEPRCTextureMappingOperator_Unknown, // Default value
+ KEPRCTextureMappingOperator_Planar, // Reserved for future use
+ KEPRCTextureMappingOperator_Cylindrical, // Reserved for future use
+ KEPRCTextureMappingOperator_Spherical, // Reserved for future use
+ KEPRCTextureMappingOperator_Cubical // Reserved for future use
+};
+
+enum EPRCTextureBlendParameter { // Reserved for future use. Defines how to apply blending.
+ KEPRCTextureBlendParameter_Unknown, // Default value.
+ KEPRCTextureBlendParameter_Zero, // Reserved for future use.
+ KEPRCTextureBlendParameter_One, // Reserved for future use.
+ KEPRCTextureBlendParameter_SrcColor, // Reserved for future use.
+ KEPRCTextureBlendParameter_OneMinusSrcColor, // Reserved for future use.
+ KEPRCTextureBlendParameter_DstColor, // Reserved for future use.
+ KEPRCTextureBlendParameter_OneMinusDstColor, // Reserved for future use.
+ KEPRCTextureBlendParameter_SrcAlpha, // Reserved for future use.
+ KEPRCTextureBlendParameter_OneMinusSrcAlpha, // Reserved for future use.
+ KEPRCTextureBlendParameter_DstAlpha, // Reserved for future use.
+ KEPRCTextureBlendParameter_OneMinusDstAlpha, // Reserved for future use.
+ KEPRCTextureBlendParameter_SrcAlphaSaturate // Reserved for future use.
+};
+
+enum EPRCTextureWrappingMode { // Defines repeating and clamping texture modes.
+ KEPRCTextureWrappingMode_Unknown, // Let the application choose.
+ KEPRCTextureWrappingMode_Repeat, // Display the repeated texture on the surface.
+ KEPRCTextureWrappingMode_ClampToBorder, // Clamp the texture to the border. Display the surface color along the texture limits.
+ KEPRCTextureWrappingMode_Clamp, // Reserved for future use.
+ KEPRCTextureWrappingMode_ClampToEdge, // Reserved for future use.
+ KEPRCTextureWrappingMode_MirroredRepeat // Reserved for future use.
+};
+
+enum EPRCTextureAlphaTest { // Reserved for future use. Defines how to use a texture alpha test.
+ KEPRCTextureAlphaTest_Unknown, // Default value.
+ KEPRCTextureAlphaTest_Never, // Reserved for future use.
+ KEPRCTextureAlphaTest_Less, // Reserved for future use.
+ KEPRCTextureAlphaTest_Equal, // Reserved for future use.
+ KEPRCTextureAlphaTest_Lequal, // Reserved for future use.
+ KEPRCTextureAlphaTest_Greater, // Reserved for future use.
+ KEPRCTextureAlphaTest_Notequal, // Reserved for future use.
+ KEPRCTextureAlphaTest_Gequal, // Reserved for future use.
+ KEPRCTextureAlphaTest_Always // Reserved for future use.
+};
+
+
+// Bit field for graphics behavior
+#define PRC_GRAPHICS_Show 0x0001 // The entity is shown.
+#define PRC_GRAPHICS_SonHeritShow 0x0002 // Shown entity son inheritance.
+#define PRC_GRAPHICS_FatherHeritShow 0x0004 // Shown entity father inheritance.
+#define PRC_GRAPHICS_SonHeritColor 0x0008 // Color/material son inheritance.
+#define PRC_GRAPHICS_FatherHeritColor 0x0010 // Color/material father inheritance.
+#define PRC_GRAPHICS_SonHeritLayer 0x0020 // Layer son inheritance.
+#define PRC_GRAPHICS_FatherHeritLayer 0x0040 // Layer father inheritance.
+#define PRC_GRAPHICS_SonHeritTransparency 0x0080 // Transparency son inheritance.
+#define PRC_GRAPHICS_FatherHeritTransparency 0x0100 // Transparency father inheritance.
+#define PRC_GRAPHICS_SonHeritLinePattern 0x0200 // Line pattern son inheritance.
+#define PRC_GRAPHICS_FatherHeritLinePattern 0x0400 // Line pattern father inheritance.
+#define PRC_GRAPHICS_SonHeritLineWidth 0x0800 // Line width son inheritance.
+#define PRC_GRAPHICS_FatherHeritLineWidth 0x1000 // Line width father inheritance.
+#define PRC_GRAPHICS_Removed 0x2000 // The entity has been removed and no longer appears in the tree.
+
+enum EPRCMarkupType {
+ KEPRCMarkupType_Unknown = 0,
+ KEPRCMarkupType_Text,
+ KEPRCMarkupType_Dimension,
+ KEPRCMarkupType_Arrow,
+ KEPRCMarkupType_Balloon,
+ KEPRCMarkupType_CircleCenter,
+ KEPRCMarkupType_Coordinate,
+ KEPRCMarkupType_Datum,
+ KEPRCMarkupType_Fastener,
+ KEPRCMarkupType_Gdt,
+ KEPRCMarkupType_Locator,
+ KEPRCMarkupType_MeasurementPoint,
+ KEPRCMarkupType_Roughness,
+ KEPRCMarkupType_Welding,
+ KEPRCMarkupType_Table,
+ KEPRCMarkupType_Other
+};
+
+enum EPRCMarkupSubType {
+ KEPRCMarkupSubType_Unknown = 0,
+ KEPRCMarkupSubType_EnumMax,
+
+ KEPRCMarkupSubType_Datum_Ident = 1 ,
+ KEPRCMarkupSubType_Datum_EnumMax,
+
+ KEPRCMarkupSubType_Dimension_Distance = 1,
+ KEPRCMarkupSubType_Dimension_Radius_Tangent,
+ KEPRCMarkupSubType_Dimension_Radius_Cylinder,
+ KEPRCMarkupSubType_Dimension_Radius_Edge,
+ KEPRCMarkupSubType_Dimension_Diameter,
+ KEPRCMarkupSubType_Dimension_Diameter_Tangent,
+ KEPRCMarkupSubType_Dimension_Diameter_Cylinder,
+ KEPRCMarkupSubType_Dimension_Diameter_Edge,
+ KEPRCMarkupSubType_Dimension_Diameter_Cone,
+ KEPRCMarkupSubType_Dimension_Length,
+ KEPRCMarkupSubType_Dimension_Length_Curvilinear,
+ KEPRCMarkupSubType_Dimension_Length_Circular,
+ KEPRCMarkupSubType_Dimension_Angle,
+ KEPRCMarkupSubType_Dimension_EnumMax,
+
+ KEPRCMarkupSubType_Gdt_Fcf = 1,
+ KEPRCMarkupSubType_Gdt_EnumMax,
+
+ KEPRCMarkupSubType_Welding_Line = 1,
+ KEPRCMarkupSubType_Welding_EnumMax,
+
+ KEPRCMarkupSubType_Other_Symbol_User = 1,
+ KEPRCMarkupSubType_Other_EnumMax
+};
+
+#define PRC_MARKUP_IsHidden 0x01 // The tessellation is hidden.
+#define PRC_MARKUP_HasFrame 0x02 // The tessellation has a frame.
+#define PRC_MARKUP_IsNotModifiable 0x04 // The tessellation is given and should not be modified.
+#define PRC_MARKUP_IsZoomable 0x08 // The tessellation has zoom capability.
+#define PRC_MARKUP_IsOnTop 0x10 // The tessellation is on top of the geometry.
+#define PRC_MARKUP_IsFlipable 0x20 // The text tessellation can be flipped to always be readable on screen. This value is currently unused.
+
+#define PRC_RENDERING_PARAMETER_SPECIAL_CULLING 0x0001 // special culling strategy to apply
+#define PRC_RENDERING_PARAMETER_FRONT_CULLING 0x0002 // apply front culling (ignored if no special culling strategy)
+#define PRC_RENDERING_PARAMETER_BACK_CULLING 0x0004 // apply back culling (ignored if no special culling strategy)
+#define PRC_RENDERING_PARAMETER_NO_LIGHT 0x0008 // if set, no light will apply on corresponding object
+
+#define PRC_MARKUP_IsMatrix 0x08000000 // Bit to denote that the current entity is a matrix.
+#define PRC_MARKUP_IsExtraData 0x04000000 // Bit to denote that the current entity is extra data (it is neither a matrix nor a polyline).
+#define PRC_MARKUP_IntegerMask 0xFFFFF // Integer mask to retrieve sizes.
+#define PRC_MARKUP_ExtraDataType 0x3E00000 // Mask to retrieve the integer type of the entity.
+
+#define PRC_MARKUP_ExtraDataType_Pattern (( 0<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_Picture (( 1<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_Triangles (( 2<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_Quads (( 3<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_FaceViewMode (( 6<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_FrameDrawMode (( 7<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_FixedSizeMode (( 8<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_Symbol (( 9<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_Cylinder ((10<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_Color ((11<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_LineStipple ((12<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_Font ((13<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_Text ((14<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_Points ((15<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_Polygon ((16<<21)|PRC_MARKUP_IsExtraData)
+#define PRC_MARKUP_ExtraDataType_LineWidth ((17<<21)|PRC_MARKUP_IsExtraData)
+
+enum EPRCCharSet
+{
+ KEPRCCharsetUnknown = -1,
+ KEPRCCharsetRoman = 0,
+ KEPRCCharsetJapanese,
+ KEPRCCharsetTraditionalChinese,
+ KEPRCCharsetKorean,
+ KEPRCCharsetArabic,
+ KEPRCCharsetHebrew,
+ KEPRCCharsetGreek,
+ KEPRCCharsetCyrillic,
+ KEPRCCharsetRightLeft,
+ KEPRCCharsetDevanagari,
+ KEPRCCharsetGurmukhi,
+ KEPRCCharsetGujarati,
+ KEPRCCharsetOriya,
+ KEPRCCharsetBengali,
+ KEPRCCharsetTamil,
+ KEPRCCharsetTelugu,
+ KEPRCCharsetKannada,
+ KEPRCCharsetMalayalam,
+ KEPRCCharsetSinhalese,
+ KEPRCCharsetBurmese,
+ KEPRCCharsetKhmer,
+ KEPRCCharsetThai,
+ KEPRCCharsetLaotian,
+ KEPRCCharsetGeorgian,
+ KEPRCCharsetArmenian,
+ KEPRCCharsetSimplifiedChinese,
+ KEPRCCharsetTibetan,
+ KEPRCCharsetMongolian,
+ KEPRCCharsetGeez,
+ KEPRCCharsetEastEuropeanRoman,
+ KEPRCCharsetVietnamese,
+ KEPRCCharsetExtendedArabic
+};
+
+#define PRC_Font_Bold 0x02 /*!< Bold. */
+#define PRC_Font_Italic 0x04 /*!< Italic. */
+#define PRC_Font_Underlined 0x08 /*!< Underlined. */
+#define PRC_Font_StrikedOut 0x10 /*!< Striked-out. */
+#define PRC_Font_Overlined 0x20 /*!< Overlined. */
+#define PRC_Font_Streched 0x40 /*!< Streched. In case the font used is not the original font, it indicates that the text needs to be stretched to fit its bounding box. */
+#define PRC_Font_Wired 0x80 /*!< Wired. Indicates that the original font is a wirefame font. */
+#define PRC_Font_FixedWidth 0x100 /*!< Fixed width. Indicates that the original font is not proportional (each glyph has the same width). */
+
+#define PRC_CONTEXT_OuterLoopFirst 0x0001 // Outer loops are always first loops (specific to PRC_TYPE_TOPO_BrepData).
+#define PRC_CONTEXT_NoClamp 0x0002 // UV curves are clamped on the surface (specific to PRC_TYPE_TOPO_BrepData).
+#define PRC_CONTEXT_NoSplit 0x0004 // Faces are split (specific to PRC_TYPE_TOPO_BrepData).
+
+#define PRC_BODY_BBOX_Evaluation 0x0001 // Bounding box based on geometry.
+#define PRC_BODY_BBOX_Precise 0x0002 // Bounding box based on tessellation.
+#define PRC_BODY_BBOX_CADData 0x0003 // Bounding box given by a CAD data file.
+
+#endif // __PRC_H
diff --git a/graphics/asymptote/prc/PRCTools/Makefile b/graphics/asymptote/prc/PRCTools/Makefile
new file mode 100644
index 0000000000..51186e7e76
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/Makefile
@@ -0,0 +1,48 @@
+CFLAGS = -O3 -Wall
+CXX = g++
+
+makePRC: PRCbitStream oPRCFile PRCdouble writePRC makePRC.cc
+ $(CXX) $(CFLAGS) -o makePRC PRCbitStream.o oPRCFile.o PRCdouble.o writePRC.o makePRC.cc -lz
+
+describePRC: bitData inflation PRCdouble iPRCFile describePRC.cc describeMain.cc
+ $(CXX) $(CFLAGS) -o describePRC bitData.o inflation.o PRCdouble.o iPRCFile.o describePRC.cc describeMain.cc -lz
+
+bitSearchUI: bitSearchUI.cc bitData PRCdouble
+ $(CXX) $(CFLAGS) -o bitSearchUI bitData.o PRCdouble.o bitSearchUI.cc
+
+bitSearchDouble: bitSearchDouble.cc bitData PRCdouble
+ $(CXX) $(CFLAGS) -o bitSearchDouble bitData.o PRCdouble.o bitSearchDouble.cc
+
+extractSections: extractSections.cc iPRCFile inflation bitData PRCdouble
+ $(CXX) $(CFLAGS) -o extractSections iPRCFile.o inflation.o bitData.o PRCdouble.o describePRC.cc extractSections.cc -lz
+
+inflateTest: inflation inflationMain.cc
+ $(CXX) $(CFLAGS) -o inflateTest inflation.o inflationMain.cc -lz
+
+PRCdouble: ../PRCdouble.cc
+ $(CXX) $(CFLAGS) -c ../PRCdouble.cc -o PRCdouble.o
+
+PRCbitStream: ../PRCbitStream.cc
+ $(CXX) $(CFLAGS) -c ../PRCbitStream.cc -o PRCbitStream.o
+
+oPRCFile: ../oPRCFile.cc
+ $(CXX) $(CFLAGS) -c ../oPRCFile.cc -o oPRCFile.o
+
+writePRC: ../writePRC.cc PRCbitStream
+ $(CXX) $(CFLAGS) -c ../writePRC.cc -o writePRC.o
+
+bitData: bitData.cc
+ $(CXX) $(CFLAGS) -c bitData.cc -o bitData.o
+
+inflation: inflation.cc
+ $(CXX) $(CFLAGS) -c inflation.cc -o inflation.o
+
+iPRCFile: iPRCFile.cc
+ $(CXX) $(CFLAGS) -c iPRCFile.cc -o iPRCFile.o
+
+all: makePRC describePRC bitSearchUI bitSearchDouble extractSections inflateTest
+
+tools: all
+
+clean:
+ rm -f *.o describePRC bitSearchUI bitSearchDouble extractSections inflateTest
diff --git a/graphics/asymptote/prc/PRCTools/bitData.cc b/graphics/asymptote/prc/PRCTools/bitData.cc
new file mode 100644
index 0000000000..9fba0eb0b1
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/bitData.cc
@@ -0,0 +1,258 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include "../PRC.h"
+#include "../PRCdouble.h"
+#include "bitData.h"
+
+using std::cout; using std::endl; using std::hex; using std::cerr;
+
+BitPosition BitByBitData::getPosition()
+{
+ BitPosition bp;
+ bp.byteIndex = data - start;
+ bp.bitIndex = 0;
+ for(unsigned char temp = bitMask<<1; temp != 0; temp <<= 1)
+ bp.bitIndex++;
+ return bp;
+}
+
+void BitByBitData::setPosition(const BitPosition& bp)
+{
+ if(bp.byteIndex < length)
+ {
+ data = start + bp.byteIndex;
+ bitMask = 0x80 >> bp.bitIndex;
+ // big-endian, zero based bit index (from 0 to 7)
+ // so 0x80 => bit 0, 0x01 => bit 7
+ // Why? It is easy to see in a hex editor.
+ failed = false;
+ }
+ else
+ {
+ failed = true;
+ }
+}
+
+void BitByBitData::setPosition(unsigned int byte, unsigned int bit)
+{
+ if(byte <= length)
+ {
+ data = start + byte;
+ bitMask = 0x80 >> bit;
+ // big-endian, zero based bit index (from 0 to 7)
+ // so 0x80 => bit 0, 0x01 => bit 7
+ // Why? It is easy to see in a hex editor.
+ failed = false;
+ }
+ else
+ {
+ failed = true;
+ }
+}
+
+void BitByBitData::setShowBits(bool val)
+{
+ showBits = val;
+}
+
+void BitByBitData::tellPosition()
+{
+ BitPosition bp = getPosition();
+ cout << bp.byteIndex << ':' << bp.bitIndex << endl;
+}
+
+bool BitByBitData::readBit()
+{
+ if(!failed)
+ {
+ bool val = *data & bitMask;
+ if(showBits) cout << (val?'1':'0');
+ nextBit();
+ return val;
+ }
+ else
+ return false;
+}
+
+unsigned char BitByBitData::readChar()
+{
+ unsigned char dat = 0;
+ dat |= readBit();
+ for(int a = 0; a < 7; ++a)
+ {
+ dat <<= 1;
+ dat |= readBit();
+ }
+ return dat;
+}
+
+unsigned int BitByBitData::readUnsignedInt()
+{
+ unsigned int result = 0;
+ unsigned int count = 0;
+ while(readBit())
+ {
+ result |= (static_cast<unsigned int>(readChar()) << 8*count++);
+ }
+ if(showBits) cout << " " << result << endl;
+ return result;
+}
+
+std::string BitByBitData::readString()
+{
+ bool isNotNull = readBit();
+ std::string result;
+ if(isNotNull)
+ {
+ unsigned int stringLength = readUnsignedInt();
+ char *buf = new char[stringLength+1];
+ buf[stringLength] = '\0';
+ for(unsigned int a = 0; a < stringLength; ++a)
+ {
+ buf[a] = readChar();
+ }
+ result = buf;
+ delete[] buf;
+ }
+ if(showBits) cout << " " << result << endl;
+ return result;
+}
+
+int BitByBitData::readInt()
+{
+ int result = 0;
+ unsigned int count = 0;
+ while(readBit())
+ {
+ result |= (static_cast<unsigned int>(readChar()) << 8*count++);
+ }
+ result <<= (4-count)*8;
+ result >>= (4-count)*8;
+ if(showBits) cout << " " << result << endl;
+ return result;
+}
+
+
+// Thanks to Michail Vidiassov
+double BitByBitData::readDouble()
+{
+ ieee754_double value;
+ value.d = 0;
+ sCodageOfFrequentDoubleOrExponent *pcofdoe;
+ unsigned int ucofdoe = 0;
+ for(int i = 1; i <= 22; ++i)
+ {
+ ucofdoe <<= 1;
+ ucofdoe |= readBit();
+ if((pcofdoe = getcofdoe(ucofdoe,i)) != NULL)
+ break;
+ }
+ value.d = pcofdoe->u2uod.Value;
+
+ // check if zero
+ if(pcofdoe->NumberOfBits==2 && pcofdoe->Bits==1 && pcofdoe->Type==VT_double)
+ return value.d;
+
+ value.ieee.negative = readBit(); // get sign
+
+ if(pcofdoe->Type == VT_double) // double from list
+ return value.d;
+
+ if(readBit()==0) // no mantissa
+ return value.d;
+
+ // read the mantissa
+ // read uppermost 4 bits of mantissa
+ unsigned char b4 = 0;
+ for(int i = 0; i < 4; ++i)
+ {
+ b4 <<= 1;
+ b4 |= readBit();
+ }
+
+#ifdef WORDS_BIGENDIAN
+ *(reinterpret_cast<unsigned char*>(&value)+1) |= b4;
+ unsigned char *lastByte = reinterpret_cast<unsigned char*>(&value)+7;
+ unsigned char *currentByte = reinterpret_cast<unsigned char*>(&value)+2;
+#else
+ *(reinterpret_cast<unsigned char*>(&value)+6) |= b4;
+ unsigned char *lastByte = reinterpret_cast<unsigned char*>(&value)+0;
+ unsigned char *currentByte = reinterpret_cast<unsigned char*>(&value)+5;
+#endif
+
+ for(;MOREBYTE(currentByte,lastByte); NEXTBYTE(currentByte))
+ {
+ if(readBit())
+ {
+ // new byte
+ *currentByte = readChar();
+ }
+ else
+ {
+ // get 3 bit offset
+ unsigned int offset = 0;
+ offset |= (readBit() << 2);
+ offset |= (readBit() << 1);
+ offset |= readBit();
+ if(offset == 0)
+ {
+ // fill remaining bytes in mantissa with previous byte
+ unsigned char pByte = BYTEAT(currentByte,1);
+ for(;MOREBYTE(currentByte,lastByte); NEXTBYTE(currentByte))
+ *currentByte = pByte;
+ break;
+ }
+ else if(offset == 6)
+ {
+ // fill remaining bytes except last byte with previous byte
+ unsigned char pByte = BYTEAT(currentByte,1);
+ PREVIOUSBYTE(lastByte);
+ for(;MOREBYTE(currentByte,lastByte); NEXTBYTE(currentByte))
+ *currentByte = pByte;
+ *currentByte = readChar();
+ break;
+ }
+ else
+ {
+ // one repeated byte
+ *currentByte = BYTEAT(currentByte,offset);
+ }
+ }
+ }
+ if(showBits) cout << " " << value.d << endl;
+ return value.d;
+}
+
+void BitByBitData::nextBit()
+{
+ bitMask >>= 1;
+ if(bitMask == 0)
+ {
+ if(data < start+length)
+ data++;
+ else
+ {
+ failed = true;
+ cout << "End of data."<< endl;
+ }
+ bitMask = 0x80;
+ }
+}
diff --git a/graphics/asymptote/prc/PRCTools/bitData.h b/graphics/asymptote/prc/PRCTools/bitData.h
new file mode 100644
index 0000000000..44a4fbe816
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/bitData.h
@@ -0,0 +1,62 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#ifndef __BITDATA_H
+#define __BITDATA_H
+
+#include <iostream>
+#include <string>
+
+struct BitPosition
+{
+ unsigned int byteIndex;
+ unsigned int bitIndex;
+};
+
+class BitByBitData
+{
+ public:
+ BitByBitData(char* s,unsigned int l) : start(s),data(s),length(l),
+ bitMask(0x80),showBits(false),failed(false) {}
+
+ void tellPosition();
+ BitPosition getPosition();
+ void setPosition(const BitPosition&);
+ void setPosition(unsigned int,unsigned int);
+ void setShowBits(bool);
+ bool readBit();
+ unsigned char readChar();
+
+ unsigned int readUnsignedInt();
+ std::string readString();
+ int readInt();
+ double readDouble();
+
+ private:
+ char *start; // first byte so we know where we are
+ char *data; // last byte read
+ unsigned int length;
+ unsigned char bitMask; // mask to read next bit of current byte
+ bool showBits; // show each bit read?
+ bool failed;
+ void nextBit(); // shift bit mask and get next byte if needed
+};
+
+#endif // __BITDATA_H
diff --git a/graphics/asymptote/prc/PRCTools/bitSearchDouble.cc b/graphics/asymptote/prc/PRCTools/bitSearchDouble.cc
new file mode 100644
index 0000000000..5fd70cb9aa
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/bitSearchDouble.cc
@@ -0,0 +1,67 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include <iostream>
+#include <fstream>
+#include <iomanip>
+#include "bitData.h"
+
+using namespace std;
+
+int main(int argc, char *argv[])
+{
+ if(argc < 2)
+ {
+ cerr << "Error: Input file not specified." << endl;
+ return 1;
+ }
+ ifstream inFile(argv[1]);
+ if(!inFile)
+ {
+ cerr << "Error: Cannot open input file." << endl;
+ return 1;
+ }
+ inFile.seekg(0,ios::end);
+ unsigned int length = inFile.tellg();
+ inFile.seekg(0,ios::beg);
+
+ char *buf = new char[length];
+
+ inFile.read(buf,length);
+ BitByBitData bbbd(buf,length);
+
+ double dsf;
+ cout << "double to search for: "; cin >> dsf;
+ BitPosition currP;
+ for(currP.byteIndex = 0; currP.byteIndex < length; ++currP.byteIndex)
+ for(currP.bitIndex = 0; currP.bitIndex < 8; ++currP.bitIndex)
+ {
+ bbbd.setPosition(currP);
+ if(bbbd.readDouble() == dsf)
+ {
+ BitPosition bp = bbbd.getPosition();
+ cout << "Found " << dsf << " at " << currP.byteIndex << ':'
+ << currP.bitIndex << " to " << bp.byteIndex << ':' << bp.bitIndex
+ << endl;
+ }
+ }
+ delete[] buf;
+ return 0;
+}
diff --git a/graphics/asymptote/prc/PRCTools/bitSearchUI.cc b/graphics/asymptote/prc/PRCTools/bitSearchUI.cc
new file mode 100644
index 0000000000..034143a1ae
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/bitSearchUI.cc
@@ -0,0 +1,65 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include <iostream>
+#include <fstream>
+#include <iomanip>
+#include "bitData.h"
+
+using namespace std;
+
+int main(int argc, char *argv[])
+{
+ if(argc < 2)
+ {
+ cerr << "Error: Input file not specified." << endl;
+ return 1;
+ }
+ ifstream inFile(argv[1]);
+ if(!inFile)
+ {
+ cerr << "Error: Cannot open input file." << endl;
+ return 1;
+ }
+ inFile.seekg(0,ios::end);
+ unsigned int length = inFile.tellg();
+ inFile.seekg(0,ios::beg);
+
+ char *buf = new char[length];
+
+ inFile.read(buf,length);
+ BitByBitData bbbd(buf,length);
+
+ unsigned int uisf;
+ cout << "Unsigned int to search for: "; cin >> uisf;
+ BitPosition currP;
+ for(currP.byteIndex = 0; currP.byteIndex < length; ++currP.byteIndex)
+ for(currP.bitIndex = 0; currP.bitIndex < 8; ++currP.bitIndex)
+ {
+ bbbd.setPosition(currP);
+ if(bbbd.readUnsignedInt() == uisf)
+ {
+ cout << "Found " << uisf << " at " << currP.byteIndex << ':'
+ << currP.bitIndex << endl;
+ }
+ }
+ delete[] buf;
+ return 0;
+}
diff --git a/graphics/asymptote/prc/PRCTools/describeMain.cc b/graphics/asymptote/prc/PRCTools/describeMain.cc
new file mode 100644
index 0000000000..329e26fe40
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/describeMain.cc
@@ -0,0 +1,45 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include <iostream>
+#include <fstream>
+#include "iPRCFile.h"
+
+using namespace std;
+
+int main(int argc, char* argv[])
+{
+ if(argc < 2)
+ {
+ cerr << "Error: Input file not specified." << endl;
+ return 1;
+ }
+ ifstream inFile(argv[1]);
+ if(!inFile)
+ {
+ cerr << "Error: Cannot open input file." << endl;
+ return 1;
+ }
+
+ iPRCFile myFile(inFile);
+ myFile.describe();
+
+ return 0;
+}
diff --git a/graphics/asymptote/prc/PRCTools/describePRC.cc b/graphics/asymptote/prc/PRCTools/describePRC.cc
new file mode 100644
index 0000000000..1efedecb72
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/describePRC.cc
@@ -0,0 +1,2272 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include <iostream>
+#include <fstream>
+#include <iomanip>
+#include <string>
+#include <sstream>
+
+#include "../PRC.h"
+#include "describePRC.h"
+
+using std::ostringstream; using std::cout; using std::endl;
+using std::hex; using std::dec; using std::string; using std::setw;
+using std::setfill;
+
+// describe sections
+
+void describeGlobals(BitByBitData &mData)
+{
+ mData.tellPosition();
+ cout << getIndent() << "--Globals--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_ASM_FileStructureGlobals))
+ return;
+ indent();
+
+ describeContentPRCBase(mData,false);
+ unsigned int numberOfReferencedFileStructures = mData.readUnsignedInt();
+ cout << getIndent() << "numberOfReferencedFileStructures "
+ << numberOfReferencedFileStructures << endl;
+ indent();
+ for(unsigned int i = 0; i < numberOfReferencedFileStructures; ++i)
+ {
+ describeCompressedUniqueID(mData);
+ }
+ dedent();
+
+ double tessellation_chord_height_ratio = mData.readDouble();
+ cout << getIndent() << "tessellation_chord_height_ratio "
+ << tessellation_chord_height_ratio << endl;
+
+ double tessellation_angle_degree = mData.readDouble();
+ cout << getIndent() << "tessellation_angle_degree "
+ << tessellation_angle_degree << endl;
+
+ string default_font_family_name = mData.readString();
+ cout << getIndent() << "default_font_family_name \""
+ << default_font_family_name << '\"' << endl;
+
+ unsigned int number_of_fonts = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_fonts " << number_of_fonts << endl;
+
+ indent();
+ for(unsigned int q = 0; q < number_of_fonts; ++q)
+ {
+ string font_name = mData.readString();
+ cout << getIndent() << "font_name \"" << font_name << '\"' << endl;
+ unsigned int char_set = mData.readUnsignedInt();
+ cout << getIndent() << "char_set " << char_set << endl;
+ unsigned int number_of_font_keys = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_font_keys " << number_of_font_keys
+ << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_font_keys; i++)
+ {
+ unsigned int font_size = mData.readUnsignedInt() - 1;
+ cout << getIndent() << "font_size " << font_size << endl;
+ unsigned char attributes = mData.readChar();
+ cout << getIndent() << "attributes "
+ << static_cast<unsigned int>(attributes) << endl;
+ }
+ dedent();
+ }
+ dedent();
+
+ unsigned int number_of_colours = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_colours " << number_of_colours << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_colours; ++i)
+ describeRGBColour(mData);
+ dedent();
+
+ unsigned int number_of_pictures = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_pictures " << number_of_pictures << endl;
+ indent();
+ for(unsigned int i=0;i<number_of_pictures;i++)
+ describePicture(mData);
+ dedent();
+
+ unsigned int number_of_texture_definitions = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_texture_definitions "
+ << number_of_texture_definitions << endl;
+ indent();
+ for(unsigned int i=0;i<number_of_texture_definitions;i++)
+ describeTextureDefinition(mData);
+ dedent();
+
+
+ unsigned int number_of_materials = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_materials " << number_of_materials << endl;
+ indent();
+ for(unsigned int i=0;i<number_of_materials;i++)
+ describeMaterial(mData);
+ dedent();
+
+ unsigned int number_of_line_patterns = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_line_patterns "
+ << number_of_line_patterns << endl;
+ indent();
+ for(unsigned int i=0;i<number_of_line_patterns;i++)
+ describeLinePattern(mData);
+ dedent();
+
+ unsigned int number_of_styles = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_styles " << number_of_styles << endl;
+ indent();
+ for(unsigned int i=0;i<number_of_styles;i++)
+ describeCategory1LineStyle(mData);
+ dedent();
+
+ unsigned int number_of_fill_patterns = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_fill_patterns "
+ << number_of_fill_patterns << endl;
+ indent();
+ for(unsigned int i=0;i<number_of_fill_patterns;i++)
+ describeFillPattern(mData);
+ dedent();
+
+ unsigned int number_of_reference_coordinate_systems = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_reference_coordinate_systems "
+ << number_of_reference_coordinate_systems << endl;
+ indent();
+ for(unsigned int i=0;i<number_of_reference_coordinate_systems;i++)
+ //NOTE: must be PRC_TYPE_RI_CoordinateSystem
+ describeRepresentationItem(mData);
+ dedent();
+
+ describeUserData(mData);
+ dedent();
+ mData.tellPosition();
+}
+
+void describeTree(BitByBitData &mData)
+{
+ mData.tellPosition();
+ cout << getIndent() << "--Tree--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_ASM_FileStructureTree))
+ return;
+ indent();
+ describeContentPRCBase(mData,false);
+
+ unsigned int number_of_part_definitions = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_part_definitions "
+ << number_of_part_definitions << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_part_definitions; ++i)
+ {
+ describePartDefinition(mData);
+ }
+ dedent();
+
+ unsigned int number_of_product_occurrences = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_product_occurrences "
+ << number_of_product_occurrences << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_product_occurrences; ++i)
+ {
+ describeProductOccurrence(mData);
+ }
+ dedent();
+
+ describeFileStructureInternalData(mData);
+
+ describeUserData(mData);
+ dedent();
+ mData.tellPosition();
+}
+
+void describeTessellation(BitByBitData &mData)
+{
+ mData.tellPosition();
+ cout << getIndent() << "--Tessellation--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_ASM_FileStructureTessellation))
+ return;
+ indent();
+
+ describeContentPRCBase(mData,false);
+
+ unsigned int number_of_tessellations = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_tessellations "
+ << number_of_tessellations << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_tessellations; ++i)
+ {
+ unsigned int type = mData.readUnsignedInt();
+ cout << getIndent() << "tessellation type " << type << endl;
+ switch(type)
+ {
+ case PRC_TYPE_TESS_3D:
+ describe3DTess(mData);
+ break;
+ case PRC_TYPE_TESS_3D_Wire:
+ describe3DWireTess(mData);
+ break;
+ case PRC_TYPE_TESS_Markup:
+ describe3DMarkupTess(mData);
+ break;
+ case PRC_TYPE_TESS_3D_Compressed:
+ describeHighlyCompressed3DTess(mData);
+ break;
+ default:
+ cout << getIndent() << "Unrecognized tessellation data type "
+ << type << endl;
+ break;
+ }
+ }
+ dedent();
+
+ describeUserData(mData);
+
+ dedent();
+ mData.tellPosition();
+}
+
+void describeGeometry(BitByBitData &mData)
+{
+ mData.tellPosition();
+ cout << getIndent() << "--Geometry--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_ASM_FileStructureGeometry))
+ return;
+ indent();
+
+ describeContentPRCBase(mData,false);
+
+ unsigned int number_of_topological_contexts = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_topological_contexts "
+ << number_of_topological_contexts << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_topological_contexts; ++i)
+ {
+ describeTopoContext(mData);
+ unsigned int number_of_bodies = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_bodies " << number_of_bodies << endl;
+ for(unsigned int i = 0; i < number_of_bodies; ++i)
+ {
+ describeBody(mData);
+ }
+ }
+ dedent();
+
+ describeUserData(mData);
+ dedent();
+ mData.tellPosition();
+}
+
+void describeExtraGeometry(BitByBitData &mData)
+{
+ mData.tellPosition();
+ cout << getIndent() << "--Extra Geometry--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_ASM_FileStructureExtraGeometry))
+ return;
+ indent();
+
+ describeContentPRCBase(mData,false);
+
+ unsigned int number_of_contexts = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_contexts " << number_of_contexts << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_contexts; ++i)
+ {
+ // geometry summary
+ unsigned int number_of_bodies = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_bodies " << number_of_bodies << endl;
+ indent();
+ for(unsigned int j = 0; j < number_of_bodies; ++j)
+ {
+ unsigned int serial_type = mData.readUnsignedInt();
+ cout << getIndent() << "serial_type " << serial_type << endl;
+ indent();
+ if(isCompressedSerialType(serial_type))
+ cout << getIndent() << "serialTolerance " << mData.readDouble();
+ dedent();
+ }
+ dedent();
+ // context graphics
+ resetCurrentGraphics();
+ unsigned int number_of_treat_types = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_treat_types "
+ << number_of_treat_types << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_treat_types; ++i)
+ {
+ cout << getIndent() << "element_type " << mData.readUnsignedInt() << endl;
+ unsigned int number_of_elements = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_elements "
+ << number_of_elements << endl;
+ indent();
+ for(unsigned int j = 0; j < number_of_elements; ++j)
+ {
+ if(mData.readBit())
+ {
+ describeGraphics(mData);
+ }
+ else
+ {
+ cout << getIndent() << "Element has no graphics" << endl;
+ }
+ }
+ dedent();
+ }
+ dedent();
+ }
+ dedent();
+
+ describeUserData(mData);
+ dedent();
+ mData.tellPosition();
+}
+
+
+void describeModelFileData(BitByBitData &mData,
+ unsigned int numberOfFileStructures)
+{
+ mData.tellPosition();
+ cout << getIndent() << "--Model File--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_ASM_ModelFile))
+ return;
+ indent();
+
+ describeContentPRCBase(mData,false);
+
+ describeUnit(mData);
+ unsigned int numberOfProductOccurrences = mData.readUnsignedInt();
+ cout << getIndent() << "Number of Product Occurrences "
+ << numberOfProductOccurrences << endl;
+ indent();
+ for(unsigned int i = 0; i < numberOfProductOccurrences; ++i)
+ {
+ describeCompressedUniqueID(mData);
+ cout << getIndent() << "index_position + 1 = "
+ << mData.readUnsignedInt() << endl;
+ cout << getIndent() << "active? " << (mData.readBit()?"yes":"no")
+ << endl << endl;
+ }
+ dedent();
+ for(unsigned int i = 0; i < numberOfFileStructures; ++i)
+ {
+ cout << getIndent() << "File Structure Index in Model File "
+ << mData.readUnsignedInt() << endl;
+ }
+
+ describeUserData(mData);
+ dedent();
+ mData.tellPosition();
+}
+
+// subsections
+// void describe(BitByBitData &mData)
+// {
+//
+// }
+
+void describeLight(BitByBitData &mData)
+{
+ unsigned int ID = mData.readUnsignedInt();
+ if(ID == PRC_TYPE_GRAPH_AmbientLight)
+ cout << getIndent() << "--Ambient Light--" << endl;
+ else
+ return;
+
+ indent();
+
+ describeContentPRCBase(mData,true);
+
+ cout << getIndent() << "ambient colour index: " << mData.readUnsignedInt()-1 << endl
+ << getIndent() << "diffuse colour index: " << mData.readUnsignedInt()-1 << endl
+ << getIndent() << "specular colour index: " << mData.readUnsignedInt()-1 << endl;
+
+ describeUserData(mData);
+ describeUserData(mData); // why?
+ dedent();
+}
+
+void describeCamera(BitByBitData &mData)
+{
+ cout << getIndent() << "--Camera--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_GRAPH_Camera))
+ return;
+ indent();
+
+ describeContentPRCBase(mData,true);
+
+ cout << getIndent() << (mData.readBit()?"orthographic":"perspective") << endl;
+ cout << getIndent() << "Camera Position" << endl;
+ describeVector3d(mData);
+ cout << getIndent() << "Look At Point" << endl;
+ describeVector3d(mData);
+ cout << getIndent() << "Up" << endl;
+ describeVector3d(mData);
+ cout << getIndent() << "X field of view angle (perspective) || X scale (orthographic) "
+ << mData.readDouble() << endl;
+ cout << getIndent() << "Y field of view angle (perspective) || Y scale (orthographic) "
+ << mData.readDouble() << endl;
+ cout << getIndent() << "aspect ratio x/y " << mData.readDouble() << endl;
+ cout << getIndent() << "near z clipping plane distance from viewer " << mData.readDouble() << endl;
+ cout << getIndent() << "far z clipping plane distance from viewer " << mData.readDouble() << endl;
+ cout << getIndent() << "zoom factor " << mData.readDouble() << endl;
+ dedent();
+}
+
+bool describeContentCurve(BitByBitData &mData)
+{
+ describeBaseGeometry(mData);
+ cout << getIndent() << "extend_info " << mData.readUnsignedInt() << endl;
+ bool is_3d = mData.readBit();
+ cout << getIndent() << "is_3d " << (is_3d?"yes":"no") << endl;
+ return is_3d;
+}
+
+void describeParameterization(BitByBitData &mData)
+{
+ cout << getIndent() << "--Parameterization--" << endl;
+ indent();
+ describeExtent1d(mData);
+ cout << getIndent() << "parameterization_coeff_a " << mData.readDouble()
+ << endl;
+ cout << getIndent() << "parameterization_coeff_b " << mData.readDouble()
+ << endl;
+ dedent();
+}
+
+void describeCurvCircle(BitByBitData &mData)
+{
+ cout << getIndent() << "--Circle--" << endl;
+ indent();
+
+ if(describeContentCurve(mData))
+ describeTransformation3d(mData);
+ else
+ describeTransformation2d(mData);
+
+ describeParameterization(mData);
+
+ cout << getIndent() << "radius " << mData.readDouble() << endl;
+
+ dedent();
+}
+
+void describeCurvLine(BitByBitData &mData)
+{
+ cout << getIndent() << "--Line--" << endl;
+ indent();
+
+ if(describeContentCurve(mData))
+ describeTransformation3d(mData);
+ else
+ describeTransformation2d(mData);
+
+ describeParameterization(mData);
+
+ dedent();
+}
+
+void describeContentWireEdge(BitByBitData &mData)
+{
+ cout << getIndent() << "--WireEdge--" << endl;
+ indent();
+
+ describeBaseTopology(mData);
+
+ describeObject(mData); //3d_curve
+
+ bool curve_trim_interval = mData.readBit();
+ cout << getIndent() << "curve_trim_interval "
+ << (curve_trim_interval?"yes":"no") << endl;
+ if(curve_trim_interval)
+ {
+ describeExtent1d(mData);
+ }
+
+ dedent();
+}
+
+void describeUVParametrization(BitByBitData &mData)
+{
+ cout << getIndent() << "--UV Parameterization--" << endl;
+ indent();
+
+ cout << getIndent() << "swap_uv " << (mData.readBit()?"yes":"no") << endl;
+ cout << getIndent() << "Domain" << endl;
+ indent(); describeExtent2d(mData); dedent();
+ cout << getIndent() << "parameterization_on_u_coeff_a "
+ << mData.readDouble() << endl;
+ cout << getIndent() << "parameterization_on_v_coeff_a "
+ << mData.readDouble() << endl;
+ cout << getIndent() << "parameterization_on_u_coeff_b "
+ << mData.readDouble() << endl;
+ cout << getIndent() << "parameterization_on_v_coeff_b "
+ << mData.readDouble() << endl;
+
+ dedent();
+}
+
+bool isCompressedSerialType(unsigned int type)
+{
+ return false; // TODO: actually check the type!!!
+}
+
+void describeSurfNURBS(BitByBitData &mData)
+{
+ cout << getIndent() << "--NURBS surface--" << endl;
+ indent();
+
+ describeContentSurface(mData);
+
+ bool is_rational = mData.readBit();
+ cout << getIndent() << "is_rational " << (is_rational?"yes":"no") << endl;
+
+ unsigned int degree_in_u = mData.readUnsignedInt();
+ cout << getIndent() << "degree_in_u " << degree_in_u << endl;
+ unsigned int degree_in_v = mData.readUnsignedInt();
+ cout << getIndent() << "degree_in_v " << degree_in_v << endl;
+
+ unsigned int number_of_control_points_in_u = mData.readUnsignedInt()+1;
+ cout << getIndent() << "number_of_control_points_in_u "
+ << number_of_control_points_in_u << endl;
+ unsigned int number_of_control_points_in_v = mData.readUnsignedInt()+1;
+ cout << getIndent() << "number_of_control_points_in_v "
+ << number_of_control_points_in_v << endl;
+
+ unsigned int number_of_knots_in_u = mData.readUnsignedInt()+1;
+ cout << getIndent() << "number_of_knots_in_u "
+ << number_of_knots_in_u << endl;
+ unsigned int number_of_knots_in_v = mData.readUnsignedInt()+1;
+ cout << getIndent() << "number_of_knots_in_v "
+ << number_of_knots_in_v << endl;
+
+ indent();
+ for(unsigned int i = 0; i < number_of_control_points_in_u; ++i)
+ {
+ for(unsigned int j = 0; j < number_of_control_points_in_v; ++j)
+ {
+ double x = mData.readDouble();
+ double y = mData.readDouble();
+ double z = mData.readDouble();
+ cout << getIndent() << "control point " << i << ' ' << j << ": ("
+ << x << ',' << y << ',' << z;
+
+ if(is_rational)
+ cout << ',' << mData.readDouble();
+
+ cout << ')' << endl;
+ }
+ }
+ dedent();
+
+ cout << getIndent() << "knots in u" << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_knots_in_u; ++i)
+ cout << getIndent() << mData.readDouble() << endl;
+ dedent();
+
+ cout << getIndent() << "knots in v" << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_knots_in_v; ++i)
+ cout << getIndent() << mData.readDouble() << endl;
+ dedent();
+
+ cout << getIndent() << "knot_type " << mData.readUnsignedInt() << endl;
+ cout << getIndent() << "surface_form " << mData.readUnsignedInt() << endl;
+
+ dedent();
+}
+
+void describeCurvNURBS(BitByBitData &mData)
+{
+ cout << getIndent() << "--NURBS curve--" << endl;
+ indent();
+ describeContentCurve(mData);
+
+ bool is_rational = mData.readBit();
+ cout << getIndent() << "is_rational " << (is_rational?"yes":"no") << endl;
+
+ unsigned int degree = mData.readUnsignedInt();
+ cout << getIndent() << "degree " << degree << endl;
+
+ unsigned int number_of_control_points = mData.readUnsignedInt()+1;
+ cout << getIndent() << "number_of_control_points "
+ << number_of_control_points << endl;
+
+ unsigned int number_of_knots = mData.readUnsignedInt()+1;
+ cout << getIndent() << "number_of_knots " << number_of_knots << endl;
+
+ indent();
+ for(unsigned int i = 0; i < number_of_control_points; ++i)
+ {
+ double x = mData.readDouble();
+ double y = mData.readDouble();
+ double z = mData.readDouble();
+ cout << getIndent() << "control point " << i << ": ("
+ << x << ',' << y << ',' << z;
+
+ if(is_rational)
+ cout << ',' << mData.readDouble();
+
+ cout << ')' << endl;
+ }
+ dedent();
+
+ cout << getIndent() << "knots" << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_knots; ++i)
+ cout << getIndent() << mData.readDouble() << endl;
+ dedent();
+
+ cout << getIndent() << "knot_type " << mData.readUnsignedInt() << endl;
+ cout << getIndent() << "surface_form " << mData.readUnsignedInt() << endl;
+
+ dedent();
+}
+
+void describeCurvPolyLine(BitByBitData &mData)
+{
+ cout << getIndent() << "--PolyLine--" << endl;
+ indent();
+ describeContentCurve(mData);
+ describeTransformation3d(mData);
+ describeParameterization(mData);
+
+ unsigned int number_of_points = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_points " << number_of_points << endl;
+
+ indent();
+ for(unsigned int i = 0; i < number_of_points; ++i)
+ {
+ describeVector3d(mData);
+ }
+ dedent();
+
+ dedent();
+}
+
+void describeSurfCylinder(BitByBitData &mData)
+{
+ cout << getIndent() << "--Cylinder surface--" << endl;
+ indent();
+
+ describeContentSurface(mData);
+ describeTransformation3d(mData);
+ describeUVParametrization(mData);
+ cout << getIndent() << "radius " << mData.readDouble() << endl;
+
+ dedent();
+}
+
+void describeSurfPlane(BitByBitData &mData)
+{
+ cout << getIndent() << "--Plane surface--" << endl;
+ indent();
+ mData.setShowBits(true);
+ describeContentSurface(mData);
+ mData.tellPosition();
+ //TODO: something is wrong, very wrong!!!
+ // For now, all this does is search until the end of the data block,
+ // assuming that the default parameterization [-inf,inf]x[-inf,inf] was used
+ BitPosition bp = mData.getPosition();
+ double nInf1 = mData.readDouble();
+ double nInf2 = mData.readDouble();
+ double inf1 = mData.readDouble();
+ double inf2 = mData.readDouble();
+ double one1 = mData.readDouble();
+ double one2 = mData.readDouble();
+ double zero1 = mData.readDouble();
+ double zero2 = mData.readDouble();
+ while(!(nInf1 == -12345.0 && nInf2 == -12345.0 && inf1 == 12345.0
+ && inf2 == 12345.0 && one1 == 1.0 && one2 == 1.0 && zero1 == 0.0
+ && zero2 == 0.0))
+ {
+ mData.setPosition(bp);
+ cout << mData.readBit();
+ bp = mData.getPosition();
+
+ nInf1 = mData.readDouble();
+ nInf2 = mData.readDouble();
+ inf1 = mData.readDouble();
+ inf2 = mData.readDouble();
+ one1 = mData.readDouble();
+ one2 = mData.readDouble();
+ zero1 = mData.readDouble();
+ zero2 = mData.readDouble();
+ }
+ cout << endl;
+ if(bp.bitIndex == 0)
+ {
+ bp.bitIndex = 7;
+ --bp.byteIndex;
+ }
+ else
+ {
+ --bp.bitIndex;
+ }
+ mData.setPosition(bp);
+
+/*
+ // this is what the 8137 docs say it should be
+ describeTransformation3d(mData);
+ cout << getIndent() << "UV domain" << endl;
+ indent();
+ cout << getIndent() << "Min: " << endl;
+ describeVector2d(mData);
+ cout << getIndent() << "Max: " << endl;
+ describeVector2d(mData);
+ dedent();
+
+ cout << getIndent() << "u coef. a = " << mData.readDouble() << endl;
+ cout << getIndent() << "v coef. a = " << mData.readDouble() << endl;
+ cout << getIndent() << "u coef. b = " << mData.readDouble() << endl;
+ cout << getIndent() << "v coef. b = " << mData.readDouble() << endl;
+*/
+ mData.setShowBits(false);
+ dedent();
+}
+
+void describeTopoFace(BitByBitData &mData)
+{
+ cout << getIndent() << "--Face--" << endl;
+ indent();
+
+ describeBaseTopology(mData);
+
+ cout << getIndent() << "base_surface" << endl;
+ indent();
+ describeObject(mData);
+ dedent();
+
+ bool surface_trim_domain = mData.readBit();
+ cout << getIndent() << "surface_trim_domain "
+ << (surface_trim_domain?"yes":"no") << endl;
+ if(surface_trim_domain)
+ {
+ indent();
+ describeExtent2d(mData);
+ dedent();
+ }
+
+ bool have_tolerance = mData.readBit();
+ cout << getIndent() << "have_tolerance "
+ << (have_tolerance?"yes":"no") << endl;
+ if(have_tolerance)
+ cout << getIndent() << "tolerance " << mData.readDouble() << endl;
+
+ unsigned int number_of_loops = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_loops " << number_of_loops << endl;
+ cout << getIndent() << "outer_loop_index " << mData.readInt() << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_loops; ++i)
+ {
+ describeObject(mData);
+ }
+ dedent();
+
+ dedent();
+}
+
+void describeTopoLoop(BitByBitData &mData)
+{
+ cout << getIndent() << "--Loop--" << endl;
+ indent();
+
+ describeBaseTopology(mData);
+
+ cout << getIndent() << "orientation_with_surface "
+ << static_cast<unsigned int>(mData.readChar()) << endl;
+ unsigned int number_of_coedge = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_coedge " << number_of_coedge << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_coedge; ++i)
+ {
+ describeObject(mData);
+ cout << getIndent() << "neigh_serial_index "
+ << mData.readUnsignedInt() << endl;
+ }
+ dedent();
+
+ dedent();
+}
+
+void describeTopoCoEdge(BitByBitData &mData)
+{
+ cout << getIndent() << "--CoEdge--" << endl;
+ indent();
+
+ describeBaseTopology(mData);
+
+ describeObject(mData); // edge
+ describeObject(mData); // uv_curve
+ cout << getIndent() << "orientation_with_loop "
+ << static_cast<unsigned int>(mData.readChar()) << endl;
+ cout << getIndent() << "orientation_uv_with_loop "
+ << static_cast<unsigned int>(mData.readChar()) << endl;
+ dedent();
+}
+
+void describeTopoEdge(BitByBitData &mData)
+{
+ cout << getIndent() << "--Edge--" << endl;
+ indent();
+
+ describeContentWireEdge(mData);
+
+ describeObject(mData); // vertex_start
+ describeObject(mData); // vertex_end
+
+ bool have_tolerance = mData.readBit();
+ cout << getIndent() << "have_tolerance "
+ << (have_tolerance?"yes":"no") << endl;
+ if(have_tolerance)
+ cout << getIndent() << "tolerance " << mData.readDouble() << endl;
+ dedent();
+}
+
+void describeTopoUniqueVertex(BitByBitData &mData)
+{
+ cout << getIndent() << "--Unique Vertex--" << endl;
+ indent();
+
+ describeBaseTopology(mData);
+ describeVector3d(mData);
+
+ bool have_tolerance = mData.readBit();
+ cout << getIndent() << "have_tolerance "
+ << (have_tolerance?"yes":"no") << endl;
+ if(have_tolerance)
+ cout << getIndent() << "tolerance " << mData.readDouble() << endl;
+
+ dedent();
+}
+
+void describeTopoConnex(BitByBitData &mData)
+{
+ cout << getIndent() << "--Connex--" << endl;
+ indent();
+ describeBaseTopology(mData);
+ unsigned int number_of_shells = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_shells "
+ << number_of_shells << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_shells; ++i)
+ {
+ // NOTE: this does not check if the objects are actually shells!
+ describeObject(mData);
+ }
+ dedent();
+
+ dedent();
+}
+
+void describeTopoShell(BitByBitData &mData)
+{
+ cout << getIndent() << "--Shell--" << endl;
+ indent();
+
+ describeBaseTopology(mData);
+
+ cout << getIndent() << "shell_is_closed "
+ << (mData.readBit()?"yes":"no") << endl;
+
+ unsigned int number_of_faces = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_faces " << number_of_faces << endl;
+ for(unsigned int i = 0; i < number_of_faces; ++i)
+ {
+ // NOTE: this does not check if the objects are actually faces!
+ describeObject(mData);
+ unsigned char orientation = mData.readChar();
+ cout << getIndent() << "orientation_surface_with_shell "
+ << static_cast<unsigned int>(orientation) << endl;
+ }
+
+ dedent();
+}
+
+void describeObject(BitByBitData &mData)
+{
+ cout << getIndent() << "--Object--" << endl;
+ bool already_stored = mData.readBit();
+ cout << getIndent() << "already_stored "
+ << (already_stored?"yes":"no") << endl;
+ if(already_stored) // reverse of documentation?
+ {
+ cout << getIndent() << "index of stored item "
+ << mData.readUnsignedInt() << endl;
+ }
+ else
+ {
+ unsigned int type = mData.readUnsignedInt();
+ switch(type)
+ {
+ case PRC_TYPE_ROOT:
+ cout << getIndent() << "NULL Object" << endl;
+ break;
+ // topological items
+ case PRC_TYPE_TOPO_Connex:
+ describeTopoConnex(mData);
+ break;
+ case PRC_TYPE_TOPO_Shell:
+ describeTopoShell(mData);
+ break;
+ case PRC_TYPE_TOPO_Face:
+ describeTopoFace(mData);
+ break;
+ case PRC_TYPE_TOPO_Loop:
+ describeTopoLoop(mData);
+ break;
+ case PRC_TYPE_TOPO_CoEdge:
+ describeTopoCoEdge(mData);
+ break;
+ case PRC_TYPE_TOPO_Edge:
+ describeTopoEdge(mData);
+ break;
+ case PRC_TYPE_TOPO_UniqueVertex:
+ describeTopoUniqueVertex(mData);
+ break;
+ case PRC_TYPE_TOPO_WireEdge:
+ describeContentWireEdge(mData);
+ break;
+
+ // curves
+ case PRC_TYPE_CRV_Circle:
+ describeCurvCircle(mData);
+ break;
+ case PRC_TYPE_CRV_NURBS:
+ describeCurvNURBS(mData);
+ break;
+ case PRC_TYPE_CRV_PolyLine:
+ describeCurvPolyLine(mData);
+ break;
+ case PRC_TYPE_CRV_Line:
+ describeCurvLine(mData);
+ break;
+ // surfaces
+ case PRC_TYPE_SURF_NURBS:
+ describeSurfNURBS(mData);
+ break;
+ case PRC_TYPE_SURF_Cylinder:
+ describeSurfCylinder(mData);
+ break;
+ case PRC_TYPE_SURF_Plane:
+ describeSurfPlane(mData);
+ break;
+
+ // topological items
+ case PRC_TYPE_TOPO_Item:
+ case PRC_TYPE_TOPO_MultipleVertex:
+
+
+ // curves
+ case PRC_TYPE_CRV_Base:
+ case PRC_TYPE_CRV_Blend02Boundary:
+ case PRC_TYPE_CRV_Composite:
+ case PRC_TYPE_CRV_OnSurf:
+ case PRC_TYPE_CRV_Ellipse:
+ case PRC_TYPE_CRV_Equation:
+ case PRC_TYPE_CRV_Helix:
+ case PRC_TYPE_CRV_Hyperbola:
+ case PRC_TYPE_CRV_Intersection:
+ case PRC_TYPE_CRV_Offset:
+ case PRC_TYPE_CRV_Parabola:
+ case PRC_TYPE_CRV_Transform:
+
+ // surfaces
+ case PRC_TYPE_SURF_Base:
+ case PRC_TYPE_SURF_Blend01:
+ case PRC_TYPE_SURF_Blend02:
+ case PRC_TYPE_SURF_Blend03:
+ case PRC_TYPE_SURF_Cone:
+ case PRC_TYPE_SURF_Cylindrical:
+ case PRC_TYPE_SURF_Offset:
+ case PRC_TYPE_SURF_Pipe:
+ case PRC_TYPE_SURF_Ruled:
+ case PRC_TYPE_SURF_Sphere:
+ case PRC_TYPE_SURF_Revolution:
+ case PRC_TYPE_SURF_Extrusion:
+ case PRC_TYPE_SURF_FromCurves:
+ case PRC_TYPE_SURF_Torus:
+ case PRC_TYPE_SURF_Transform:
+ case PRC_TYPE_SURF_Blend04:
+ cout << getIndent() << "TODO: Unhandled object of type "
+ << type << endl;
+ break;
+ default:
+ cout << getIndent() << "Invalid object of type " << type << endl;
+ break;
+ }
+ }
+}
+
+void describeBaseTopology(BitByBitData &mData)
+{
+ bool base_information = mData.readBit();
+ cout << getIndent() << "base_information " <<
+ (base_information?"yes":"no") << endl;
+ if(base_information)
+ {
+ describeAttributes(mData);
+ describeName(mData);
+ cout << getIndent() << "identifier " << mData.readUnsignedInt() << endl;
+ }
+}
+
+void describeBaseGeometry(BitByBitData &mData)
+{
+ bool base_information = mData.readBit();
+ cout << getIndent() << "base_information " <<
+ (base_information?"yes":"no") << endl;
+ if(base_information)
+ {
+ describeAttributes(mData);
+ describeName(mData);
+ cout << getIndent() << "identifier " << mData.readUnsignedInt() << endl;
+ }
+}
+
+unsigned int describeContentBody(BitByBitData &mData)
+{
+ describeBaseTopology(mData);
+ unsigned int behaviour = static_cast<unsigned int>(mData.readChar());
+ cout << getIndent() << "behaviour " << behaviour << endl;
+ return behaviour;
+}
+
+void describeContentSurface(BitByBitData &mData)
+{
+ describeBaseGeometry(mData);
+ cout << getIndent() << "extend_info " << mData.readUnsignedInt() << endl;
+}
+
+void describeBody(BitByBitData &mData)
+{
+ cout << getIndent() << "--Body--" << endl;
+ unsigned int type = mData.readUnsignedInt();
+ switch(type)
+ {
+ case PRC_TYPE_TOPO_BrepData:
+ {
+ cout << getIndent() << "--PRC_TYPE_TOPO_BrepData--" << endl;
+ unsigned int behaviour = describeContentBody(mData);
+
+ unsigned int number_of_connex = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_connex " << number_of_connex << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_connex; ++i)
+ {
+ describeObject(mData);
+ }
+ dedent();
+ if(behaviour != 0)
+ {
+ cout << getIndent() << "bbox " << endl;
+ indent();
+ describeExtent3d(mData);
+ dedent();
+ }
+ break;
+ }
+ case PRC_TYPE_TOPO_SingleWireBody:
+ {
+ cout << getIndent() << "--PRC_TYPE_TOPO_SingleWireBody--" << endl;
+ // unsigned int behaviour = describeContentBody(mData);
+ // TODO: is behaviour needed to get data about how to describe?
+ describeContentBody(mData);
+
+ describeObject(mData); // curve
+
+ break;
+ }
+ case PRC_TYPE_TOPO_BrepDataCompress:
+ case PRC_TYPE_TOPO_SingleWireBodyCompress:
+ cout << getIndent() << "TODO: Unhandled body type " << type << endl;
+ break;
+ default:
+ cout << getIndent() << "Invalid body type " << type << endl;
+ break;
+ }
+}
+
+void describeTopoContext(BitByBitData &mData)
+{
+ cout << getIndent() << "--Topological Context--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_TOPO_Context))
+ return;
+ indent();
+
+ describeContentPRCBase(mData,false);
+
+ cout << getIndent() << "behaviour "
+ << static_cast<unsigned int>(mData.readChar()) << endl;
+ cout << getIndent() << "granularity " << mData.readDouble() << endl;
+ cout << getIndent() << "tolerance " << mData.readDouble() << endl;
+
+ bool have_smallest_face_thickness = mData.readBit();
+ cout << getIndent() << "have_smallest_face_thickness "
+ << (have_smallest_face_thickness?"yes":"no") << endl;
+ if(have_smallest_face_thickness)
+ cout << getIndent() << "smallest_thickness " << mData.readDouble() << endl;
+
+ bool have_scale = mData.readBit();
+ cout << getIndent() << "have_scale " << (have_scale?"yes":"no") << endl;
+ if(have_scale)
+ cout << getIndent() << "scale " << mData.readDouble() << endl;
+
+ dedent();
+}
+
+void describeLineAttr(BitByBitData& mData)
+{
+ cout << getIndent() << "index_of_line_style "
+ << mData.readUnsignedInt()-1 << endl;
+}
+
+void describeArrayRGBA(BitByBitData& mData, int number_of_colours,
+ int number_by_vector)
+{
+ // bool new_colour = true; // not currently used
+ for(int i = 0; i < number_by_vector; ++i)
+ {
+ cout << getIndent() << static_cast<unsigned int>(mData.readChar()) << ' ';
+ cout << static_cast<unsigned int>(mData.readChar()) << ' ';
+ cout << static_cast<unsigned int>(mData.readChar()) << endl;
+ //TODO: finish this
+ }
+}
+
+void describeContentBaseTessData(BitByBitData &mData)
+{
+ cout << getIndent() << "is_calculated "
+ << (mData.readBit()?"yes":"no") << endl;
+ unsigned int number_of_coordinates = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_coordinates "
+ << number_of_coordinates << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_coordinates; ++i)
+ {
+ cout << getIndent() << mData.readDouble() << endl;
+ }
+ dedent();
+}
+
+void describeTessFace(BitByBitData &mData)
+{
+ cout << getIndent() << "--Tessellation Face--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_TESS_Face))
+ return;
+ indent();
+
+ unsigned int size_of_line_attributes = mData.readUnsignedInt();
+ cout << getIndent() << "size_of_line_attributes "
+ << size_of_line_attributes << endl;
+ indent();
+ for(unsigned int i = 0; i < size_of_line_attributes; ++i)
+ {
+ describeLineAttr(mData);
+ }
+ dedent();
+
+ unsigned int start_wire = mData.readUnsignedInt();
+ cout << getIndent() << "start_wire " << start_wire << endl;
+ unsigned int size_of_sizes_wire = mData.readUnsignedInt();
+ cout << getIndent() << "size_of_sizes_wire " << size_of_sizes_wire << endl;
+ indent();
+ for(unsigned int i = 0; i < size_of_sizes_wire; ++i)
+ {
+ cout << getIndent() << mData.readUnsignedInt() << endl;
+ }
+ dedent();
+
+
+ unsigned int used_entities_flag = mData.readUnsignedInt();
+ cout << getIndent() << "used_entities_flag " << used_entities_flag << endl;
+
+ unsigned int start_triangulated = mData.readUnsignedInt();
+ cout << getIndent() << "start_triangulated " << start_triangulated << endl;
+ unsigned int size_of_sizes_triangulated = mData.readUnsignedInt();
+ cout << getIndent() << "size_of_sizes_triangulated "
+ << size_of_sizes_triangulated << endl;
+ indent();
+ for(unsigned int i = 0; i < size_of_sizes_triangulated; ++i)
+ {
+ cout << getIndent() << mData.readUnsignedInt() << endl;
+ }
+ dedent();
+
+ cout << getIndent() << "number_of_texture_coordinate_indexes "
+ << mData.readUnsignedInt() << endl;
+
+ bool has_vertex_colors = mData.readBit();
+ cout << getIndent() << "has_vertex_colors "
+ << (has_vertex_colors?"yes":"no") << endl;
+ indent();
+ if(has_vertex_colors)
+ {
+ bool is_rgba = mData.readBit();
+ cout << getIndent() << "is_rgba " << (is_rgba?"yes":"no") << endl;
+
+ bool b_optimised = mData.readBit();
+ cout << getIndent() << "b_optimised " << (b_optimised?"yes":"no") << endl;
+ if(!b_optimised)
+ {
+ indent();
+ //TODO: compute size of Array and pass it instead of 0
+ describeArrayRGBA(mData,0,(is_rgba ? 4 : 3));
+ dedent();
+ }
+ else
+ {
+ // not described
+ // what does this mean? that this should not happen?
+ // or is omitted from the docs?
+ }
+ }
+ dedent();
+
+ if(size_of_line_attributes)
+ {
+ cout << getIndent() << "behaviour " << mData.readUnsignedInt() << endl;
+ }
+
+ dedent();
+}
+
+void describe3DTess(BitByBitData &mData)
+{
+ cout << getIndent() << "--3D Tessellation--" << endl;
+ indent();
+
+ describeContentBaseTessData(mData);
+
+ cout << getIndent() << "has_faces " << (mData.readBit()?"yes":"no") << endl;
+ cout << getIndent() << "has_loops " << (mData.readBit()?"yes":"no") << endl;
+
+ bool must_recalculate_normals = mData.readBit();
+ cout << getIndent() << "must_recalculate_normals "
+ << (must_recalculate_normals?"yes":"no") << endl;
+ indent();
+ if(must_recalculate_normals)
+ {
+ cout << getIndent()
+ << "Docs were wrong: must_recalculate_normals is true." << endl;
+ cout << getIndent() << "normals_recalculation_flags "
+ << static_cast<unsigned int>(mData.readChar()) << endl;
+ cout << getIndent() << "crease_angle " << mData.readDouble() << endl;
+ }
+ dedent();
+
+ unsigned int number_of_normal_coordinates = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_normal_coordinates "
+ << number_of_normal_coordinates << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_normal_coordinates; ++i)
+ {
+ cout << getIndent() << mData.readDouble() << endl;
+ }
+ dedent();
+
+ unsigned int number_of_wire_indices = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_wire_indices "
+ << number_of_wire_indices << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_wire_indices; ++i)
+ {
+ cout << getIndent() << mData.readUnsignedInt() << endl;
+ }
+ dedent();
+
+ unsigned int number_of_triangulated_indices = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_triangulated_indices "
+ << number_of_triangulated_indices << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_triangulated_indices; ++i)
+ {
+ cout << getIndent() << mData.readUnsignedInt() << endl;
+ }
+ dedent();
+
+ unsigned int number_of_face_tessellation = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_face_tessellation "
+ << number_of_face_tessellation << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_face_tessellation; ++i)
+ {
+ describeTessFace(mData);
+ }
+ dedent();
+
+ unsigned int number_of_texture_coordinates = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_texture_coordinates "
+ << number_of_texture_coordinates << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_texture_coordinates; ++i)
+ {
+ cout << getIndent() << mData.readDouble() << endl;
+ }
+ dedent();
+
+ dedent();
+}
+
+void describe3DWireTess(BitByBitData &mData)
+{
+ //TODO
+}
+
+void describe3DMarkupTess(BitByBitData &mData)
+{
+ //TODO
+}
+
+void describeHighlyCompressed3DTess(BitByBitData &mData)
+{
+ //TODO
+}
+
+void describeSceneDisplayParameters(BitByBitData &mData)
+{
+ cout << getIndent() << "--Scene Display Parameters--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_GRAPH_SceneDisplayParameters))
+ return;
+ indent();
+ describeContentPRCBase(mData,true);
+
+ cout << getIndent() << "is active? " << (mData.readBit()?"yes":"no") << endl;
+
+ unsigned int number_of_lights = mData.readUnsignedInt();
+ cout << getIndent() << "number of lights " << number_of_lights << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_lights; ++i)
+ {
+ describeLight(mData);
+ }
+ dedent();
+
+ bool camera = mData.readBit();
+ cout << getIndent() << "camera? " << (camera?"yes":"no") << endl;
+ if(camera)
+ describeCamera(mData);
+
+ bool rotation_centre = mData.readBit();
+ cout << getIndent() << "rotation centre? " << (rotation_centre?"yes":"no") << endl;
+ if(rotation_centre)
+ describeVector3d(mData);
+
+ unsigned int number_of_clipping_planes = mData.readUnsignedInt();
+ cout << getIndent() << "number of clipping planes " << number_of_clipping_planes << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_clipping_planes; ++i)
+ {
+ cout << "Can't describe planes!!!" << endl;
+ //describePlane(mData);
+ }
+ dedent();
+
+ cout << getIndent() << "Background line style index: " << mData.readUnsignedInt()-1 << endl;
+ cout << getIndent() << "Default line style index: " << mData.readUnsignedInt()-1 << endl;
+
+ unsigned int number_of_default_styles_per_type = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_default_styles_per_type " << number_of_default_styles_per_type << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_default_styles_per_type; ++i)
+ {
+ cout << getIndent() << "type " << mData.readUnsignedInt() << endl;
+ cout << getIndent() << "line style index: " << mData.readUnsignedInt()-1 << endl;
+ }
+ dedent();
+
+ dedent();
+}
+
+void describeCartesionTransformation3d(BitByBitData& mData)
+{
+ cout << getIndent() << "--3d Cartesian Transformation--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_MISC_CartesianTransformation))
+ return;
+ indent();
+ unsigned char behaviour = mData.readChar();
+ cout << getIndent() << "behaviour "
+ << static_cast<unsigned int>(behaviour) << endl;
+ if((behaviour & PRC_TRANSFORMATION_Translate) != 0)
+ {
+ cout << getIndent() << "Translation" << endl;
+ describeVector3d(mData);
+ }
+
+ if((behaviour & PRC_TRANSFORMATION_NonOrtho) != 0)
+ {
+ cout << getIndent() << "Non orthogonal transformation" << endl;
+ cout << getIndent() << "X" << endl; describeVector3d(mData);
+ cout << getIndent() << "Y" << endl; describeVector3d(mData);
+ cout << getIndent() << "Z" << endl; describeVector3d(mData);
+ }
+ else if((behaviour & PRC_TRANSFORMATION_Rotate) != 0)
+ {
+ cout << getIndent() << "Rotation" << endl;
+ cout << getIndent() << "X" << endl; describeVector3d(mData);
+ cout << getIndent() << "Y" << endl; describeVector3d(mData);
+ }
+
+ // this is different from the docs!!! but it works...
+ if ((behaviour & PRC_TRANSFORMATION_NonUniformScale) != 0)
+ {
+ cout << getIndent() << "Non-uniform scale by " << endl;
+ describeVector3d(mData);
+ }
+
+ // this is different from the docs!!! but it works...
+ if((behaviour & PRC_TRANSFORMATION_Scale) != 0)
+ {
+ cout << getIndent() << "Uniform Scale by " << mData.readDouble() << endl;
+ }
+
+ if((behaviour & PRC_TRANSFORMATION_Homogeneous) != 0)
+ {
+ cout << getIndent() << "transformation has homogenous values" << endl;
+ cout << getIndent() << "x = " << mData.readDouble() << endl;
+ cout << getIndent() << "y = " << mData.readDouble() << endl;
+ cout << getIndent() << "z = " << mData.readDouble() << endl;
+ cout << getIndent() << "w = " << mData.readDouble() << endl;
+ }
+ dedent();
+}
+
+void describeTransformation3d(BitByBitData& mData)
+{
+ cout << getIndent() << "--3d Transformation--" << endl;
+ indent();
+ bool has_transformation = mData.readBit();
+ cout << getIndent() << "has_transformation "
+ << (has_transformation?"yes":"no") << endl;
+ if(has_transformation)
+ {
+ unsigned char behaviour = mData.readChar();
+ cout << getIndent() << "behaviour "
+ << static_cast<unsigned int>(behaviour) << endl;
+ if((behaviour & PRC_TRANSFORMATION_Translate) != 0)
+ {
+ cout << getIndent() << "Translation" << endl;
+ describeVector3d(mData);
+ }
+ if((behaviour & PRC_TRANSFORMATION_Rotate) != 0)
+ {
+ cout << getIndent() << "Rotation" << endl;
+ cout << getIndent() << "X" << endl; describeVector3d(mData);
+ cout << getIndent() << "Y" << endl; describeVector3d(mData);
+ }
+
+ if((behaviour & PRC_TRANSFORMATION_Scale) != 0)
+ {
+ cout << getIndent() << "Uniform Scale by " << mData.readDouble() << endl;
+ }
+ }
+ dedent();
+}
+
+void describeTransformation2d(BitByBitData& mData)
+{
+ cout << getIndent() << "--2d Transformation--" << endl;
+ indent();
+ bool has_transformation = mData.readBit();
+ cout << "has_transformation " << (has_transformation?"yes":"no") << endl;
+ if(has_transformation)
+ {
+ unsigned char behaviour = mData.readChar();
+ cout << getIndent() << "behaviour "
+ << static_cast<unsigned int>(behaviour) << endl;
+ if((behaviour & PRC_TRANSFORMATION_Translate) != 0)
+ {
+ cout << getIndent() << "Translation" << endl;
+ describeVector2d(mData);
+ }
+ if((behaviour & PRC_TRANSFORMATION_Rotate) != 0)
+ {
+ cout << getIndent() << "Rotation" << endl;
+ cout << getIndent() << "X" << endl; describeVector2d(mData);
+ cout << getIndent() << "Y" << endl; describeVector2d(mData);
+ }
+
+ if((behaviour & PRC_TRANSFORMATION_Scale) != 0)
+ {
+ cout << getIndent() << "Uniform Scale by " << mData.readDouble() << endl;
+ }
+ }
+ dedent();
+}
+
+void describeFileStructureInternalData(BitByBitData &mData)
+{
+ cout << getIndent() << "--File Structure Internal Data--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_ASM_FileStructure))
+ return;
+ indent();
+ describeContentPRCBase(mData,false);
+ cout << getIndent() << "next_available_index "
+ << mData.readUnsignedInt() << endl;
+ cout << getIndent() << "index_product_occurence "
+ << mData.readUnsignedInt() << endl;
+ dedent();
+}
+
+void describeProductOccurrence(BitByBitData &mData)
+{
+ cout << getIndent() << "--Product Occurrence--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_ASM_ProductOccurence))
+ return;
+ indent();
+
+ describeContentPRCBaseWithGraphics(mData,true);
+
+ cout << getIndent() << "index_part "
+ << static_cast<int>(mData.readUnsignedInt()-1) << endl;
+ unsigned int index_prototype = mData.readUnsignedInt()-1;
+ cout << getIndent() << "index_prototype "
+ << static_cast<int>(index_prototype) << endl;
+ if(index_prototype+1 != 0)
+ {
+ bool prototype_in_same_file_structure = mData.readBit();
+ cout << getIndent() << "prototype_in_same_file_structure "
+ << (prototype_in_same_file_structure?"yes":"no") << endl;
+ if(!prototype_in_same_file_structure)
+ describeCompressedUniqueID(mData);
+ }
+
+ unsigned int index_external_data = mData.readUnsignedInt()-1;
+ cout << getIndent() << "index_external_data "
+ << static_cast<int>(index_external_data) << endl;
+ if(index_external_data+1 != 0)
+ {
+ bool external_data_in_same_file_structure = mData.readBit();
+ cout << getIndent() << "external_data_in_same_file_structure "
+ << (external_data_in_same_file_structure?"yes":"no") << endl;
+ if(!external_data_in_same_file_structure)
+ describeCompressedUniqueID(mData);
+ }
+
+ unsigned int number_of_son_product_occurences = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_son_product_occurences "
+ << number_of_son_product_occurences << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_son_product_occurences; ++i)
+ cout << getIndent() << mData.readUnsignedInt() << endl;
+ dedent();
+
+ cout << getIndent() << "product_behaviour "
+ << static_cast<unsigned int>(mData.readChar()) << endl;
+
+ describeUnit(mData);
+ cout << getIndent() << "Product information flags "
+ << static_cast<unsigned int>(mData.readChar()) << endl;
+ cout << getIndent() << "product_load_status "
+ << mData.readUnsignedInt() << endl;
+
+ bool has_location = mData.readBit();
+ cout << getIndent() << "has_location " << has_location << endl;
+ if(has_location)
+ {
+ describeCartesionTransformation3d(mData);
+ }
+
+ unsigned int number_of_references = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_references "
+ << number_of_references << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_references; ++i)
+ {
+ //TODO: describeReferenceToPRCBase(mData);
+ }
+ dedent();
+
+ describeMarkups(mData);
+
+ unsigned int number_of_views = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_views " << number_of_views << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_views; ++i)
+ {
+ describeAnnotationView(mData);
+ }
+ dedent();
+
+ bool has_entity_filter = mData.readBit();
+ cout << getIndent() << "has_entity_filter "
+ << (has_entity_filter?"yes":"no") << endl;
+ if(has_entity_filter)
+ {
+ //TODO: describeEntityFilter(mData);
+ }
+
+ unsigned int number_of_display_filters = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_display_filters "
+ << number_of_display_filters << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_display_filters; ++i)
+ {
+ //TODO: describeFilter(mData);
+ }
+ dedent();
+
+ unsigned int number_of_scene_display_parameters = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_scene_display_parameters "
+ << number_of_scene_display_parameters << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_scene_display_parameters; ++i)
+ {
+ describeSceneDisplayParameters(mData);
+ }
+ dedent();
+
+ describeUserData(mData);
+ dedent();
+}
+
+void describeGraphics(BitByBitData &mData)
+{
+ bool sameGraphicsAsCurrent = mData.readBit();
+ cout << getIndent() << "Same graphics as current graphics? "
+ << (sameGraphicsAsCurrent?"yes":"no") << endl;
+ if(!sameGraphicsAsCurrent)
+ {
+ layer_index = mData.readUnsignedInt()-1;
+ cout << getIndent() << "layer_index " << layer_index << endl;
+ index_of_line_style = mData.readUnsignedInt()-1;
+ cout << getIndent() << "index_of_line_style "
+ << index_of_line_style << endl;
+ unsigned char c1 = mData.readChar();
+ unsigned char c2 = mData.readChar();
+ behaviour_bit_field = c1 | (static_cast<unsigned short>(c2) << 8);
+ cout << getIndent() << "behaviour_bit_field "
+ << behaviour_bit_field << endl;
+ }
+}
+
+void describeContentPRCBaseWithGraphics(BitByBitData &mData, bool efr)
+{
+ describeContentPRCBase(mData,efr);
+ describeGraphics(mData);
+}
+
+void describePartDefinition(BitByBitData &mData)
+{
+ cout << getIndent() << "--Part Definition--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_ASM_PartDefinition))
+ return;
+ indent();
+
+ describeContentPRCBaseWithGraphics(mData,true);
+ describeExtent3d(mData);
+
+ unsigned int number_of_representation_items = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_representation_items "
+ << number_of_representation_items << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_representation_items; ++i)
+ {
+ describeRepresentationItem(mData);
+ }
+ dedent();
+
+ describeMarkups(mData);
+
+ unsigned int number_of_views = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_views " << number_of_views << endl;
+ indent();
+ for(unsigned int i = 0; i < number_of_views; ++i)
+ {
+ describeAnnotationView(mData);
+ }
+ dedent();
+
+ describeUserData(mData);
+ dedent();
+}
+
+void describeMarkups(BitByBitData& mData)
+{
+ cout << getIndent() << "--Markups--" << endl;
+ indent();
+
+ unsigned int number_of_linked_items = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_linked_items "
+ << number_of_linked_items << endl;
+ for(unsigned int i = 0; i < number_of_linked_items; ++i)
+ {
+ cout << "describe linked item!" << endl;
+ }
+
+ unsigned int number_of_leaders = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_leaders " << number_of_leaders << endl;
+ for(unsigned int i = 0; i < number_of_leaders; ++i)
+ {
+ cout << "describe leader!" << endl;
+ }
+
+ unsigned int number_of_markups = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_markups " << number_of_markups << endl;
+ for(unsigned int i=0; i < number_of_markups; ++i)
+ {
+ cout << "describe markup!" << endl;
+ }
+
+ unsigned int number_of_annotation_entities = mData.readUnsignedInt();
+ cout << getIndent() << "number_of_annotation_entities "
+ << number_of_annotation_entities << endl;
+ for(unsigned int i=0; i < number_of_annotation_entities; ++i)
+ {
+ cout << "describe annotation entity!" << endl;
+ }
+
+ dedent();
+}
+
+void describeAnnotationView(BitByBitData &mData)
+{
+ cout << getIndent() << "--Annotation View--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_MKP_View))
+ return;
+ indent();
+ describeContentPRCBaseWithGraphics(mData,true);
+ unsigned int number_of_annotations = mData.readUnsignedInt();
+ for(unsigned int i = 0; i < number_of_annotations; ++i)
+ {
+ //TODO: describeReferenceUniqueIdentifier(mData);
+ }
+ //TODO: describePlane(mData);
+ bool scene_display_parameters = mData.readBit();
+ if(scene_display_parameters)
+ {
+ describeSceneDisplayParameters(mData);
+ }
+ describeUserData(mData);
+ dedent();
+}
+
+void describeExtent3d(BitByBitData &mData)
+{ // I suspect the order of min/max should be flipped
+ cout << getIndent() << "Minimum" << endl;
+ indent(); describeVector3d(mData); dedent();
+ cout << getIndent() << "Maximum" << endl;
+ indent(); describeVector3d(mData); dedent();
+}
+
+void describeExtent1d(BitByBitData &mData)
+{
+ cout << getIndent() << "Minimum " << mData.readDouble() << endl;
+ cout << getIndent() << "Maximum " << mData.readDouble() << endl;
+}
+
+void describeExtent2d(BitByBitData &mData)
+{
+ cout << getIndent() << "Minimum" << endl;
+ indent(); describeVector2d(mData); dedent();
+ cout << getIndent() << "Maximum" << endl;
+ indent(); describeVector2d(mData); dedent();
+}
+
+void describeVector3d(BitByBitData &mData)
+{
+ double x = mData.readDouble();
+ double y = mData.readDouble();
+ double z = mData.readDouble();
+ cout << getIndent() << '(' << x << ',' << y << ',' << z << ')' << endl;
+}
+
+void describeVector2d(BitByBitData &mData)
+{
+ double x = mData.readDouble();
+ double y = mData.readDouble();
+ cout << getIndent() << '(' << x << ',' << y << ')' << endl;
+}
+
+void describePicture(BitByBitData &mData)
+{
+ cout << getIndent() << "--Picture--" << endl;
+ unsigned int sectionCode = mData.readUnsignedInt();
+ if(sectionCode != PRC_TYPE_GRAPH_Picture)
+ {
+ cout << getIndent() << "Invalid section code." << endl;
+ }
+
+ describeContentPRCBase(mData,false);
+
+ int format = mData.readInt();
+ switch(format)
+ {
+ case KEPRCPicture_PNG:
+ cout << getIndent() << "PNG format" << endl;
+ break;
+ case KEPRCPicture_JPG:
+ cout << getIndent() << "JPG format" << endl;
+ break;
+ case KEPRCPicture_BITMAP_RGB_BYTE:
+ cout << getIndent() << "gzipped pixel data (see PRC base compression). Each element is a RGB triple. (3 components)" << endl;
+ break;
+ case KEPRCPicture_BITMAP_RGBA_BYTE:
+ cout << getIndent() << "gzipped pixel data (see PRC base compression). Each element is a complete RGBA element. (4 components)" << endl;
+ break;
+ case KEPRCPicture_BITMAP_GREY_BYTE:
+ cout << getIndent() << "gzipped pixel data (see PRC base compression). Each element is a single luminance value. (1 components)" << endl;
+ break;
+ case KEPRCPicture_BITMAP_GREYA_BYTE:
+ cout << getIndent() << "gzipped pixel data (see PRC base compression). Each element is a luminance/alpha pair. (2 components)" << endl;
+ break;
+ default:
+ cout << getIndent() << "Invalid picture format." << endl;
+ break;
+ }
+ cout << getIndent() << "uncompressed_file_index "
+ << mData.readUnsignedInt()-1 << endl;
+ cout << getIndent() << "pixel width " << mData.readUnsignedInt() << endl;
+ cout << getIndent() << "pixel height " << mData.readUnsignedInt() << endl;
+}
+
+void describeTextureDefinition(BitByBitData &mData)
+{
+ cout << getIndent() << "--Texture Definition--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_GRAPH_TextureDefinition))
+ return;
+
+ cout << getIndent() << "TODO: Can't describe textures yet." << endl;
+}
+
+void describeMaterial(BitByBitData &mData)
+{
+ cout << getIndent() << "--Material--" << endl;
+ unsigned int code = mData.readUnsignedInt();
+ if(code == PRC_TYPE_GRAPH_Material)
+ {
+ describeContentPRCBase(mData,true);
+ cout << getIndent() << "index of ambient color "
+ << mData.readUnsignedInt() - 1 << endl;
+ cout << getIndent() << "index of diffuse color "
+ << mData.readUnsignedInt() - 1 << endl;
+ cout << getIndent() << "index of emissive color "
+ << mData.readUnsignedInt() - 1 << endl;
+ cout << getIndent() << "index of specular color "
+ << mData.readUnsignedInt() - 1 << endl;
+ cout << getIndent() << "shininess " << mData.readDouble() << endl;
+ cout << getIndent() << "ambient_alpha " << mData.readDouble() << endl;
+ cout << getIndent() << "diffuse_alpha " << mData.readDouble() << endl;
+ cout << getIndent() << "emissive_alpha " << mData.readDouble() << endl;
+ cout << getIndent() << "specular_alpha " << mData.readDouble() << endl;
+ }
+ else if(code == PRC_TYPE_GRAPH_TextureApplication)
+ {
+ describeContentPRCBase(mData,true);
+ cout << getIndent() << "material_generic_index "
+ << mData.readUnsignedInt() - 1 << endl;
+ cout << getIndent() << "texture_definition_index "
+ << mData.readUnsignedInt() - 1 << endl;
+ cout << getIndent() << "next_texture_index "
+ << mData.readUnsignedInt() - 1 << endl;
+ cout << getIndent() << "UV_coordinates_index "
+ << mData.readUnsignedInt() - 1 << endl;
+ }
+ else
+ {
+ cout << getIndent() << "Invalid section code in material definition."
+ << endl;
+ }
+}
+
+void describeLinePattern(BitByBitData &mData)
+{
+ cout << getIndent() << "--Line Pattern--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_GRAPH_LinePattern))
+ return;
+ indent();
+
+ describeContentPRCBase(mData,true);
+ unsigned int size_lengths = mData.readUnsignedInt();
+ cout << getIndent() << "size_lengths " << size_lengths << endl;
+ indent();
+ for(unsigned int i=0;i<size_lengths;i++)
+ {
+ cout << getIndent() << "length " << mData.readDouble() << endl;
+ }
+ dedent();
+ cout << getIndent() << "phase " << mData.readDouble() << endl;
+ cout << getIndent() << "is real length "
+ << (mData.readBit()?"yes":"no") << endl;
+
+ dedent();
+}
+
+void describeCategory1LineStyle(BitByBitData &mData)
+{
+ cout << getIndent() << "--Category 1 Line Style--" << endl;
+ if(!checkSectionCode(mData,PRC_TYPE_GRAPH_Style))
+ return;
+ indent();
+
+ // This was missing from the docs!!!!! argh!
+ describeContentPRCBase(mData,true);
+
+
+ cout << getIndent() << "line_width " << mData.readDouble() << " mm" << endl;
+
+ cout << getIndent() << "is_vpicture " << (mData.readBit()?"yes":"no") << endl;
+
+ cout << getIndent() << "line_pattern_index/vpicture_index "
+ << static_cast<int>(mData.readUnsignedInt()-1) << endl;
+ cout << getIndent() << "is_material " << (mData.readBit()?"yes":"no") << endl;
+ cout << getIndent() << "color_index / material_index "
+ << static_cast<int>(mData.readUnsignedInt()-1) << endl;
+
+ bool is_transparency_defined = mData.readBit();
+ cout << getIndent() << "is_transparency_defined "
+ << (is_transparency_defined?"yes":"no") << endl;
+ if(is_transparency_defined)
+ {
+ indent();
+ cout << getIndent() << "transparency "
+ << static_cast<unsigned int>(mData.readChar()) << endl;
+ dedent();
+ }
+
+ bool is_additional_1_defined = mData.readBit();
+ cout << getIndent() << "is_additional_1_defined "
+ << (is_additional_1_defined?"yes":"no") << endl;
+ if(is_additional_1_defined)
+ {
+ indent();
+ cout << getIndent() << "additional_1 "
+ << static_cast<unsigned int>(mData.readChar()) << endl;
+ dedent();
+ }
+
+ bool is_additional_2_defined = mData.readBit();
+ cout << getIndent() << "is_additional_2_defined "
+ << (is_additional_2_defined?"yes":"no") << endl;
+ if(is_additional_2_defined)
+ {
+ indent();
+ cout << getIndent() << "additional_2 "
+ << static_cast<unsigned int>(mData.readChar()) << endl;
+ dedent();
+ }
+
+ bool is_additional_3_defined = mData.readBit();
+ cout << getIndent() << "is_additional_3_defined "
+ << (is_additional_3_defined?"yes":"no") << endl;
+ if(is_additional_3_defined)
+ {
+ indent();
+ cout << getIndent() << "additional_3 "
+ << static_cast<unsigned int>(mData.readChar()) << endl;
+ dedent();
+ }
+ dedent();
+}
+
+void describeFillPattern(BitByBitData &mData)
+{
+ cout << getIndent() << "--Fill Pattern--" << endl;
+ unsigned int type = mData.readUnsignedInt();
+ cout << getIndent() << "type " << type << endl;
+ switch(type)
+ {
+ //TODO: actually describe fill patterns
+ default:
+ cout << getIndent() << "Invalid fill pattern type " << type << endl;
+ }
+}
+
+void describeRepresentationItemContent(BitByBitData &mData)
+{
+ describeContentPRCBaseWithGraphics(mData,true);
+ unsigned int index_local_coordinate_system = mData.readUnsignedInt()-1;
+ unsigned int index_tessellation = mData.readUnsignedInt()-1;
+ //cast to int will not be right for big indices
+ cout << getIndent() << "index_local_coordinate_system "
+ << static_cast<int>(index_local_coordinate_system) << endl;
+ cout << getIndent() << "index_tessellation "
+ << static_cast<int>(index_tessellation) << endl;
+}
+
+void describeRepresentationItem(BitByBitData &mData)
+{
+ cout << getIndent() << "--Representation Item--" << endl;
+ unsigned int type = mData.readUnsignedInt();
+ switch(type)
+ {
+ case PRC_TYPE_RI_Curve:
+ {
+ cout << getIndent() << "--PRC_TYPE_RI_Curve--" << endl;
+ describeRepresentationItemContent(mData);
+ bool has_wire_body = mData.readBit();
+ if(has_wire_body)
+ {
+ cout << getIndent() << "context_id " << mData.readUnsignedInt() << endl;
+ cout << getIndent() << "body_id " << mData.readUnsignedInt() << endl;
+ }
+ describeUserData(mData);
+ break;
+ }
+ case PRC_TYPE_RI_PolyBrepModel:
+ {
+ cout << getIndent() << "--PRC_TYPE_RI_PolyBrepModel--" << endl;
+ describeRepresentationItemContent(mData);
+ cout << getIndent() << "is_closed "
+ << (mData.readBit()?"yes":"no") << endl;
+ describeUserData(mData);
+ break;
+ }
+ case PRC_TYPE_RI_BrepModel:
+ {
+ cout << getIndent() << "--PRC_TYPE_RI_BrepModel--" << endl;
+ describeRepresentationItemContent(mData);
+ bool has_brep_data = mData.readBit();
+ cout << getIndent() << "has_brep_data "
+ << (has_brep_data?"yes":"no") << endl;
+ if(has_brep_data)
+ {
+ cout << getIndent() << "context_id " << mData.readUnsignedInt() << endl;
+ cout << getIndent() << "object_id " << mData.readUnsignedInt() << endl;
+ }
+ cout << getIndent() << "is_closed "
+ << (mData.readBit()?"yes":"no") << endl;
+ describeUserData(mData);
+ break;
+ }
+ case PRC_TYPE_RI_Direction:
+
+ case PRC_TYPE_RI_Plane:
+ case PRC_TYPE_RI_CoordinateSystem:
+ case PRC_TYPE_RI_PointSet:
+ case PRC_TYPE_RI_Set:
+ case PRC_TYPE_RI_PolyWire:
+ cout << getIndent() << "TODO: Unhandled representation item "
+ << type << endl;
+ break;
+ default:
+ cout << getIndent() << "Invalid representation item type "
+ << type << endl;
+ break;
+ }
+}
+
+void describeRGBColour(BitByBitData &mData)
+{
+ cout << getIndent() << "R: " << mData.readDouble();
+ cout << " G: " << mData.readDouble();
+ cout << " B: " << mData.readDouble() << endl;
+}
+
+void describeSchema(BitByBitData &mData)
+{
+ cout << getIndent() << "--Schema--" << endl;
+ indent();
+ unsigned int numSchemas = mData.readUnsignedInt();
+ cout << getIndent() << "Number of Schemas " << numSchemas << endl;
+ if(numSchemas != 0)
+ {
+ cout << "Error: Don't know how to handle multiple schemas." << endl;
+ }
+ dedent();
+}
+
+string currentName;
+int layer_index;
+int index_of_line_style;
+unsigned short behaviour_bit_field;
+
+void resetCurrentGraphics()
+{
+ layer_index = -1;
+ index_of_line_style = -1;
+ behaviour_bit_field = 1;
+}
+
+void unFlushSerialization()
+{
+ currentName = "";
+
+ resetCurrentGraphics();
+}
+
+void describeName(BitByBitData &mData)
+{
+ bool sameNameAsCurrent = mData.readBit();
+ cout << getIndent() << "Same name as current name? "
+ << (sameNameAsCurrent?"yes":"no") << endl;
+ if(!sameNameAsCurrent)
+ currentName = mData.readString();
+ cout << getIndent() << "Name \"" << currentName << '\"' << endl;
+}
+
+void describeUnit(BitByBitData &mData)
+{
+ cout << getIndent() << "Unit is from CAD file? "
+ << (mData.readBit()?"yes":"no") << endl;
+ cout << getIndent() << "Unit is " << mData.readDouble() << " mm" << endl;
+}
+
+void describeAttributes(BitByBitData &mData)
+{
+ cout << getIndent() << "--Attributes--" << endl;
+ indent();
+
+ unsigned int numAttribs = mData.readUnsignedInt();
+ cout << getIndent() << "Number of Attributes " << numAttribs << endl;
+ indent();
+ for(unsigned int i = 0; i < numAttribs; ++i)
+ {
+ cout << getIndent() << "PRC_TYPE_MISC_Attribute "
+ << mData.readUnsignedInt() << endl;
+ bool titleIsInt = mData.readBit();
+ cout << getIndent() << "Title is integer? "
+ << (titleIsInt?"yes":"no") << endl;
+ indent();
+ if(titleIsInt)
+ {
+ cout << getIndent() << "Title " << mData.readUnsignedInt() << endl;
+ }
+ else
+ {
+ cout << getIndent() << "Title \"" << mData.readString() << '\"' << endl;
+ }
+ unsigned int sizeOfAttributeKeys = mData.readUnsignedInt();
+ cout << getIndent() << "Size of Attribute Keys "
+ << sizeOfAttributeKeys << endl;
+ for(unsigned int a = 0; a < sizeOfAttributeKeys; ++a)
+ {
+ bool titleIsInt = mData.readBit();
+ cout << getIndent() << "Title is integer? "
+ << (titleIsInt?"yes":"no") << endl;
+ indent();
+ if(titleIsInt)
+ {
+ cout << getIndent() << "Title " << mData.readUnsignedInt() << endl;
+ }
+ else
+ {
+ cout << getIndent() << "Title \"" << mData.readString() << '\"' << endl;
+ }
+ dedent();
+ unsigned int attributeType = mData.readUnsignedInt();
+ cout << getIndent() << "Attribute Type " << attributeType << endl;
+ switch(attributeType)
+ {
+ case KEPRCModellerAttributeTypeInt:
+ cout << getIndent() << "Attribute Value (int) "
+ << mData.readInt() << endl;
+ break;
+ case KEPRCModellerAttributeTypeReal:
+ cout << getIndent() << "Attribute Value (double) "
+ << mData.readDouble() << endl;
+ break;
+ case KEPRCModellerAttributeTypeTime:
+ cout << getIndent() << "Attribute Value (time_t) "
+ << mData.readUnsignedInt() << endl;
+ break;
+ case KEPRCModellerAttributeTypeString:
+ cout << getIndent() << "Attribute Value (string) \""
+ << mData.readString() << '\"' << endl;
+ break;
+ default:
+ break;
+ }
+ }
+ dedent();
+
+ cout << endl;
+ }
+ dedent();
+
+
+ dedent();
+}
+
+void describeContentPRCBase(BitByBitData &mData, bool typeEligibleForReference)
+{
+ cout << getIndent() << "--ContentPRCBase--" << endl;
+ indent();
+ describeAttributes(mData);
+ describeName(mData);
+ if(typeEligibleForReference)
+ {
+ cout << getIndent() << "CAD_identifier "
+ << mData.readUnsignedInt() << endl;
+ cout << getIndent() << "CAD_persistent_identifier "
+ << mData.readUnsignedInt() << endl;
+ cout << getIndent() << "PRC_unique_identifier "
+ << mData.readUnsignedInt() << endl;
+ }
+ dedent();
+}
+
+void describeCompressedUniqueID(BitByBitData &mData)
+{
+ cout << getIndent() << "UUID: " << hex << setfill('0');
+ for(int i = 0; i < 4; ++i)
+ cout << setw(8) << mData.readUnsignedInt() << ' ';
+ cout << dec << setfill(' ') << endl;
+}
+
+void describeUserData(BitByBitData &mData)
+{
+ unsigned int bits = mData.readUnsignedInt();
+ cout << getIndent() << bits << " bits of user data" << endl;
+ indent();
+ for(unsigned int i = 0; i < bits; ++i)
+ {
+ if(i%64 == 0)
+ cout << getIndent();
+ cout << mData.readBit();
+ if(i%64 == 63)
+ cout << endl;
+ }
+ if(bits%64 != 0)
+ cout << endl;
+ dedent();
+}
+
+bool checkSectionCode(BitByBitData &mData, unsigned int code)
+{
+ unsigned int num = mData.readUnsignedInt();
+ if(code != num)
+ {
+ cout << getIndent() << "Invalid section code " << num <<
+ ". Expected " << code << " at "; mData.tellPosition();
+ return false;
+ }
+ else
+ {
+ cout << getIndent() << "Section code " << code << endl;
+ return true;
+ }
+}
+
+unsigned int currentIndent = 0;
+
+string getIndent()
+{
+ ostringstream out;
+ for(unsigned int i = 0; i < currentIndent; ++i)
+ out << " ";
+ return out.str();
+}
+
+void indent()
+{
+ ++currentIndent;
+}
+
+void dedent()
+{
+ --currentIndent;
+}
diff --git a/graphics/asymptote/prc/PRCTools/describePRC.h b/graphics/asymptote/prc/PRCTools/describePRC.h
new file mode 100644
index 0000000000..acafb875da
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/describePRC.h
@@ -0,0 +1,117 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#ifndef __DESCRIBE_PRC_H
+#define __DESCRIBE_PRC_H
+
+#include "iPRCFile.h"
+#include "bitData.h"
+
+void describeGlobals(BitByBitData&);
+void describeTree(BitByBitData&);
+void describeTessellation(BitByBitData&);
+void describeGeometry(BitByBitData&);
+void describeExtraGeometry(BitByBitData&);
+void describeModelFileData(BitByBitData&,unsigned int);
+
+void describePicture(BitByBitData&);
+void describeTextureDefinition(BitByBitData&);
+void describeMaterial(BitByBitData&);
+void describeLinePattern(BitByBitData&);
+void describeCategory1LineStyle(BitByBitData&);
+void describeFillPattern(BitByBitData&);
+void describeRepresentationItem(BitByBitData&);
+
+//void describe(BitByBitData&);
+void describeLight(BitByBitData&);
+void describeCamera(BitByBitData&);
+bool describeContentCurve(BitByBitData&);
+void describeCurvCircle(BitByBitData&);
+void describeCurvLine(BitByBitData&);
+void describeCurvNURBS(BitByBitData&);
+void describeCurvPolyLine(BitByBitData&);
+void describeContentWireEdge(BitByBitData&);
+bool isCompressedSerialType(unsigned int);
+void describeUVParametrization(BitByBitData&);
+void describeSurfNURBS(BitByBitData&);
+void describeSurfCylinder(BitByBitData&);
+void describeSurfPlane(BitByBitData&);
+void describeTopoFace(BitByBitData&);
+void describeTopoLoop(BitByBitData&);
+void describeTopoCoEdge(BitByBitData&);
+void describeTopoEdge(BitByBitData&);
+void describeTopoConnex(BitByBitData&);
+void describeTopoShell(BitByBitData&);
+void describeObject(BitByBitData&);
+void describeBaseTopology(BitByBitData&);
+void describeBaseGeometry(BitByBitData&);
+unsigned int describeContentBody(BitByBitData&);
+void describeContentSurface(BitByBitData&);
+void describeBody(BitByBitData&);
+void describeTopoContext(BitByBitData&);
+void describeLineAttr(BitByBitData&);
+void describeArrayRGBA(BitByBitData&,int,int);
+void describeContentBaseTessData(BitByBitData&);
+void describeTessFace(BitByBitData&);
+void describe3DTess(BitByBitData&);
+void describe3DWireTess(BitByBitData&);
+void describe3DMarkupTess(BitByBitData&);
+void describeHighlyCompressed3DTess(BitByBitData&);
+void describeSceneDisplayParameters(BitByBitData&);
+void describeCartesionTransformation3d(BitByBitData&);
+void describeTransformation3d(BitByBitData&);
+void describeTransformation2d(BitByBitData&);
+void describeFileStructureInternalData(BitByBitData&);
+void describeProductOccurrence(BitByBitData&);
+void describeRepresentationItemContent(BitByBitData&);
+void describeMarkups(BitByBitData&);
+void describeAnnotationView(BitByBitData&);
+void describeExtent3d(BitByBitData&);
+void describeExtent2d(BitByBitData&);
+void describeExtent1d(BitByBitData&);
+void describeVector3d(BitByBitData&);
+void describeVector2d(BitByBitData&);
+void describeContentPRCBaseWithGraphics(BitByBitData&,bool);
+void describeGraphics(BitByBitData&);
+void describePartDefinition(BitByBitData&);
+void describeRGBColour(BitByBitData&);
+void describeSchema(BitByBitData&);
+void describeName(BitByBitData&);
+void describeAttributes(BitByBitData&);
+void describeContentPRCBase(BitByBitData&,bool);
+void describeUnit(BitByBitData&);
+void describeCompressedUniqueID(BitByBitData&);
+void describeUserData(BitByBitData&);
+
+extern std::string currentName;
+extern int layer_index;
+extern int index_of_line_style;
+extern unsigned short behaviour_bit_field;
+
+void unFlushSerialization();
+void resetCurrentGraphics();
+
+bool checkSectionCode(BitByBitData&,unsigned int);
+
+std::string getIndent();
+void indent();
+void dedent();
+
+#endif // __DESCRIBE_PRC_H
diff --git a/graphics/asymptote/prc/PRCTools/extractSections.cc b/graphics/asymptote/prc/PRCTools/extractSections.cc
new file mode 100644
index 0000000000..865f159698
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/extractSections.cc
@@ -0,0 +1,46 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include <iostream>
+#include <fstream>
+#include "iPRCFile.h"
+
+using namespace std;
+
+int main(int argc, char* argv[])
+{
+ if(argc < 2)
+ {
+ cerr << "Error: Input file not specified." << endl;
+ return 1;
+ }
+ ifstream inFile(argv[1]);
+ if(!inFile)
+ {
+ cerr << "Error: Cannot open input file." << endl;
+ return 1;
+ }
+
+ iPRCFile myFile(inFile);
+ string name(argv[1]);
+ myFile.dumpSections(name.substr(0,name.find(".")).c_str());
+
+ return 0;
+}
diff --git a/graphics/asymptote/prc/PRCTools/iPRCFile.cc b/graphics/asymptote/prc/PRCTools/iPRCFile.cc
new file mode 100644
index 0000000000..02967a5478
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/iPRCFile.cc
@@ -0,0 +1,220 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include "bitData.h"
+#include "iPRCFile.h"
+#include "describePRC.h"
+
+using std::vector; using std::istream; using std::ios;
+using std::cout; using std::endl; using std::cerr;
+using std::string;
+
+using std::ofstream;
+using std::ostringstream;
+
+void iPRCFile::dumpSections(string prefix)
+{
+ ofstream out;
+
+ for(unsigned int i = 0; i < fileStructures.size(); ++i)
+ {
+ ostringstream name;
+ name << prefix << "Structure" << i;
+
+ out.open((name.str()+"-Globals.bin").c_str());
+ out.write(fileStructures[i].sections[GLOBALS_SECTION],fileStructures[i].sectionLengths[GLOBALS_SECTION]);
+ out.close();
+
+ out.open((name.str()+"-Tree.bin").c_str());
+ out.write(fileStructures[i].sections[TREE_SECTION],fileStructures[i].sectionLengths[TREE_SECTION]);
+ out.close();
+
+ out.open((name.str()+"-Tessellation.bin").c_str());
+ out.write(fileStructures[i].sections[TESSELLATION_SECTION],fileStructures[i].sectionLengths[TESSELLATION_SECTION]);
+ out.close();
+
+ out.open((name.str()+"-Geometry.bin").c_str());
+ out.write(fileStructures[i].sections[GEOMETRY_SECTION],fileStructures[i].sectionLengths[GEOMETRY_SECTION]);
+ out.close();
+
+ out.open((name.str()+"-ExtraGeometry.bin").c_str());
+ out.write(fileStructures[i].sections[EXTRA_GEOMETRY_SECTION],fileStructures[i].sectionLengths[EXTRA_GEOMETRY_SECTION]);
+ out.close();
+ }
+ out.open((prefix+"-ModelFile.bin").c_str());
+ out.write(modelFileData,modelFileLength);
+ out.close();
+}
+
+void iPRCFile::describe()
+{
+ /*
+ for(int i = 0; i < modelFileLength; ++i)
+ {
+ cout << ' ' << std::hex << std::setw(2) << std::setfill('0') << static_cast<unsigned int>(static_cast<unsigned char>(mfd.readChar()));
+ if(i%16 == 15)
+ cout << endl;
+ }
+ cout << endl;
+ */
+
+ unFlushSerialization();
+ for(unsigned int i = 0; i < fileStructures.size(); ++i)
+ {
+ cout << "File Structure " << i << ":" << endl;
+
+ //describe header
+ char *header = buffer + fileStructureInfos[i].offsets[0];
+ cout << "--Header Section--" << endl;
+ cout << " Signature " << header[0] << header[1] << header[2] << endl;
+ cout << " Minimal version for read " << *(unsigned int*)(header+3) << endl;
+ cout << " Authoring version " << *(unsigned int*)(header+7) << endl;
+ cout << std::hex;
+ cout << " File structure UUID " << *(unsigned int*)(header+11) << ' ' << *(unsigned int*)(header+15) << ' '
+ << *(unsigned int*)(header+19) << ' ' << *(unsigned int*)(header+23) << endl;
+ cout << " Application UUID " << *(unsigned int*)(header+27) << ' ' << *(unsigned int*)(header+31) << ' '
+ << *(unsigned int*)(header+35) << ' ' << *(unsigned int*)(header+39) << endl;
+ cout << std::dec;
+ // uncompressed files
+ unsigned int numberOfUncompressedFiles = *(unsigned int*)(header+43);
+ cout << "Number of uncompressed files " << numberOfUncompressedFiles << endl;
+ char *position = header+47;
+ for(unsigned int j = 0; j < numberOfUncompressedFiles; ++j)
+ {
+ cout << "Uncompressed file " << j << ":" << endl;
+ unsigned int size = *(unsigned int*)position;
+ cout << " size " << size << " bytes" << endl;
+ position += size+sizeof(unsigned int);
+ }
+
+ BitByBitData fileStruct(fileStructures[i].sections[GLOBALS_SECTION],fileStructures[i].sectionLengths[GLOBALS_SECTION]);
+ describeSchema(fileStruct);
+ describeGlobals(fileStruct);
+ unFlushSerialization();
+
+ fileStruct = BitByBitData(fileStructures[i].sections[TREE_SECTION],fileStructures[i].sectionLengths[TREE_SECTION]);
+ describeTree(fileStruct);
+ unFlushSerialization();
+
+ fileStruct = BitByBitData(fileStructures[i].sections[TESSELLATION_SECTION],fileStructures[i].sectionLengths[TESSELLATION_SECTION]);
+ describeTessellation(fileStruct);
+ unFlushSerialization();
+
+ fileStruct = BitByBitData(fileStructures[i].sections[GEOMETRY_SECTION],fileStructures[i].sectionLengths[GEOMETRY_SECTION]);
+ describeGeometry(fileStruct);
+ unFlushSerialization();
+
+ fileStruct = BitByBitData(fileStructures[i].sections[EXTRA_GEOMETRY_SECTION],fileStructures[i].sectionLengths[EXTRA_GEOMETRY_SECTION]);
+ describeExtraGeometry(fileStruct);
+ unFlushSerialization();
+ }
+
+ BitByBitData mfd(modelFileData,modelFileLength);
+
+ describeSchema(mfd);
+ describeModelFileData(mfd,fileStructures.size());
+ unFlushSerialization();
+}
+
+iPRCFile::iPRCFile(istream& in)
+{
+ char PRC[3];
+ in.read(PRC,3);
+ if(PRC[0] != 'P' || PRC[1] != 'R' || PRC[2] != 'C')
+ {
+ cerr << "Error: Invalid file format: PRC not found." << endl;
+ }
+ unsigned int versionForRead,authoringVersion;
+ in.read((char*)&versionForRead,sizeof(versionForRead));
+ in.read((char*)&authoringVersion,sizeof(authoringVersion));
+ cout << "Version for reading " << versionForRead << endl;
+ cout << "Authoring version " << authoringVersion << endl;
+ unsigned int fileStructureUUID[4];
+ in.read((char*)fileStructureUUID,sizeof(fileStructureUUID));
+ //(void*) is for formatting
+ cout << "File structure UUID " << (void*)(fileStructureUUID[0]) << ' ' << (void*)(fileStructureUUID[1]) << ' '
+ << (void*)(fileStructureUUID[2]) << ' ' << (void*)(fileStructureUUID[3]) << endl;
+ unsigned int applicationUUID[4];
+ in.read((char*)applicationUUID,sizeof(applicationUUID));
+ cout << "Application UUID " << (void*)(applicationUUID[0]) << ' ' << (void*)(applicationUUID[1]) << ' '
+ << (void*)(applicationUUID[2]) << ' ' << (void*)(applicationUUID[3]) << endl;
+ unsigned int numberOfFileStructures;
+ in.read((char*)&numberOfFileStructures,sizeof(numberOfFileStructures));
+ cout << "number of file structures " << numberOfFileStructures << endl;
+
+ // load fileStructureInformation
+ for(unsigned int fsi = 0; fsi < numberOfFileStructures; ++fsi)
+ {
+ FileStructureInformation info;
+ in.read((char*)&info.UUID,sizeof(info.UUID));
+ cout << "\tFile structure UUID " << (void*)(info.UUID[0]) << ' ' << (void*)(info.UUID[1]) << ' '
+ << (void*)(info.UUID[2]) << ' ' << (void*)(info.UUID[3]) << endl;
+
+ in.read((char*)&info.reserved,sizeof(info.reserved));
+ cout << "\tReserved " << info.reserved << endl;
+
+ unsigned int numberOfOffsets;
+ in.read((char*)&numberOfOffsets,sizeof(numberOfOffsets));
+ cout << "\tNumber of Offsets " << numberOfOffsets << endl;
+
+ for(unsigned int oi = 0; oi < numberOfOffsets; ++oi)
+ {
+ unsigned int offset;
+ in.read((char*)&offset,sizeof(offset));
+ info.offsets.push_back(offset);
+ cout << "\t\tOffset " << offset << endl;
+ }
+ fileStructureInfos.push_back(info);
+ }
+ in.read((char*)&modelFileOffset,sizeof(modelFileOffset));
+ cout << "Model file offset " << modelFileOffset << endl;
+ in.read((char*)&fileSize,sizeof(fileSize)); // this is not documented
+ cout << "File size " << fileSize << endl;
+
+ in.read((char*)&numberOfUncompressedFiles,sizeof(numberOfUncompressedFiles));
+ cout << "Number of uncompressed files " << numberOfUncompressedFiles << endl;
+ for(unsigned int ufi = 0; ufi < numberOfUncompressedFiles; ++ufi)
+ {
+ unsigned int size;
+ in.read((char*)&size,sizeof(size));
+ in.seekg(size,ios::cur);
+ }
+
+ //read the whole file into memory
+ in.seekg(0,ios::beg);
+ buffer = new char[fileSize];
+ if(!buffer) cerr << "Couldn't get memory." << endl;
+ in.read(buffer,fileSize);
+ //decompress fileStructures
+ for(unsigned int fs = 0; fs < fileStructureInfos.size(); ++fs)
+ {
+ fileStructures.push_back(FileStructure());
+ for(unsigned int i = 1; i < fileStructureInfos[fs].offsets.size(); ++i) // start at 1 since header is decompressed
+ {
+ fileStructures[fs].sections[i-1] = NULL;
+ unsigned int offset = fileStructureInfos[fs].offsets[i];
+ fileStructures[fs].sectionLengths[i-1] = decompress(buffer+offset,fileSize-offset,fileStructures[fs].sections[i-1]);
+ }
+ }
+
+ //decompress modelFileData
+ modelFileData = NULL;
+ modelFileLength = decompress(buffer+modelFileOffset,fileSize-modelFileOffset,modelFileData);
+}
diff --git a/graphics/asymptote/prc/PRCTools/iPRCFile.h b/graphics/asymptote/prc/PRCTools/iPRCFile.h
new file mode 100644
index 0000000000..2622cb966d
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/iPRCFile.h
@@ -0,0 +1,88 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#ifndef __READPRC_H
+#define __READPRC_H
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include <sstream>
+#include <iomanip>
+#include "../PRC.h"
+#include "inflation.h"
+
+struct FileStructureInformation
+{
+ unsigned int UUID[4];
+ unsigned int reserved;
+ std::vector<unsigned int> offsets;
+};
+
+
+const int GLOBALS_SECTION = 0;
+const int TREE_SECTION = 1;
+const int TESSELLATION_SECTION = 2;
+const int GEOMETRY_SECTION = 3;
+const int EXTRA_GEOMETRY_SECTION = 4;
+
+struct FileStructure
+{
+ unsigned int readVersion;
+ unsigned int authoringVersion;
+ unsigned int fileUUID[4];
+ unsigned int appUUID[4];
+ char* sections[5];
+ unsigned int sectionLengths[5];
+};
+
+class iPRCFile
+{
+ public:
+ iPRCFile(std::istream&);
+
+ ~iPRCFile()
+ {
+ for(unsigned int i = 0; i < fileStructures.size(); ++i)
+ for(unsigned int j = 0; j < 5; ++j)
+ if(fileStructures[i].sections[j] != NULL)
+ free(fileStructures[i].sections[j]);
+ if(modelFileData!=NULL)
+ free(modelFileData);
+ if(buffer != 0)
+ delete[] buffer;
+ }
+
+ void describe();
+ void dumpSections(std::string);
+
+ private:
+ // header data
+ std::vector<FileStructureInformation> fileStructureInfos;
+ std::vector<FileStructure> fileStructures;
+ unsigned int modelFileOffset;
+ char* modelFileData;
+ unsigned int modelFileLength;
+ char *buffer;
+ unsigned int fileSize;
+ unsigned int numberOfUncompressedFiles;
+};
+#endif // __READPRC_H
diff --git a/graphics/asymptote/prc/PRCTools/inflation.cc b/graphics/asymptote/prc/PRCTools/inflation.cc
new file mode 100644
index 0000000000..1b2d3c9686
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/inflation.cc
@@ -0,0 +1,90 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include "inflation.h"
+
+using std::istream;
+using std::ios;
+using std::cout;
+using std::cerr;
+using std::endl;
+using std::exit;
+
+int decompress(char* inb, int fileLength, char* &outb)
+{
+ const int CHUNK = 16384;
+ unsigned int resultSize = 0;
+
+ outb = (char*) realloc(outb,CHUNK);
+ z_stream strm;
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.avail_in = fileLength;
+ strm.next_in = (unsigned char*)inb;
+ strm.opaque = Z_NULL;
+ int code = inflateInit(&strm);
+
+ if(code != Z_OK)
+ return -1;
+
+ strm.next_out = (unsigned char*)outb;
+ strm.avail_out = CHUNK;
+ code = inflate(&strm,Z_NO_FLUSH);
+ resultSize = CHUNK-strm.avail_out;
+
+ unsigned int size = CHUNK;
+ while(code == Z_OK)
+ {
+ outb = (char*) realloc(outb,2*size);
+ if(outb == NULL)
+ {
+ cerr << "Ran out of memory while decompressing." << endl;
+ exit(1);
+ }
+ strm.next_out = (Bytef*)(outb + resultSize);
+ strm.avail_out += size;
+ size *= 2;
+ code = inflate(&strm,Z_NO_FLUSH);
+ resultSize = size - strm.avail_out;
+ }
+
+ code = inflateEnd(&strm);
+ if(code != Z_OK)
+ {
+ free(outb);
+ return 0;
+ }
+
+ return resultSize;
+}
+
+int decompress(istream &input,char* &result)
+{
+ input.seekg(0,ios::end);
+ int fileLength = input.tellg();
+ input.seekg(0,ios::beg);
+
+ char *inb = new char[fileLength];
+ input.read(inb,fileLength);
+
+ int code = decompress(inb,fileLength,result);
+ delete[] inb;
+ return code;
+}
diff --git a/graphics/asymptote/prc/PRCTools/inflation.h b/graphics/asymptote/prc/PRCTools/inflation.h
new file mode 100644
index 0000000000..79d29caa7f
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/inflation.h
@@ -0,0 +1,31 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#ifndef __INFLATION_H
+#define __INFLATION_H
+
+#include <iostream>
+#include <cstdlib>
+#include <zlib.h>
+
+int decompress(std::istream&,char*&);
+int decompress(char*,int,char*&);
+
+#endif // __INFLATION_H
diff --git a/graphics/asymptote/prc/PRCTools/inflationMain.cc b/graphics/asymptote/prc/PRCTools/inflationMain.cc
new file mode 100644
index 0000000000..81beefd26d
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/inflationMain.cc
@@ -0,0 +1,55 @@
+/************
+*
+* This file is part of a tool for reading 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include <cstdlib>
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include "inflation.h"
+
+using namespace std;
+
+int main(int argc, char *argv[])
+{
+ if(argc < 2)
+ {
+ cerr << "No file specified." << endl;
+ return 1;
+ }
+
+ ifstream data(argv[1]);
+
+ char *buff = NULL;
+ int dataSize = decompress(data,buff);
+
+ cout << hex;
+
+ for(int i = 0; i < dataSize; ++i)
+ {
+ cout << ' ' << setw(2) << setfill('0')
+ << static_cast<unsigned int>(static_cast<unsigned char>(buff[i]));
+ if(i%16 == 15)
+ cout << endl;
+ }
+ cout << endl << dec << dataSize << " bytes" << endl;
+ free(buff);
+
+ return 0;
+}
diff --git a/graphics/asymptote/prc/PRCTools/makePRC.cc b/graphics/asymptote/prc/PRCTools/makePRC.cc
new file mode 100644
index 0000000000..f757300020
--- /dev/null
+++ b/graphics/asymptote/prc/PRCTools/makePRC.cc
@@ -0,0 +1,187 @@
+/************
+*
+* This file is part of a tool for producing 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <unistd.h>
+#include <cstdlib>
+#include "../oPRCFile.h"
+
+using namespace std;
+
+void readPoints(istream &is, unsigned int n, double p[][3])
+{
+ for(unsigned int i = 0; i < n; ++i)
+ {
+ is >> p[i][0] >> p[i][1] >> p[i][2];
+ }
+ if(!is)
+ {
+ cerr << "Error reading list of points." << endl;
+ exit(1);
+ }
+}
+
+void readDoubles(istream &is, unsigned int n, double d[])
+{
+ for(unsigned int i = 0; i < n; ++i)
+ {
+ is >> d[i];
+ }
+ if(!is)
+ {
+ cerr << "Error reading list of doubles." << endl;
+ exit(1);
+ }
+}
+
+int main(int argc, char **argv)
+{
+ const char *oFileName = "output.prc";
+
+ int c;
+ opterr = 0;
+ while ((c = getopt (argc, argv, "o:")) != -1)
+ switch (c)
+ {
+ case 'o':
+ oFileName = optarg;
+ break;
+ case '?':
+ if (optopt == 'o')
+ cerr << "Option '-o' requires an argument, the filename." << endl;
+ else
+ cerr << "Unrecognized option '-" << (char)optopt << "'." << endl;
+ exit(1);
+ break;
+ default:
+ exit(1);
+ }
+ istream *ins = NULL;
+ if(optind < argc)
+ {
+ ins = new ifstream(argv[optind]);
+ if(!*ins)
+ {
+ cerr << "Error opening input file " << argv[optind] << endl;
+ exit(1);
+ }
+ }
+ else
+ {
+ ins = &cin;
+ }
+
+ ofstream outf(oFileName);
+ if(!outf)
+ {
+ cerr << "Error opening output file " << oFileName << endl;
+ exit(1);
+ }
+
+ oPRCFile oPRC(outf);
+
+ string entityType;
+ while(*ins)
+ {
+ *ins >> entityType;
+ if(!*ins) break;
+ if(entityType == "Line")
+ {
+ double r,g,b,a;
+ unsigned int numberOfPoints;
+ *ins >> r >> g >> b >> a >> numberOfPoints;
+ if(!*ins)
+ {
+ cerr << "Error reading line data." << endl;
+ exit(1);
+ }
+ else
+ {
+ double (*points)[3] = new double[numberOfPoints][3];
+ readPoints(*ins,numberOfPoints,points);
+ oPRC.add(new PRCline(&oPRC,numberOfPoints,points,
+ *new RGBAColour(r,g,b,a)));
+ }
+ }
+ else if(entityType == "Curve")
+ {
+ double r,g,b,a;
+ unsigned int numberOfPoints;
+ unsigned int degree;
+ *ins >> r >> g >> b >> a >> degree >> numberOfPoints;
+ if(!*ins)
+ {
+ cerr << "Error reading curve data." << endl;
+ exit(1);
+ }
+ else
+ {
+ double (*points)[3] = new double[numberOfPoints][3];
+ double *knots = new double[degree+numberOfPoints+1];
+ readPoints(*ins,numberOfPoints,points);
+ readDoubles(*ins,degree+numberOfPoints+1,knots);
+ oPRC.add(new PRCcurve(&oPRC,degree,numberOfPoints,points,
+ knots,*new RGBAColour(r,g,b,a)));
+ }
+ }
+ else if(entityType == "Surface")
+ {
+ double r,g,b,a;
+ unsigned int numberOfPointsU,numberOfPointsV;
+ unsigned int degreeU,degreeV;
+ *ins >> r >> g >> b >> a >> degreeU >> degreeV >> numberOfPointsU
+ >> numberOfPointsV;
+ if(!*ins)
+ {
+ cerr << "Error reading surface data." << endl;
+ exit(1);
+ }
+ else
+ {
+ double (*points)[3] = new double[numberOfPointsU*numberOfPointsV][3];
+ double *knotsU = new double[degreeU+numberOfPointsU+1];
+ double *knotsV = new double[degreeV+numberOfPointsV+1];
+ readPoints(*ins,numberOfPointsU*numberOfPointsV,points);
+ readDoubles(*ins,degreeU+numberOfPointsU+1,knotsU);
+ readDoubles(*ins,degreeV+numberOfPointsV+1,knotsV);
+ oPRC.add(new PRCsurface(&oPRC,degreeU,degreeV,numberOfPointsU,
+ numberOfPointsV,points,knotsU,knotsV,
+ *new RGBAColour(r,g,b,a)));
+ }
+ }
+ else
+ {
+ cerr << "Unrecognized entity type " << entityType << endl;
+ exit(1);
+ }
+ }
+
+ if(ins && ins != &cin)
+ delete ins;
+
+
+ oPRC.finish();
+
+ outf.close();
+
+ return 0;
+}
diff --git a/graphics/asymptote/prc/PRCbitStream.cc b/graphics/asymptote/prc/PRCbitStream.cc
new file mode 100644
index 0000000000..9b18186a46
--- /dev/null
+++ b/graphics/asymptote/prc/PRCbitStream.cc
@@ -0,0 +1,404 @@
+/************
+*
+* This file is part of a tool for producing 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include <iostream>
+#include <zlib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <cassert>
+#include "PRCbitStream.h"
+#include "PRCdouble.h"
+
+using std::string;
+using std::cerr;
+using std::endl;
+
+void PRCbitStream::compress()
+{
+ const int CHUNK= 1024; // is this reasonable?
+ compressedDataSize = 0;
+
+ z_stream strm;
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.opaque = Z_NULL;
+ if(deflateInit(&strm,Z_DEFAULT_COMPRESSION) != Z_OK)
+ {
+ cerr << "Compression initialization failed" << endl;
+ return;
+ }
+ unsigned int sizeAvailable = deflateBound(&strm,getSize());
+ uint8_t *compressedData = (uint8_t*) malloc(sizeAvailable);
+ strm.avail_in = getSize();
+ strm.next_in = (unsigned char*)data;
+ strm.next_out = (unsigned char*)compressedData;
+ strm.avail_out = sizeAvailable;
+
+ int code;
+ unsigned int chunks = 0;
+ while((code = deflate(&strm,Z_FINISH)) == Z_OK)
+ {
+ ++chunks;
+ // strm.avail_out should be 0 if we got Z_OK
+ compressedDataSize = sizeAvailable - strm.avail_out;
+ compressedData = (uint8_t*) realloc(compressedData,CHUNK*chunks);
+ strm.next_out = (Bytef*)(compressedData + compressedDataSize);
+ strm.avail_out += CHUNK;
+ sizeAvailable += CHUNK;
+ }
+ compressedDataSize = sizeAvailable-strm.avail_out;
+
+ if(code != Z_STREAM_END)
+ {
+ cerr << "Compression error" << endl;
+ deflateEnd(&strm);
+ free(compressedData);
+ return;
+ }
+
+ compressed = true;
+
+ free(data);
+ data = compressedData;
+
+ deflateEnd(&strm);
+}
+
+void PRCbitStream::write(std::ostream &out) const
+{
+ if(compressed)
+ {
+ out.write((char*)data,compressedDataSize);
+ }
+ else
+ {
+ cerr << "Attempt to write stream before compression." << endl;
+ exit(1);
+ }
+}
+
+unsigned int PRCbitStream::getSize() const
+{
+ if(compressed)
+ return compressedDataSize;
+ else
+ return byteIndex+1;
+}
+
+uint8_t* PRCbitStream::getData()
+{
+ return data;
+}
+
+PRCbitStream& PRCbitStream::operator <<(bool b)
+{
+ writeBit(b);
+ return *this;
+}
+
+PRCbitStream& PRCbitStream::operator <<(uint32_t u)
+{
+ while(u != 0)
+ {
+ writeBit(1);
+ writeByte(u & 0xFF);
+ u >>= 8;
+ }
+ writeBit(0);
+ return *this;
+}
+
+PRCbitStream& PRCbitStream::operator <<(uint8_t u)
+{
+ writeByte(u);
+ return *this;
+}
+
+PRCbitStream& PRCbitStream::operator <<(int32_t i)
+{
+ uint8_t lastByte = 0;
+ //while(!((current value is 0 and last byte was positive) OR (current value is -1 and last value was negative)))
+ while(!(((i == 0)&&((lastByte & 0x80)==0))||((i == -1)&&((lastByte & 0x80) != 0))))
+ {
+ writeBit(1);
+ lastByte = i & 0xFF;
+ writeByte(lastByte);
+ i >>= 8;
+ }
+ writeBit(0);
+ return *this;
+}
+
+PRCbitStream& PRCbitStream::operator <<(double value)
+{
+ // write a double
+ if(compressed)
+ {
+ cerr << "Cannot write to a stream that has been compressed." << endl;
+ return *this;
+ }
+ union ieee754_double *pid=(union ieee754_double *)&value;
+ int
+ i,
+ fSaveAtEnd;
+ PRCbyte
+ *pb,
+ *pbStart,
+ *pbStop,
+ *pbEnd,
+ *pbResult,
+ bSaveAtEnd = 0;
+ struct sCodageOfFrequentDoubleOrExponent
+ cofdoe,
+ *pcofdoe;
+
+ cofdoe.u2uod.Value=value;
+ pcofdoe = (struct sCodageOfFrequentDoubleOrExponent *)bsearch(
+ &cofdoe,
+ acofdoe,
+ sizeof(acofdoe)/sizeof(pcofdoe[0]),
+ sizeof(pcofdoe[0]),
+ stCOFDOECompare);
+
+ while(pcofdoe>acofdoe && EXPONENT(pcofdoe->u2uod.Value)==EXPONENT((pcofdoe-1)->u2uod.Value))
+ pcofdoe--;
+
+ assert(pcofdoe);
+ while(pcofdoe->Type==VT_double)
+ {
+ if(fabs(value)==pcofdoe->u2uod.Value)
+ break;
+ pcofdoe++;
+ }
+
+ for(i=1<<(pcofdoe->NumberOfBits-1);i>=1;i>>=1)
+ writeBit((pcofdoe->Bits&i)!=0);
+
+ if
+ (
+ !memcmp(&value,stadwZero,sizeof(value))
+ || !memcmp(&value,stadwNegativeZero,sizeof(value))
+ )
+ return *this;
+
+ writeBit(pid->ieee.negative);
+
+ if(pcofdoe->Type==VT_double)
+ return *this;
+
+ if(pid->ieee.mantissa0==0 && pid->ieee.mantissa1==0)
+ {
+ writeBit(0);
+ return *this;
+ }
+
+ writeBit(1);
+
+#ifdef WORDS_BIGENDIAN
+ pb=((PRCbyte *)&value)+1;
+#else
+ pb=((PRCbyte *)&value)+6;
+#endif
+ //add_bits((*pb)&0x0f,4 STAT_V STAT_DOUBLE);
+ writeBits((*pb)&0x0F,4);
+
+ NEXTBYTE(pb);
+ pbStart=pb;
+#ifdef WORDS_BIGENDIAN
+ pbEnd=
+ pbStop= ((PRCbyte *)(&value+1))-1;
+#else
+ pbEnd=
+ pbStop= ((PRCbyte *)&value);
+#endif
+
+ if((fSaveAtEnd=(*pbStop!=*BEFOREBYTE(pbStop)))!=0)
+ bSaveAtEnd=*pbEnd;
+ PREVIOUSBYTE(pbStop);
+
+ while(*pbStop==*BEFOREBYTE(pbStop))
+ PREVIOUSBYTE(pbStop);
+
+ for(;MOREBYTE(pb,pbStop);NEXTBYTE(pb))
+ {
+ if(pb!=pbStart && (pbResult=SEARCHBYTE(BEFOREBYTE(pb),*pb,DIFFPOINTERS(pb,pbStart)))!=NULL)
+ {
+ writeBit(0);
+ writeBits(DIFFPOINTERS(pb,pbResult),3);
+ }
+ else
+ {
+ writeBit(1);
+ writeByte(*pb);
+ }
+ }
+
+ if(!MOREBYTE(BEFOREBYTE(pbEnd),pbStop))
+ {
+ if(fSaveAtEnd)
+ {
+ writeBit(0);
+ writeBits(6,3);
+ writeByte(bSaveAtEnd);
+ }
+ else
+ {
+ writeBit(0);
+ writeBits(0,3);
+ }
+ }
+ else
+ {
+ if((pbResult=SEARCHBYTE(BEFOREBYTE(pb),*pb,DIFFPOINTERS(pb,pbStart)))!=NULL)
+ {
+ writeBit(0);
+ writeBits(DIFFPOINTERS(pb,pbResult),3);
+ }
+ else
+ {
+ writeBit(1);
+ writeByte(*pb);
+ }
+ }
+
+ return *this;
+}
+
+PRCbitStream& PRCbitStream::operator <<(const char* s)
+{
+ if (s == NULL)
+ {
+ writeBit(false); // string is NULL
+ return *this;
+ }
+ string str(s);
+ *this << str;
+ return *this;
+}
+
+PRCbitStream& PRCbitStream::operator <<(const string& s)
+{
+ if(s == "")
+ {
+ writeBit(false); // string is NULL
+ return *this;
+ }
+ writeBit(true);
+ size_t l = s.length();
+ *this << static_cast<uint32_t>(l);
+ for(size_t i = 0; i < l; ++i)
+ writeByte(s[i]);
+ return *this;
+}
+
+void PRCbitStream::writeBit(bool b)
+{
+ if(compressed)
+ {
+ cerr << "Cannot write to a stream that has been compressed." << endl;
+ return;
+ }
+
+ if(b)
+ {
+ data[byteIndex] |= (0x80 >> bitIndex);
+ }
+ nextBit();
+}
+
+void PRCbitStream::writeBits(uint32_t u, uint8_t bits)
+{
+ if(bits > 32)
+ return;
+ else
+ {
+ for(uint32_t mask = (1 << (bits-1)); mask != 0; mask >>= 1)
+ {
+ writeBit((u&mask) != 0);
+ }
+ }
+}
+
+void PRCbitStream::writeByte(uint8_t u)
+{
+ if(compressed)
+ {
+ cerr << "Cannot write to a stream that has been compressed." << endl;
+ return;
+ }
+
+ if(bitIndex == 0)
+ {
+ data[byteIndex] = u;
+ nextByte();
+ }
+ else
+ {
+ data[byteIndex] |= (u >> bitIndex);
+ unsigned int obi = bitIndex;
+ nextByte();
+ data[byteIndex] |= (u << (8-obi));
+ bitIndex = obi; // bit index is not changed by writing 8 bits
+ }
+}
+
+void PRCbitStream::nextBit()
+{
+ ++bitIndex;
+ if(bitIndex == 8)
+ {
+ nextByte();
+ }
+}
+
+void PRCbitStream::nextByte()
+{
+ ++byteIndex;
+ if(byteIndex >= allocatedLength)
+ getAChunk();
+ data[byteIndex] = 0; // clear the garbage data
+ bitIndex = 0;
+}
+
+void PRCbitStream::getAChunk()
+{
+ if(allocatedLength==0)
+ data = (uint8_t*)realloc((void*)data,CHUNK_SIZE);
+ else
+ data = (uint8_t*)realloc((void*)data,2*allocatedLength);
+
+ if(data != NULL)
+ {
+ if(allocatedLength==0)
+ {
+ allocatedLength = CHUNK_SIZE;
+ *data = 0; // clear first byte
+ }
+ else
+ allocatedLength *= 2;
+ }
+ else
+ {
+ // warn about memory problem!
+ cerr << "Memory allocation error." << endl;
+ exit(1);
+ }
+}
diff --git a/graphics/asymptote/prc/PRCbitStream.h b/graphics/asymptote/prc/PRCbitStream.h
new file mode 100644
index 0000000000..5f189e428b
--- /dev/null
+++ b/graphics/asymptote/prc/PRCbitStream.h
@@ -0,0 +1,87 @@
+/************
+*
+* This file is part of a tool for producing 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#ifndef __PRC_BIT_STREAM_H
+#define __PRC_BIT_STREAM_H
+
+#ifdef _MSC_VER
+#include <stdio.h>
+#if _MSC_VER >= 1600
+#include <stdint.h>
+#else
+typedef signed char int8_t;
+typedef signed short int16_t;
+typedef signed long int32_t;
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned long uint32_t;
+#endif // _MSC_VER >= 1600
+#else
+#include <inttypes.h>
+#endif // _MSC_VER
+#include <string>
+#include <iostream>
+#include <stdlib.h>
+
+#define CHUNK_SIZE (1024)
+// Is this a reasonable initial size?
+
+class PRCbitStream
+{
+ public:
+ PRCbitStream(uint8_t*& buff, unsigned int l) : byteIndex(0), bitIndex(0),
+ allocatedLength(l), data(buff), compressed(false)
+ {
+ if(data == 0)
+ {
+ getAChunk();
+ }
+ }
+
+ unsigned int getSize() const;
+ uint8_t* getData();
+
+ PRCbitStream& operator <<(const std::string&);
+ PRCbitStream& operator <<(bool);
+ PRCbitStream& operator <<(uint32_t);
+ PRCbitStream& operator <<(uint8_t);
+ PRCbitStream& operator <<(int32_t);
+ PRCbitStream& operator <<(double);
+ PRCbitStream& operator <<(const char*);
+
+ void compress();
+ void write(std::ostream &out) const;
+ private:
+ void writeBit(bool);
+ void writeBits(uint32_t,uint8_t);
+ void writeByte(uint8_t);
+ void nextByte();
+ void nextBit();
+ void getAChunk();
+ // bitIndex is "big endian", zero based, location of next bit to write
+ unsigned int byteIndex,bitIndex;
+ unsigned int allocatedLength;
+ uint8_t*& data;
+ bool compressed;
+ uint32_t compressedDataSize;
+};
+
+#endif // __PRC_BIT_STREAM_H
diff --git a/graphics/asymptote/prc/PRCdouble.cc b/graphics/asymptote/prc/PRCdouble.cc
new file mode 100644
index 0000000000..69d4b02f16
--- /dev/null
+++ b/graphics/asymptote/prc/PRCdouble.cc
@@ -0,0 +1,2121 @@
+#include "PRCdouble.h"
+
+// from Adobe's documentation
+
+PRCdword stadwZero[2]={DOUBLEWITHTWODWORD(0x00000000,0x00000000)};
+PRCdword stadwNegativeZero[2]={DOUBLEWITHTWODWORD(0x80000000,0x00000000)};
+
+struct sCodageOfFrequentDoubleOrExponent* getcofdoe(unsigned Bits, short NumberOfBits)
+{
+ struct sCodageOfFrequentDoubleOrExponent *pcofdoe;
+ for(pcofdoe=acofdoe; pcofdoe < acofdoe+NUMBEROFELEMENTINACOFDOE; ++pcofdoe)
+ {
+ if(pcofdoe->NumberOfBits == NumberOfBits && pcofdoe->Bits == Bits)
+ return pcofdoe;
+ }
+ return NULL;
+}
+
+int stCOFDOECompare(const void* pcofdoe1,const void* pcofdoe2)
+{
+ return(EXPONENT(((const struct sCodageOfFrequentDoubleOrExponent *)pcofdoe1)->u2uod.Value)-
+ EXPONENT(((const struct sCodageOfFrequentDoubleOrExponent *)pcofdoe2)->u2uod.Value));
+}
+
+#ifdef WORDS_BIGENDIAN
+#ifndef HAVE_MEMRCHR
+void *memrchr(const void *buf,int c,size_t count)
+{
+ unsigned char
+ *pcBuffer=(unsigned char *)buf,
+ *pcBufferEnd=pcBuffer-count;
+
+ for(;pcBuffer>pcBufferEnd;pcBuffer--)
+ if(*pcBuffer==c)
+ return(pcBuffer);
+
+ return(NULL);
+}
+#endif
+#endif
+
+sCodageOfFrequentDoubleOrExponent acofdoe[NUMBEROFELEMENTINACOFDOE] =
+{
+ {VT_double,2,0x1,{DOUBLEWITHTWODWORDINTREE(0x00000000,0x00000000)}},
+ {VT_exponent,22,0xd1d32,{DOUBLEWITHTWODWORDINTREE(0x00000000,0x00000000)}},
+ {VT_exponent,22,0xd1d33,{DOUBLEWITHTWODWORDINTREE(0x00100000,0x00000000)}},
+ {VT_exponent,22,0xf78d8,{DOUBLEWITHTWODWORDINTREE(0x00200000,0x00000000)}},
+ {VT_exponent,22,0xf78d9,{DOUBLEWITHTWODWORDINTREE(0x00300000,0x00000000)}},
+ {VT_exponent,22,0xf78da,{DOUBLEWITHTWODWORDINTREE(0x00400000,0x00000000)}},
+ {VT_exponent,22,0xf78db,{DOUBLEWITHTWODWORDINTREE(0x00500000,0x00000000)}},
+ {VT_exponent,22,0xf78dc,{DOUBLEWITHTWODWORDINTREE(0x00600000,0x00000000)}},
+ {VT_exponent,22,0xf78dd,{DOUBLEWITHTWODWORDINTREE(0x00700000,0x00000000)}},
+ {VT_exponent,22,0xf78de,{DOUBLEWITHTWODWORDINTREE(0x00800000,0x00000000)}},
+ {VT_exponent,22,0xf78df,{DOUBLEWITHTWODWORDINTREE(0x00900000,0x00000000)}},
+ {VT_exponent,22,0xf78e0,{DOUBLEWITHTWODWORDINTREE(0x00a00000,0x00000000)}},
+ {VT_exponent,22,0xf78e1,{DOUBLEWITHTWODWORDINTREE(0x00b00000,0x00000000)}},
+ {VT_exponent,22,0xf78e2,{DOUBLEWITHTWODWORDINTREE(0x00c00000,0x00000000)}},
+ {VT_exponent,22,0xf78e3,{DOUBLEWITHTWODWORDINTREE(0x00d00000,0x00000000)}},
+ {VT_exponent,22,0xf78e4,{DOUBLEWITHTWODWORDINTREE(0x00e00000,0x00000000)}},
+ {VT_exponent,22,0xf78e5,{DOUBLEWITHTWODWORDINTREE(0x00f00000,0x00000000)}},
+ {VT_exponent,22,0xf78e6,{DOUBLEWITHTWODWORDINTREE(0x01000000,0x00000000)}},
+ {VT_exponent,22,0xf78e7,{DOUBLEWITHTWODWORDINTREE(0x01100000,0x00000000)}},
+ {VT_exponent,22,0xf78e8,{DOUBLEWITHTWODWORDINTREE(0x01200000,0x00000000)}},
+ {VT_exponent,22,0xf78e9,{DOUBLEWITHTWODWORDINTREE(0x01300000,0x00000000)}},
+ {VT_exponent,22,0xf78ea,{DOUBLEWITHTWODWORDINTREE(0x01400000,0x00000000)}},
+ {VT_exponent,22,0xf78eb,{DOUBLEWITHTWODWORDINTREE(0x01500000,0x00000000)}},
+ {VT_exponent,22,0xf78ec,{DOUBLEWITHTWODWORDINTREE(0x01600000,0x00000000)}},
+ {VT_exponent,22,0xf78ed,{DOUBLEWITHTWODWORDINTREE(0x01700000,0x00000000)}},
+ {VT_exponent,22,0xf78ee,{DOUBLEWITHTWODWORDINTREE(0x01800000,0x00000000)}},
+ {VT_exponent,22,0xf78ef,{DOUBLEWITHTWODWORDINTREE(0x01900000,0x00000000)}},
+ {VT_exponent,22,0xf78f0,{DOUBLEWITHTWODWORDINTREE(0x01a00000,0x00000000)}},
+ {VT_exponent,22,0xf78f1,{DOUBLEWITHTWODWORDINTREE(0x01b00000,0x00000000)}},
+ {VT_exponent,22,0xf78f2,{DOUBLEWITHTWODWORDINTREE(0x01c00000,0x00000000)}},
+ {VT_exponent,22,0xf78f3,{DOUBLEWITHTWODWORDINTREE(0x01d00000,0x00000000)}},
+ {VT_exponent,22,0xf78f4,{DOUBLEWITHTWODWORDINTREE(0x01e00000,0x00000000)}},
+ {VT_exponent,22,0xf78f5,{DOUBLEWITHTWODWORDINTREE(0x01f00000,0x00000000)}},
+ {VT_exponent,22,0xf78f6,{DOUBLEWITHTWODWORDINTREE(0x02000000,0x00000000)}},
+ {VT_exponent,22,0xf78f7,{DOUBLEWITHTWODWORDINTREE(0x02100000,0x00000000)}},
+ {VT_exponent,22,0xf78f8,{DOUBLEWITHTWODWORDINTREE(0x02200000,0x00000000)}},
+ {VT_exponent,22,0xf78f9,{DOUBLEWITHTWODWORDINTREE(0x02300000,0x00000000)}},
+ {VT_exponent,22,0xf78fa,{DOUBLEWITHTWODWORDINTREE(0x02400000,0x00000000)}},
+ {VT_exponent,22,0xf78fb,{DOUBLEWITHTWODWORDINTREE(0x02500000,0x00000000)}},
+ {VT_exponent,22,0xf78fc,{DOUBLEWITHTWODWORDINTREE(0x02600000,0x00000000)}},
+ {VT_exponent,22,0xf78fd,{DOUBLEWITHTWODWORDINTREE(0x02700000,0x00000000)}},
+ {VT_exponent,22,0xf78fe,{DOUBLEWITHTWODWORDINTREE(0x02800000,0x00000000)}},
+ {VT_exponent,22,0xf78ff,{DOUBLEWITHTWODWORDINTREE(0x02900000,0x00000000)}},
+ {VT_exponent,22,0x3a8300,{DOUBLEWITHTWODWORDINTREE(0x02a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8301,{DOUBLEWITHTWODWORDINTREE(0x02b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8302,{DOUBLEWITHTWODWORDINTREE(0x02c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8303,{DOUBLEWITHTWODWORDINTREE(0x02d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8304,{DOUBLEWITHTWODWORDINTREE(0x02e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8305,{DOUBLEWITHTWODWORDINTREE(0x02f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8306,{DOUBLEWITHTWODWORDINTREE(0x03000000,0x00000000)}},
+ {VT_exponent,22,0x3a8307,{DOUBLEWITHTWODWORDINTREE(0x03100000,0x00000000)}},
+ {VT_exponent,22,0x3a8308,{DOUBLEWITHTWODWORDINTREE(0x03200000,0x00000000)}},
+ {VT_exponent,22,0x3a8309,{DOUBLEWITHTWODWORDINTREE(0x03300000,0x00000000)}},
+ {VT_exponent,22,0x3a830a,{DOUBLEWITHTWODWORDINTREE(0x03400000,0x00000000)}},
+ {VT_exponent,22,0x3a830b,{DOUBLEWITHTWODWORDINTREE(0x03500000,0x00000000)}},
+ {VT_exponent,22,0x3a830c,{DOUBLEWITHTWODWORDINTREE(0x03600000,0x00000000)}},
+ {VT_exponent,22,0x3a830d,{DOUBLEWITHTWODWORDINTREE(0x03700000,0x00000000)}},
+ {VT_exponent,22,0x3a830e,{DOUBLEWITHTWODWORDINTREE(0x03800000,0x00000000)}},
+ {VT_exponent,22,0x3a830f,{DOUBLEWITHTWODWORDINTREE(0x03900000,0x00000000)}},
+ {VT_exponent,22,0x3a8310,{DOUBLEWITHTWODWORDINTREE(0x03a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8311,{DOUBLEWITHTWODWORDINTREE(0x03b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8312,{DOUBLEWITHTWODWORDINTREE(0x03c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8313,{DOUBLEWITHTWODWORDINTREE(0x03d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8314,{DOUBLEWITHTWODWORDINTREE(0x03e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8315,{DOUBLEWITHTWODWORDINTREE(0x03f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8316,{DOUBLEWITHTWODWORDINTREE(0x04000000,0x00000000)}},
+ {VT_exponent,22,0x3a8317,{DOUBLEWITHTWODWORDINTREE(0x04100000,0x00000000)}},
+ {VT_exponent,22,0x3a8318,{DOUBLEWITHTWODWORDINTREE(0x04200000,0x00000000)}},
+ {VT_exponent,22,0x3a8319,{DOUBLEWITHTWODWORDINTREE(0x04300000,0x00000000)}},
+ {VT_exponent,22,0x3a831a,{DOUBLEWITHTWODWORDINTREE(0x04400000,0x00000000)}},
+ {VT_exponent,22,0x3a831b,{DOUBLEWITHTWODWORDINTREE(0x04500000,0x00000000)}},
+ {VT_exponent,22,0x3a831c,{DOUBLEWITHTWODWORDINTREE(0x04600000,0x00000000)}},
+ {VT_exponent,22,0x3a831d,{DOUBLEWITHTWODWORDINTREE(0x04700000,0x00000000)}},
+ {VT_exponent,22,0x3a831e,{DOUBLEWITHTWODWORDINTREE(0x04800000,0x00000000)}},
+ {VT_exponent,22,0x3a831f,{DOUBLEWITHTWODWORDINTREE(0x04900000,0x00000000)}},
+ {VT_exponent,22,0x3a8320,{DOUBLEWITHTWODWORDINTREE(0x04a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8321,{DOUBLEWITHTWODWORDINTREE(0x04b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8322,{DOUBLEWITHTWODWORDINTREE(0x04c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8323,{DOUBLEWITHTWODWORDINTREE(0x04d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8324,{DOUBLEWITHTWODWORDINTREE(0x04e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8325,{DOUBLEWITHTWODWORDINTREE(0x04f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8326,{DOUBLEWITHTWODWORDINTREE(0x05000000,0x00000000)}},
+ {VT_exponent,22,0x3a8327,{DOUBLEWITHTWODWORDINTREE(0x05100000,0x00000000)}},
+ {VT_exponent,22,0x3a8328,{DOUBLEWITHTWODWORDINTREE(0x05200000,0x00000000)}},
+ {VT_exponent,22,0x3a8329,{DOUBLEWITHTWODWORDINTREE(0x05300000,0x00000000)}},
+ {VT_exponent,22,0x3a832a,{DOUBLEWITHTWODWORDINTREE(0x05400000,0x00000000)}},
+ {VT_exponent,22,0x3a832b,{DOUBLEWITHTWODWORDINTREE(0x05500000,0x00000000)}},
+ {VT_exponent,22,0x3a832c,{DOUBLEWITHTWODWORDINTREE(0x05600000,0x00000000)}},
+ {VT_exponent,22,0x3a832d,{DOUBLEWITHTWODWORDINTREE(0x05700000,0x00000000)}},
+ {VT_exponent,22,0x3a832e,{DOUBLEWITHTWODWORDINTREE(0x05800000,0x00000000)}},
+ {VT_exponent,22,0x3a832f,{DOUBLEWITHTWODWORDINTREE(0x05900000,0x00000000)}},
+ {VT_exponent,22,0x3a8330,{DOUBLEWITHTWODWORDINTREE(0x05a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8331,{DOUBLEWITHTWODWORDINTREE(0x05b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8332,{DOUBLEWITHTWODWORDINTREE(0x05c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8333,{DOUBLEWITHTWODWORDINTREE(0x05d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8334,{DOUBLEWITHTWODWORDINTREE(0x05e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8335,{DOUBLEWITHTWODWORDINTREE(0x05f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8336,{DOUBLEWITHTWODWORDINTREE(0x06000000,0x00000000)}},
+ {VT_exponent,22,0x3a8337,{DOUBLEWITHTWODWORDINTREE(0x06100000,0x00000000)}},
+ {VT_exponent,22,0x3a8338,{DOUBLEWITHTWODWORDINTREE(0x06200000,0x00000000)}},
+ {VT_exponent,22,0x3a8339,{DOUBLEWITHTWODWORDINTREE(0x06300000,0x00000000)}},
+ {VT_exponent,22,0x3a833a,{DOUBLEWITHTWODWORDINTREE(0x06400000,0x00000000)}},
+ {VT_exponent,22,0x3a833b,{DOUBLEWITHTWODWORDINTREE(0x06500000,0x00000000)}},
+ {VT_exponent,22,0x3a833c,{DOUBLEWITHTWODWORDINTREE(0x06600000,0x00000000)}},
+ {VT_exponent,22,0x3a833d,{DOUBLEWITHTWODWORDINTREE(0x06700000,0x00000000)}},
+ {VT_exponent,22,0x3a833e,{DOUBLEWITHTWODWORDINTREE(0x06800000,0x00000000)}},
+ {VT_exponent,22,0x3a833f,{DOUBLEWITHTWODWORDINTREE(0x06900000,0x00000000)}},
+ {VT_exponent,22,0x3a8340,{DOUBLEWITHTWODWORDINTREE(0x06a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8341,{DOUBLEWITHTWODWORDINTREE(0x06b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8342,{DOUBLEWITHTWODWORDINTREE(0x06c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8343,{DOUBLEWITHTWODWORDINTREE(0x06d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8344,{DOUBLEWITHTWODWORDINTREE(0x06e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8345,{DOUBLEWITHTWODWORDINTREE(0x06f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8346,{DOUBLEWITHTWODWORDINTREE(0x07000000,0x00000000)}},
+ {VT_exponent,22,0x3a8347,{DOUBLEWITHTWODWORDINTREE(0x07100000,0x00000000)}},
+ {VT_exponent,22,0x3a8348,{DOUBLEWITHTWODWORDINTREE(0x07200000,0x00000000)}},
+ {VT_exponent,22,0x3a8349,{DOUBLEWITHTWODWORDINTREE(0x07300000,0x00000000)}},
+ {VT_exponent,22,0x3a834a,{DOUBLEWITHTWODWORDINTREE(0x07400000,0x00000000)}},
+ {VT_exponent,22,0x3a834b,{DOUBLEWITHTWODWORDINTREE(0x07500000,0x00000000)}},
+ {VT_exponent,22,0x3a834c,{DOUBLEWITHTWODWORDINTREE(0x07600000,0x00000000)}},
+ {VT_exponent,22,0x3a834d,{DOUBLEWITHTWODWORDINTREE(0x07700000,0x00000000)}},
+ {VT_exponent,22,0x3a834e,{DOUBLEWITHTWODWORDINTREE(0x07800000,0x00000000)}},
+ {VT_exponent,22,0x3a834f,{DOUBLEWITHTWODWORDINTREE(0x07900000,0x00000000)}},
+ {VT_exponent,22,0x3a8350,{DOUBLEWITHTWODWORDINTREE(0x07a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8351,{DOUBLEWITHTWODWORDINTREE(0x07b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8352,{DOUBLEWITHTWODWORDINTREE(0x07c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8353,{DOUBLEWITHTWODWORDINTREE(0x07d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8354,{DOUBLEWITHTWODWORDINTREE(0x07e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8355,{DOUBLEWITHTWODWORDINTREE(0x07f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8356,{DOUBLEWITHTWODWORDINTREE(0x08000000,0x00000000)}},
+ {VT_exponent,22,0x3a8357,{DOUBLEWITHTWODWORDINTREE(0x08100000,0x00000000)}},
+ {VT_exponent,22,0x3a8358,{DOUBLEWITHTWODWORDINTREE(0x08200000,0x00000000)}},
+ {VT_exponent,22,0x3a8359,{DOUBLEWITHTWODWORDINTREE(0x08300000,0x00000000)}},
+ {VT_exponent,22,0x3a835a,{DOUBLEWITHTWODWORDINTREE(0x08400000,0x00000000)}},
+ {VT_exponent,22,0x3a835b,{DOUBLEWITHTWODWORDINTREE(0x08500000,0x00000000)}},
+ {VT_exponent,22,0x3a835c,{DOUBLEWITHTWODWORDINTREE(0x08600000,0x00000000)}},
+ {VT_exponent,22,0x3a835d,{DOUBLEWITHTWODWORDINTREE(0x08700000,0x00000000)}},
+ {VT_exponent,22,0x3a835e,{DOUBLEWITHTWODWORDINTREE(0x08800000,0x00000000)}},
+ {VT_exponent,22,0x3a835f,{DOUBLEWITHTWODWORDINTREE(0x08900000,0x00000000)}},
+ {VT_exponent,22,0x3a8360,{DOUBLEWITHTWODWORDINTREE(0x08a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8361,{DOUBLEWITHTWODWORDINTREE(0x08b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8362,{DOUBLEWITHTWODWORDINTREE(0x08c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8363,{DOUBLEWITHTWODWORDINTREE(0x08d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8364,{DOUBLEWITHTWODWORDINTREE(0x08e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8365,{DOUBLEWITHTWODWORDINTREE(0x08f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8366,{DOUBLEWITHTWODWORDINTREE(0x09000000,0x00000000)}},
+ {VT_exponent,22,0x3a8367,{DOUBLEWITHTWODWORDINTREE(0x09100000,0x00000000)}},
+ {VT_exponent,22,0x3a8368,{DOUBLEWITHTWODWORDINTREE(0x09200000,0x00000000)}},
+ {VT_exponent,22,0x3a8369,{DOUBLEWITHTWODWORDINTREE(0x09300000,0x00000000)}},
+ {VT_exponent,22,0x3a836a,{DOUBLEWITHTWODWORDINTREE(0x09400000,0x00000000)}},
+ {VT_exponent,22,0x3a836b,{DOUBLEWITHTWODWORDINTREE(0x09500000,0x00000000)}},
+ {VT_exponent,22,0x3a836c,{DOUBLEWITHTWODWORDINTREE(0x09600000,0x00000000)}},
+ {VT_exponent,22,0x3a836d,{DOUBLEWITHTWODWORDINTREE(0x09700000,0x00000000)}},
+ {VT_exponent,22,0x3a836e,{DOUBLEWITHTWODWORDINTREE(0x09800000,0x00000000)}},
+ {VT_exponent,22,0x3a836f,{DOUBLEWITHTWODWORDINTREE(0x09900000,0x00000000)}},
+ {VT_exponent,22,0x3a8370,{DOUBLEWITHTWODWORDINTREE(0x09a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8371,{DOUBLEWITHTWODWORDINTREE(0x09b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8372,{DOUBLEWITHTWODWORDINTREE(0x09c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8373,{DOUBLEWITHTWODWORDINTREE(0x09d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8374,{DOUBLEWITHTWODWORDINTREE(0x09e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8375,{DOUBLEWITHTWODWORDINTREE(0x09f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8376,{DOUBLEWITHTWODWORDINTREE(0x0a000000,0x00000000)}},
+ {VT_exponent,22,0x3a8377,{DOUBLEWITHTWODWORDINTREE(0x0a100000,0x00000000)}},
+ {VT_exponent,22,0x3a8378,{DOUBLEWITHTWODWORDINTREE(0x0a200000,0x00000000)}},
+ {VT_exponent,22,0x3a8379,{DOUBLEWITHTWODWORDINTREE(0x0a300000,0x00000000)}},
+ {VT_exponent,22,0x3a837a,{DOUBLEWITHTWODWORDINTREE(0x0a400000,0x00000000)}},
+ {VT_exponent,22,0x3a837b,{DOUBLEWITHTWODWORDINTREE(0x0a500000,0x00000000)}},
+ {VT_exponent,22,0x3a837c,{DOUBLEWITHTWODWORDINTREE(0x0a600000,0x00000000)}},
+ {VT_exponent,22,0x3a837d,{DOUBLEWITHTWODWORDINTREE(0x0a700000,0x00000000)}},
+ {VT_exponent,22,0x3a837e,{DOUBLEWITHTWODWORDINTREE(0x0a800000,0x00000000)}},
+ {VT_exponent,22,0x3a837f,{DOUBLEWITHTWODWORDINTREE(0x0a900000,0x00000000)}},
+ {VT_exponent,22,0x3a8380,{DOUBLEWITHTWODWORDINTREE(0x0aa00000,0x00000000)}},
+ {VT_exponent,22,0x3a8381,{DOUBLEWITHTWODWORDINTREE(0x0ab00000,0x00000000)}},
+ {VT_exponent,22,0x3a8382,{DOUBLEWITHTWODWORDINTREE(0x0ac00000,0x00000000)}},
+ {VT_exponent,22,0x3a8383,{DOUBLEWITHTWODWORDINTREE(0x0ad00000,0x00000000)}},
+ {VT_exponent,22,0x3a8384,{DOUBLEWITHTWODWORDINTREE(0x0ae00000,0x00000000)}},
+ {VT_exponent,22,0x3a8385,{DOUBLEWITHTWODWORDINTREE(0x0af00000,0x00000000)}},
+ {VT_exponent,22,0x3a8386,{DOUBLEWITHTWODWORDINTREE(0x0b000000,0x00000000)}},
+ {VT_exponent,22,0x3a8387,{DOUBLEWITHTWODWORDINTREE(0x0b100000,0x00000000)}},
+ {VT_exponent,22,0x3a8388,{DOUBLEWITHTWODWORDINTREE(0x0b200000,0x00000000)}},
+ {VT_exponent,22,0x3a8389,{DOUBLEWITHTWODWORDINTREE(0x0b300000,0x00000000)}},
+ {VT_exponent,22,0x3a838a,{DOUBLEWITHTWODWORDINTREE(0x0b400000,0x00000000)}},
+ {VT_exponent,22,0x3a838b,{DOUBLEWITHTWODWORDINTREE(0x0b500000,0x00000000)}},
+ {VT_exponent,22,0x3a838c,{DOUBLEWITHTWODWORDINTREE(0x0b600000,0x00000000)}},
+ {VT_exponent,22,0x3a838d,{DOUBLEWITHTWODWORDINTREE(0x0b700000,0x00000000)}},
+ {VT_exponent,22,0x3a838e,{DOUBLEWITHTWODWORDINTREE(0x0b800000,0x00000000)}},
+ {VT_exponent,22,0x3a838f,{DOUBLEWITHTWODWORDINTREE(0x0b900000,0x00000000)}},
+ {VT_exponent,22,0x3a8390,{DOUBLEWITHTWODWORDINTREE(0x0ba00000,0x00000000)}},
+ {VT_exponent,22,0x3a8391,{DOUBLEWITHTWODWORDINTREE(0x0bb00000,0x00000000)}},
+ {VT_exponent,22,0x3a8392,{DOUBLEWITHTWODWORDINTREE(0x0bc00000,0x00000000)}},
+ {VT_exponent,22,0x3a8393,{DOUBLEWITHTWODWORDINTREE(0x0bd00000,0x00000000)}},
+ {VT_exponent,22,0x3a8394,{DOUBLEWITHTWODWORDINTREE(0x0be00000,0x00000000)}},
+ {VT_exponent,22,0x3a8395,{DOUBLEWITHTWODWORDINTREE(0x0bf00000,0x00000000)}},
+ {VT_exponent,22,0x3a8396,{DOUBLEWITHTWODWORDINTREE(0x0c000000,0x00000000)}},
+ {VT_exponent,22,0x3a8397,{DOUBLEWITHTWODWORDINTREE(0x0c100000,0x00000000)}},
+ {VT_exponent,22,0x3a8398,{DOUBLEWITHTWODWORDINTREE(0x0c200000,0x00000000)}},
+ {VT_exponent,22,0x3a8399,{DOUBLEWITHTWODWORDINTREE(0x0c300000,0x00000000)}},
+ {VT_exponent,22,0x3a839a,{DOUBLEWITHTWODWORDINTREE(0x0c400000,0x00000000)}},
+ {VT_exponent,22,0x3a839b,{DOUBLEWITHTWODWORDINTREE(0x0c500000,0x00000000)}},
+ {VT_exponent,22,0x3a839c,{DOUBLEWITHTWODWORDINTREE(0x0c600000,0x00000000)}},
+ {VT_exponent,22,0x3a839d,{DOUBLEWITHTWODWORDINTREE(0x0c700000,0x00000000)}},
+ {VT_exponent,22,0x3a839e,{DOUBLEWITHTWODWORDINTREE(0x0c800000,0x00000000)}},
+ {VT_exponent,22,0x3a839f,{DOUBLEWITHTWODWORDINTREE(0x0c900000,0x00000000)}},
+ {VT_exponent,22,0x3a83a0,{DOUBLEWITHTWODWORDINTREE(0x0ca00000,0x00000000)}},
+ {VT_exponent,22,0x3a83a1,{DOUBLEWITHTWODWORDINTREE(0x0cb00000,0x00000000)}},
+ {VT_exponent,22,0x3a83a2,{DOUBLEWITHTWODWORDINTREE(0x0cc00000,0x00000000)}},
+ {VT_exponent,22,0x3a83a3,{DOUBLEWITHTWODWORDINTREE(0x0cd00000,0x00000000)}},
+ {VT_exponent,22,0x3a83a4,{DOUBLEWITHTWODWORDINTREE(0x0ce00000,0x00000000)}},
+ {VT_exponent,22,0x3a83a5,{DOUBLEWITHTWODWORDINTREE(0x0cf00000,0x00000000)}},
+ {VT_exponent,22,0x3a83a6,{DOUBLEWITHTWODWORDINTREE(0x0d000000,0x00000000)}},
+ {VT_exponent,22,0x3a83a7,{DOUBLEWITHTWODWORDINTREE(0x0d100000,0x00000000)}},
+ {VT_exponent,22,0x3a83a8,{DOUBLEWITHTWODWORDINTREE(0x0d200000,0x00000000)}},
+ {VT_exponent,22,0x3a83a9,{DOUBLEWITHTWODWORDINTREE(0x0d300000,0x00000000)}},
+ {VT_exponent,22,0x3a83aa,{DOUBLEWITHTWODWORDINTREE(0x0d400000,0x00000000)}},
+ {VT_exponent,22,0x3a83ab,{DOUBLEWITHTWODWORDINTREE(0x0d500000,0x00000000)}},
+ {VT_exponent,22,0x3a83ac,{DOUBLEWITHTWODWORDINTREE(0x0d600000,0x00000000)}},
+ {VT_exponent,22,0x3a83ad,{DOUBLEWITHTWODWORDINTREE(0x0d700000,0x00000000)}},
+ {VT_exponent,22,0x3a83ae,{DOUBLEWITHTWODWORDINTREE(0x0d800000,0x00000000)}},
+ {VT_exponent,22,0x3a83af,{DOUBLEWITHTWODWORDINTREE(0x0d900000,0x00000000)}},
+ {VT_exponent,22,0x3a83b0,{DOUBLEWITHTWODWORDINTREE(0x0da00000,0x00000000)}},
+ {VT_exponent,22,0x3a83b1,{DOUBLEWITHTWODWORDINTREE(0x0db00000,0x00000000)}},
+ {VT_exponent,22,0x3a83b2,{DOUBLEWITHTWODWORDINTREE(0x0dc00000,0x00000000)}},
+ {VT_exponent,22,0x3a83b3,{DOUBLEWITHTWODWORDINTREE(0x0dd00000,0x00000000)}},
+ {VT_exponent,22,0x3a83b4,{DOUBLEWITHTWODWORDINTREE(0x0de00000,0x00000000)}},
+ {VT_exponent,22,0x3a83b5,{DOUBLEWITHTWODWORDINTREE(0x0df00000,0x00000000)}},
+ {VT_exponent,22,0x3a83b6,{DOUBLEWITHTWODWORDINTREE(0x0e000000,0x00000000)}},
+ {VT_exponent,22,0x3a83b7,{DOUBLEWITHTWODWORDINTREE(0x0e100000,0x00000000)}},
+ {VT_exponent,22,0x3a83b8,{DOUBLEWITHTWODWORDINTREE(0x0e200000,0x00000000)}},
+ {VT_exponent,22,0x3a83b9,{DOUBLEWITHTWODWORDINTREE(0x0e300000,0x00000000)}},
+ {VT_exponent,22,0x3a83ba,{DOUBLEWITHTWODWORDINTREE(0x0e400000,0x00000000)}},
+ {VT_exponent,22,0x3a83bb,{DOUBLEWITHTWODWORDINTREE(0x0e500000,0x00000000)}},
+ {VT_exponent,22,0x3a83bc,{DOUBLEWITHTWODWORDINTREE(0x0e600000,0x00000000)}},
+ {VT_exponent,22,0x3a83bd,{DOUBLEWITHTWODWORDINTREE(0x0e700000,0x00000000)}},
+ {VT_exponent,22,0x3a83be,{DOUBLEWITHTWODWORDINTREE(0x0e800000,0x00000000)}},
+ {VT_exponent,22,0x3a83bf,{DOUBLEWITHTWODWORDINTREE(0x0e900000,0x00000000)}},
+ {VT_exponent,22,0x3a83c0,{DOUBLEWITHTWODWORDINTREE(0x0ea00000,0x00000000)}},
+ {VT_exponent,22,0x3a83c1,{DOUBLEWITHTWODWORDINTREE(0x0eb00000,0x00000000)}},
+ {VT_exponent,22,0x3a83c2,{DOUBLEWITHTWODWORDINTREE(0x0ec00000,0x00000000)}},
+ {VT_exponent,22,0x3a83c3,{DOUBLEWITHTWODWORDINTREE(0x0ed00000,0x00000000)}},
+ {VT_exponent,22,0x3a83c4,{DOUBLEWITHTWODWORDINTREE(0x0ee00000,0x00000000)}},
+ {VT_exponent,22,0x3a83c5,{DOUBLEWITHTWODWORDINTREE(0x0ef00000,0x00000000)}},
+ {VT_exponent,22,0x3a83c6,{DOUBLEWITHTWODWORDINTREE(0x0f000000,0x00000000)}},
+ {VT_exponent,22,0x3a83c7,{DOUBLEWITHTWODWORDINTREE(0x0f100000,0x00000000)}},
+ {VT_exponent,22,0x3a83c8,{DOUBLEWITHTWODWORDINTREE(0x0f200000,0x00000000)}},
+ {VT_exponent,22,0x3a83c9,{DOUBLEWITHTWODWORDINTREE(0x0f300000,0x00000000)}},
+ {VT_exponent,22,0x3a83ca,{DOUBLEWITHTWODWORDINTREE(0x0f400000,0x00000000)}},
+ {VT_exponent,22,0x3a83cb,{DOUBLEWITHTWODWORDINTREE(0x0f500000,0x00000000)}},
+ {VT_exponent,22,0x3a83cc,{DOUBLEWITHTWODWORDINTREE(0x0f600000,0x00000000)}},
+ {VT_exponent,22,0x3a83cd,{DOUBLEWITHTWODWORDINTREE(0x0f700000,0x00000000)}},
+ {VT_exponent,22,0x3a83ce,{DOUBLEWITHTWODWORDINTREE(0x0f800000,0x00000000)}},
+ {VT_exponent,22,0x3a83cf,{DOUBLEWITHTWODWORDINTREE(0x0f900000,0x00000000)}},
+ {VT_exponent,22,0x3a83d0,{DOUBLEWITHTWODWORDINTREE(0x0fa00000,0x00000000)}},
+ {VT_exponent,22,0x3a83d1,{DOUBLEWITHTWODWORDINTREE(0x0fb00000,0x00000000)}},
+ {VT_exponent,22,0x3a83d2,{DOUBLEWITHTWODWORDINTREE(0x0fc00000,0x00000000)}},
+ {VT_exponent,22,0x3a83d3,{DOUBLEWITHTWODWORDINTREE(0x0fd00000,0x00000000)}},
+ {VT_exponent,22,0x3a83d4,{DOUBLEWITHTWODWORDINTREE(0x0fe00000,0x00000000)}},
+ {VT_exponent,22,0x3a83d5,{DOUBLEWITHTWODWORDINTREE(0x0ff00000,0x00000000)}},
+ {VT_exponent,22,0x3a83d6,{DOUBLEWITHTWODWORDINTREE(0x10000000,0x00000000)}},
+ {VT_exponent,22,0x3a83d7,{DOUBLEWITHTWODWORDINTREE(0x10100000,0x00000000)}},
+ {VT_exponent,22,0x3a83d8,{DOUBLEWITHTWODWORDINTREE(0x10200000,0x00000000)}},
+ {VT_exponent,22,0x3a83d9,{DOUBLEWITHTWODWORDINTREE(0x10300000,0x00000000)}},
+ {VT_exponent,22,0x3a83da,{DOUBLEWITHTWODWORDINTREE(0x10400000,0x00000000)}},
+ {VT_exponent,22,0x3a83db,{DOUBLEWITHTWODWORDINTREE(0x10500000,0x00000000)}},
+ {VT_exponent,22,0x3a83dc,{DOUBLEWITHTWODWORDINTREE(0x10600000,0x00000000)}},
+ {VT_exponent,22,0x3a83dd,{DOUBLEWITHTWODWORDINTREE(0x10700000,0x00000000)}},
+ {VT_exponent,22,0x3a83de,{DOUBLEWITHTWODWORDINTREE(0x10800000,0x00000000)}},
+ {VT_exponent,22,0x3a83df,{DOUBLEWITHTWODWORDINTREE(0x10900000,0x00000000)}},
+ {VT_exponent,22,0x3a83e0,{DOUBLEWITHTWODWORDINTREE(0x10a00000,0x00000000)}},
+ {VT_exponent,22,0x3a83e1,{DOUBLEWITHTWODWORDINTREE(0x10b00000,0x00000000)}},
+ {VT_exponent,22,0x3a83e2,{DOUBLEWITHTWODWORDINTREE(0x10c00000,0x00000000)}},
+ {VT_exponent,22,0x3a83e3,{DOUBLEWITHTWODWORDINTREE(0x10d00000,0x00000000)}},
+ {VT_exponent,22,0x3a83e4,{DOUBLEWITHTWODWORDINTREE(0x10e00000,0x00000000)}},
+ {VT_exponent,22,0x3a83e5,{DOUBLEWITHTWODWORDINTREE(0x10f00000,0x00000000)}},
+ {VT_exponent,22,0x3a83e6,{DOUBLEWITHTWODWORDINTREE(0x11000000,0x00000000)}},
+ {VT_exponent,22,0x3a83e7,{DOUBLEWITHTWODWORDINTREE(0x11100000,0x00000000)}},
+ {VT_exponent,22,0x3a83e8,{DOUBLEWITHTWODWORDINTREE(0x11200000,0x00000000)}},
+ {VT_exponent,22,0x3a83e9,{DOUBLEWITHTWODWORDINTREE(0x11300000,0x00000000)}},
+ {VT_exponent,22,0x3a83ea,{DOUBLEWITHTWODWORDINTREE(0x11400000,0x00000000)}},
+ {VT_exponent,22,0x3a83eb,{DOUBLEWITHTWODWORDINTREE(0x11500000,0x00000000)}},
+ {VT_exponent,22,0x3a83ec,{DOUBLEWITHTWODWORDINTREE(0x11600000,0x00000000)}},
+ {VT_exponent,22,0x3a83ed,{DOUBLEWITHTWODWORDINTREE(0x11700000,0x00000000)}},
+ {VT_exponent,22,0x3a83ee,{DOUBLEWITHTWODWORDINTREE(0x11800000,0x00000000)}},
+ {VT_exponent,22,0x3a83ef,{DOUBLEWITHTWODWORDINTREE(0x11900000,0x00000000)}},
+ {VT_exponent,22,0x3a83f0,{DOUBLEWITHTWODWORDINTREE(0x11a00000,0x00000000)}},
+ {VT_exponent,22,0x3a83f1,{DOUBLEWITHTWODWORDINTREE(0x11b00000,0x00000000)}},
+ {VT_exponent,22,0x3a83f2,{DOUBLEWITHTWODWORDINTREE(0x11c00000,0x00000000)}},
+ {VT_exponent,22,0x3a83f3,{DOUBLEWITHTWODWORDINTREE(0x11d00000,0x00000000)}},
+ {VT_exponent,22,0x3a83f4,{DOUBLEWITHTWODWORDINTREE(0x11e00000,0x00000000)}},
+ {VT_exponent,22,0x3a83f5,{DOUBLEWITHTWODWORDINTREE(0x11f00000,0x00000000)}},
+ {VT_exponent,22,0x3a83f6,{DOUBLEWITHTWODWORDINTREE(0x12000000,0x00000000)}},
+ {VT_exponent,22,0x3a83f7,{DOUBLEWITHTWODWORDINTREE(0x12100000,0x00000000)}},
+ {VT_exponent,22,0x3a83f8,{DOUBLEWITHTWODWORDINTREE(0x12200000,0x00000000)}},
+ {VT_exponent,22,0x3a83f9,{DOUBLEWITHTWODWORDINTREE(0x12300000,0x00000000)}},
+ {VT_exponent,22,0x3a83fa,{DOUBLEWITHTWODWORDINTREE(0x12400000,0x00000000)}},
+ {VT_exponent,22,0x3a83fb,{DOUBLEWITHTWODWORDINTREE(0x12500000,0x00000000)}},
+ {VT_exponent,22,0x3a83fc,{DOUBLEWITHTWODWORDINTREE(0x12600000,0x00000000)}},
+ {VT_exponent,22,0x3a83fd,{DOUBLEWITHTWODWORDINTREE(0x12700000,0x00000000)}},
+ {VT_exponent,22,0x3a83fe,{DOUBLEWITHTWODWORDINTREE(0x12800000,0x00000000)}},
+ {VT_exponent,22,0x3a83ff,{DOUBLEWITHTWODWORDINTREE(0x12900000,0x00000000)}},
+ {VT_exponent,22,0x3a8400,{DOUBLEWITHTWODWORDINTREE(0x12a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8401,{DOUBLEWITHTWODWORDINTREE(0x12b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8402,{DOUBLEWITHTWODWORDINTREE(0x12c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8403,{DOUBLEWITHTWODWORDINTREE(0x12d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8404,{DOUBLEWITHTWODWORDINTREE(0x12e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8405,{DOUBLEWITHTWODWORDINTREE(0x12f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8406,{DOUBLEWITHTWODWORDINTREE(0x13000000,0x00000000)}},
+ {VT_exponent,22,0x3a8407,{DOUBLEWITHTWODWORDINTREE(0x13100000,0x00000000)}},
+ {VT_exponent,22,0x3a8408,{DOUBLEWITHTWODWORDINTREE(0x13200000,0x00000000)}},
+ {VT_exponent,22,0x3a8409,{DOUBLEWITHTWODWORDINTREE(0x13300000,0x00000000)}},
+ {VT_exponent,22,0x3a840a,{DOUBLEWITHTWODWORDINTREE(0x13400000,0x00000000)}},
+ {VT_exponent,22,0x3a840b,{DOUBLEWITHTWODWORDINTREE(0x13500000,0x00000000)}},
+ {VT_exponent,22,0x3a840c,{DOUBLEWITHTWODWORDINTREE(0x13600000,0x00000000)}},
+ {VT_exponent,22,0x3a840d,{DOUBLEWITHTWODWORDINTREE(0x13700000,0x00000000)}},
+ {VT_exponent,22,0x3a840e,{DOUBLEWITHTWODWORDINTREE(0x13800000,0x00000000)}},
+ {VT_exponent,22,0x3a840f,{DOUBLEWITHTWODWORDINTREE(0x13900000,0x00000000)}},
+ {VT_exponent,22,0x3a8410,{DOUBLEWITHTWODWORDINTREE(0x13a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8411,{DOUBLEWITHTWODWORDINTREE(0x13b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8412,{DOUBLEWITHTWODWORDINTREE(0x13c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8413,{DOUBLEWITHTWODWORDINTREE(0x13d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8414,{DOUBLEWITHTWODWORDINTREE(0x13e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8415,{DOUBLEWITHTWODWORDINTREE(0x13f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8416,{DOUBLEWITHTWODWORDINTREE(0x14000000,0x00000000)}},
+ {VT_exponent,22,0x3a8417,{DOUBLEWITHTWODWORDINTREE(0x14100000,0x00000000)}},
+ {VT_exponent,22,0x3a8418,{DOUBLEWITHTWODWORDINTREE(0x14200000,0x00000000)}},
+ {VT_exponent,22,0x3a8419,{DOUBLEWITHTWODWORDINTREE(0x14300000,0x00000000)}},
+ {VT_exponent,22,0x3a841a,{DOUBLEWITHTWODWORDINTREE(0x14400000,0x00000000)}},
+ {VT_exponent,22,0x3a841b,{DOUBLEWITHTWODWORDINTREE(0x14500000,0x00000000)}},
+ {VT_exponent,22,0x3a841c,{DOUBLEWITHTWODWORDINTREE(0x14600000,0x00000000)}},
+ {VT_exponent,22,0x3a841d,{DOUBLEWITHTWODWORDINTREE(0x14700000,0x00000000)}},
+ {VT_exponent,22,0x3a841e,{DOUBLEWITHTWODWORDINTREE(0x14800000,0x00000000)}},
+ {VT_exponent,22,0x3a841f,{DOUBLEWITHTWODWORDINTREE(0x14900000,0x00000000)}},
+ {VT_exponent,22,0x3a8420,{DOUBLEWITHTWODWORDINTREE(0x14a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8421,{DOUBLEWITHTWODWORDINTREE(0x14b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8422,{DOUBLEWITHTWODWORDINTREE(0x14c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8423,{DOUBLEWITHTWODWORDINTREE(0x14d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8424,{DOUBLEWITHTWODWORDINTREE(0x14e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8425,{DOUBLEWITHTWODWORDINTREE(0x14f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8426,{DOUBLEWITHTWODWORDINTREE(0x15000000,0x00000000)}},
+ {VT_exponent,22,0x3a8427,{DOUBLEWITHTWODWORDINTREE(0x15100000,0x00000000)}},
+ {VT_exponent,22,0x3a8428,{DOUBLEWITHTWODWORDINTREE(0x15200000,0x00000000)}},
+ {VT_exponent,22,0x3a8429,{DOUBLEWITHTWODWORDINTREE(0x15300000,0x00000000)}},
+ {VT_exponent,22,0x3a842a,{DOUBLEWITHTWODWORDINTREE(0x15400000,0x00000000)}},
+ {VT_exponent,22,0x3a842b,{DOUBLEWITHTWODWORDINTREE(0x15500000,0x00000000)}},
+ {VT_exponent,22,0x3a842c,{DOUBLEWITHTWODWORDINTREE(0x15600000,0x00000000)}},
+ {VT_exponent,22,0x3a842d,{DOUBLEWITHTWODWORDINTREE(0x15700000,0x00000000)}},
+ {VT_exponent,22,0x3a842e,{DOUBLEWITHTWODWORDINTREE(0x15800000,0x00000000)}},
+ {VT_exponent,22,0x3a842f,{DOUBLEWITHTWODWORDINTREE(0x15900000,0x00000000)}},
+ {VT_exponent,22,0x3a8430,{DOUBLEWITHTWODWORDINTREE(0x15a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8431,{DOUBLEWITHTWODWORDINTREE(0x15b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8432,{DOUBLEWITHTWODWORDINTREE(0x15c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8433,{DOUBLEWITHTWODWORDINTREE(0x15d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8434,{DOUBLEWITHTWODWORDINTREE(0x15e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8435,{DOUBLEWITHTWODWORDINTREE(0x15f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8436,{DOUBLEWITHTWODWORDINTREE(0x16000000,0x00000000)}},
+ {VT_exponent,22,0x3a8437,{DOUBLEWITHTWODWORDINTREE(0x16100000,0x00000000)}},
+ {VT_exponent,22,0x3a8438,{DOUBLEWITHTWODWORDINTREE(0x16200000,0x00000000)}},
+ {VT_exponent,22,0x3a8439,{DOUBLEWITHTWODWORDINTREE(0x16300000,0x00000000)}},
+ {VT_exponent,22,0x3a843a,{DOUBLEWITHTWODWORDINTREE(0x16400000,0x00000000)}},
+ {VT_exponent,22,0x3a843b,{DOUBLEWITHTWODWORDINTREE(0x16500000,0x00000000)}},
+ {VT_exponent,22,0x3a843c,{DOUBLEWITHTWODWORDINTREE(0x16600000,0x00000000)}},
+ {VT_exponent,22,0x3a843d,{DOUBLEWITHTWODWORDINTREE(0x16700000,0x00000000)}},
+ {VT_exponent,22,0x3a843e,{DOUBLEWITHTWODWORDINTREE(0x16800000,0x00000000)}},
+ {VT_exponent,22,0x3a843f,{DOUBLEWITHTWODWORDINTREE(0x16900000,0x00000000)}},
+ {VT_exponent,22,0x3a8440,{DOUBLEWITHTWODWORDINTREE(0x16a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8441,{DOUBLEWITHTWODWORDINTREE(0x16b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8442,{DOUBLEWITHTWODWORDINTREE(0x16c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8443,{DOUBLEWITHTWODWORDINTREE(0x16d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8444,{DOUBLEWITHTWODWORDINTREE(0x16e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8445,{DOUBLEWITHTWODWORDINTREE(0x16f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8446,{DOUBLEWITHTWODWORDINTREE(0x17000000,0x00000000)}},
+ {VT_exponent,22,0x3a8447,{DOUBLEWITHTWODWORDINTREE(0x17100000,0x00000000)}},
+ {VT_exponent,22,0x3a8448,{DOUBLEWITHTWODWORDINTREE(0x17200000,0x00000000)}},
+ {VT_exponent,22,0x3a8449,{DOUBLEWITHTWODWORDINTREE(0x17300000,0x00000000)}},
+ {VT_exponent,22,0x3a844a,{DOUBLEWITHTWODWORDINTREE(0x17400000,0x00000000)}},
+ {VT_exponent,22,0x3a844b,{DOUBLEWITHTWODWORDINTREE(0x17500000,0x00000000)}},
+ {VT_exponent,22,0x3a844c,{DOUBLEWITHTWODWORDINTREE(0x17600000,0x00000000)}},
+ {VT_exponent,22,0x3a844d,{DOUBLEWITHTWODWORDINTREE(0x17700000,0x00000000)}},
+ {VT_exponent,22,0x3a844e,{DOUBLEWITHTWODWORDINTREE(0x17800000,0x00000000)}},
+ {VT_exponent,22,0x3a844f,{DOUBLEWITHTWODWORDINTREE(0x17900000,0x00000000)}},
+ {VT_exponent,22,0x3a8450,{DOUBLEWITHTWODWORDINTREE(0x17a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8451,{DOUBLEWITHTWODWORDINTREE(0x17b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8452,{DOUBLEWITHTWODWORDINTREE(0x17c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8453,{DOUBLEWITHTWODWORDINTREE(0x17d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8454,{DOUBLEWITHTWODWORDINTREE(0x17e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8455,{DOUBLEWITHTWODWORDINTREE(0x17f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8456,{DOUBLEWITHTWODWORDINTREE(0x18000000,0x00000000)}},
+ {VT_exponent,22,0x3a8457,{DOUBLEWITHTWODWORDINTREE(0x18100000,0x00000000)}},
+ {VT_exponent,22,0x3a8458,{DOUBLEWITHTWODWORDINTREE(0x18200000,0x00000000)}},
+ {VT_exponent,22,0x3a8459,{DOUBLEWITHTWODWORDINTREE(0x18300000,0x00000000)}},
+ {VT_exponent,22,0x3a845a,{DOUBLEWITHTWODWORDINTREE(0x18400000,0x00000000)}},
+ {VT_exponent,22,0x3a845b,{DOUBLEWITHTWODWORDINTREE(0x18500000,0x00000000)}},
+ {VT_exponent,22,0x3a845c,{DOUBLEWITHTWODWORDINTREE(0x18600000,0x00000000)}},
+ {VT_exponent,22,0x3a845d,{DOUBLEWITHTWODWORDINTREE(0x18700000,0x00000000)}},
+ {VT_exponent,22,0x3a845e,{DOUBLEWITHTWODWORDINTREE(0x18800000,0x00000000)}},
+ {VT_exponent,22,0x3a845f,{DOUBLEWITHTWODWORDINTREE(0x18900000,0x00000000)}},
+ {VT_exponent,22,0x3a8460,{DOUBLEWITHTWODWORDINTREE(0x18a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8461,{DOUBLEWITHTWODWORDINTREE(0x18b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8462,{DOUBLEWITHTWODWORDINTREE(0x18c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8463,{DOUBLEWITHTWODWORDINTREE(0x18d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8464,{DOUBLEWITHTWODWORDINTREE(0x18e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8465,{DOUBLEWITHTWODWORDINTREE(0x18f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8466,{DOUBLEWITHTWODWORDINTREE(0x19000000,0x00000000)}},
+ {VT_exponent,22,0x3a8467,{DOUBLEWITHTWODWORDINTREE(0x19100000,0x00000000)}},
+ {VT_exponent,22,0x3a8468,{DOUBLEWITHTWODWORDINTREE(0x19200000,0x00000000)}},
+ {VT_exponent,22,0x3a8469,{DOUBLEWITHTWODWORDINTREE(0x19300000,0x00000000)}},
+ {VT_exponent,22,0x3a846a,{DOUBLEWITHTWODWORDINTREE(0x19400000,0x00000000)}},
+ {VT_exponent,22,0x3a846b,{DOUBLEWITHTWODWORDINTREE(0x19500000,0x00000000)}},
+ {VT_exponent,22,0x3a846c,{DOUBLEWITHTWODWORDINTREE(0x19600000,0x00000000)}},
+ {VT_exponent,22,0x3a846d,{DOUBLEWITHTWODWORDINTREE(0x19700000,0x00000000)}},
+ {VT_exponent,22,0x3a846e,{DOUBLEWITHTWODWORDINTREE(0x19800000,0x00000000)}},
+ {VT_exponent,22,0x3a846f,{DOUBLEWITHTWODWORDINTREE(0x19900000,0x00000000)}},
+ {VT_exponent,22,0x3a8470,{DOUBLEWITHTWODWORDINTREE(0x19a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8471,{DOUBLEWITHTWODWORDINTREE(0x19b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8472,{DOUBLEWITHTWODWORDINTREE(0x19c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8473,{DOUBLEWITHTWODWORDINTREE(0x19d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8474,{DOUBLEWITHTWODWORDINTREE(0x19e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8475,{DOUBLEWITHTWODWORDINTREE(0x19f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8476,{DOUBLEWITHTWODWORDINTREE(0x1a000000,0x00000000)}},
+ {VT_exponent,22,0x3a8477,{DOUBLEWITHTWODWORDINTREE(0x1a100000,0x00000000)}},
+ {VT_exponent,22,0x3a8478,{DOUBLEWITHTWODWORDINTREE(0x1a200000,0x00000000)}},
+ {VT_exponent,22,0x3a8479,{DOUBLEWITHTWODWORDINTREE(0x1a300000,0x00000000)}},
+ {VT_exponent,22,0x3a847a,{DOUBLEWITHTWODWORDINTREE(0x1a400000,0x00000000)}},
+ {VT_exponent,22,0x3a847b,{DOUBLEWITHTWODWORDINTREE(0x1a500000,0x00000000)}},
+ {VT_exponent,22,0x3a847c,{DOUBLEWITHTWODWORDINTREE(0x1a600000,0x00000000)}},
+ {VT_exponent,22,0x3a847d,{DOUBLEWITHTWODWORDINTREE(0x1a700000,0x00000000)}},
+ {VT_exponent,22,0x3a847e,{DOUBLEWITHTWODWORDINTREE(0x1a800000,0x00000000)}},
+ {VT_exponent,22,0x3a847f,{DOUBLEWITHTWODWORDINTREE(0x1a900000,0x00000000)}},
+ {VT_exponent,22,0x3a8480,{DOUBLEWITHTWODWORDINTREE(0x1aa00000,0x00000000)}},
+ {VT_exponent,22,0x3a8481,{DOUBLEWITHTWODWORDINTREE(0x1ab00000,0x00000000)}},
+ {VT_exponent,22,0x3a8482,{DOUBLEWITHTWODWORDINTREE(0x1ac00000,0x00000000)}},
+ {VT_exponent,22,0x3a8483,{DOUBLEWITHTWODWORDINTREE(0x1ad00000,0x00000000)}},
+ {VT_exponent,22,0x3a8484,{DOUBLEWITHTWODWORDINTREE(0x1ae00000,0x00000000)}},
+ {VT_exponent,22,0x3a8485,{DOUBLEWITHTWODWORDINTREE(0x1af00000,0x00000000)}},
+ {VT_exponent,22,0x3a8486,{DOUBLEWITHTWODWORDINTREE(0x1b000000,0x00000000)}},
+ {VT_exponent,22,0x3a8487,{DOUBLEWITHTWODWORDINTREE(0x1b100000,0x00000000)}},
+ {VT_exponent,22,0x3a8488,{DOUBLEWITHTWODWORDINTREE(0x1b200000,0x00000000)}},
+ {VT_exponent,22,0x3a8489,{DOUBLEWITHTWODWORDINTREE(0x1b300000,0x00000000)}},
+ {VT_exponent,22,0x3a848a,{DOUBLEWITHTWODWORDINTREE(0x1b400000,0x00000000)}},
+ {VT_exponent,22,0x3a848b,{DOUBLEWITHTWODWORDINTREE(0x1b500000,0x00000000)}},
+ {VT_exponent,22,0x3a848c,{DOUBLEWITHTWODWORDINTREE(0x1b600000,0x00000000)}},
+ {VT_exponent,22,0x3a848d,{DOUBLEWITHTWODWORDINTREE(0x1b700000,0x00000000)}},
+ {VT_exponent,22,0x3a848e,{DOUBLEWITHTWODWORDINTREE(0x1b800000,0x00000000)}},
+ {VT_exponent,22,0x3a848f,{DOUBLEWITHTWODWORDINTREE(0x1b900000,0x00000000)}},
+ {VT_exponent,22,0x3a8490,{DOUBLEWITHTWODWORDINTREE(0x1ba00000,0x00000000)}},
+ {VT_exponent,22,0x3a8491,{DOUBLEWITHTWODWORDINTREE(0x1bb00000,0x00000000)}},
+ {VT_exponent,22,0x3a8492,{DOUBLEWITHTWODWORDINTREE(0x1bc00000,0x00000000)}},
+ {VT_exponent,22,0x3a8493,{DOUBLEWITHTWODWORDINTREE(0x1bd00000,0x00000000)}},
+ {VT_exponent,22,0x3a8494,{DOUBLEWITHTWODWORDINTREE(0x1be00000,0x00000000)}},
+ {VT_exponent,22,0x3a8495,{DOUBLEWITHTWODWORDINTREE(0x1bf00000,0x00000000)}},
+ {VT_exponent,22,0x3a8496,{DOUBLEWITHTWODWORDINTREE(0x1c000000,0x00000000)}},
+ {VT_exponent,22,0x3a8497,{DOUBLEWITHTWODWORDINTREE(0x1c100000,0x00000000)}},
+ {VT_exponent,22,0x3a8498,{DOUBLEWITHTWODWORDINTREE(0x1c200000,0x00000000)}},
+ {VT_exponent,22,0x3a8499,{DOUBLEWITHTWODWORDINTREE(0x1c300000,0x00000000)}},
+ {VT_exponent,22,0x3a849a,{DOUBLEWITHTWODWORDINTREE(0x1c400000,0x00000000)}},
+ {VT_exponent,22,0x3a849b,{DOUBLEWITHTWODWORDINTREE(0x1c500000,0x00000000)}},
+ {VT_exponent,22,0x3a849c,{DOUBLEWITHTWODWORDINTREE(0x1c600000,0x00000000)}},
+ {VT_exponent,22,0x3a849d,{DOUBLEWITHTWODWORDINTREE(0x1c700000,0x00000000)}},
+ {VT_exponent,22,0x3a849e,{DOUBLEWITHTWODWORDINTREE(0x1c800000,0x00000000)}},
+ {VT_exponent,22,0x3a849f,{DOUBLEWITHTWODWORDINTREE(0x1c900000,0x00000000)}},
+ {VT_exponent,22,0x3a84a0,{DOUBLEWITHTWODWORDINTREE(0x1ca00000,0x00000000)}},
+ {VT_exponent,22,0x3a84a1,{DOUBLEWITHTWODWORDINTREE(0x1cb00000,0x00000000)}},
+ {VT_exponent,22,0x3a84a2,{DOUBLEWITHTWODWORDINTREE(0x1cc00000,0x00000000)}},
+ {VT_exponent,22,0x3a84a3,{DOUBLEWITHTWODWORDINTREE(0x1cd00000,0x00000000)}},
+ {VT_exponent,22,0x3a84a4,{DOUBLEWITHTWODWORDINTREE(0x1ce00000,0x00000000)}},
+ {VT_exponent,22,0x3a84a5,{DOUBLEWITHTWODWORDINTREE(0x1cf00000,0x00000000)}},
+ {VT_exponent,22,0x3a84a6,{DOUBLEWITHTWODWORDINTREE(0x1d000000,0x00000000)}},
+ {VT_exponent,22,0x3a84a7,{DOUBLEWITHTWODWORDINTREE(0x1d100000,0x00000000)}},
+ {VT_exponent,22,0x3a84a8,{DOUBLEWITHTWODWORDINTREE(0x1d200000,0x00000000)}},
+ {VT_exponent,22,0x3a84a9,{DOUBLEWITHTWODWORDINTREE(0x1d300000,0x00000000)}},
+ {VT_exponent,22,0x3a84aa,{DOUBLEWITHTWODWORDINTREE(0x1d400000,0x00000000)}},
+ {VT_exponent,22,0x3a84ab,{DOUBLEWITHTWODWORDINTREE(0x1d500000,0x00000000)}},
+ {VT_exponent,22,0x3a84ac,{DOUBLEWITHTWODWORDINTREE(0x1d600000,0x00000000)}},
+ {VT_exponent,22,0x3a84ad,{DOUBLEWITHTWODWORDINTREE(0x1d700000,0x00000000)}},
+ {VT_exponent,22,0x3a84ae,{DOUBLEWITHTWODWORDINTREE(0x1d800000,0x00000000)}},
+ {VT_exponent,22,0x3a84af,{DOUBLEWITHTWODWORDINTREE(0x1d900000,0x00000000)}},
+ {VT_exponent,22,0x3a84b0,{DOUBLEWITHTWODWORDINTREE(0x1da00000,0x00000000)}},
+ {VT_exponent,22,0x3a84b1,{DOUBLEWITHTWODWORDINTREE(0x1db00000,0x00000000)}},
+ {VT_exponent,22,0x3a84b2,{DOUBLEWITHTWODWORDINTREE(0x1dc00000,0x00000000)}},
+ {VT_exponent,22,0x3a84b3,{DOUBLEWITHTWODWORDINTREE(0x1dd00000,0x00000000)}},
+ {VT_exponent,22,0x3a84b4,{DOUBLEWITHTWODWORDINTREE(0x1de00000,0x00000000)}},
+ {VT_exponent,22,0x3a84b5,{DOUBLEWITHTWODWORDINTREE(0x1df00000,0x00000000)}},
+ {VT_exponent,22,0x3a84b6,{DOUBLEWITHTWODWORDINTREE(0x1e000000,0x00000000)}},
+ {VT_exponent,22,0x3a84b7,{DOUBLEWITHTWODWORDINTREE(0x1e100000,0x00000000)}},
+ {VT_exponent,22,0x3a84b8,{DOUBLEWITHTWODWORDINTREE(0x1e200000,0x00000000)}},
+ {VT_exponent,22,0x3a84b9,{DOUBLEWITHTWODWORDINTREE(0x1e300000,0x00000000)}},
+ {VT_exponent,22,0x3a84ba,{DOUBLEWITHTWODWORDINTREE(0x1e400000,0x00000000)}},
+ {VT_exponent,22,0x3a84bb,{DOUBLEWITHTWODWORDINTREE(0x1e500000,0x00000000)}},
+ {VT_exponent,22,0x3a84bc,{DOUBLEWITHTWODWORDINTREE(0x1e600000,0x00000000)}},
+ {VT_exponent,22,0x3a84bd,{DOUBLEWITHTWODWORDINTREE(0x1e700000,0x00000000)}},
+ {VT_exponent,22,0x3a84be,{DOUBLEWITHTWODWORDINTREE(0x1e800000,0x00000000)}},
+ {VT_exponent,22,0x3a84bf,{DOUBLEWITHTWODWORDINTREE(0x1e900000,0x00000000)}},
+ {VT_exponent,22,0x3a84c0,{DOUBLEWITHTWODWORDINTREE(0x1ea00000,0x00000000)}},
+ {VT_exponent,22,0x3a84c1,{DOUBLEWITHTWODWORDINTREE(0x1eb00000,0x00000000)}},
+ {VT_exponent,22,0x3a84c2,{DOUBLEWITHTWODWORDINTREE(0x1ec00000,0x00000000)}},
+ {VT_exponent,22,0x3a84c3,{DOUBLEWITHTWODWORDINTREE(0x1ed00000,0x00000000)}},
+ {VT_exponent,22,0x3a84c4,{DOUBLEWITHTWODWORDINTREE(0x1ee00000,0x00000000)}},
+ {VT_exponent,22,0x3a84c5,{DOUBLEWITHTWODWORDINTREE(0x1ef00000,0x00000000)}},
+ {VT_exponent,22,0x3a84c6,{DOUBLEWITHTWODWORDINTREE(0x1f000000,0x00000000)}},
+ {VT_exponent,22,0x3a84c7,{DOUBLEWITHTWODWORDINTREE(0x1f100000,0x00000000)}},
+ {VT_exponent,22,0x3a84c8,{DOUBLEWITHTWODWORDINTREE(0x1f200000,0x00000000)}},
+ {VT_exponent,22,0x3a84c9,{DOUBLEWITHTWODWORDINTREE(0x1f300000,0x00000000)}},
+ {VT_exponent,22,0x3a84ca,{DOUBLEWITHTWODWORDINTREE(0x1f400000,0x00000000)}},
+ {VT_exponent,22,0x3a84cb,{DOUBLEWITHTWODWORDINTREE(0x1f500000,0x00000000)}},
+ {VT_exponent,22,0x3a84cc,{DOUBLEWITHTWODWORDINTREE(0x1f600000,0x00000000)}},
+ {VT_exponent,22,0x3a84cd,{DOUBLEWITHTWODWORDINTREE(0x1f700000,0x00000000)}},
+ {VT_exponent,22,0x3a84ce,{DOUBLEWITHTWODWORDINTREE(0x1f800000,0x00000000)}},
+ {VT_exponent,22,0x3a84cf,{DOUBLEWITHTWODWORDINTREE(0x1f900000,0x00000000)}},
+ {VT_exponent,22,0x3a84d0,{DOUBLEWITHTWODWORDINTREE(0x1fa00000,0x00000000)}},
+ {VT_exponent,22,0x3a84d1,{DOUBLEWITHTWODWORDINTREE(0x1fb00000,0x00000000)}},
+ {VT_exponent,22,0x3a84d2,{DOUBLEWITHTWODWORDINTREE(0x1fc00000,0x00000000)}},
+ {VT_exponent,22,0x3a84d3,{DOUBLEWITHTWODWORDINTREE(0x1fd00000,0x00000000)}},
+ {VT_exponent,22,0x3a84d4,{DOUBLEWITHTWODWORDINTREE(0x1fe00000,0x00000000)}},
+ {VT_exponent,22,0x3a84d5,{DOUBLEWITHTWODWORDINTREE(0x1ff00000,0x00000000)}},
+ {VT_exponent,22,0x3a84d6,{DOUBLEWITHTWODWORDINTREE(0x20000000,0x00000000)}},
+ {VT_exponent,22,0x3a84d7,{DOUBLEWITHTWODWORDINTREE(0x20100000,0x00000000)}},
+ {VT_exponent,22,0x3a84d8,{DOUBLEWITHTWODWORDINTREE(0x20200000,0x00000000)}},
+ {VT_exponent,22,0x3a84d9,{DOUBLEWITHTWODWORDINTREE(0x20300000,0x00000000)}},
+ {VT_exponent,22,0x3a84da,{DOUBLEWITHTWODWORDINTREE(0x20400000,0x00000000)}},
+ {VT_exponent,22,0x3a84db,{DOUBLEWITHTWODWORDINTREE(0x20500000,0x00000000)}},
+ {VT_exponent,22,0x3a84dc,{DOUBLEWITHTWODWORDINTREE(0x20600000,0x00000000)}},
+ {VT_exponent,22,0x3a84dd,{DOUBLEWITHTWODWORDINTREE(0x20700000,0x00000000)}},
+ {VT_exponent,22,0x3a84de,{DOUBLEWITHTWODWORDINTREE(0x20800000,0x00000000)}},
+ {VT_exponent,22,0x3a84df,{DOUBLEWITHTWODWORDINTREE(0x20900000,0x00000000)}},
+ {VT_exponent,22,0x3a84e0,{DOUBLEWITHTWODWORDINTREE(0x20a00000,0x00000000)}},
+ {VT_exponent,22,0x3a84e1,{DOUBLEWITHTWODWORDINTREE(0x20b00000,0x00000000)}},
+ {VT_exponent,22,0x3a84e2,{DOUBLEWITHTWODWORDINTREE(0x20c00000,0x00000000)}},
+ {VT_exponent,22,0x3a84e3,{DOUBLEWITHTWODWORDINTREE(0x20d00000,0x00000000)}},
+ {VT_exponent,22,0x3a84e4,{DOUBLEWITHTWODWORDINTREE(0x20e00000,0x00000000)}},
+ {VT_exponent,22,0x3a84e5,{DOUBLEWITHTWODWORDINTREE(0x20f00000,0x00000000)}},
+ {VT_exponent,22,0x3a84e6,{DOUBLEWITHTWODWORDINTREE(0x21000000,0x00000000)}},
+ {VT_exponent,22,0x3a84e7,{DOUBLEWITHTWODWORDINTREE(0x21100000,0x00000000)}},
+ {VT_exponent,22,0x3a84e8,{DOUBLEWITHTWODWORDINTREE(0x21200000,0x00000000)}},
+ {VT_exponent,22,0x3a84e9,{DOUBLEWITHTWODWORDINTREE(0x21300000,0x00000000)}},
+ {VT_exponent,22,0x3a84ea,{DOUBLEWITHTWODWORDINTREE(0x21400000,0x00000000)}},
+ {VT_exponent,22,0x3a84eb,{DOUBLEWITHTWODWORDINTREE(0x21500000,0x00000000)}},
+ {VT_exponent,22,0x3a84ec,{DOUBLEWITHTWODWORDINTREE(0x21600000,0x00000000)}},
+ {VT_exponent,22,0x3a84ed,{DOUBLEWITHTWODWORDINTREE(0x21700000,0x00000000)}},
+ {VT_exponent,22,0x3a84ee,{DOUBLEWITHTWODWORDINTREE(0x21800000,0x00000000)}},
+ {VT_exponent,22,0x3a84ef,{DOUBLEWITHTWODWORDINTREE(0x21900000,0x00000000)}},
+ {VT_exponent,22,0x3a84f0,{DOUBLEWITHTWODWORDINTREE(0x21a00000,0x00000000)}},
+ {VT_exponent,22,0x3a84f1,{DOUBLEWITHTWODWORDINTREE(0x21b00000,0x00000000)}},
+ {VT_exponent,22,0x3a84f2,{DOUBLEWITHTWODWORDINTREE(0x21c00000,0x00000000)}},
+ {VT_exponent,22,0x3a84f3,{DOUBLEWITHTWODWORDINTREE(0x21d00000,0x00000000)}},
+ {VT_exponent,22,0x3a84f4,{DOUBLEWITHTWODWORDINTREE(0x21e00000,0x00000000)}},
+ {VT_exponent,22,0x3a84f5,{DOUBLEWITHTWODWORDINTREE(0x21f00000,0x00000000)}},
+ {VT_exponent,22,0x3a84f6,{DOUBLEWITHTWODWORDINTREE(0x22000000,0x00000000)}},
+ {VT_exponent,22,0x3a84f7,{DOUBLEWITHTWODWORDINTREE(0x22100000,0x00000000)}},
+ {VT_exponent,22,0x3a84f8,{DOUBLEWITHTWODWORDINTREE(0x22200000,0x00000000)}},
+ {VT_exponent,22,0x3a84f9,{DOUBLEWITHTWODWORDINTREE(0x22300000,0x00000000)}},
+ {VT_exponent,22,0x3a84fa,{DOUBLEWITHTWODWORDINTREE(0x22400000,0x00000000)}},
+ {VT_exponent,22,0x3a84fb,{DOUBLEWITHTWODWORDINTREE(0x22500000,0x00000000)}},
+ {VT_exponent,22,0x3a84fc,{DOUBLEWITHTWODWORDINTREE(0x22600000,0x00000000)}},
+ {VT_exponent,22,0x3a84fd,{DOUBLEWITHTWODWORDINTREE(0x22700000,0x00000000)}},
+ {VT_exponent,22,0x3a84fe,{DOUBLEWITHTWODWORDINTREE(0x22800000,0x00000000)}},
+ {VT_exponent,22,0x3a84ff,{DOUBLEWITHTWODWORDINTREE(0x22900000,0x00000000)}},
+ {VT_exponent,22,0x3a8500,{DOUBLEWITHTWODWORDINTREE(0x22a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8501,{DOUBLEWITHTWODWORDINTREE(0x22b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8502,{DOUBLEWITHTWODWORDINTREE(0x22c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8503,{DOUBLEWITHTWODWORDINTREE(0x22d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8504,{DOUBLEWITHTWODWORDINTREE(0x22e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8505,{DOUBLEWITHTWODWORDINTREE(0x22f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8506,{DOUBLEWITHTWODWORDINTREE(0x23000000,0x00000000)}},
+ {VT_exponent,22,0x3a8507,{DOUBLEWITHTWODWORDINTREE(0x23100000,0x00000000)}},
+ {VT_exponent,22,0x3a8508,{DOUBLEWITHTWODWORDINTREE(0x23200000,0x00000000)}},
+ {VT_exponent,22,0x3a8509,{DOUBLEWITHTWODWORDINTREE(0x23300000,0x00000000)}},
+ {VT_exponent,22,0x3a850a,{DOUBLEWITHTWODWORDINTREE(0x23400000,0x00000000)}},
+ {VT_exponent,22,0x3a850b,{DOUBLEWITHTWODWORDINTREE(0x23500000,0x00000000)}},
+ {VT_exponent,22,0x3a850c,{DOUBLEWITHTWODWORDINTREE(0x23600000,0x00000000)}},
+ {VT_exponent,22,0x3a850d,{DOUBLEWITHTWODWORDINTREE(0x23700000,0x00000000)}},
+ {VT_exponent,22,0x3a850e,{DOUBLEWITHTWODWORDINTREE(0x23800000,0x00000000)}},
+ {VT_exponent,22,0x3a850f,{DOUBLEWITHTWODWORDINTREE(0x23900000,0x00000000)}},
+ {VT_exponent,22,0x3a8510,{DOUBLEWITHTWODWORDINTREE(0x23a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8511,{DOUBLEWITHTWODWORDINTREE(0x23b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8512,{DOUBLEWITHTWODWORDINTREE(0x23c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8513,{DOUBLEWITHTWODWORDINTREE(0x23d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8514,{DOUBLEWITHTWODWORDINTREE(0x23e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8515,{DOUBLEWITHTWODWORDINTREE(0x23f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8516,{DOUBLEWITHTWODWORDINTREE(0x24000000,0x00000000)}},
+ {VT_exponent,22,0x3a8517,{DOUBLEWITHTWODWORDINTREE(0x24100000,0x00000000)}},
+ {VT_exponent,22,0x3a8518,{DOUBLEWITHTWODWORDINTREE(0x24200000,0x00000000)}},
+ {VT_exponent,22,0x3a8519,{DOUBLEWITHTWODWORDINTREE(0x24300000,0x00000000)}},
+ {VT_exponent,22,0x3a851a,{DOUBLEWITHTWODWORDINTREE(0x24400000,0x00000000)}},
+ {VT_exponent,22,0x3a851b,{DOUBLEWITHTWODWORDINTREE(0x24500000,0x00000000)}},
+ {VT_exponent,22,0x3a851c,{DOUBLEWITHTWODWORDINTREE(0x24600000,0x00000000)}},
+ {VT_exponent,22,0x3a851d,{DOUBLEWITHTWODWORDINTREE(0x24700000,0x00000000)}},
+ {VT_exponent,22,0x3a851e,{DOUBLEWITHTWODWORDINTREE(0x24800000,0x00000000)}},
+ {VT_exponent,22,0x3a851f,{DOUBLEWITHTWODWORDINTREE(0x24900000,0x00000000)}},
+ {VT_exponent,22,0x3a8520,{DOUBLEWITHTWODWORDINTREE(0x24a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8521,{DOUBLEWITHTWODWORDINTREE(0x24b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8522,{DOUBLEWITHTWODWORDINTREE(0x24c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8523,{DOUBLEWITHTWODWORDINTREE(0x24d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8524,{DOUBLEWITHTWODWORDINTREE(0x24e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8525,{DOUBLEWITHTWODWORDINTREE(0x24f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8526,{DOUBLEWITHTWODWORDINTREE(0x25000000,0x00000000)}},
+ {VT_exponent,22,0x3a8527,{DOUBLEWITHTWODWORDINTREE(0x25100000,0x00000000)}},
+ {VT_exponent,22,0x3a8528,{DOUBLEWITHTWODWORDINTREE(0x25200000,0x00000000)}},
+ {VT_exponent,22,0x3a8529,{DOUBLEWITHTWODWORDINTREE(0x25300000,0x00000000)}},
+ {VT_exponent,22,0x3a852a,{DOUBLEWITHTWODWORDINTREE(0x25400000,0x00000000)}},
+ {VT_exponent,22,0x3a852b,{DOUBLEWITHTWODWORDINTREE(0x25500000,0x00000000)}},
+ {VT_exponent,22,0x3a852c,{DOUBLEWITHTWODWORDINTREE(0x25600000,0x00000000)}},
+ {VT_exponent,22,0x3a852d,{DOUBLEWITHTWODWORDINTREE(0x25700000,0x00000000)}},
+ {VT_exponent,22,0x3a852e,{DOUBLEWITHTWODWORDINTREE(0x25800000,0x00000000)}},
+ {VT_exponent,22,0x3a852f,{DOUBLEWITHTWODWORDINTREE(0x25900000,0x00000000)}},
+ {VT_exponent,22,0x3a8530,{DOUBLEWITHTWODWORDINTREE(0x25a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8531,{DOUBLEWITHTWODWORDINTREE(0x25b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8532,{DOUBLEWITHTWODWORDINTREE(0x25c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8533,{DOUBLEWITHTWODWORDINTREE(0x25d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8534,{DOUBLEWITHTWODWORDINTREE(0x25e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8535,{DOUBLEWITHTWODWORDINTREE(0x25f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8536,{DOUBLEWITHTWODWORDINTREE(0x26000000,0x00000000)}},
+ {VT_exponent,22,0x3a8537,{DOUBLEWITHTWODWORDINTREE(0x26100000,0x00000000)}},
+ {VT_exponent,22,0x3a8538,{DOUBLEWITHTWODWORDINTREE(0x26200000,0x00000000)}},
+ {VT_exponent,22,0x3a8539,{DOUBLEWITHTWODWORDINTREE(0x26300000,0x00000000)}},
+ {VT_exponent,22,0x3a853a,{DOUBLEWITHTWODWORDINTREE(0x26400000,0x00000000)}},
+ {VT_exponent,22,0x3a853b,{DOUBLEWITHTWODWORDINTREE(0x26500000,0x00000000)}},
+ {VT_exponent,22,0x3a853c,{DOUBLEWITHTWODWORDINTREE(0x26600000,0x00000000)}},
+ {VT_exponent,22,0x3a853d,{DOUBLEWITHTWODWORDINTREE(0x26700000,0x00000000)}},
+ {VT_exponent,22,0x3a853e,{DOUBLEWITHTWODWORDINTREE(0x26800000,0x00000000)}},
+ {VT_exponent,22,0x3a853f,{DOUBLEWITHTWODWORDINTREE(0x26900000,0x00000000)}},
+ {VT_exponent,22,0x3a8540,{DOUBLEWITHTWODWORDINTREE(0x26a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8541,{DOUBLEWITHTWODWORDINTREE(0x26b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8542,{DOUBLEWITHTWODWORDINTREE(0x26c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8543,{DOUBLEWITHTWODWORDINTREE(0x26d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8544,{DOUBLEWITHTWODWORDINTREE(0x26e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8545,{DOUBLEWITHTWODWORDINTREE(0x26f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8546,{DOUBLEWITHTWODWORDINTREE(0x27000000,0x00000000)}},
+ {VT_exponent,22,0x3a8547,{DOUBLEWITHTWODWORDINTREE(0x27100000,0x00000000)}},
+ {VT_exponent,22,0x3a8548,{DOUBLEWITHTWODWORDINTREE(0x27200000,0x00000000)}},
+ {VT_exponent,22,0x3a8549,{DOUBLEWITHTWODWORDINTREE(0x27300000,0x00000000)}},
+ {VT_exponent,22,0x3a854a,{DOUBLEWITHTWODWORDINTREE(0x27400000,0x00000000)}},
+ {VT_exponent,22,0x3a854b,{DOUBLEWITHTWODWORDINTREE(0x27500000,0x00000000)}},
+ {VT_exponent,22,0x3a854c,{DOUBLEWITHTWODWORDINTREE(0x27600000,0x00000000)}},
+ {VT_exponent,22,0x3a854d,{DOUBLEWITHTWODWORDINTREE(0x27700000,0x00000000)}},
+ {VT_exponent,22,0x3a854e,{DOUBLEWITHTWODWORDINTREE(0x27800000,0x00000000)}},
+ {VT_exponent,22,0x3a854f,{DOUBLEWITHTWODWORDINTREE(0x27900000,0x00000000)}},
+ {VT_exponent,22,0x3a8550,{DOUBLEWITHTWODWORDINTREE(0x27a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8551,{DOUBLEWITHTWODWORDINTREE(0x27b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8552,{DOUBLEWITHTWODWORDINTREE(0x27c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8553,{DOUBLEWITHTWODWORDINTREE(0x27d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8554,{DOUBLEWITHTWODWORDINTREE(0x27e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8555,{DOUBLEWITHTWODWORDINTREE(0x27f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8556,{DOUBLEWITHTWODWORDINTREE(0x28000000,0x00000000)}},
+ {VT_exponent,22,0x3a8557,{DOUBLEWITHTWODWORDINTREE(0x28100000,0x00000000)}},
+ {VT_exponent,22,0x3a8558,{DOUBLEWITHTWODWORDINTREE(0x28200000,0x00000000)}},
+ {VT_exponent,22,0x3a8559,{DOUBLEWITHTWODWORDINTREE(0x28300000,0x00000000)}},
+ {VT_exponent,22,0x3a855a,{DOUBLEWITHTWODWORDINTREE(0x28400000,0x00000000)}},
+ {VT_exponent,22,0x3a855b,{DOUBLEWITHTWODWORDINTREE(0x28500000,0x00000000)}},
+ {VT_exponent,22,0x3a855c,{DOUBLEWITHTWODWORDINTREE(0x28600000,0x00000000)}},
+ {VT_exponent,22,0x3a855d,{DOUBLEWITHTWODWORDINTREE(0x28700000,0x00000000)}},
+ {VT_exponent,22,0x3a855e,{DOUBLEWITHTWODWORDINTREE(0x28800000,0x00000000)}},
+ {VT_exponent,22,0x3a855f,{DOUBLEWITHTWODWORDINTREE(0x28900000,0x00000000)}},
+ {VT_exponent,22,0x3a8560,{DOUBLEWITHTWODWORDINTREE(0x28a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8561,{DOUBLEWITHTWODWORDINTREE(0x28b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8562,{DOUBLEWITHTWODWORDINTREE(0x28c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8563,{DOUBLEWITHTWODWORDINTREE(0x28d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8564,{DOUBLEWITHTWODWORDINTREE(0x28e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8565,{DOUBLEWITHTWODWORDINTREE(0x28f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8566,{DOUBLEWITHTWODWORDINTREE(0x29000000,0x00000000)}},
+ {VT_exponent,22,0x3a8567,{DOUBLEWITHTWODWORDINTREE(0x29100000,0x00000000)}},
+ {VT_exponent,22,0x3a8568,{DOUBLEWITHTWODWORDINTREE(0x29200000,0x00000000)}},
+ {VT_exponent,22,0x3a8569,{DOUBLEWITHTWODWORDINTREE(0x29300000,0x00000000)}},
+ {VT_exponent,22,0x3a856a,{DOUBLEWITHTWODWORDINTREE(0x29400000,0x00000000)}},
+ {VT_exponent,22,0x3a856b,{DOUBLEWITHTWODWORDINTREE(0x29500000,0x00000000)}},
+ {VT_exponent,22,0x3a856c,{DOUBLEWITHTWODWORDINTREE(0x29600000,0x00000000)}},
+ {VT_exponent,22,0x3a856d,{DOUBLEWITHTWODWORDINTREE(0x29700000,0x00000000)}},
+ {VT_exponent,22,0x3a856e,{DOUBLEWITHTWODWORDINTREE(0x29800000,0x00000000)}},
+ {VT_exponent,22,0x3a856f,{DOUBLEWITHTWODWORDINTREE(0x29900000,0x00000000)}},
+ {VT_exponent,22,0x3a8570,{DOUBLEWITHTWODWORDINTREE(0x29a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8571,{DOUBLEWITHTWODWORDINTREE(0x29b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8572,{DOUBLEWITHTWODWORDINTREE(0x29c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8573,{DOUBLEWITHTWODWORDINTREE(0x29d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8574,{DOUBLEWITHTWODWORDINTREE(0x29e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8575,{DOUBLEWITHTWODWORDINTREE(0x29f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8576,{DOUBLEWITHTWODWORDINTREE(0x2a000000,0x00000000)}},
+ {VT_exponent,22,0x3a8577,{DOUBLEWITHTWODWORDINTREE(0x2a100000,0x00000000)}},
+ {VT_exponent,22,0x3a8578,{DOUBLEWITHTWODWORDINTREE(0x2a200000,0x00000000)}},
+ {VT_exponent,22,0x3a8579,{DOUBLEWITHTWODWORDINTREE(0x2a300000,0x00000000)}},
+ {VT_exponent,22,0x3a857a,{DOUBLEWITHTWODWORDINTREE(0x2a400000,0x00000000)}},
+ {VT_exponent,22,0x3a857b,{DOUBLEWITHTWODWORDINTREE(0x2a500000,0x00000000)}},
+ {VT_exponent,22,0x3a857c,{DOUBLEWITHTWODWORDINTREE(0x2a600000,0x00000000)}},
+ {VT_exponent,22,0x3a857d,{DOUBLEWITHTWODWORDINTREE(0x2a700000,0x00000000)}},
+ {VT_exponent,22,0x3a857e,{DOUBLEWITHTWODWORDINTREE(0x2a800000,0x00000000)}},
+ {VT_exponent,22,0x3a857f,{DOUBLEWITHTWODWORDINTREE(0x2a900000,0x00000000)}},
+ {VT_exponent,22,0x3a8580,{DOUBLEWITHTWODWORDINTREE(0x2aa00000,0x00000000)}},
+ {VT_exponent,22,0x3a8581,{DOUBLEWITHTWODWORDINTREE(0x2ab00000,0x00000000)}},
+ {VT_exponent,22,0x3a8582,{DOUBLEWITHTWODWORDINTREE(0x2ac00000,0x00000000)}},
+ {VT_exponent,22,0x3a8583,{DOUBLEWITHTWODWORDINTREE(0x2ad00000,0x00000000)}},
+ {VT_exponent,22,0x3a8584,{DOUBLEWITHTWODWORDINTREE(0x2ae00000,0x00000000)}},
+ {VT_exponent,22,0x3a8585,{DOUBLEWITHTWODWORDINTREE(0x2af00000,0x00000000)}},
+ {VT_exponent,22,0x3a8586,{DOUBLEWITHTWODWORDINTREE(0x2b000000,0x00000000)}},
+ {VT_exponent,22,0x3a8587,{DOUBLEWITHTWODWORDINTREE(0x2b100000,0x00000000)}},
+ {VT_exponent,22,0x3a8588,{DOUBLEWITHTWODWORDINTREE(0x2b200000,0x00000000)}},
+ {VT_exponent,22,0x3a8589,{DOUBLEWITHTWODWORDINTREE(0x2b300000,0x00000000)}},
+ {VT_exponent,22,0x3a858a,{DOUBLEWITHTWODWORDINTREE(0x2b400000,0x00000000)}},
+ {VT_exponent,22,0x3a858b,{DOUBLEWITHTWODWORDINTREE(0x2b500000,0x00000000)}},
+ {VT_exponent,22,0x3a858c,{DOUBLEWITHTWODWORDINTREE(0x2b600000,0x00000000)}},
+ {VT_exponent,22,0x3a858d,{DOUBLEWITHTWODWORDINTREE(0x2b700000,0x00000000)}},
+ {VT_exponent,22,0x3a858e,{DOUBLEWITHTWODWORDINTREE(0x2b800000,0x00000000)}},
+ {VT_exponent,22,0x3a858f,{DOUBLEWITHTWODWORDINTREE(0x2b900000,0x00000000)}},
+ {VT_exponent,22,0x3a8590,{DOUBLEWITHTWODWORDINTREE(0x2ba00000,0x00000000)}},
+ {VT_exponent,22,0x3a8591,{DOUBLEWITHTWODWORDINTREE(0x2bb00000,0x00000000)}},
+ {VT_exponent,22,0x3a8592,{DOUBLEWITHTWODWORDINTREE(0x2bc00000,0x00000000)}},
+ {VT_exponent,22,0x3a8593,{DOUBLEWITHTWODWORDINTREE(0x2bd00000,0x00000000)}},
+ {VT_exponent,22,0x3a8594,{DOUBLEWITHTWODWORDINTREE(0x2be00000,0x00000000)}},
+ {VT_exponent,22,0x3a8595,{DOUBLEWITHTWODWORDINTREE(0x2bf00000,0x00000000)}},
+ {VT_exponent,22,0x3a8596,{DOUBLEWITHTWODWORDINTREE(0x2c000000,0x00000000)}},
+ {VT_exponent,22,0x3a8597,{DOUBLEWITHTWODWORDINTREE(0x2c100000,0x00000000)}},
+ {VT_exponent,22,0x3a8598,{DOUBLEWITHTWODWORDINTREE(0x2c200000,0x00000000)}},
+ {VT_exponent,22,0x3a8599,{DOUBLEWITHTWODWORDINTREE(0x2c300000,0x00000000)}},
+ {VT_exponent,22,0x3a859a,{DOUBLEWITHTWODWORDINTREE(0x2c400000,0x00000000)}},
+ {VT_exponent,22,0x3a859b,{DOUBLEWITHTWODWORDINTREE(0x2c500000,0x00000000)}},
+ {VT_exponent,22,0x3a859c,{DOUBLEWITHTWODWORDINTREE(0x2c600000,0x00000000)}},
+ {VT_exponent,22,0x3a859d,{DOUBLEWITHTWODWORDINTREE(0x2c700000,0x00000000)}},
+ {VT_exponent,22,0x3a859e,{DOUBLEWITHTWODWORDINTREE(0x2c800000,0x00000000)}},
+ {VT_exponent,22,0x3a859f,{DOUBLEWITHTWODWORDINTREE(0x2c900000,0x00000000)}},
+ {VT_exponent,22,0x3a85a0,{DOUBLEWITHTWODWORDINTREE(0x2ca00000,0x00000000)}},
+ {VT_exponent,22,0x3a85a1,{DOUBLEWITHTWODWORDINTREE(0x2cb00000,0x00000000)}},
+ {VT_exponent,22,0x3a85a2,{DOUBLEWITHTWODWORDINTREE(0x2cc00000,0x00000000)}},
+ {VT_exponent,22,0x3a85a3,{DOUBLEWITHTWODWORDINTREE(0x2cd00000,0x00000000)}},
+ {VT_exponent,22,0x3a85a4,{DOUBLEWITHTWODWORDINTREE(0x2ce00000,0x00000000)}},
+ {VT_exponent,22,0x3a85a5,{DOUBLEWITHTWODWORDINTREE(0x2cf00000,0x00000000)}},
+ {VT_exponent,22,0x3a85a6,{DOUBLEWITHTWODWORDINTREE(0x2d000000,0x00000000)}},
+ {VT_exponent,22,0x3a85a7,{DOUBLEWITHTWODWORDINTREE(0x2d100000,0x00000000)}},
+ {VT_exponent,22,0x3a85a8,{DOUBLEWITHTWODWORDINTREE(0x2d200000,0x00000000)}},
+ {VT_exponent,22,0x3a85a9,{DOUBLEWITHTWODWORDINTREE(0x2d300000,0x00000000)}},
+ {VT_exponent,22,0x3a85aa,{DOUBLEWITHTWODWORDINTREE(0x2d400000,0x00000000)}},
+ {VT_exponent,22,0x3a85ab,{DOUBLEWITHTWODWORDINTREE(0x2d500000,0x00000000)}},
+ {VT_exponent,22,0x3a85ac,{DOUBLEWITHTWODWORDINTREE(0x2d600000,0x00000000)}},
+ {VT_exponent,22,0x3a85ad,{DOUBLEWITHTWODWORDINTREE(0x2d700000,0x00000000)}},
+ {VT_exponent,22,0x3a85ae,{DOUBLEWITHTWODWORDINTREE(0x2d800000,0x00000000)}},
+ {VT_exponent,22,0x3a85af,{DOUBLEWITHTWODWORDINTREE(0x2d900000,0x00000000)}},
+ {VT_exponent,22,0x3a85b0,{DOUBLEWITHTWODWORDINTREE(0x2da00000,0x00000000)}},
+ {VT_exponent,22,0x3a85b1,{DOUBLEWITHTWODWORDINTREE(0x2db00000,0x00000000)}},
+ {VT_exponent,22,0x3a85b2,{DOUBLEWITHTWODWORDINTREE(0x2dc00000,0x00000000)}},
+ {VT_exponent,22,0x3a85b3,{DOUBLEWITHTWODWORDINTREE(0x2dd00000,0x00000000)}},
+ {VT_exponent,22,0x3a85b4,{DOUBLEWITHTWODWORDINTREE(0x2de00000,0x00000000)}},
+ {VT_exponent,22,0x3a85b5,{DOUBLEWITHTWODWORDINTREE(0x2df00000,0x00000000)}},
+ {VT_exponent,22,0x3a85b6,{DOUBLEWITHTWODWORDINTREE(0x2e000000,0x00000000)}},
+ {VT_exponent,22,0x3a85b7,{DOUBLEWITHTWODWORDINTREE(0x2e100000,0x00000000)}},
+ {VT_exponent,22,0x3a85b8,{DOUBLEWITHTWODWORDINTREE(0x2e200000,0x00000000)}},
+ {VT_exponent,22,0x3a85b9,{DOUBLEWITHTWODWORDINTREE(0x2e300000,0x00000000)}},
+ {VT_exponent,22,0x3a85ba,{DOUBLEWITHTWODWORDINTREE(0x2e400000,0x00000000)}},
+ {VT_exponent,22,0x3a85bb,{DOUBLEWITHTWODWORDINTREE(0x2e500000,0x00000000)}},
+ {VT_exponent,22,0x3a85bc,{DOUBLEWITHTWODWORDINTREE(0x2e600000,0x00000000)}},
+ {VT_exponent,22,0x3a85bd,{DOUBLEWITHTWODWORDINTREE(0x2e700000,0x00000000)}},
+ {VT_exponent,22,0x3a85be,{DOUBLEWITHTWODWORDINTREE(0x2e800000,0x00000000)}},
+ {VT_exponent,22,0x3a85bf,{DOUBLEWITHTWODWORDINTREE(0x2e900000,0x00000000)}},
+ {VT_exponent,22,0x3a85c0,{DOUBLEWITHTWODWORDINTREE(0x2ea00000,0x00000000)}},
+ {VT_exponent,22,0x3a85c1,{DOUBLEWITHTWODWORDINTREE(0x2eb00000,0x00000000)}},
+ {VT_exponent,22,0x3a85c2,{DOUBLEWITHTWODWORDINTREE(0x2ec00000,0x00000000)}},
+ {VT_exponent,22,0x3a85c3,{DOUBLEWITHTWODWORDINTREE(0x2ed00000,0x00000000)}},
+ {VT_exponent,22,0x3a85c4,{DOUBLEWITHTWODWORDINTREE(0x2ee00000,0x00000000)}},
+ {VT_exponent,22,0x3a85c5,{DOUBLEWITHTWODWORDINTREE(0x2ef00000,0x00000000)}},
+ {VT_exponent,22,0x3a85c6,{DOUBLEWITHTWODWORDINTREE(0x2f000000,0x00000000)}},
+ {VT_exponent,22,0x3a85c7,{DOUBLEWITHTWODWORDINTREE(0x2f100000,0x00000000)}},
+ {VT_exponent,22,0x3a85c8,{DOUBLEWITHTWODWORDINTREE(0x2f200000,0x00000000)}},
+ {VT_exponent,22,0x3a85c9,{DOUBLEWITHTWODWORDINTREE(0x2f300000,0x00000000)}},
+ {VT_exponent,22,0x3a85ca,{DOUBLEWITHTWODWORDINTREE(0x2f400000,0x00000000)}},
+ {VT_exponent,22,0x3a85cb,{DOUBLEWITHTWODWORDINTREE(0x2f500000,0x00000000)}},
+ {VT_exponent,22,0x3a85cc,{DOUBLEWITHTWODWORDINTREE(0x2f600000,0x00000000)}},
+ {VT_exponent,22,0x3a85cd,{DOUBLEWITHTWODWORDINTREE(0x2f700000,0x00000000)}},
+ {VT_exponent,22,0x3a85ce,{DOUBLEWITHTWODWORDINTREE(0x2f800000,0x00000000)}},
+ {VT_exponent,22,0x3a85cf,{DOUBLEWITHTWODWORDINTREE(0x2f900000,0x00000000)}},
+ {VT_exponent,22,0x3a85d0,{DOUBLEWITHTWODWORDINTREE(0x2fa00000,0x00000000)}},
+ {VT_exponent,22,0x3a85d1,{DOUBLEWITHTWODWORDINTREE(0x2fb00000,0x00000000)}},
+ {VT_exponent,22,0x3a85d2,{DOUBLEWITHTWODWORDINTREE(0x2fc00000,0x00000000)}},
+ {VT_exponent,22,0x3a85d3,{DOUBLEWITHTWODWORDINTREE(0x2fd00000,0x00000000)}},
+ {VT_exponent,22,0x3a85d4,{DOUBLEWITHTWODWORDINTREE(0x2fe00000,0x00000000)}},
+ {VT_exponent,22,0x3a85d5,{DOUBLEWITHTWODWORDINTREE(0x2ff00000,0x00000000)}},
+ {VT_exponent,22,0x3a85d6,{DOUBLEWITHTWODWORDINTREE(0x30000000,0x00000000)}},
+ {VT_exponent,22,0x3a85d7,{DOUBLEWITHTWODWORDINTREE(0x30100000,0x00000000)}},
+ {VT_exponent,22,0x3a85d8,{DOUBLEWITHTWODWORDINTREE(0x30200000,0x00000000)}},
+ {VT_exponent,22,0x3a85d9,{DOUBLEWITHTWODWORDINTREE(0x30300000,0x00000000)}},
+ {VT_exponent,22,0x3a85da,{DOUBLEWITHTWODWORDINTREE(0x30400000,0x00000000)}},
+ {VT_exponent,22,0x3a85db,{DOUBLEWITHTWODWORDINTREE(0x30500000,0x00000000)}},
+ {VT_exponent,22,0x3a85dc,{DOUBLEWITHTWODWORDINTREE(0x30600000,0x00000000)}},
+ {VT_exponent,22,0x3a85dd,{DOUBLEWITHTWODWORDINTREE(0x30700000,0x00000000)}},
+ {VT_exponent,22,0x3a85de,{DOUBLEWITHTWODWORDINTREE(0x30800000,0x00000000)}},
+ {VT_exponent,22,0x3a85df,{DOUBLEWITHTWODWORDINTREE(0x30900000,0x00000000)}},
+ {VT_exponent,22,0x3a85e0,{DOUBLEWITHTWODWORDINTREE(0x30a00000,0x00000000)}},
+ {VT_exponent,22,0x3a85e1,{DOUBLEWITHTWODWORDINTREE(0x30b00000,0x00000000)}},
+ {VT_exponent,22,0x3a85e2,{DOUBLEWITHTWODWORDINTREE(0x30c00000,0x00000000)}},
+ {VT_exponent,22,0x3a85e3,{DOUBLEWITHTWODWORDINTREE(0x30d00000,0x00000000)}},
+ {VT_exponent,22,0x3a85e4,{DOUBLEWITHTWODWORDINTREE(0x30e00000,0x00000000)}},
+ {VT_exponent,22,0x3a85e5,{DOUBLEWITHTWODWORDINTREE(0x30f00000,0x00000000)}},
+ {VT_exponent,22,0x3a85e6,{DOUBLEWITHTWODWORDINTREE(0x31000000,0x00000000)}},
+ {VT_exponent,22,0x3a85e7,{DOUBLEWITHTWODWORDINTREE(0x31100000,0x00000000)}},
+ {VT_exponent,22,0x3a85e8,{DOUBLEWITHTWODWORDINTREE(0x31200000,0x00000000)}},
+ {VT_exponent,22,0x3a85e9,{DOUBLEWITHTWODWORDINTREE(0x31300000,0x00000000)}},
+ {VT_exponent,22,0x3a85ea,{DOUBLEWITHTWODWORDINTREE(0x31400000,0x00000000)}},
+ {VT_exponent,22,0x3a85eb,{DOUBLEWITHTWODWORDINTREE(0x31500000,0x00000000)}},
+ {VT_exponent,22,0x3a85ec,{DOUBLEWITHTWODWORDINTREE(0x31600000,0x00000000)}},
+ {VT_exponent,22,0x3a85ed,{DOUBLEWITHTWODWORDINTREE(0x31700000,0x00000000)}},
+ {VT_exponent,22,0x3a85ee,{DOUBLEWITHTWODWORDINTREE(0x31800000,0x00000000)}},
+ {VT_exponent,22,0x3a85ef,{DOUBLEWITHTWODWORDINTREE(0x31900000,0x00000000)}},
+ {VT_exponent,22,0x3a85f0,{DOUBLEWITHTWODWORDINTREE(0x31a00000,0x00000000)}},
+ {VT_exponent,22,0x3a85f1,{DOUBLEWITHTWODWORDINTREE(0x31b00000,0x00000000)}},
+ {VT_exponent,22,0x3a85f2,{DOUBLEWITHTWODWORDINTREE(0x31c00000,0x00000000)}},
+ {VT_exponent,22,0x3a85f3,{DOUBLEWITHTWODWORDINTREE(0x31d00000,0x00000000)}},
+ {VT_exponent,22,0x3a85f4,{DOUBLEWITHTWODWORDINTREE(0x31e00000,0x00000000)}},
+ {VT_exponent,22,0x3a85f5,{DOUBLEWITHTWODWORDINTREE(0x31f00000,0x00000000)}},
+ {VT_exponent,22,0x3a85f6,{DOUBLEWITHTWODWORDINTREE(0x32000000,0x00000000)}},
+ {VT_exponent,22,0x3a85f7,{DOUBLEWITHTWODWORDINTREE(0x32100000,0x00000000)}},
+ {VT_exponent,22,0x3a85f8,{DOUBLEWITHTWODWORDINTREE(0x32200000,0x00000000)}},
+ {VT_exponent,22,0x3a85f9,{DOUBLEWITHTWODWORDINTREE(0x32300000,0x00000000)}},
+ {VT_exponent,22,0x3a85fa,{DOUBLEWITHTWODWORDINTREE(0x32400000,0x00000000)}},
+ {VT_exponent,22,0x3a85fb,{DOUBLEWITHTWODWORDINTREE(0x32500000,0x00000000)}},
+ {VT_exponent,22,0x3a85fc,{DOUBLEWITHTWODWORDINTREE(0x32600000,0x00000000)}},
+ {VT_exponent,22,0x3a85fd,{DOUBLEWITHTWODWORDINTREE(0x32700000,0x00000000)}},
+ {VT_exponent,22,0x3a85fe,{DOUBLEWITHTWODWORDINTREE(0x32800000,0x00000000)}},
+ {VT_exponent,22,0x3a85ff,{DOUBLEWITHTWODWORDINTREE(0x32900000,0x00000000)}},
+ {VT_exponent,22,0x3a8600,{DOUBLEWITHTWODWORDINTREE(0x32a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8601,{DOUBLEWITHTWODWORDINTREE(0x32b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8602,{DOUBLEWITHTWODWORDINTREE(0x32c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8603,{DOUBLEWITHTWODWORDINTREE(0x32d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8604,{DOUBLEWITHTWODWORDINTREE(0x32e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8605,{DOUBLEWITHTWODWORDINTREE(0x32f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8606,{DOUBLEWITHTWODWORDINTREE(0x33000000,0x00000000)}},
+ {VT_exponent,22,0x3a8607,{DOUBLEWITHTWODWORDINTREE(0x33100000,0x00000000)}},
+ {VT_exponent,22,0x3a8608,{DOUBLEWITHTWODWORDINTREE(0x33200000,0x00000000)}},
+ {VT_exponent,22,0x3a8609,{DOUBLEWITHTWODWORDINTREE(0x33300000,0x00000000)}},
+ {VT_exponent,22,0x3a860a,{DOUBLEWITHTWODWORDINTREE(0x33400000,0x00000000)}},
+ {VT_exponent,22,0x3a860b,{DOUBLEWITHTWODWORDINTREE(0x33500000,0x00000000)}},
+ {VT_exponent,22,0x3a860c,{DOUBLEWITHTWODWORDINTREE(0x33600000,0x00000000)}},
+ {VT_exponent,22,0x3a860d,{DOUBLEWITHTWODWORDINTREE(0x33700000,0x00000000)}},
+ {VT_exponent,22,0x3a860e,{DOUBLEWITHTWODWORDINTREE(0x33800000,0x00000000)}},
+ {VT_exponent,22,0x3a860f,{DOUBLEWITHTWODWORDINTREE(0x33900000,0x00000000)}},
+ {VT_exponent,22,0x3a8610,{DOUBLEWITHTWODWORDINTREE(0x33a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8611,{DOUBLEWITHTWODWORDINTREE(0x33b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8612,{DOUBLEWITHTWODWORDINTREE(0x33c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8613,{DOUBLEWITHTWODWORDINTREE(0x33d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8614,{DOUBLEWITHTWODWORDINTREE(0x33e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8615,{DOUBLEWITHTWODWORDINTREE(0x33f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8616,{DOUBLEWITHTWODWORDINTREE(0x34000000,0x00000000)}},
+ {VT_exponent,22,0x3a8617,{DOUBLEWITHTWODWORDINTREE(0x34100000,0x00000000)}},
+ {VT_exponent,22,0x3a8618,{DOUBLEWITHTWODWORDINTREE(0x34200000,0x00000000)}},
+ {VT_exponent,22,0x3a8619,{DOUBLEWITHTWODWORDINTREE(0x34300000,0x00000000)}},
+ {VT_exponent,22,0x3a861a,{DOUBLEWITHTWODWORDINTREE(0x34400000,0x00000000)}},
+ {VT_exponent,22,0x3a861b,{DOUBLEWITHTWODWORDINTREE(0x34500000,0x00000000)}},
+ {VT_exponent,22,0x3a861c,{DOUBLEWITHTWODWORDINTREE(0x34600000,0x00000000)}},
+ {VT_exponent,22,0x3a861d,{DOUBLEWITHTWODWORDINTREE(0x34700000,0x00000000)}},
+ {VT_exponent,22,0x3a861e,{DOUBLEWITHTWODWORDINTREE(0x34800000,0x00000000)}},
+ {VT_exponent,22,0x3a861f,{DOUBLEWITHTWODWORDINTREE(0x34900000,0x00000000)}},
+ {VT_exponent,22,0x3a8620,{DOUBLEWITHTWODWORDINTREE(0x34a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8621,{DOUBLEWITHTWODWORDINTREE(0x34b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8622,{DOUBLEWITHTWODWORDINTREE(0x34c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8623,{DOUBLEWITHTWODWORDINTREE(0x34d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8624,{DOUBLEWITHTWODWORDINTREE(0x34e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8625,{DOUBLEWITHTWODWORDINTREE(0x34f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8626,{DOUBLEWITHTWODWORDINTREE(0x35000000,0x00000000)}},
+ {VT_exponent,22,0x3a8627,{DOUBLEWITHTWODWORDINTREE(0x35100000,0x00000000)}},
+ {VT_exponent,22,0x3a8628,{DOUBLEWITHTWODWORDINTREE(0x35200000,0x00000000)}},
+ {VT_exponent,22,0x3a8629,{DOUBLEWITHTWODWORDINTREE(0x35300000,0x00000000)}},
+ {VT_exponent,18,0xf787,{DOUBLEWITHTWODWORDINTREE(0x35400000,0x00000000)}},
+ {VT_exponent,18,0xd1d4,{DOUBLEWITHTWODWORDINTREE(0x35500000,0x00000000)}},
+ {VT_exponent,19,0x77f9f,{DOUBLEWITHTWODWORDINTREE(0x35600000,0x00000000)}},
+ {VT_exponent,18,0x3b8fb,{DOUBLEWITHTWODWORDINTREE(0x35700000,0x00000000)}},
+ {VT_exponent,19,0x1ef1a,{DOUBLEWITHTWODWORDINTREE(0x35800000,0x00000000)}},
+ {VT_exponent,21,0x1d4315,{DOUBLEWITHTWODWORDINTREE(0x35900000,0x00000000)}},
+ {VT_exponent,16,0x3de2,{DOUBLEWITHTWODWORDINTREE(0x35a00000,0x00000000)}},
+ {VT_exponent,22,0x3a862c,{DOUBLEWITHTWODWORDINTREE(0x35b00000,0x00000000)}},
+ {VT_exponent,22,0x3a862d,{DOUBLEWITHTWODWORDINTREE(0x35c00000,0x00000000)}},
+ {VT_exponent,22,0x3a862e,{DOUBLEWITHTWODWORDINTREE(0x35d00000,0x00000000)}},
+ {VT_exponent,22,0x3a862f,{DOUBLEWITHTWODWORDINTREE(0x35e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8630,{DOUBLEWITHTWODWORDINTREE(0x35f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8631,{DOUBLEWITHTWODWORDINTREE(0x36000000,0x00000000)}},
+ {VT_exponent,22,0x3a8632,{DOUBLEWITHTWODWORDINTREE(0x36100000,0x00000000)}},
+ {VT_exponent,22,0x3a8633,{DOUBLEWITHTWODWORDINTREE(0x36200000,0x00000000)}},
+ {VT_exponent,22,0x3a8634,{DOUBLEWITHTWODWORDINTREE(0x36300000,0x00000000)}},
+ {VT_exponent,22,0x3a8635,{DOUBLEWITHTWODWORDINTREE(0x36400000,0x00000000)}},
+ {VT_exponent,22,0x3a8636,{DOUBLEWITHTWODWORDINTREE(0x36500000,0x00000000)}},
+ {VT_exponent,22,0x3a8637,{DOUBLEWITHTWODWORDINTREE(0x36600000,0x00000000)}},
+ {VT_exponent,22,0x3a8638,{DOUBLEWITHTWODWORDINTREE(0x36700000,0x00000000)}},
+ {VT_exponent,21,0x1d431d,{DOUBLEWITHTWODWORDINTREE(0x36800000,0x00000000)}},
+ {VT_exponent,22,0x3a8639,{DOUBLEWITHTWODWORDINTREE(0x36900000,0x00000000)}},
+ {VT_exponent,22,0x3a863c,{DOUBLEWITHTWODWORDINTREE(0x36a00000,0x00000000)}},
+ {VT_exponent,16,0x3de0,{DOUBLEWITHTWODWORDINTREE(0x36b00000,0x00000000)}},
+ {VT_exponent,18,0x3a95e,{DOUBLEWITHTWODWORDINTREE(0x36c00000,0x00000000)}},
+ {VT_exponent,21,0x1d431f,{DOUBLEWITHTWODWORDINTREE(0x36d00000,0x00000000)}},
+ {VT_exponent,22,0x3a863d,{DOUBLEWITHTWODWORDINTREE(0x36e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8640,{DOUBLEWITHTWODWORDINTREE(0x36f00000,0x00000000)}},
+ {VT_exponent,20,0x34749,{DOUBLEWITHTWODWORDINTREE(0x37000000,0x00000000)}},
+ {VT_exponent,20,0x3474d,{DOUBLEWITHTWODWORDINTREE(0x37100000,0x00000000)}},
+ {VT_exponent,22,0x3a8641,{DOUBLEWITHTWODWORDINTREE(0x37200000,0x00000000)}},
+ {VT_exponent,22,0x3a8642,{DOUBLEWITHTWODWORDINTREE(0x37300000,0x00000000)}},
+ {VT_exponent,22,0x3a8643,{DOUBLEWITHTWODWORDINTREE(0x37400000,0x00000000)}},
+ {VT_exponent,22,0x3a8644,{DOUBLEWITHTWODWORDINTREE(0x37500000,0x00000000)}},
+ {VT_exponent,22,0x3a8645,{DOUBLEWITHTWODWORDINTREE(0x37600000,0x00000000)}},
+ {VT_exponent,22,0x3a8646,{DOUBLEWITHTWODWORDINTREE(0x37700000,0x00000000)}},
+ {VT_exponent,22,0x3a8647,{DOUBLEWITHTWODWORDINTREE(0x37800000,0x00000000)}},
+ {VT_exponent,22,0x3a8648,{DOUBLEWITHTWODWORDINTREE(0x37900000,0x00000000)}},
+ {VT_exponent,22,0x3a8649,{DOUBLEWITHTWODWORDINTREE(0x37a00000,0x00000000)}},
+ {VT_exponent,22,0x3a864a,{DOUBLEWITHTWODWORDINTREE(0x37b00000,0x00000000)}},
+ {VT_exponent,22,0x3a864b,{DOUBLEWITHTWODWORDINTREE(0x37c00000,0x00000000)}},
+ {VT_exponent,22,0x3a864c,{DOUBLEWITHTWODWORDINTREE(0x37d00000,0x00000000)}},
+ {VT_exponent,22,0x3a864d,{DOUBLEWITHTWODWORDINTREE(0x37e00000,0x00000000)}},
+ {VT_exponent,22,0x3a864e,{DOUBLEWITHTWODWORDINTREE(0x37f00000,0x00000000)}},
+ {VT_exponent,22,0x3a864f,{DOUBLEWITHTWODWORDINTREE(0x38000000,0x00000000)}},
+ {VT_exponent,22,0x3a8650,{DOUBLEWITHTWODWORDINTREE(0x38100000,0x00000000)}},
+ {VT_exponent,22,0x3a8651,{DOUBLEWITHTWODWORDINTREE(0x38200000,0x00000000)}},
+ {VT_exponent,22,0x3a8652,{DOUBLEWITHTWODWORDINTREE(0x38300000,0x00000000)}},
+ {VT_exponent,22,0x3a8653,{DOUBLEWITHTWODWORDINTREE(0x38400000,0x00000000)}},
+ {VT_exponent,22,0x3a8654,{DOUBLEWITHTWODWORDINTREE(0x38500000,0x00000000)}},
+ {VT_exponent,22,0x3a8655,{DOUBLEWITHTWODWORDINTREE(0x38600000,0x00000000)}},
+ {VT_exponent,22,0x3a8656,{DOUBLEWITHTWODWORDINTREE(0x38700000,0x00000000)}},
+ {VT_exponent,22,0x3a8657,{DOUBLEWITHTWODWORDINTREE(0x38800000,0x00000000)}},
+ {VT_exponent,22,0x3a8658,{DOUBLEWITHTWODWORDINTREE(0x38900000,0x00000000)}},
+ {VT_exponent,22,0x3a8659,{DOUBLEWITHTWODWORDINTREE(0x38a00000,0x00000000)}},
+ {VT_exponent,22,0x3a865a,{DOUBLEWITHTWODWORDINTREE(0x38b00000,0x00000000)}},
+ {VT_exponent,22,0x3a865b,{DOUBLEWITHTWODWORDINTREE(0x38c00000,0x00000000)}},
+ {VT_exponent,22,0x3a865c,{DOUBLEWITHTWODWORDINTREE(0x38d00000,0x00000000)}},
+ {VT_exponent,22,0x3a865d,{DOUBLEWITHTWODWORDINTREE(0x38e00000,0x00000000)}},
+ {VT_exponent,21,0x1d432f,{DOUBLEWITHTWODWORDINTREE(0x38f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8660,{DOUBLEWITHTWODWORDINTREE(0x39000000,0x00000000)}},
+ {VT_exponent,22,0x3a8661,{DOUBLEWITHTWODWORDINTREE(0x39100000,0x00000000)}},
+ {VT_exponent,22,0x3a8662,{DOUBLEWITHTWODWORDINTREE(0x39200000,0x00000000)}},
+ {VT_exponent,21,0x1d4332,{DOUBLEWITHTWODWORDINTREE(0x39300000,0x00000000)}},
+ {VT_exponent,18,0xd1d5,{DOUBLEWITHTWODWORDINTREE(0x39400000,0x00000000)}},
+ {VT_exponent,18,0x3bfda,{DOUBLEWITHTWODWORDINTREE(0x39500000,0x00000000)}},
+ {VT_exponent,15,0x7528,{DOUBLEWITHTWODWORDINTREE(0x39600000,0x00000000)}},
+ {VT_exponent,15,0x7529,{DOUBLEWITHTWODWORDINTREE(0x39700000,0x00000000)}},
+ {VT_exponent,18,0x3a95f,{DOUBLEWITHTWODWORDINTREE(0x39800000,0x00000000)}},
+ {VT_exponent,17,0x1d434,{DOUBLEWITHTWODWORDINTREE(0x39900000,0x00000000)}},
+ {VT_exponent,19,0x750cd,{DOUBLEWITHTWODWORDINTREE(0x39a00000,0x00000000)}},
+ {VT_exponent,18,0x3a867,{DOUBLEWITHTWODWORDINTREE(0x39b00000,0x00000000)}},
+ {VT_exponent,19,0x771fd,{DOUBLEWITHTWODWORDINTREE(0x39c00000,0x00000000)}},
+ {VT_exponent,15,0x7764,{DOUBLEWITHTWODWORDINTREE(0x39d00000,0x00000000)}},
+ {VT_exponent,20,0xee3f9,{DOUBLEWITHTWODWORDINTREE(0x39e00000,0x00000000)}},
+ {VT_exponent,18,0x3bfdb,{DOUBLEWITHTWODWORDINTREE(0x39f00000,0x00000000)}},
+ {VT_exponent,16,0xeff7,{DOUBLEWITHTWODWORDINTREE(0x3a000000,0x00000000)}},
+ {VT_exponent,18,0xd1d6,{DOUBLEWITHTWODWORDINTREE(0x3a100000,0x00000000)}},
+ {VT_exponent,22,0x3a8663,{DOUBLEWITHTWODWORDINTREE(0x3a200000,0x00000000)}},
+ {VT_exponent,22,0x3a8666,{DOUBLEWITHTWODWORDINTREE(0x3a300000,0x00000000)}},
+ {VT_exponent,18,0x3b8fa,{DOUBLEWITHTWODWORDINTREE(0x3a400000,0x00000000)}},
+ {VT_exponent,17,0x1d435,{DOUBLEWITHTWODWORDINTREE(0x3a500000,0x00000000)}},
+ {VT_exponent,17,0x1dfe4,{DOUBLEWITHTWODWORDINTREE(0x3a600000,0x00000000)}},
+ {VT_exponent,19,0x750d8,{DOUBLEWITHTWODWORDINTREE(0x3a700000,0x00000000)}},
+ {VT_exponent,18,0x3a95b,{DOUBLEWITHTWODWORDINTREE(0x3a800000,0x00000000)}},
+ {VT_exponent,19,0x77f9e,{DOUBLEWITHTWODWORDINTREE(0x3a900000,0x00000000)}},
+ {VT_exponent,19,0x750d9,{DOUBLEWITHTWODWORDINTREE(0x3aa00000,0x00000000)}},
+ {VT_exponent,18,0xd1d7,{DOUBLEWITHTWODWORDINTREE(0x3ab00000,0x00000000)}},
+ {VT_exponent,18,0x3b8ff,{DOUBLEWITHTWODWORDINTREE(0x3ac00000,0x00000000)}},
+ {VT_exponent,17,0x1dc7c,{DOUBLEWITHTWODWORDINTREE(0x3ad00000,0x00000000)}},
+ {VT_exponent,19,0x750da,{DOUBLEWITHTWODWORDINTREE(0x3ae00000,0x00000000)}},
+ {VT_exponent,17,0x7bc2,{DOUBLEWITHTWODWORDINTREE(0x3af00000,0x00000000)}},
+ {VT_exponent,18,0x3bfca,{DOUBLEWITHTWODWORDINTREE(0x3b000000,0x00000000)}},
+ {VT_exponent,19,0x1a3a5,{DOUBLEWITHTWODWORDINTREE(0x3b100000,0x00000000)}},
+ {VT_exponent,17,0x1d4ac,{DOUBLEWITHTWODWORDINTREE(0x3b200000,0x00000000)}},
+ {VT_exponent,18,0x3a86e,{DOUBLEWITHTWODWORDINTREE(0x3b300000,0x00000000)}},
+ {VT_exponent,17,0x1d438,{DOUBLEWITHTWODWORDINTREE(0x3b400000,0x00000000)}},
+ {VT_exponent,18,0x3bfcb,{DOUBLEWITHTWODWORDINTREE(0x3b500000,0x00000000)}},
+ {VT_exponent,19,0x1a3a7,{DOUBLEWITHTWODWORDINTREE(0x3b600000,0x00000000)}},
+ {VT_exponent,17,0x1d4ae,{DOUBLEWITHTWODWORDINTREE(0x3b700000,0x00000000)}},
+ {VT_exponent,18,0x3bfce,{DOUBLEWITHTWODWORDINTREE(0x3b800000,0x00000000)}},
+ {VT_exponent,18,0xf78c,{DOUBLEWITHTWODWORDINTREE(0x3b900000,0x00000000)}},
+ {VT_exponent,17,0x1dfec,{DOUBLEWITHTWODWORDINTREE(0x3ba00000,0x00000000)}},
+ {VT_exponent,17,0x1d439,{DOUBLEWITHTWODWORDINTREE(0x3bb00000,0x00000000)}},
+ {VT_exponent,17,0x68e8,{DOUBLEWITHTWODWORDINTREE(0x3bc00000,0x00000000)}},
+ {VT_exponent,18,0xf786,{DOUBLEWITHTWODWORDINTREE(0x3bd00000,0x00000000)}},
+ {VT_exponent,15,0x771e,{DOUBLEWITHTWODWORDINTREE(0x3be00000,0x00000000)}},
+ {VT_exponent,17,0x1dfe6,{DOUBLEWITHTWODWORDINTREE(0x3bf00000,0x00000000)}},
+ {VT_exponent,15,0x77f8,{DOUBLEWITHTWODWORDINTREE(0x3c000000,0x00000000)}},
+ {VT_exponent,14,0x3bb3,{DOUBLEWITHTWODWORDINTREE(0x3c100000,0x00000000)}},
+ {VT_exponent,14,0x3b8e,{DOUBLEWITHTWODWORDINTREE(0x3c200000,0x00000000)}},
+ {VT_exponent,14,0x3a82,{DOUBLEWITHTWODWORDINTREE(0x3c300000,0x00000000)}},
+ {VT_exponent,14,0x3b96,{DOUBLEWITHTWODWORDINTREE(0x3c400000,0x00000000)}},
+ {VT_exponent,13,0x68f,{DOUBLEWITHTWODWORDINTREE(0x3c500000,0x00000000)}},
+ {VT_exponent,12,0x3d4,{DOUBLEWITHTWODWORDINTREE(0x3c600000,0x00000000)}},
+ {VT_exponent,13,0x1dca,{DOUBLEWITHTWODWORDINTREE(0x3c700000,0x00000000)}},
+ {VT_exponent,12,0x346,{DOUBLEWITHTWODWORDINTREE(0x3c800000,0x00000000)}},
+ {VT_exponent,12,0xee7,{DOUBLEWITHTWODWORDINTREE(0x3c900000,0x00000000)}},
+ {VT_exponent,12,0xeea,{DOUBLEWITHTWODWORDINTREE(0x3ca00000,0x00000000)}},
+ {VT_exponent,11,0x1ed,{DOUBLEWITHTWODWORDINTREE(0x3cb00000,0x00000000)}},
+ {VT_exponent,12,0x3df,{DOUBLEWITHTWODWORDINTREE(0x3cc00000,0x00000000)}},
+ {VT_exponent,11,0x1a2,{DOUBLEWITHTWODWORDINTREE(0x3cd00000,0x00000000)}},
+ {VT_exponent,11,0x56f,{DOUBLEWITHTWODWORDINTREE(0x3ce00000,0x00000000)}},
+ {VT_exponent,11,0xb9,{DOUBLEWITHTWODWORDINTREE(0x3cf00000,0x00000000)}},
+ {VT_exponent,13,0x7b2,{DOUBLEWITHTWODWORDINTREE(0x3d000000,0x00000000)}},
+ {VT_exponent,13,0x1dd8,{DOUBLEWITHTWODWORDINTREE(0x3d100000,0x00000000)}},
+ {VT_exponent,13,0x15ba,{DOUBLEWITHTWODWORDINTREE(0x3d200000,0x00000000)}},
+ {VT_exponent,12,0xee6,{DOUBLEWITHTWODWORDINTREE(0x3d300000,0x00000000)}},
+ {VT_exponent,13,0x15b8,{DOUBLEWITHTWODWORDINTREE(0x3d400000,0x00000000)}},
+ {VT_exponent,14,0xf79,{DOUBLEWITHTWODWORDINTREE(0x3d500000,0x00000000)}},
+ {VT_exponent,14,0x3a81,{DOUBLEWITHTWODWORDINTREE(0x3d600000,0x00000000)}},
+ {VT_exponent,14,0xd1c,{DOUBLEWITHTWODWORDINTREE(0x3d700000,0x00000000)}},
+ {VT_exponent,15,0x7765,{DOUBLEWITHTWODWORDINTREE(0x3d800000,0x00000000)}},
+ {VT_exponent,14,0xf54,{DOUBLEWITHTWODWORDINTREE(0x3d900000,0x00000000)}},
+ {VT_exponent,13,0x15b9,{DOUBLEWITHTWODWORDINTREE(0x3da00000,0x00000000)}},
+ {VT_exponent,13,0x7ab,{DOUBLEWITHTWODWORDINTREE(0x3db00000,0x00000000)}},
+ {VT_exponent,15,0x7500,{DOUBLEWITHTWODWORDINTREE(0x3dc00000,0x00000000)}},
+ {VT_exponent,15,0x1eaa,{DOUBLEWITHTWODWORDINTREE(0x3dd00000,0x00000000)}},
+ {VT_exponent,15,0x7501,{DOUBLEWITHTWODWORDINTREE(0x3de00000,0x00000000)}},
+ {VT_exponent,15,0x1eab,{DOUBLEWITHTWODWORDINTREE(0x3df00000,0x00000000)}},
+ {VT_exponent,14,0x3b97,{DOUBLEWITHTWODWORDINTREE(0x3e000000,0x00000000)}},
+ {VT_exponent,15,0x752a,{DOUBLEWITHTWODWORDINTREE(0x3e100000,0x00000000)}},
+ {VT_exponent,15,0x77fa,{DOUBLEWITHTWODWORDINTREE(0x3e200000,0x00000000)}},
+ {VT_double,10,0xf4,{DOUBLEWITHTWODWORDINTREE(0x3e35798e,0xe2308c3a)}},
+ {VT_exponent,14,0x3a93,{DOUBLEWITHTWODWORDINTREE(0x3e300000,0x00000000)}},
+ {VT_double,11,0x77c,{DOUBLEWITHTWODWORDINTREE(0x3e45798e,0xe2308c3a)}},
+ {VT_exponent,13,0x1dc6,{DOUBLEWITHTWODWORDINTREE(0x3e400000,0x00000000)}},
+ {VT_exponent,13,0x7bd,{DOUBLEWITHTWODWORDINTREE(0x3e500000,0x00000000)}},
+ {VT_exponent,13,0x1dff,{DOUBLEWITHTWODWORDINTREE(0x3e600000,0x00000000)}},
+ {VT_exponent,12,0xefe,{DOUBLEWITHTWODWORDINTREE(0x3e700000,0x00000000)}},
+ {VT_double,8,0xaf,{DOUBLEWITHTWODWORDINTREE(0x3e8ad7f2,0x9abcaf4a)}},
+ {VT_exponent,12,0xeed,{DOUBLEWITHTWODWORDINTREE(0x3e800000,0x00000000)}},
+ {VT_exponent,11,0xb8,{DOUBLEWITHTWODWORDINTREE(0x3e900000,0x00000000)}},
+ {VT_exponent,12,0x3d8,{DOUBLEWITHTWODWORDINTREE(0x3ea00000,0x00000000)}},
+ {VT_exponent,11,0x1eb,{DOUBLEWITHTWODWORDINTREE(0x3eb00000,0x00000000)}},
+ {VT_double,9,0x1d2,{DOUBLEWITHTWODWORDINTREE(0x3ec0c6f7,0xa0b5ed8e)}},
+ {VT_exponent,13,0x1d4b,{DOUBLEWITHTWODWORDINTREE(0x3ec00000,0x00000000)}},
+ {VT_exponent,13,0x7b3,{DOUBLEWITHTWODWORDINTREE(0x3ed00000,0x00000000)}},
+ {VT_exponent,10,0x5d,{DOUBLEWITHTWODWORDINTREE(0x3ee00000,0x00000000)}},
+ {VT_exponent,12,0xeeb,{DOUBLEWITHTWODWORDINTREE(0x3ef00000,0x00000000)}},
+ {VT_exponent,11,0x1ee,{DOUBLEWITHTWODWORDINTREE(0x3f000000,0x00000000)}},
+ {VT_exponent,10,0x5f,{DOUBLEWITHTWODWORDINTREE(0x3f100000,0x00000000)}},
+ {VT_exponent,10,0x2b6,{DOUBLEWITHTWODWORDINTREE(0x3f200000,0x00000000)}},
+ {VT_exponent,9,0x1de,{DOUBLEWITHTWODWORDINTREE(0x3f300000,0x00000000)}},
+ {VT_double,10,0xd0,{DOUBLEWITHTWODWORDINTREE(0x3f454c98,0x5f06f694)}},
+ {VT_double,6,0x9,{DOUBLEWITHTWODWORDINTREE(0x3f4a36e2,0xeb1c432d)}},
+ {VT_exponent,8,0xe8,{DOUBLEWITHTWODWORDINTREE(0x3f400000,0x00000000)}},
+ {VT_double,4,0xf,{DOUBLEWITHTWODWORDINTREE(0x3f50624d,0xd2f1a9fc)}},
+ {VT_exponent,8,0xae,{DOUBLEWITHTWODWORDINTREE(0x3f500000,0x00000000)}},
+ {VT_double,5,0x16,{DOUBLEWITHTWODWORDINTREE(0x3f60624d,0xd2f1a9fc)}},
+ {VT_exponent,7,0x1b,{DOUBLEWITHTWODWORDINTREE(0x3f600000,0x00000000)}},
+ {VT_exponent,7,0x76,{DOUBLEWITHTWODWORDINTREE(0x3f700000,0x00000000)}},
+ {VT_exponent,7,0xa,{DOUBLEWITHTWODWORDINTREE(0x3f800000,0x00000000)}},
+ {VT_exponent,6,0x8,{DOUBLEWITHTWODWORDINTREE(0x3f900000,0x00000000)}},
+ {VT_exponent,6,0xe,{DOUBLEWITHTWODWORDINTREE(0x3fa00000,0x00000000)}},
+ {VT_double,11,0x751,{DOUBLEWITHTWODWORDINTREE(0x3fbe69ad,0x42c3c9ee)}},
+ {VT_exponent,6,0x4,{DOUBLEWITHTWODWORDINTREE(0x3fb00000,0x00000000)}},
+ {VT_exponent,6,0xc,{DOUBLEWITHTWODWORDINTREE(0x3fc00000,0x00000000)}},
+ {VT_exponent,5,0x3,{DOUBLEWITHTWODWORDINTREE(0x3fd00000,0x00000000)}},
+ {VT_double,11,0x777,{DOUBLEWITHTWODWORDINTREE(0x3fe00000,0x00000000)}},
+ {VT_double,9,0x1d6,{DOUBLEWITHTWODWORDINTREE(0x3fefffff,0xf8000002)}},
+ {VT_exponent,4,0x8,{DOUBLEWITHTWODWORDINTREE(0x3fe00000,0x00000000)}},
+ {VT_double,4,0x0,{DOUBLEWITHTWODWORDINTREE(0x3ff00000,0x00000000)}},
+ {VT_exponent,5,0x13,{DOUBLEWITHTWODWORDINTREE(0x3ff00000,0x00000000)}},
+ {VT_exponent,5,0x1b,{DOUBLEWITHTWODWORDINTREE(0x40000000,0x00000000)}},
+ {VT_double,9,0x15a,{DOUBLEWITHTWODWORDINTREE(0x401921fb,0x54442d18)}},
+ {VT_exponent,5,0x17,{DOUBLEWITHTWODWORDINTREE(0x40100000,0x00000000)}},
+ {VT_exponent,5,0x12,{DOUBLEWITHTWODWORDINTREE(0x40200000,0x00000000)}},
+ {VT_double,11,0x774,{DOUBLEWITHTWODWORDINTREE(0x4035ee14,0x80000000)}},
+ {VT_exponent,5,0x19,{DOUBLEWITHTWODWORDINTREE(0x40300000,0x00000000)}},
+ {VT_double,9,0x1d3,{DOUBLEWITHTWODWORDINTREE(0x404ca5dc,0x1a63c1f8)}},
+ {VT_exponent,5,0x1a,{DOUBLEWITHTWODWORDINTREE(0x40400000,0x00000000)}},
+ {VT_double,11,0x77e,{DOUBLEWITHTWODWORDINTREE(0x405bb32f,0xe0000000)}},
+ {VT_double,10,0x5e,{DOUBLEWITHTWODWORDINTREE(0x405c332f,0xe0000000)}},
+ {VT_exponent,5,0x18,{DOUBLEWITHTWODWORDINTREE(0x40500000,0x00000000)}},
+ {VT_double,9,0x1d7,{DOUBLEWITHTWODWORDINTREE(0x40668000,0x00000000)}},
+ {VT_exponent,5,0x1c,{DOUBLEWITHTWODWORDINTREE(0x40600000,0x00000000)}},
+ {VT_double,9,0x1d5,{DOUBLEWITHTWODWORDINTREE(0x40768000,0x00000000)}},
+ {VT_exponent,5,0x14,{DOUBLEWITHTWODWORDINTREE(0x40700000,0x00000000)}},
+ {VT_double,11,0x77d,{DOUBLEWITHTWODWORDINTREE(0x408f4000,0x00000000)}},
+ {VT_exponent,5,0x5,{DOUBLEWITHTWODWORDINTREE(0x40800000,0x00000000)}},
+ {VT_double,10,0xd2,{DOUBLEWITHTWODWORDINTREE(0x409233ff,0xffffffff)}},
+ {VT_double,8,0x3c,{DOUBLEWITHTWODWORDINTREE(0x40923400,0x00000000)}},
+ {VT_double,11,0x753,{DOUBLEWITHTWODWORDINTREE(0x40923400,0x00000001)}},
+ {VT_double,10,0xd3,{DOUBLEWITHTWODWORDINTREE(0x4092abff,0xffffffff)}},
+ {VT_double,8,0x35,{DOUBLEWITHTWODWORDINTREE(0x4092ac00,0x00000000)}},
+ {VT_double,11,0x770,{DOUBLEWITHTWODWORDINTREE(0x4092ac00,0x00000001)}},
+ {VT_exponent,8,0x16,{DOUBLEWITHTWODWORDINTREE(0x40900000,0x00000000)}},
+ {VT_exponent,12,0xee2,{DOUBLEWITHTWODWORDINTREE(0x40a00000,0x00000000)}},
+ {VT_exponent,12,0xee4,{DOUBLEWITHTWODWORDINTREE(0x40b00000,0x00000000)}},
+ {VT_double,7,0x1f,{DOUBLEWITHTWODWORDINTREE(0x40c81c80,0x00000000)}},
+ {VT_exponent,8,0xac,{DOUBLEWITHTWODWORDINTREE(0x40c00000,0x00000000)}},
+ {VT_exponent,13,0x15bb,{DOUBLEWITHTWODWORDINTREE(0x40d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8667,{DOUBLEWITHTWODWORDINTREE(0x40e00000,0x00000000)}},
+ {VT_exponent,22,0x3a86d8,{DOUBLEWITHTWODWORDINTREE(0x40f00000,0x00000000)}},
+ {VT_exponent,22,0x3a86d9,{DOUBLEWITHTWODWORDINTREE(0x41000000,0x00000000)}},
+ {VT_exponent,22,0x3a86da,{DOUBLEWITHTWODWORDINTREE(0x41100000,0x00000000)}},
+ {VT_exponent,17,0x1dc7e,{DOUBLEWITHTWODWORDINTREE(0x41200000,0x00000000)}},
+ {VT_exponent,22,0x3a86db,{DOUBLEWITHTWODWORDINTREE(0x41300000,0x00000000)}},
+ {VT_exponent,22,0x3a86dc,{DOUBLEWITHTWODWORDINTREE(0x41400000,0x00000000)}},
+ {VT_exponent,22,0x3a86dd,{DOUBLEWITHTWODWORDINTREE(0x41500000,0x00000000)}},
+ {VT_exponent,22,0x3a86de,{DOUBLEWITHTWODWORDINTREE(0x41600000,0x00000000)}},
+ {VT_exponent,22,0x3a86df,{DOUBLEWITHTWODWORDINTREE(0x41700000,0x00000000)}},
+ {VT_exponent,22,0x3a86f0,{DOUBLEWITHTWODWORDINTREE(0x41800000,0x00000000)}},
+ {VT_exponent,22,0x3a86f1,{DOUBLEWITHTWODWORDINTREE(0x41900000,0x00000000)}},
+ {VT_exponent,22,0x3a86f2,{DOUBLEWITHTWODWORDINTREE(0x41a00000,0x00000000)}},
+ {VT_exponent,22,0x3a86f3,{DOUBLEWITHTWODWORDINTREE(0x41b00000,0x00000000)}},
+ {VT_double,6,0x2a,{DOUBLEWITHTWODWORDINTREE(0x41cdcd64,0xff800000)}},
+ {VT_exponent,22,0x3a86f4,{DOUBLEWITHTWODWORDINTREE(0x41c00000,0x00000000)}},
+ {VT_exponent,22,0x3a86f5,{DOUBLEWITHTWODWORDINTREE(0x41d00000,0x00000000)}},
+ {VT_exponent,22,0x3a86f6,{DOUBLEWITHTWODWORDINTREE(0x41e00000,0x00000000)}},
+ {VT_exponent,22,0x3a86f7,{DOUBLEWITHTWODWORDINTREE(0x41f00000,0x00000000)}},
+ {VT_exponent,22,0x3a86f8,{DOUBLEWITHTWODWORDINTREE(0x42000000,0x00000000)}},
+ {VT_exponent,22,0x3a86f9,{DOUBLEWITHTWODWORDINTREE(0x42100000,0x00000000)}},
+ {VT_exponent,22,0x3a86fa,{DOUBLEWITHTWODWORDINTREE(0x42200000,0x00000000)}},
+ {VT_exponent,22,0x3a86fb,{DOUBLEWITHTWODWORDINTREE(0x42300000,0x00000000)}},
+ {VT_exponent,22,0x3a86fc,{DOUBLEWITHTWODWORDINTREE(0x42400000,0x00000000)}},
+ {VT_exponent,22,0x3a86fd,{DOUBLEWITHTWODWORDINTREE(0x42500000,0x00000000)}},
+ {VT_exponent,22,0x3a86fe,{DOUBLEWITHTWODWORDINTREE(0x42600000,0x00000000)}},
+ {VT_exponent,22,0x3a86ff,{DOUBLEWITHTWODWORDINTREE(0x42700000,0x00000000)}},
+ {VT_exponent,22,0x3a8740,{DOUBLEWITHTWODWORDINTREE(0x42800000,0x00000000)}},
+ {VT_exponent,22,0x3a8741,{DOUBLEWITHTWODWORDINTREE(0x42900000,0x00000000)}},
+ {VT_exponent,22,0x3a8742,{DOUBLEWITHTWODWORDINTREE(0x42a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8743,{DOUBLEWITHTWODWORDINTREE(0x42b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8744,{DOUBLEWITHTWODWORDINTREE(0x42c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8745,{DOUBLEWITHTWODWORDINTREE(0x42d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8746,{DOUBLEWITHTWODWORDINTREE(0x42e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8747,{DOUBLEWITHTWODWORDINTREE(0x42f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8748,{DOUBLEWITHTWODWORDINTREE(0x43000000,0x00000000)}},
+ {VT_exponent,22,0x3a8749,{DOUBLEWITHTWODWORDINTREE(0x43100000,0x00000000)}},
+ {VT_exponent,22,0x3a874a,{DOUBLEWITHTWODWORDINTREE(0x43200000,0x00000000)}},
+ {VT_exponent,22,0x3a874b,{DOUBLEWITHTWODWORDINTREE(0x43300000,0x00000000)}},
+ {VT_exponent,22,0x3a874c,{DOUBLEWITHTWODWORDINTREE(0x43400000,0x00000000)}},
+ {VT_exponent,22,0x3a874d,{DOUBLEWITHTWODWORDINTREE(0x43500000,0x00000000)}},
+ {VT_exponent,22,0x3a874e,{DOUBLEWITHTWODWORDINTREE(0x43600000,0x00000000)}},
+ {VT_exponent,22,0x3a874f,{DOUBLEWITHTWODWORDINTREE(0x43700000,0x00000000)}},
+ {VT_exponent,22,0x3a8750,{DOUBLEWITHTWODWORDINTREE(0x43800000,0x00000000)}},
+ {VT_exponent,22,0x3a8751,{DOUBLEWITHTWODWORDINTREE(0x43900000,0x00000000)}},
+ {VT_exponent,22,0x3a8752,{DOUBLEWITHTWODWORDINTREE(0x43a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8753,{DOUBLEWITHTWODWORDINTREE(0x43b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8754,{DOUBLEWITHTWODWORDINTREE(0x43c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8755,{DOUBLEWITHTWODWORDINTREE(0x43d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8756,{DOUBLEWITHTWODWORDINTREE(0x43e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8757,{DOUBLEWITHTWODWORDINTREE(0x43f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8758,{DOUBLEWITHTWODWORDINTREE(0x44000000,0x00000000)}},
+ {VT_exponent,15,0x1a3b,{DOUBLEWITHTWODWORDINTREE(0x44100000,0x00000000)}},
+ {VT_exponent,22,0x3a8759,{DOUBLEWITHTWODWORDINTREE(0x44200000,0x00000000)}},
+ {VT_exponent,22,0x3a875a,{DOUBLEWITHTWODWORDINTREE(0x44300000,0x00000000)}},
+ {VT_exponent,22,0x3a875b,{DOUBLEWITHTWODWORDINTREE(0x44400000,0x00000000)}},
+ {VT_exponent,22,0x3a875c,{DOUBLEWITHTWODWORDINTREE(0x44500000,0x00000000)}},
+ {VT_exponent,22,0x3a875d,{DOUBLEWITHTWODWORDINTREE(0x44600000,0x00000000)}},
+ {VT_exponent,22,0x3a875e,{DOUBLEWITHTWODWORDINTREE(0x44700000,0x00000000)}},
+ {VT_exponent,22,0x3a875f,{DOUBLEWITHTWODWORDINTREE(0x44800000,0x00000000)}},
+ {VT_exponent,22,0x3a8760,{DOUBLEWITHTWODWORDINTREE(0x44900000,0x00000000)}},
+ {VT_exponent,22,0x3a8761,{DOUBLEWITHTWODWORDINTREE(0x44a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8762,{DOUBLEWITHTWODWORDINTREE(0x44b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8763,{DOUBLEWITHTWODWORDINTREE(0x44c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8764,{DOUBLEWITHTWODWORDINTREE(0x44d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8765,{DOUBLEWITHTWODWORDINTREE(0x44e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8766,{DOUBLEWITHTWODWORDINTREE(0x44f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8767,{DOUBLEWITHTWODWORDINTREE(0x45000000,0x00000000)}},
+ {VT_exponent,22,0x3a8768,{DOUBLEWITHTWODWORDINTREE(0x45100000,0x00000000)}},
+ {VT_exponent,22,0x3a8769,{DOUBLEWITHTWODWORDINTREE(0x45200000,0x00000000)}},
+ {VT_exponent,22,0x3a876a,{DOUBLEWITHTWODWORDINTREE(0x45300000,0x00000000)}},
+ {VT_exponent,22,0x3a876b,{DOUBLEWITHTWODWORDINTREE(0x45400000,0x00000000)}},
+ {VT_exponent,22,0x3a876c,{DOUBLEWITHTWODWORDINTREE(0x45500000,0x00000000)}},
+ {VT_exponent,22,0x3a876d,{DOUBLEWITHTWODWORDINTREE(0x45600000,0x00000000)}},
+ {VT_exponent,22,0x3a876e,{DOUBLEWITHTWODWORDINTREE(0x45700000,0x00000000)}},
+ {VT_exponent,22,0x3a876f,{DOUBLEWITHTWODWORDINTREE(0x45800000,0x00000000)}},
+ {VT_exponent,22,0x3a8770,{DOUBLEWITHTWODWORDINTREE(0x45900000,0x00000000)}},
+ {VT_exponent,22,0x3a8771,{DOUBLEWITHTWODWORDINTREE(0x45a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8772,{DOUBLEWITHTWODWORDINTREE(0x45b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8773,{DOUBLEWITHTWODWORDINTREE(0x45c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8774,{DOUBLEWITHTWODWORDINTREE(0x45d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8775,{DOUBLEWITHTWODWORDINTREE(0x45e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8776,{DOUBLEWITHTWODWORDINTREE(0x45f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8777,{DOUBLEWITHTWODWORDINTREE(0x46000000,0x00000000)}},
+ {VT_exponent,22,0x3a8778,{DOUBLEWITHTWODWORDINTREE(0x46100000,0x00000000)}},
+ {VT_exponent,22,0x3a8779,{DOUBLEWITHTWODWORDINTREE(0x46200000,0x00000000)}},
+ {VT_exponent,22,0x3a877a,{DOUBLEWITHTWODWORDINTREE(0x46300000,0x00000000)}},
+ {VT_exponent,22,0x3a877b,{DOUBLEWITHTWODWORDINTREE(0x46400000,0x00000000)}},
+ {VT_exponent,22,0x3a877c,{DOUBLEWITHTWODWORDINTREE(0x46500000,0x00000000)}},
+ {VT_exponent,22,0x3a877d,{DOUBLEWITHTWODWORDINTREE(0x46600000,0x00000000)}},
+ {VT_exponent,22,0x3a877e,{DOUBLEWITHTWODWORDINTREE(0x46700000,0x00000000)}},
+ {VT_exponent,22,0x3a877f,{DOUBLEWITHTWODWORDINTREE(0x46800000,0x00000000)}},
+ {VT_exponent,22,0x3a8780,{DOUBLEWITHTWODWORDINTREE(0x46900000,0x00000000)}},
+ {VT_exponent,22,0x3a8781,{DOUBLEWITHTWODWORDINTREE(0x46a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8782,{DOUBLEWITHTWODWORDINTREE(0x46b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8783,{DOUBLEWITHTWODWORDINTREE(0x46c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8784,{DOUBLEWITHTWODWORDINTREE(0x46d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8785,{DOUBLEWITHTWODWORDINTREE(0x46e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8786,{DOUBLEWITHTWODWORDINTREE(0x46f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8787,{DOUBLEWITHTWODWORDINTREE(0x47000000,0x00000000)}},
+ {VT_exponent,22,0x3a8788,{DOUBLEWITHTWODWORDINTREE(0x47100000,0x00000000)}},
+ {VT_exponent,22,0x3a8789,{DOUBLEWITHTWODWORDINTREE(0x47200000,0x00000000)}},
+ {VT_exponent,22,0x3a878a,{DOUBLEWITHTWODWORDINTREE(0x47300000,0x00000000)}},
+ {VT_exponent,22,0x3a878b,{DOUBLEWITHTWODWORDINTREE(0x47400000,0x00000000)}},
+ {VT_exponent,22,0x3a878c,{DOUBLEWITHTWODWORDINTREE(0x47500000,0x00000000)}},
+ {VT_exponent,22,0x3a878d,{DOUBLEWITHTWODWORDINTREE(0x47600000,0x00000000)}},
+ {VT_exponent,22,0x3a878e,{DOUBLEWITHTWODWORDINTREE(0x47700000,0x00000000)}},
+ {VT_exponent,22,0x3a878f,{DOUBLEWITHTWODWORDINTREE(0x47800000,0x00000000)}},
+ {VT_exponent,22,0x3a8790,{DOUBLEWITHTWODWORDINTREE(0x47900000,0x00000000)}},
+ {VT_exponent,22,0x3a8791,{DOUBLEWITHTWODWORDINTREE(0x47a00000,0x00000000)}},
+ {VT_exponent,22,0x3a8792,{DOUBLEWITHTWODWORDINTREE(0x47b00000,0x00000000)}},
+ {VT_exponent,22,0x3a8793,{DOUBLEWITHTWODWORDINTREE(0x47c00000,0x00000000)}},
+ {VT_exponent,22,0x3a8794,{DOUBLEWITHTWODWORDINTREE(0x47d00000,0x00000000)}},
+ {VT_exponent,22,0x3a8795,{DOUBLEWITHTWODWORDINTREE(0x47e00000,0x00000000)}},
+ {VT_exponent,22,0x3a8796,{DOUBLEWITHTWODWORDINTREE(0x47f00000,0x00000000)}},
+ {VT_exponent,22,0x3a8797,{DOUBLEWITHTWODWORDINTREE(0x48000000,0x00000000)}},
+ {VT_exponent,22,0x3a8798,{DOUBLEWITHTWODWORDINTREE(0x48100000,0x00000000)}},
+ {VT_exponent,22,0x3a8799,{DOUBLEWITHTWODWORDINTREE(0x48200000,0x00000000)}},
+ {VT_exponent,22,0x3a879a,{DOUBLEWITHTWODWORDINTREE(0x48300000,0x00000000)}},
+ {VT_exponent,22,0x3a879b,{DOUBLEWITHTWODWORDINTREE(0x48400000,0x00000000)}},
+ {VT_exponent,22,0x3a879c,{DOUBLEWITHTWODWORDINTREE(0x48500000,0x00000000)}},
+ {VT_exponent,22,0x3a879d,{DOUBLEWITHTWODWORDINTREE(0x48600000,0x00000000)}},
+ {VT_exponent,22,0x3a879e,{DOUBLEWITHTWODWORDINTREE(0x48700000,0x00000000)}},
+ {VT_exponent,22,0x3a879f,{DOUBLEWITHTWODWORDINTREE(0x48800000,0x00000000)}},
+ {VT_exponent,22,0x3a87a0,{DOUBLEWITHTWODWORDINTREE(0x48900000,0x00000000)}},
+ {VT_exponent,22,0x3a87a1,{DOUBLEWITHTWODWORDINTREE(0x48a00000,0x00000000)}},
+ {VT_exponent,22,0x3a87a2,{DOUBLEWITHTWODWORDINTREE(0x48b00000,0x00000000)}},
+ {VT_exponent,22,0x3a87a3,{DOUBLEWITHTWODWORDINTREE(0x48c00000,0x00000000)}},
+ {VT_exponent,22,0x3a87a4,{DOUBLEWITHTWODWORDINTREE(0x48d00000,0x00000000)}},
+ {VT_exponent,22,0x3a87a5,{DOUBLEWITHTWODWORDINTREE(0x48e00000,0x00000000)}},
+ {VT_exponent,22,0x3a87a6,{DOUBLEWITHTWODWORDINTREE(0x48f00000,0x00000000)}},
+ {VT_exponent,22,0x3a87a7,{DOUBLEWITHTWODWORDINTREE(0x49000000,0x00000000)}},
+ {VT_exponent,22,0x3a87a8,{DOUBLEWITHTWODWORDINTREE(0x49100000,0x00000000)}},
+ {VT_exponent,22,0x3a87a9,{DOUBLEWITHTWODWORDINTREE(0x49200000,0x00000000)}},
+ {VT_exponent,22,0x3a87aa,{DOUBLEWITHTWODWORDINTREE(0x49300000,0x00000000)}},
+ {VT_exponent,22,0x3a87ab,{DOUBLEWITHTWODWORDINTREE(0x49400000,0x00000000)}},
+ {VT_exponent,22,0x3a87ac,{DOUBLEWITHTWODWORDINTREE(0x49500000,0x00000000)}},
+ {VT_exponent,22,0x3a87ad,{DOUBLEWITHTWODWORDINTREE(0x49600000,0x00000000)}},
+ {VT_exponent,22,0x3a87ae,{DOUBLEWITHTWODWORDINTREE(0x49700000,0x00000000)}},
+ {VT_exponent,22,0x3a87af,{DOUBLEWITHTWODWORDINTREE(0x49800000,0x00000000)}},
+ {VT_exponent,22,0x3a87b0,{DOUBLEWITHTWODWORDINTREE(0x49900000,0x00000000)}},
+ {VT_exponent,22,0x3a87b1,{DOUBLEWITHTWODWORDINTREE(0x49a00000,0x00000000)}},
+ {VT_exponent,22,0x3a87b2,{DOUBLEWITHTWODWORDINTREE(0x49b00000,0x00000000)}},
+ {VT_exponent,22,0x3a87b3,{DOUBLEWITHTWODWORDINTREE(0x49c00000,0x00000000)}},
+ {VT_exponent,22,0x3a87b4,{DOUBLEWITHTWODWORDINTREE(0x49d00000,0x00000000)}},
+ {VT_exponent,22,0x3a87b5,{DOUBLEWITHTWODWORDINTREE(0x49e00000,0x00000000)}},
+ {VT_exponent,22,0x3a87b6,{DOUBLEWITHTWODWORDINTREE(0x49f00000,0x00000000)}},
+ {VT_exponent,22,0x3a87b7,{DOUBLEWITHTWODWORDINTREE(0x4a000000,0x00000000)}},
+ {VT_exponent,22,0x3a87b8,{DOUBLEWITHTWODWORDINTREE(0x4a100000,0x00000000)}},
+ {VT_exponent,22,0x3a87b9,{DOUBLEWITHTWODWORDINTREE(0x4a200000,0x00000000)}},
+ {VT_exponent,22,0x3a87ba,{DOUBLEWITHTWODWORDINTREE(0x4a300000,0x00000000)}},
+ {VT_exponent,22,0x3a87bb,{DOUBLEWITHTWODWORDINTREE(0x4a400000,0x00000000)}},
+ {VT_exponent,22,0x3a87bc,{DOUBLEWITHTWODWORDINTREE(0x4a500000,0x00000000)}},
+ {VT_exponent,22,0x3a87bd,{DOUBLEWITHTWODWORDINTREE(0x4a600000,0x00000000)}},
+ {VT_exponent,22,0x3a87be,{DOUBLEWITHTWODWORDINTREE(0x4a700000,0x00000000)}},
+ {VT_exponent,22,0x3a87bf,{DOUBLEWITHTWODWORDINTREE(0x4a800000,0x00000000)}},
+ {VT_exponent,22,0x3a87c0,{DOUBLEWITHTWODWORDINTREE(0x4a900000,0x00000000)}},
+ {VT_exponent,22,0x3a87c1,{DOUBLEWITHTWODWORDINTREE(0x4aa00000,0x00000000)}},
+ {VT_exponent,22,0x3a87c2,{DOUBLEWITHTWODWORDINTREE(0x4ab00000,0x00000000)}},
+ {VT_exponent,22,0x3a87c3,{DOUBLEWITHTWODWORDINTREE(0x4ac00000,0x00000000)}},
+ {VT_exponent,22,0x3a87c4,{DOUBLEWITHTWODWORDINTREE(0x4ad00000,0x00000000)}},
+ {VT_exponent,22,0x3a87c5,{DOUBLEWITHTWODWORDINTREE(0x4ae00000,0x00000000)}},
+ {VT_exponent,22,0x3a87c6,{DOUBLEWITHTWODWORDINTREE(0x4af00000,0x00000000)}},
+ {VT_exponent,22,0x3a87c7,{DOUBLEWITHTWODWORDINTREE(0x4b000000,0x00000000)}},
+ {VT_exponent,22,0x3a87c8,{DOUBLEWITHTWODWORDINTREE(0x4b100000,0x00000000)}},
+ {VT_exponent,22,0x3a87c9,{DOUBLEWITHTWODWORDINTREE(0x4b200000,0x00000000)}},
+ {VT_exponent,22,0x3a87ca,{DOUBLEWITHTWODWORDINTREE(0x4b300000,0x00000000)}},
+ {VT_exponent,22,0x3a87cb,{DOUBLEWITHTWODWORDINTREE(0x4b400000,0x00000000)}},
+ {VT_exponent,22,0x3a87cc,{DOUBLEWITHTWODWORDINTREE(0x4b500000,0x00000000)}},
+ {VT_exponent,22,0x3a87cd,{DOUBLEWITHTWODWORDINTREE(0x4b600000,0x00000000)}},
+ {VT_exponent,22,0x3a87ce,{DOUBLEWITHTWODWORDINTREE(0x4b700000,0x00000000)}},
+ {VT_exponent,22,0x3a87cf,{DOUBLEWITHTWODWORDINTREE(0x4b800000,0x00000000)}},
+ {VT_exponent,22,0x3a87d0,{DOUBLEWITHTWODWORDINTREE(0x4b900000,0x00000000)}},
+ {VT_exponent,22,0x3a87d1,{DOUBLEWITHTWODWORDINTREE(0x4ba00000,0x00000000)}},
+ {VT_exponent,22,0x3a87d2,{DOUBLEWITHTWODWORDINTREE(0x4bb00000,0x00000000)}},
+ {VT_exponent,22,0x3a87d3,{DOUBLEWITHTWODWORDINTREE(0x4bc00000,0x00000000)}},
+ {VT_exponent,22,0x3a87d4,{DOUBLEWITHTWODWORDINTREE(0x4bd00000,0x00000000)}},
+ {VT_exponent,22,0x3a87d5,{DOUBLEWITHTWODWORDINTREE(0x4be00000,0x00000000)}},
+ {VT_exponent,22,0x3a87d6,{DOUBLEWITHTWODWORDINTREE(0x4bf00000,0x00000000)}},
+ {VT_exponent,22,0x3a87d7,{DOUBLEWITHTWODWORDINTREE(0x4c000000,0x00000000)}},
+ {VT_exponent,22,0x3a87d8,{DOUBLEWITHTWODWORDINTREE(0x4c100000,0x00000000)}},
+ {VT_exponent,22,0x3a87d9,{DOUBLEWITHTWODWORDINTREE(0x4c200000,0x00000000)}},
+ {VT_exponent,22,0x3a87da,{DOUBLEWITHTWODWORDINTREE(0x4c300000,0x00000000)}},
+ {VT_exponent,22,0x3a87db,{DOUBLEWITHTWODWORDINTREE(0x4c400000,0x00000000)}},
+ {VT_exponent,22,0x3a87dc,{DOUBLEWITHTWODWORDINTREE(0x4c500000,0x00000000)}},
+ {VT_exponent,22,0x3a87dd,{DOUBLEWITHTWODWORDINTREE(0x4c600000,0x00000000)}},
+ {VT_exponent,22,0x3a87de,{DOUBLEWITHTWODWORDINTREE(0x4c700000,0x00000000)}},
+ {VT_exponent,22,0x3a87df,{DOUBLEWITHTWODWORDINTREE(0x4c800000,0x00000000)}},
+ {VT_exponent,22,0x3a87e0,{DOUBLEWITHTWODWORDINTREE(0x4c900000,0x00000000)}},
+ {VT_exponent,22,0x3a87e1,{DOUBLEWITHTWODWORDINTREE(0x4ca00000,0x00000000)}},
+ {VT_exponent,22,0x3a87e2,{DOUBLEWITHTWODWORDINTREE(0x4cb00000,0x00000000)}},
+ {VT_exponent,22,0x3a87e3,{DOUBLEWITHTWODWORDINTREE(0x4cc00000,0x00000000)}},
+ {VT_exponent,22,0x3a87e4,{DOUBLEWITHTWODWORDINTREE(0x4cd00000,0x00000000)}},
+ {VT_exponent,22,0x3a87e5,{DOUBLEWITHTWODWORDINTREE(0x4ce00000,0x00000000)}},
+ {VT_exponent,22,0x3a87e6,{DOUBLEWITHTWODWORDINTREE(0x4cf00000,0x00000000)}},
+ {VT_exponent,22,0x3a87e7,{DOUBLEWITHTWODWORDINTREE(0x4d000000,0x00000000)}},
+ {VT_exponent,22,0x3a87e8,{DOUBLEWITHTWODWORDINTREE(0x4d100000,0x00000000)}},
+ {VT_exponent,22,0x3a87e9,{DOUBLEWITHTWODWORDINTREE(0x4d200000,0x00000000)}},
+ {VT_exponent,22,0x3a87ea,{DOUBLEWITHTWODWORDINTREE(0x4d300000,0x00000000)}},
+ {VT_exponent,22,0x3a87eb,{DOUBLEWITHTWODWORDINTREE(0x4d400000,0x00000000)}},
+ {VT_exponent,22,0x3a87ec,{DOUBLEWITHTWODWORDINTREE(0x4d500000,0x00000000)}},
+ {VT_exponent,22,0x3a87ed,{DOUBLEWITHTWODWORDINTREE(0x4d600000,0x00000000)}},
+ {VT_exponent,22,0x3a87ee,{DOUBLEWITHTWODWORDINTREE(0x4d700000,0x00000000)}},
+ {VT_exponent,22,0x3a87ef,{DOUBLEWITHTWODWORDINTREE(0x4d800000,0x00000000)}},
+ {VT_exponent,22,0x3a87f0,{DOUBLEWITHTWODWORDINTREE(0x4d900000,0x00000000)}},
+ {VT_exponent,22,0x3a87f1,{DOUBLEWITHTWODWORDINTREE(0x4da00000,0x00000000)}},
+ {VT_exponent,22,0x3a87f2,{DOUBLEWITHTWODWORDINTREE(0x4db00000,0x00000000)}},
+ {VT_exponent,22,0x3a87f3,{DOUBLEWITHTWODWORDINTREE(0x4dc00000,0x00000000)}},
+ {VT_exponent,22,0x3a87f4,{DOUBLEWITHTWODWORDINTREE(0x4dd00000,0x00000000)}},
+ {VT_exponent,22,0x3a87f5,{DOUBLEWITHTWODWORDINTREE(0x4de00000,0x00000000)}},
+ {VT_exponent,22,0x3a87f6,{DOUBLEWITHTWODWORDINTREE(0x4df00000,0x00000000)}},
+ {VT_exponent,22,0x3a87f7,{DOUBLEWITHTWODWORDINTREE(0x4e000000,0x00000000)}},
+ {VT_exponent,22,0x3a87f8,{DOUBLEWITHTWODWORDINTREE(0x4e100000,0x00000000)}},
+ {VT_exponent,22,0x3a87f9,{DOUBLEWITHTWODWORDINTREE(0x4e200000,0x00000000)}},
+ {VT_exponent,22,0x3a87fa,{DOUBLEWITHTWODWORDINTREE(0x4e300000,0x00000000)}},
+ {VT_exponent,22,0x3a87fb,{DOUBLEWITHTWODWORDINTREE(0x4e400000,0x00000000)}},
+ {VT_exponent,22,0x3a87fc,{DOUBLEWITHTWODWORDINTREE(0x4e500000,0x00000000)}},
+ {VT_exponent,22,0x3a87fd,{DOUBLEWITHTWODWORDINTREE(0x4e600000,0x00000000)}},
+ {VT_exponent,22,0x3a87fe,{DOUBLEWITHTWODWORDINTREE(0x4e700000,0x00000000)}},
+ {VT_exponent,22,0x3a87ff,{DOUBLEWITHTWODWORDINTREE(0x4e800000,0x00000000)}},
+ {VT_exponent,22,0x3a9000,{DOUBLEWITHTWODWORDINTREE(0x4e900000,0x00000000)}},
+ {VT_exponent,22,0x3a9001,{DOUBLEWITHTWODWORDINTREE(0x4ea00000,0x00000000)}},
+ {VT_exponent,22,0x3a9002,{DOUBLEWITHTWODWORDINTREE(0x4eb00000,0x00000000)}},
+ {VT_exponent,22,0x3a9003,{DOUBLEWITHTWODWORDINTREE(0x4ec00000,0x00000000)}},
+ {VT_exponent,22,0x3a9004,{DOUBLEWITHTWODWORDINTREE(0x4ed00000,0x00000000)}},
+ {VT_exponent,22,0x3a9005,{DOUBLEWITHTWODWORDINTREE(0x4ee00000,0x00000000)}},
+ {VT_exponent,22,0x3a9006,{DOUBLEWITHTWODWORDINTREE(0x4ef00000,0x00000000)}},
+ {VT_exponent,22,0x3a9007,{DOUBLEWITHTWODWORDINTREE(0x4f000000,0x00000000)}},
+ {VT_exponent,22,0x3a9008,{DOUBLEWITHTWODWORDINTREE(0x4f100000,0x00000000)}},
+ {VT_exponent,22,0x3a9009,{DOUBLEWITHTWODWORDINTREE(0x4f200000,0x00000000)}},
+ {VT_exponent,22,0x3a900a,{DOUBLEWITHTWODWORDINTREE(0x4f300000,0x00000000)}},
+ {VT_exponent,22,0x3a900b,{DOUBLEWITHTWODWORDINTREE(0x4f400000,0x00000000)}},
+ {VT_exponent,22,0x3a900c,{DOUBLEWITHTWODWORDINTREE(0x4f500000,0x00000000)}},
+ {VT_exponent,22,0x3a900d,{DOUBLEWITHTWODWORDINTREE(0x4f600000,0x00000000)}},
+ {VT_exponent,22,0x3a900e,{DOUBLEWITHTWODWORDINTREE(0x4f700000,0x00000000)}},
+ {VT_exponent,22,0x3a900f,{DOUBLEWITHTWODWORDINTREE(0x4f800000,0x00000000)}},
+ {VT_exponent,22,0x3a9010,{DOUBLEWITHTWODWORDINTREE(0x4f900000,0x00000000)}},
+ {VT_exponent,22,0x3a9011,{DOUBLEWITHTWODWORDINTREE(0x4fa00000,0x00000000)}},
+ {VT_exponent,22,0x3a9012,{DOUBLEWITHTWODWORDINTREE(0x4fb00000,0x00000000)}},
+ {VT_exponent,22,0x3a9013,{DOUBLEWITHTWODWORDINTREE(0x4fc00000,0x00000000)}},
+ {VT_exponent,22,0x3a9014,{DOUBLEWITHTWODWORDINTREE(0x4fd00000,0x00000000)}},
+ {VT_exponent,22,0x3a9015,{DOUBLEWITHTWODWORDINTREE(0x4fe00000,0x00000000)}},
+ {VT_exponent,22,0x3a9016,{DOUBLEWITHTWODWORDINTREE(0x4ff00000,0x00000000)}},
+ {VT_exponent,22,0x3a9017,{DOUBLEWITHTWODWORDINTREE(0x50000000,0x00000000)}},
+ {VT_exponent,22,0x3a9018,{DOUBLEWITHTWODWORDINTREE(0x50100000,0x00000000)}},
+ {VT_exponent,22,0x3a9019,{DOUBLEWITHTWODWORDINTREE(0x50200000,0x00000000)}},
+ {VT_exponent,22,0x3a901a,{DOUBLEWITHTWODWORDINTREE(0x50300000,0x00000000)}},
+ {VT_exponent,22,0x3a901b,{DOUBLEWITHTWODWORDINTREE(0x50400000,0x00000000)}},
+ {VT_exponent,22,0x3a901c,{DOUBLEWITHTWODWORDINTREE(0x50500000,0x00000000)}},
+ {VT_exponent,22,0x3a901d,{DOUBLEWITHTWODWORDINTREE(0x50600000,0x00000000)}},
+ {VT_exponent,22,0x3a901e,{DOUBLEWITHTWODWORDINTREE(0x50700000,0x00000000)}},
+ {VT_exponent,22,0x3a901f,{DOUBLEWITHTWODWORDINTREE(0x50800000,0x00000000)}},
+ {VT_exponent,22,0x3a9020,{DOUBLEWITHTWODWORDINTREE(0x50900000,0x00000000)}},
+ {VT_exponent,22,0x3a9021,{DOUBLEWITHTWODWORDINTREE(0x50a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9022,{DOUBLEWITHTWODWORDINTREE(0x50b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9023,{DOUBLEWITHTWODWORDINTREE(0x50c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9024,{DOUBLEWITHTWODWORDINTREE(0x50d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9025,{DOUBLEWITHTWODWORDINTREE(0x50e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9026,{DOUBLEWITHTWODWORDINTREE(0x50f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9027,{DOUBLEWITHTWODWORDINTREE(0x51000000,0x00000000)}},
+ {VT_exponent,22,0x3a9028,{DOUBLEWITHTWODWORDINTREE(0x51100000,0x00000000)}},
+ {VT_exponent,22,0x3a9029,{DOUBLEWITHTWODWORDINTREE(0x51200000,0x00000000)}},
+ {VT_exponent,22,0x3a902a,{DOUBLEWITHTWODWORDINTREE(0x51300000,0x00000000)}},
+ {VT_exponent,22,0x3a902b,{DOUBLEWITHTWODWORDINTREE(0x51400000,0x00000000)}},
+ {VT_exponent,22,0x3a902c,{DOUBLEWITHTWODWORDINTREE(0x51500000,0x00000000)}},
+ {VT_exponent,22,0x3a902d,{DOUBLEWITHTWODWORDINTREE(0x51600000,0x00000000)}},
+ {VT_exponent,22,0x3a902e,{DOUBLEWITHTWODWORDINTREE(0x51700000,0x00000000)}},
+ {VT_exponent,22,0x3a902f,{DOUBLEWITHTWODWORDINTREE(0x51800000,0x00000000)}},
+ {VT_exponent,22,0x3a9030,{DOUBLEWITHTWODWORDINTREE(0x51900000,0x00000000)}},
+ {VT_exponent,22,0x3a9031,{DOUBLEWITHTWODWORDINTREE(0x51a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9032,{DOUBLEWITHTWODWORDINTREE(0x51b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9033,{DOUBLEWITHTWODWORDINTREE(0x51c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9034,{DOUBLEWITHTWODWORDINTREE(0x51d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9035,{DOUBLEWITHTWODWORDINTREE(0x51e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9036,{DOUBLEWITHTWODWORDINTREE(0x51f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9037,{DOUBLEWITHTWODWORDINTREE(0x52000000,0x00000000)}},
+ {VT_exponent,22,0x3a9038,{DOUBLEWITHTWODWORDINTREE(0x52100000,0x00000000)}},
+ {VT_exponent,22,0x3a9039,{DOUBLEWITHTWODWORDINTREE(0x52200000,0x00000000)}},
+ {VT_exponent,22,0x3a903a,{DOUBLEWITHTWODWORDINTREE(0x52300000,0x00000000)}},
+ {VT_exponent,22,0x3a903b,{DOUBLEWITHTWODWORDINTREE(0x52400000,0x00000000)}},
+ {VT_exponent,22,0x3a903c,{DOUBLEWITHTWODWORDINTREE(0x52500000,0x00000000)}},
+ {VT_exponent,22,0x3a903d,{DOUBLEWITHTWODWORDINTREE(0x52600000,0x00000000)}},
+ {VT_exponent,22,0x3a903e,{DOUBLEWITHTWODWORDINTREE(0x52700000,0x00000000)}},
+ {VT_exponent,22,0x3a903f,{DOUBLEWITHTWODWORDINTREE(0x52800000,0x00000000)}},
+ {VT_exponent,22,0x3a9040,{DOUBLEWITHTWODWORDINTREE(0x52900000,0x00000000)}},
+ {VT_exponent,22,0x3a9041,{DOUBLEWITHTWODWORDINTREE(0x52a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9042,{DOUBLEWITHTWODWORDINTREE(0x52b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9043,{DOUBLEWITHTWODWORDINTREE(0x52c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9044,{DOUBLEWITHTWODWORDINTREE(0x52d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9045,{DOUBLEWITHTWODWORDINTREE(0x52e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9046,{DOUBLEWITHTWODWORDINTREE(0x52f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9047,{DOUBLEWITHTWODWORDINTREE(0x53000000,0x00000000)}},
+ {VT_exponent,22,0x3a9048,{DOUBLEWITHTWODWORDINTREE(0x53100000,0x00000000)}},
+ {VT_exponent,22,0x3a9049,{DOUBLEWITHTWODWORDINTREE(0x53200000,0x00000000)}},
+ {VT_exponent,22,0x3a904a,{DOUBLEWITHTWODWORDINTREE(0x53300000,0x00000000)}},
+ {VT_exponent,22,0x3a904b,{DOUBLEWITHTWODWORDINTREE(0x53400000,0x00000000)}},
+ {VT_exponent,22,0x3a904c,{DOUBLEWITHTWODWORDINTREE(0x53500000,0x00000000)}},
+ {VT_exponent,22,0x3a904d,{DOUBLEWITHTWODWORDINTREE(0x53600000,0x00000000)}},
+ {VT_exponent,22,0x3a904e,{DOUBLEWITHTWODWORDINTREE(0x53700000,0x00000000)}},
+ {VT_exponent,22,0x3a904f,{DOUBLEWITHTWODWORDINTREE(0x53800000,0x00000000)}},
+ {VT_exponent,22,0x3a9050,{DOUBLEWITHTWODWORDINTREE(0x53900000,0x00000000)}},
+ {VT_exponent,22,0x3a9051,{DOUBLEWITHTWODWORDINTREE(0x53a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9052,{DOUBLEWITHTWODWORDINTREE(0x53b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9053,{DOUBLEWITHTWODWORDINTREE(0x53c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9054,{DOUBLEWITHTWODWORDINTREE(0x53d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9055,{DOUBLEWITHTWODWORDINTREE(0x53e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9056,{DOUBLEWITHTWODWORDINTREE(0x53f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9057,{DOUBLEWITHTWODWORDINTREE(0x54000000,0x00000000)}},
+ {VT_exponent,22,0x3a9058,{DOUBLEWITHTWODWORDINTREE(0x54100000,0x00000000)}},
+ {VT_exponent,22,0x3a9059,{DOUBLEWITHTWODWORDINTREE(0x54200000,0x00000000)}},
+ {VT_exponent,22,0x3a905a,{DOUBLEWITHTWODWORDINTREE(0x54300000,0x00000000)}},
+ {VT_exponent,22,0x3a905b,{DOUBLEWITHTWODWORDINTREE(0x54400000,0x00000000)}},
+ {VT_exponent,22,0x3a905c,{DOUBLEWITHTWODWORDINTREE(0x54500000,0x00000000)}},
+ {VT_exponent,22,0x3a905d,{DOUBLEWITHTWODWORDINTREE(0x54600000,0x00000000)}},
+ {VT_exponent,22,0x3a905e,{DOUBLEWITHTWODWORDINTREE(0x54700000,0x00000000)}},
+ {VT_exponent,22,0x3a905f,{DOUBLEWITHTWODWORDINTREE(0x54800000,0x00000000)}},
+ {VT_exponent,22,0x3a9060,{DOUBLEWITHTWODWORDINTREE(0x54900000,0x00000000)}},
+ {VT_exponent,22,0x3a9061,{DOUBLEWITHTWODWORDINTREE(0x54a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9062,{DOUBLEWITHTWODWORDINTREE(0x54b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9063,{DOUBLEWITHTWODWORDINTREE(0x54c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9064,{DOUBLEWITHTWODWORDINTREE(0x54d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9065,{DOUBLEWITHTWODWORDINTREE(0x54e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9066,{DOUBLEWITHTWODWORDINTREE(0x54f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9067,{DOUBLEWITHTWODWORDINTREE(0x55000000,0x00000000)}},
+ {VT_exponent,22,0x3a9068,{DOUBLEWITHTWODWORDINTREE(0x55100000,0x00000000)}},
+ {VT_exponent,22,0x3a9069,{DOUBLEWITHTWODWORDINTREE(0x55200000,0x00000000)}},
+ {VT_exponent,22,0x3a906a,{DOUBLEWITHTWODWORDINTREE(0x55300000,0x00000000)}},
+ {VT_exponent,22,0x3a906b,{DOUBLEWITHTWODWORDINTREE(0x55400000,0x00000000)}},
+ {VT_exponent,22,0x3a906c,{DOUBLEWITHTWODWORDINTREE(0x55500000,0x00000000)}},
+ {VT_exponent,22,0x3a906d,{DOUBLEWITHTWODWORDINTREE(0x55600000,0x00000000)}},
+ {VT_exponent,22,0x3a906e,{DOUBLEWITHTWODWORDINTREE(0x55700000,0x00000000)}},
+ {VT_exponent,22,0x3a906f,{DOUBLEWITHTWODWORDINTREE(0x55800000,0x00000000)}},
+ {VT_exponent,22,0x3a9070,{DOUBLEWITHTWODWORDINTREE(0x55900000,0x00000000)}},
+ {VT_exponent,22,0x3a9071,{DOUBLEWITHTWODWORDINTREE(0x55a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9072,{DOUBLEWITHTWODWORDINTREE(0x55b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9073,{DOUBLEWITHTWODWORDINTREE(0x55c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9074,{DOUBLEWITHTWODWORDINTREE(0x55d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9075,{DOUBLEWITHTWODWORDINTREE(0x55e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9076,{DOUBLEWITHTWODWORDINTREE(0x55f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9077,{DOUBLEWITHTWODWORDINTREE(0x56000000,0x00000000)}},
+ {VT_exponent,22,0x3a9078,{DOUBLEWITHTWODWORDINTREE(0x56100000,0x00000000)}},
+ {VT_exponent,22,0x3a9079,{DOUBLEWITHTWODWORDINTREE(0x56200000,0x00000000)}},
+ {VT_exponent,22,0x3a907a,{DOUBLEWITHTWODWORDINTREE(0x56300000,0x00000000)}},
+ {VT_exponent,22,0x3a907b,{DOUBLEWITHTWODWORDINTREE(0x56400000,0x00000000)}},
+ {VT_exponent,22,0x3a907c,{DOUBLEWITHTWODWORDINTREE(0x56500000,0x00000000)}},
+ {VT_exponent,22,0x3a907d,{DOUBLEWITHTWODWORDINTREE(0x56600000,0x00000000)}},
+ {VT_exponent,22,0x3a907e,{DOUBLEWITHTWODWORDINTREE(0x56700000,0x00000000)}},
+ {VT_exponent,22,0x3a907f,{DOUBLEWITHTWODWORDINTREE(0x56800000,0x00000000)}},
+ {VT_exponent,22,0x3a9080,{DOUBLEWITHTWODWORDINTREE(0x56900000,0x00000000)}},
+ {VT_exponent,22,0x3a9081,{DOUBLEWITHTWODWORDINTREE(0x56a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9082,{DOUBLEWITHTWODWORDINTREE(0x56b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9083,{DOUBLEWITHTWODWORDINTREE(0x56c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9084,{DOUBLEWITHTWODWORDINTREE(0x56d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9085,{DOUBLEWITHTWODWORDINTREE(0x56e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9086,{DOUBLEWITHTWODWORDINTREE(0x56f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9087,{DOUBLEWITHTWODWORDINTREE(0x57000000,0x00000000)}},
+ {VT_exponent,22,0x3a9088,{DOUBLEWITHTWODWORDINTREE(0x57100000,0x00000000)}},
+ {VT_exponent,22,0x3a9089,{DOUBLEWITHTWODWORDINTREE(0x57200000,0x00000000)}},
+ {VT_exponent,22,0x3a908a,{DOUBLEWITHTWODWORDINTREE(0x57300000,0x00000000)}},
+ {VT_exponent,22,0x3a908b,{DOUBLEWITHTWODWORDINTREE(0x57400000,0x00000000)}},
+ {VT_exponent,22,0x3a908c,{DOUBLEWITHTWODWORDINTREE(0x57500000,0x00000000)}},
+ {VT_exponent,22,0x3a908d,{DOUBLEWITHTWODWORDINTREE(0x57600000,0x00000000)}},
+ {VT_exponent,22,0x3a908e,{DOUBLEWITHTWODWORDINTREE(0x57700000,0x00000000)}},
+ {VT_exponent,22,0x3a908f,{DOUBLEWITHTWODWORDINTREE(0x57800000,0x00000000)}},
+ {VT_exponent,22,0x3a9090,{DOUBLEWITHTWODWORDINTREE(0x57900000,0x00000000)}},
+ {VT_exponent,22,0x3a9091,{DOUBLEWITHTWODWORDINTREE(0x57a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9092,{DOUBLEWITHTWODWORDINTREE(0x57b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9093,{DOUBLEWITHTWODWORDINTREE(0x57c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9094,{DOUBLEWITHTWODWORDINTREE(0x57d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9095,{DOUBLEWITHTWODWORDINTREE(0x57e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9096,{DOUBLEWITHTWODWORDINTREE(0x57f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9097,{DOUBLEWITHTWODWORDINTREE(0x58000000,0x00000000)}},
+ {VT_exponent,22,0x3a9098,{DOUBLEWITHTWODWORDINTREE(0x58100000,0x00000000)}},
+ {VT_exponent,22,0x3a9099,{DOUBLEWITHTWODWORDINTREE(0x58200000,0x00000000)}},
+ {VT_exponent,22,0x3a909a,{DOUBLEWITHTWODWORDINTREE(0x58300000,0x00000000)}},
+ {VT_exponent,22,0x3a909b,{DOUBLEWITHTWODWORDINTREE(0x58400000,0x00000000)}},
+ {VT_exponent,22,0x3a909c,{DOUBLEWITHTWODWORDINTREE(0x58500000,0x00000000)}},
+ {VT_exponent,22,0x3a909d,{DOUBLEWITHTWODWORDINTREE(0x58600000,0x00000000)}},
+ {VT_exponent,22,0x3a909e,{DOUBLEWITHTWODWORDINTREE(0x58700000,0x00000000)}},
+ {VT_exponent,22,0x3a909f,{DOUBLEWITHTWODWORDINTREE(0x58800000,0x00000000)}},
+ {VT_exponent,22,0x3a90a0,{DOUBLEWITHTWODWORDINTREE(0x58900000,0x00000000)}},
+ {VT_exponent,22,0x3a90a1,{DOUBLEWITHTWODWORDINTREE(0x58a00000,0x00000000)}},
+ {VT_exponent,22,0x3a90a2,{DOUBLEWITHTWODWORDINTREE(0x58b00000,0x00000000)}},
+ {VT_exponent,22,0x3a90a3,{DOUBLEWITHTWODWORDINTREE(0x58c00000,0x00000000)}},
+ {VT_exponent,22,0x3a90a4,{DOUBLEWITHTWODWORDINTREE(0x58d00000,0x00000000)}},
+ {VT_exponent,22,0x3a90a5,{DOUBLEWITHTWODWORDINTREE(0x58e00000,0x00000000)}},
+ {VT_exponent,22,0x3a90a6,{DOUBLEWITHTWODWORDINTREE(0x58f00000,0x00000000)}},
+ {VT_exponent,22,0x3a90a7,{DOUBLEWITHTWODWORDINTREE(0x59000000,0x00000000)}},
+ {VT_exponent,22,0x3a90a8,{DOUBLEWITHTWODWORDINTREE(0x59100000,0x00000000)}},
+ {VT_exponent,22,0x3a90a9,{DOUBLEWITHTWODWORDINTREE(0x59200000,0x00000000)}},
+ {VT_exponent,22,0x3a90aa,{DOUBLEWITHTWODWORDINTREE(0x59300000,0x00000000)}},
+ {VT_exponent,22,0x3a90ab,{DOUBLEWITHTWODWORDINTREE(0x59400000,0x00000000)}},
+ {VT_exponent,22,0x3a90ac,{DOUBLEWITHTWODWORDINTREE(0x59500000,0x00000000)}},
+ {VT_exponent,22,0x3a90ad,{DOUBLEWITHTWODWORDINTREE(0x59600000,0x00000000)}},
+ {VT_exponent,22,0x3a90ae,{DOUBLEWITHTWODWORDINTREE(0x59700000,0x00000000)}},
+ {VT_exponent,22,0x3a90af,{DOUBLEWITHTWODWORDINTREE(0x59800000,0x00000000)}},
+ {VT_exponent,22,0x3a90b0,{DOUBLEWITHTWODWORDINTREE(0x59900000,0x00000000)}},
+ {VT_exponent,22,0x3a90b1,{DOUBLEWITHTWODWORDINTREE(0x59a00000,0x00000000)}},
+ {VT_exponent,22,0x3a90b2,{DOUBLEWITHTWODWORDINTREE(0x59b00000,0x00000000)}},
+ {VT_exponent,22,0x3a90b3,{DOUBLEWITHTWODWORDINTREE(0x59c00000,0x00000000)}},
+ {VT_exponent,22,0x3a90b4,{DOUBLEWITHTWODWORDINTREE(0x59d00000,0x00000000)}},
+ {VT_exponent,22,0x3a90b5,{DOUBLEWITHTWODWORDINTREE(0x59e00000,0x00000000)}},
+ {VT_exponent,22,0x3a90b6,{DOUBLEWITHTWODWORDINTREE(0x59f00000,0x00000000)}},
+ {VT_exponent,22,0x3a90b7,{DOUBLEWITHTWODWORDINTREE(0x5a000000,0x00000000)}},
+ {VT_exponent,22,0x3a90b8,{DOUBLEWITHTWODWORDINTREE(0x5a100000,0x00000000)}},
+ {VT_exponent,22,0x3a90b9,{DOUBLEWITHTWODWORDINTREE(0x5a200000,0x00000000)}},
+ {VT_exponent,22,0x3a90ba,{DOUBLEWITHTWODWORDINTREE(0x5a300000,0x00000000)}},
+ {VT_exponent,22,0x3a90bb,{DOUBLEWITHTWODWORDINTREE(0x5a400000,0x00000000)}},
+ {VT_exponent,22,0x3a90bc,{DOUBLEWITHTWODWORDINTREE(0x5a500000,0x00000000)}},
+ {VT_exponent,22,0x3a90bd,{DOUBLEWITHTWODWORDINTREE(0x5a600000,0x00000000)}},
+ {VT_exponent,22,0x3a90be,{DOUBLEWITHTWODWORDINTREE(0x5a700000,0x00000000)}},
+ {VT_exponent,22,0x3a90bf,{DOUBLEWITHTWODWORDINTREE(0x5a800000,0x00000000)}},
+ {VT_exponent,22,0x3a90c0,{DOUBLEWITHTWODWORDINTREE(0x5a900000,0x00000000)}},
+ {VT_exponent,22,0x3a90c1,{DOUBLEWITHTWODWORDINTREE(0x5aa00000,0x00000000)}},
+ {VT_exponent,22,0x3a90c2,{DOUBLEWITHTWODWORDINTREE(0x5ab00000,0x00000000)}},
+ {VT_exponent,22,0x3a90c3,{DOUBLEWITHTWODWORDINTREE(0x5ac00000,0x00000000)}},
+ {VT_exponent,22,0x3a90c4,{DOUBLEWITHTWODWORDINTREE(0x5ad00000,0x00000000)}},
+ {VT_exponent,22,0x3a90c5,{DOUBLEWITHTWODWORDINTREE(0x5ae00000,0x00000000)}},
+ {VT_exponent,22,0x3a90c6,{DOUBLEWITHTWODWORDINTREE(0x5af00000,0x00000000)}},
+ {VT_exponent,22,0x3a90c7,{DOUBLEWITHTWODWORDINTREE(0x5b000000,0x00000000)}},
+ {VT_exponent,22,0x3a90c8,{DOUBLEWITHTWODWORDINTREE(0x5b100000,0x00000000)}},
+ {VT_exponent,22,0x3a90c9,{DOUBLEWITHTWODWORDINTREE(0x5b200000,0x00000000)}},
+ {VT_exponent,22,0x3a90ca,{DOUBLEWITHTWODWORDINTREE(0x5b300000,0x00000000)}},
+ {VT_exponent,22,0x3a90cb,{DOUBLEWITHTWODWORDINTREE(0x5b400000,0x00000000)}},
+ {VT_exponent,22,0x3a90cc,{DOUBLEWITHTWODWORDINTREE(0x5b500000,0x00000000)}},
+ {VT_exponent,22,0x3a90cd,{DOUBLEWITHTWODWORDINTREE(0x5b600000,0x00000000)}},
+ {VT_exponent,22,0x3a90ce,{DOUBLEWITHTWODWORDINTREE(0x5b700000,0x00000000)}},
+ {VT_exponent,22,0x3a90cf,{DOUBLEWITHTWODWORDINTREE(0x5b800000,0x00000000)}},
+ {VT_exponent,22,0x3a90d0,{DOUBLEWITHTWODWORDINTREE(0x5b900000,0x00000000)}},
+ {VT_exponent,22,0x3a90d1,{DOUBLEWITHTWODWORDINTREE(0x5ba00000,0x00000000)}},
+ {VT_exponent,22,0x3a90d2,{DOUBLEWITHTWODWORDINTREE(0x5bb00000,0x00000000)}},
+ {VT_exponent,22,0x3a90d3,{DOUBLEWITHTWODWORDINTREE(0x5bc00000,0x00000000)}},
+ {VT_exponent,22,0x3a90d4,{DOUBLEWITHTWODWORDINTREE(0x5bd00000,0x00000000)}},
+ {VT_exponent,22,0x3a90d5,{DOUBLEWITHTWODWORDINTREE(0x5be00000,0x00000000)}},
+ {VT_exponent,22,0x3a90d6,{DOUBLEWITHTWODWORDINTREE(0x5bf00000,0x00000000)}},
+ {VT_exponent,22,0x3a90d7,{DOUBLEWITHTWODWORDINTREE(0x5c000000,0x00000000)}},
+ {VT_exponent,22,0x3a90d8,{DOUBLEWITHTWODWORDINTREE(0x5c100000,0x00000000)}},
+ {VT_exponent,22,0x3a90d9,{DOUBLEWITHTWODWORDINTREE(0x5c200000,0x00000000)}},
+ {VT_exponent,22,0x3a90da,{DOUBLEWITHTWODWORDINTREE(0x5c300000,0x00000000)}},
+ {VT_exponent,22,0x3a90db,{DOUBLEWITHTWODWORDINTREE(0x5c400000,0x00000000)}},
+ {VT_exponent,22,0x3a90dc,{DOUBLEWITHTWODWORDINTREE(0x5c500000,0x00000000)}},
+ {VT_exponent,22,0x3a90dd,{DOUBLEWITHTWODWORDINTREE(0x5c600000,0x00000000)}},
+ {VT_exponent,22,0x3a90de,{DOUBLEWITHTWODWORDINTREE(0x5c700000,0x00000000)}},
+ {VT_exponent,22,0x3a90df,{DOUBLEWITHTWODWORDINTREE(0x5c800000,0x00000000)}},
+ {VT_exponent,22,0x3a90e0,{DOUBLEWITHTWODWORDINTREE(0x5c900000,0x00000000)}},
+ {VT_exponent,22,0x3a90e1,{DOUBLEWITHTWODWORDINTREE(0x5ca00000,0x00000000)}},
+ {VT_exponent,22,0x3a90e2,{DOUBLEWITHTWODWORDINTREE(0x5cb00000,0x00000000)}},
+ {VT_exponent,22,0x3a90e3,{DOUBLEWITHTWODWORDINTREE(0x5cc00000,0x00000000)}},
+ {VT_exponent,22,0x3a90e4,{DOUBLEWITHTWODWORDINTREE(0x5cd00000,0x00000000)}},
+ {VT_exponent,22,0x3a90e5,{DOUBLEWITHTWODWORDINTREE(0x5ce00000,0x00000000)}},
+ {VT_exponent,22,0x3a90e6,{DOUBLEWITHTWODWORDINTREE(0x5cf00000,0x00000000)}},
+ {VT_exponent,22,0x3a90e7,{DOUBLEWITHTWODWORDINTREE(0x5d000000,0x00000000)}},
+ {VT_exponent,22,0x3a90e8,{DOUBLEWITHTWODWORDINTREE(0x5d100000,0x00000000)}},
+ {VT_exponent,22,0x3a90e9,{DOUBLEWITHTWODWORDINTREE(0x5d200000,0x00000000)}},
+ {VT_exponent,22,0x3a90ea,{DOUBLEWITHTWODWORDINTREE(0x5d300000,0x00000000)}},
+ {VT_exponent,22,0x3a90eb,{DOUBLEWITHTWODWORDINTREE(0x5d400000,0x00000000)}},
+ {VT_exponent,22,0x3a90ec,{DOUBLEWITHTWODWORDINTREE(0x5d500000,0x00000000)}},
+ {VT_exponent,22,0x3a90ed,{DOUBLEWITHTWODWORDINTREE(0x5d600000,0x00000000)}},
+ {VT_exponent,22,0x3a90ee,{DOUBLEWITHTWODWORDINTREE(0x5d700000,0x00000000)}},
+ {VT_exponent,22,0x3a90ef,{DOUBLEWITHTWODWORDINTREE(0x5d800000,0x00000000)}},
+ {VT_exponent,22,0x3a90f0,{DOUBLEWITHTWODWORDINTREE(0x5d900000,0x00000000)}},
+ {VT_exponent,22,0x3a90f1,{DOUBLEWITHTWODWORDINTREE(0x5da00000,0x00000000)}},
+ {VT_exponent,22,0x3a90f2,{DOUBLEWITHTWODWORDINTREE(0x5db00000,0x00000000)}},
+ {VT_exponent,22,0x3a90f3,{DOUBLEWITHTWODWORDINTREE(0x5dc00000,0x00000000)}},
+ {VT_exponent,22,0x3a90f4,{DOUBLEWITHTWODWORDINTREE(0x5dd00000,0x00000000)}},
+ {VT_exponent,22,0x3a90f5,{DOUBLEWITHTWODWORDINTREE(0x5de00000,0x00000000)}},
+ {VT_exponent,22,0x3a90f6,{DOUBLEWITHTWODWORDINTREE(0x5df00000,0x00000000)}},
+ {VT_exponent,22,0x3a90f7,{DOUBLEWITHTWODWORDINTREE(0x5e000000,0x00000000)}},
+ {VT_exponent,22,0x3a90f8,{DOUBLEWITHTWODWORDINTREE(0x5e100000,0x00000000)}},
+ {VT_exponent,22,0x3a90f9,{DOUBLEWITHTWODWORDINTREE(0x5e200000,0x00000000)}},
+ {VT_exponent,22,0x3a90fa,{DOUBLEWITHTWODWORDINTREE(0x5e300000,0x00000000)}},
+ {VT_exponent,22,0x3a90fb,{DOUBLEWITHTWODWORDINTREE(0x5e400000,0x00000000)}},
+ {VT_exponent,22,0x3a90fc,{DOUBLEWITHTWODWORDINTREE(0x5e500000,0x00000000)}},
+ {VT_exponent,22,0x3a90fd,{DOUBLEWITHTWODWORDINTREE(0x5e600000,0x00000000)}},
+ {VT_exponent,22,0x3a90fe,{DOUBLEWITHTWODWORDINTREE(0x5e700000,0x00000000)}},
+ {VT_exponent,22,0x3a90ff,{DOUBLEWITHTWODWORDINTREE(0x5e800000,0x00000000)}},
+ {VT_exponent,22,0x3a9100,{DOUBLEWITHTWODWORDINTREE(0x5e900000,0x00000000)}},
+ {VT_exponent,22,0x3a9101,{DOUBLEWITHTWODWORDINTREE(0x5ea00000,0x00000000)}},
+ {VT_exponent,22,0x3a9102,{DOUBLEWITHTWODWORDINTREE(0x5eb00000,0x00000000)}},
+ {VT_exponent,22,0x3a9103,{DOUBLEWITHTWODWORDINTREE(0x5ec00000,0x00000000)}},
+ {VT_exponent,22,0x3a9104,{DOUBLEWITHTWODWORDINTREE(0x5ed00000,0x00000000)}},
+ {VT_exponent,22,0x3a9105,{DOUBLEWITHTWODWORDINTREE(0x5ee00000,0x00000000)}},
+ {VT_exponent,22,0x3a9106,{DOUBLEWITHTWODWORDINTREE(0x5ef00000,0x00000000)}},
+ {VT_exponent,22,0x3a9107,{DOUBLEWITHTWODWORDINTREE(0x5f000000,0x00000000)}},
+ {VT_exponent,22,0x3a9108,{DOUBLEWITHTWODWORDINTREE(0x5f100000,0x00000000)}},
+ {VT_exponent,22,0x3a9109,{DOUBLEWITHTWODWORDINTREE(0x5f200000,0x00000000)}},
+ {VT_exponent,22,0x3a910a,{DOUBLEWITHTWODWORDINTREE(0x5f300000,0x00000000)}},
+ {VT_exponent,22,0x3a910b,{DOUBLEWITHTWODWORDINTREE(0x5f400000,0x00000000)}},
+ {VT_exponent,22,0x3a910c,{DOUBLEWITHTWODWORDINTREE(0x5f500000,0x00000000)}},
+ {VT_exponent,22,0x3a910d,{DOUBLEWITHTWODWORDINTREE(0x5f600000,0x00000000)}},
+ {VT_exponent,22,0x3a910e,{DOUBLEWITHTWODWORDINTREE(0x5f700000,0x00000000)}},
+ {VT_exponent,22,0x3a910f,{DOUBLEWITHTWODWORDINTREE(0x5f800000,0x00000000)}},
+ {VT_exponent,22,0x3a9110,{DOUBLEWITHTWODWORDINTREE(0x5f900000,0x00000000)}},
+ {VT_exponent,22,0x3a9111,{DOUBLEWITHTWODWORDINTREE(0x5fa00000,0x00000000)}},
+ {VT_exponent,22,0x3a9112,{DOUBLEWITHTWODWORDINTREE(0x5fb00000,0x00000000)}},
+ {VT_exponent,22,0x3a9113,{DOUBLEWITHTWODWORDINTREE(0x5fc00000,0x00000000)}},
+ {VT_exponent,22,0x3a9114,{DOUBLEWITHTWODWORDINTREE(0x5fd00000,0x00000000)}},
+ {VT_exponent,22,0x3a9115,{DOUBLEWITHTWODWORDINTREE(0x5fe00000,0x00000000)}},
+ {VT_exponent,22,0x3a9116,{DOUBLEWITHTWODWORDINTREE(0x5ff00000,0x00000000)}},
+ {VT_exponent,22,0x3a9117,{DOUBLEWITHTWODWORDINTREE(0x60000000,0x00000000)}},
+ {VT_exponent,22,0x3a9118,{DOUBLEWITHTWODWORDINTREE(0x60100000,0x00000000)}},
+ {VT_exponent,22,0x3a9119,{DOUBLEWITHTWODWORDINTREE(0x60200000,0x00000000)}},
+ {VT_exponent,22,0x3a911a,{DOUBLEWITHTWODWORDINTREE(0x60300000,0x00000000)}},
+ {VT_exponent,22,0x3a911b,{DOUBLEWITHTWODWORDINTREE(0x60400000,0x00000000)}},
+ {VT_exponent,22,0x3a911c,{DOUBLEWITHTWODWORDINTREE(0x60500000,0x00000000)}},
+ {VT_exponent,22,0x3a911d,{DOUBLEWITHTWODWORDINTREE(0x60600000,0x00000000)}},
+ {VT_exponent,22,0x3a911e,{DOUBLEWITHTWODWORDINTREE(0x60700000,0x00000000)}},
+ {VT_exponent,22,0x3a911f,{DOUBLEWITHTWODWORDINTREE(0x60800000,0x00000000)}},
+ {VT_exponent,22,0x3a9120,{DOUBLEWITHTWODWORDINTREE(0x60900000,0x00000000)}},
+ {VT_exponent,22,0x3a9121,{DOUBLEWITHTWODWORDINTREE(0x60a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9122,{DOUBLEWITHTWODWORDINTREE(0x60b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9123,{DOUBLEWITHTWODWORDINTREE(0x60c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9124,{DOUBLEWITHTWODWORDINTREE(0x60d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9125,{DOUBLEWITHTWODWORDINTREE(0x60e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9126,{DOUBLEWITHTWODWORDINTREE(0x60f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9127,{DOUBLEWITHTWODWORDINTREE(0x61000000,0x00000000)}},
+ {VT_exponent,22,0x3a9128,{DOUBLEWITHTWODWORDINTREE(0x61100000,0x00000000)}},
+ {VT_exponent,22,0x3a9129,{DOUBLEWITHTWODWORDINTREE(0x61200000,0x00000000)}},
+ {VT_exponent,22,0x3a912a,{DOUBLEWITHTWODWORDINTREE(0x61300000,0x00000000)}},
+ {VT_exponent,22,0x3a912b,{DOUBLEWITHTWODWORDINTREE(0x61400000,0x00000000)}},
+ {VT_exponent,22,0x3a912c,{DOUBLEWITHTWODWORDINTREE(0x61500000,0x00000000)}},
+ {VT_exponent,22,0x3a912d,{DOUBLEWITHTWODWORDINTREE(0x61600000,0x00000000)}},
+ {VT_exponent,22,0x3a912e,{DOUBLEWITHTWODWORDINTREE(0x61700000,0x00000000)}},
+ {VT_exponent,22,0x3a912f,{DOUBLEWITHTWODWORDINTREE(0x61800000,0x00000000)}},
+ {VT_exponent,22,0x3a9130,{DOUBLEWITHTWODWORDINTREE(0x61900000,0x00000000)}},
+ {VT_exponent,22,0x3a9131,{DOUBLEWITHTWODWORDINTREE(0x61a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9132,{DOUBLEWITHTWODWORDINTREE(0x61b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9133,{DOUBLEWITHTWODWORDINTREE(0x61c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9134,{DOUBLEWITHTWODWORDINTREE(0x61d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9135,{DOUBLEWITHTWODWORDINTREE(0x61e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9136,{DOUBLEWITHTWODWORDINTREE(0x61f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9137,{DOUBLEWITHTWODWORDINTREE(0x62000000,0x00000000)}},
+ {VT_exponent,22,0x3a9138,{DOUBLEWITHTWODWORDINTREE(0x62100000,0x00000000)}},
+ {VT_exponent,22,0x3a9139,{DOUBLEWITHTWODWORDINTREE(0x62200000,0x00000000)}},
+ {VT_exponent,22,0x3a913a,{DOUBLEWITHTWODWORDINTREE(0x62300000,0x00000000)}},
+ {VT_exponent,22,0x3a913b,{DOUBLEWITHTWODWORDINTREE(0x62400000,0x00000000)}},
+ {VT_exponent,22,0x3a913c,{DOUBLEWITHTWODWORDINTREE(0x62500000,0x00000000)}},
+ {VT_exponent,22,0x3a913d,{DOUBLEWITHTWODWORDINTREE(0x62600000,0x00000000)}},
+ {VT_exponent,22,0x3a913e,{DOUBLEWITHTWODWORDINTREE(0x62700000,0x00000000)}},
+ {VT_exponent,22,0x3a913f,{DOUBLEWITHTWODWORDINTREE(0x62800000,0x00000000)}},
+ {VT_exponent,22,0x3a9140,{DOUBLEWITHTWODWORDINTREE(0x62900000,0x00000000)}},
+ {VT_exponent,22,0x3a9141,{DOUBLEWITHTWODWORDINTREE(0x62a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9142,{DOUBLEWITHTWODWORDINTREE(0x62b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9143,{DOUBLEWITHTWODWORDINTREE(0x62c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9144,{DOUBLEWITHTWODWORDINTREE(0x62d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9145,{DOUBLEWITHTWODWORDINTREE(0x62e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9146,{DOUBLEWITHTWODWORDINTREE(0x62f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9147,{DOUBLEWITHTWODWORDINTREE(0x63000000,0x00000000)}},
+ {VT_exponent,22,0x3a9148,{DOUBLEWITHTWODWORDINTREE(0x63100000,0x00000000)}},
+ {VT_exponent,22,0x3a9149,{DOUBLEWITHTWODWORDINTREE(0x63200000,0x00000000)}},
+ {VT_exponent,22,0x3a914a,{DOUBLEWITHTWODWORDINTREE(0x63300000,0x00000000)}},
+ {VT_exponent,22,0x3a914b,{DOUBLEWITHTWODWORDINTREE(0x63400000,0x00000000)}},
+ {VT_exponent,22,0x3a914c,{DOUBLEWITHTWODWORDINTREE(0x63500000,0x00000000)}},
+ {VT_exponent,22,0x3a914d,{DOUBLEWITHTWODWORDINTREE(0x63600000,0x00000000)}},
+ {VT_exponent,22,0x3a914e,{DOUBLEWITHTWODWORDINTREE(0x63700000,0x00000000)}},
+ {VT_exponent,22,0x3a914f,{DOUBLEWITHTWODWORDINTREE(0x63800000,0x00000000)}},
+ {VT_exponent,22,0x3a9150,{DOUBLEWITHTWODWORDINTREE(0x63900000,0x00000000)}},
+ {VT_exponent,22,0x3a9151,{DOUBLEWITHTWODWORDINTREE(0x63a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9152,{DOUBLEWITHTWODWORDINTREE(0x63b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9153,{DOUBLEWITHTWODWORDINTREE(0x63c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9154,{DOUBLEWITHTWODWORDINTREE(0x63d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9155,{DOUBLEWITHTWODWORDINTREE(0x63e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9156,{DOUBLEWITHTWODWORDINTREE(0x63f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9157,{DOUBLEWITHTWODWORDINTREE(0x64000000,0x00000000)}},
+ {VT_exponent,22,0x3a9158,{DOUBLEWITHTWODWORDINTREE(0x64100000,0x00000000)}},
+ {VT_exponent,22,0x3a9159,{DOUBLEWITHTWODWORDINTREE(0x64200000,0x00000000)}},
+ {VT_exponent,22,0x3a915a,{DOUBLEWITHTWODWORDINTREE(0x64300000,0x00000000)}},
+ {VT_exponent,22,0x3a915b,{DOUBLEWITHTWODWORDINTREE(0x64400000,0x00000000)}},
+ {VT_exponent,22,0x3a915c,{DOUBLEWITHTWODWORDINTREE(0x64500000,0x00000000)}},
+ {VT_exponent,22,0x3a915d,{DOUBLEWITHTWODWORDINTREE(0x64600000,0x00000000)}},
+ {VT_exponent,22,0x3a915e,{DOUBLEWITHTWODWORDINTREE(0x64700000,0x00000000)}},
+ {VT_exponent,22,0x3a915f,{DOUBLEWITHTWODWORDINTREE(0x64800000,0x00000000)}},
+ {VT_exponent,22,0x3a9160,{DOUBLEWITHTWODWORDINTREE(0x64900000,0x00000000)}},
+ {VT_exponent,22,0x3a9161,{DOUBLEWITHTWODWORDINTREE(0x64a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9162,{DOUBLEWITHTWODWORDINTREE(0x64b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9163,{DOUBLEWITHTWODWORDINTREE(0x64c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9164,{DOUBLEWITHTWODWORDINTREE(0x64d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9165,{DOUBLEWITHTWODWORDINTREE(0x64e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9166,{DOUBLEWITHTWODWORDINTREE(0x64f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9167,{DOUBLEWITHTWODWORDINTREE(0x65000000,0x00000000)}},
+ {VT_exponent,22,0x3a9168,{DOUBLEWITHTWODWORDINTREE(0x65100000,0x00000000)}},
+ {VT_exponent,22,0x3a9169,{DOUBLEWITHTWODWORDINTREE(0x65200000,0x00000000)}},
+ {VT_exponent,22,0x3a916a,{DOUBLEWITHTWODWORDINTREE(0x65300000,0x00000000)}},
+ {VT_exponent,22,0x3a916b,{DOUBLEWITHTWODWORDINTREE(0x65400000,0x00000000)}},
+ {VT_exponent,22,0x3a916c,{DOUBLEWITHTWODWORDINTREE(0x65500000,0x00000000)}},
+ {VT_exponent,22,0x3a916d,{DOUBLEWITHTWODWORDINTREE(0x65600000,0x00000000)}},
+ {VT_exponent,22,0x3a916e,{DOUBLEWITHTWODWORDINTREE(0x65700000,0x00000000)}},
+ {VT_exponent,22,0x3a916f,{DOUBLEWITHTWODWORDINTREE(0x65800000,0x00000000)}},
+ {VT_exponent,22,0x3a9170,{DOUBLEWITHTWODWORDINTREE(0x65900000,0x00000000)}},
+ {VT_exponent,22,0x3a9171,{DOUBLEWITHTWODWORDINTREE(0x65a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9172,{DOUBLEWITHTWODWORDINTREE(0x65b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9173,{DOUBLEWITHTWODWORDINTREE(0x65c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9174,{DOUBLEWITHTWODWORDINTREE(0x65d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9175,{DOUBLEWITHTWODWORDINTREE(0x65e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9176,{DOUBLEWITHTWODWORDINTREE(0x65f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9177,{DOUBLEWITHTWODWORDINTREE(0x66000000,0x00000000)}},
+ {VT_exponent,22,0x3a9178,{DOUBLEWITHTWODWORDINTREE(0x66100000,0x00000000)}},
+ {VT_exponent,22,0x3a9179,{DOUBLEWITHTWODWORDINTREE(0x66200000,0x00000000)}},
+ {VT_exponent,22,0x3a917a,{DOUBLEWITHTWODWORDINTREE(0x66300000,0x00000000)}},
+ {VT_exponent,22,0x3a917b,{DOUBLEWITHTWODWORDINTREE(0x66400000,0x00000000)}},
+ {VT_exponent,22,0x3a917c,{DOUBLEWITHTWODWORDINTREE(0x66500000,0x00000000)}},
+ {VT_exponent,22,0x3a917d,{DOUBLEWITHTWODWORDINTREE(0x66600000,0x00000000)}},
+ {VT_exponent,22,0x3a917e,{DOUBLEWITHTWODWORDINTREE(0x66700000,0x00000000)}},
+ {VT_exponent,22,0x3a917f,{DOUBLEWITHTWODWORDINTREE(0x66800000,0x00000000)}},
+ {VT_exponent,22,0x3a9180,{DOUBLEWITHTWODWORDINTREE(0x66900000,0x00000000)}},
+ {VT_exponent,22,0x3a9181,{DOUBLEWITHTWODWORDINTREE(0x66a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9182,{DOUBLEWITHTWODWORDINTREE(0x66b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9183,{DOUBLEWITHTWODWORDINTREE(0x66c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9184,{DOUBLEWITHTWODWORDINTREE(0x66d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9185,{DOUBLEWITHTWODWORDINTREE(0x66e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9186,{DOUBLEWITHTWODWORDINTREE(0x66f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9187,{DOUBLEWITHTWODWORDINTREE(0x67000000,0x00000000)}},
+ {VT_exponent,22,0x3a9188,{DOUBLEWITHTWODWORDINTREE(0x67100000,0x00000000)}},
+ {VT_exponent,22,0x3a9189,{DOUBLEWITHTWODWORDINTREE(0x67200000,0x00000000)}},
+ {VT_exponent,22,0x3a918a,{DOUBLEWITHTWODWORDINTREE(0x67300000,0x00000000)}},
+ {VT_exponent,22,0x3a918b,{DOUBLEWITHTWODWORDINTREE(0x67400000,0x00000000)}},
+ {VT_exponent,22,0x3a918c,{DOUBLEWITHTWODWORDINTREE(0x67500000,0x00000000)}},
+ {VT_exponent,22,0x3a918d,{DOUBLEWITHTWODWORDINTREE(0x67600000,0x00000000)}},
+ {VT_exponent,22,0x3a918e,{DOUBLEWITHTWODWORDINTREE(0x67700000,0x00000000)}},
+ {VT_exponent,22,0x3a918f,{DOUBLEWITHTWODWORDINTREE(0x67800000,0x00000000)}},
+ {VT_exponent,22,0x3a9190,{DOUBLEWITHTWODWORDINTREE(0x67900000,0x00000000)}},
+ {VT_exponent,22,0x3a9191,{DOUBLEWITHTWODWORDINTREE(0x67a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9192,{DOUBLEWITHTWODWORDINTREE(0x67b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9193,{DOUBLEWITHTWODWORDINTREE(0x67c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9194,{DOUBLEWITHTWODWORDINTREE(0x67d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9195,{DOUBLEWITHTWODWORDINTREE(0x67e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9196,{DOUBLEWITHTWODWORDINTREE(0x67f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9197,{DOUBLEWITHTWODWORDINTREE(0x68000000,0x00000000)}},
+ {VT_exponent,22,0x3a9198,{DOUBLEWITHTWODWORDINTREE(0x68100000,0x00000000)}},
+ {VT_exponent,22,0x3a9199,{DOUBLEWITHTWODWORDINTREE(0x68200000,0x00000000)}},
+ {VT_exponent,22,0x3a919a,{DOUBLEWITHTWODWORDINTREE(0x68300000,0x00000000)}},
+ {VT_exponent,22,0x3a919b,{DOUBLEWITHTWODWORDINTREE(0x68400000,0x00000000)}},
+ {VT_exponent,22,0x3a919c,{DOUBLEWITHTWODWORDINTREE(0x68500000,0x00000000)}},
+ {VT_exponent,22,0x3a919d,{DOUBLEWITHTWODWORDINTREE(0x68600000,0x00000000)}},
+ {VT_exponent,22,0x3a919e,{DOUBLEWITHTWODWORDINTREE(0x68700000,0x00000000)}},
+ {VT_exponent,22,0x3a919f,{DOUBLEWITHTWODWORDINTREE(0x68800000,0x00000000)}},
+ {VT_exponent,22,0x3a91a0,{DOUBLEWITHTWODWORDINTREE(0x68900000,0x00000000)}},
+ {VT_exponent,22,0x3a91a1,{DOUBLEWITHTWODWORDINTREE(0x68a00000,0x00000000)}},
+ {VT_exponent,22,0x3a91a2,{DOUBLEWITHTWODWORDINTREE(0x68b00000,0x00000000)}},
+ {VT_exponent,22,0x3a91a3,{DOUBLEWITHTWODWORDINTREE(0x68c00000,0x00000000)}},
+ {VT_exponent,22,0x3a91a4,{DOUBLEWITHTWODWORDINTREE(0x68d00000,0x00000000)}},
+ {VT_exponent,22,0x3a91a5,{DOUBLEWITHTWODWORDINTREE(0x68e00000,0x00000000)}},
+ {VT_exponent,22,0x3a91a6,{DOUBLEWITHTWODWORDINTREE(0x68f00000,0x00000000)}},
+ {VT_exponent,22,0x3a91a7,{DOUBLEWITHTWODWORDINTREE(0x69000000,0x00000000)}},
+ {VT_exponent,22,0x3a91a8,{DOUBLEWITHTWODWORDINTREE(0x69100000,0x00000000)}},
+ {VT_exponent,22,0x3a91a9,{DOUBLEWITHTWODWORDINTREE(0x69200000,0x00000000)}},
+ {VT_exponent,22,0x3a91aa,{DOUBLEWITHTWODWORDINTREE(0x69300000,0x00000000)}},
+ {VT_exponent,22,0x3a91ab,{DOUBLEWITHTWODWORDINTREE(0x69400000,0x00000000)}},
+ {VT_exponent,22,0x3a91ac,{DOUBLEWITHTWODWORDINTREE(0x69500000,0x00000000)}},
+ {VT_exponent,22,0x3a91ad,{DOUBLEWITHTWODWORDINTREE(0x69600000,0x00000000)}},
+ {VT_exponent,22,0x3a91ae,{DOUBLEWITHTWODWORDINTREE(0x69700000,0x00000000)}},
+ {VT_exponent,22,0x3a91af,{DOUBLEWITHTWODWORDINTREE(0x69800000,0x00000000)}},
+ {VT_exponent,22,0x3a91b0,{DOUBLEWITHTWODWORDINTREE(0x69900000,0x00000000)}},
+ {VT_exponent,22,0x3a91b1,{DOUBLEWITHTWODWORDINTREE(0x69a00000,0x00000000)}},
+ {VT_exponent,22,0x3a91b2,{DOUBLEWITHTWODWORDINTREE(0x69b00000,0x00000000)}},
+ {VT_exponent,22,0x3a91b3,{DOUBLEWITHTWODWORDINTREE(0x69c00000,0x00000000)}},
+ {VT_exponent,22,0x3a91b4,{DOUBLEWITHTWODWORDINTREE(0x69d00000,0x00000000)}},
+ {VT_exponent,22,0x3a91b5,{DOUBLEWITHTWODWORDINTREE(0x69e00000,0x00000000)}},
+ {VT_exponent,22,0x3a91b6,{DOUBLEWITHTWODWORDINTREE(0x69f00000,0x00000000)}},
+ {VT_exponent,22,0x3a91b7,{DOUBLEWITHTWODWORDINTREE(0x6a000000,0x00000000)}},
+ {VT_exponent,22,0x3a91b8,{DOUBLEWITHTWODWORDINTREE(0x6a100000,0x00000000)}},
+ {VT_exponent,22,0x3a91b9,{DOUBLEWITHTWODWORDINTREE(0x6a200000,0x00000000)}},
+ {VT_exponent,22,0x3a91ba,{DOUBLEWITHTWODWORDINTREE(0x6a300000,0x00000000)}},
+ {VT_exponent,22,0x3a91bb,{DOUBLEWITHTWODWORDINTREE(0x6a400000,0x00000000)}},
+ {VT_exponent,22,0x3a91bc,{DOUBLEWITHTWODWORDINTREE(0x6a500000,0x00000000)}},
+ {VT_exponent,22,0x3a91bd,{DOUBLEWITHTWODWORDINTREE(0x6a600000,0x00000000)}},
+ {VT_exponent,22,0x3a91be,{DOUBLEWITHTWODWORDINTREE(0x6a700000,0x00000000)}},
+ {VT_exponent,22,0x3a91bf,{DOUBLEWITHTWODWORDINTREE(0x6a800000,0x00000000)}},
+ {VT_exponent,22,0x3a91c0,{DOUBLEWITHTWODWORDINTREE(0x6a900000,0x00000000)}},
+ {VT_exponent,22,0x3a91c1,{DOUBLEWITHTWODWORDINTREE(0x6aa00000,0x00000000)}},
+ {VT_exponent,22,0x3a91c2,{DOUBLEWITHTWODWORDINTREE(0x6ab00000,0x00000000)}},
+ {VT_exponent,22,0x3a91c3,{DOUBLEWITHTWODWORDINTREE(0x6ac00000,0x00000000)}},
+ {VT_exponent,22,0x3a91c4,{DOUBLEWITHTWODWORDINTREE(0x6ad00000,0x00000000)}},
+ {VT_exponent,22,0x3a91c5,{DOUBLEWITHTWODWORDINTREE(0x6ae00000,0x00000000)}},
+ {VT_exponent,22,0x3a91c6,{DOUBLEWITHTWODWORDINTREE(0x6af00000,0x00000000)}},
+ {VT_exponent,22,0x3a91c7,{DOUBLEWITHTWODWORDINTREE(0x6b000000,0x00000000)}},
+ {VT_exponent,22,0x3a91c8,{DOUBLEWITHTWODWORDINTREE(0x6b100000,0x00000000)}},
+ {VT_exponent,22,0x3a91c9,{DOUBLEWITHTWODWORDINTREE(0x6b200000,0x00000000)}},
+ {VT_exponent,22,0x3a91ca,{DOUBLEWITHTWODWORDINTREE(0x6b300000,0x00000000)}},
+ {VT_exponent,22,0x3a91cb,{DOUBLEWITHTWODWORDINTREE(0x6b400000,0x00000000)}},
+ {VT_exponent,22,0x3a91cc,{DOUBLEWITHTWODWORDINTREE(0x6b500000,0x00000000)}},
+ {VT_exponent,22,0x3a91cd,{DOUBLEWITHTWODWORDINTREE(0x6b600000,0x00000000)}},
+ {VT_exponent,22,0x3a91ce,{DOUBLEWITHTWODWORDINTREE(0x6b700000,0x00000000)}},
+ {VT_exponent,22,0x3a91cf,{DOUBLEWITHTWODWORDINTREE(0x6b800000,0x00000000)}},
+ {VT_exponent,22,0x3a91d0,{DOUBLEWITHTWODWORDINTREE(0x6b900000,0x00000000)}},
+ {VT_exponent,22,0x3a91d1,{DOUBLEWITHTWODWORDINTREE(0x6ba00000,0x00000000)}},
+ {VT_exponent,22,0x3a91d2,{DOUBLEWITHTWODWORDINTREE(0x6bb00000,0x00000000)}},
+ {VT_exponent,22,0x3a91d3,{DOUBLEWITHTWODWORDINTREE(0x6bc00000,0x00000000)}},
+ {VT_exponent,22,0x3a91d4,{DOUBLEWITHTWODWORDINTREE(0x6bd00000,0x00000000)}},
+ {VT_exponent,22,0x3a91d5,{DOUBLEWITHTWODWORDINTREE(0x6be00000,0x00000000)}},
+ {VT_exponent,22,0x3a91d6,{DOUBLEWITHTWODWORDINTREE(0x6bf00000,0x00000000)}},
+ {VT_exponent,22,0x3a91d7,{DOUBLEWITHTWODWORDINTREE(0x6c000000,0x00000000)}},
+ {VT_exponent,22,0x3a91d8,{DOUBLEWITHTWODWORDINTREE(0x6c100000,0x00000000)}},
+ {VT_exponent,22,0x3a91d9,{DOUBLEWITHTWODWORDINTREE(0x6c200000,0x00000000)}},
+ {VT_exponent,22,0x3a91da,{DOUBLEWITHTWODWORDINTREE(0x6c300000,0x00000000)}},
+ {VT_exponent,22,0x3a91db,{DOUBLEWITHTWODWORDINTREE(0x6c400000,0x00000000)}},
+ {VT_exponent,22,0x3a91dc,{DOUBLEWITHTWODWORDINTREE(0x6c500000,0x00000000)}},
+ {VT_exponent,22,0x3a91dd,{DOUBLEWITHTWODWORDINTREE(0x6c600000,0x00000000)}},
+ {VT_exponent,22,0x3a91de,{DOUBLEWITHTWODWORDINTREE(0x6c700000,0x00000000)}},
+ {VT_exponent,22,0x3a91df,{DOUBLEWITHTWODWORDINTREE(0x6c800000,0x00000000)}},
+ {VT_exponent,22,0x3a91e0,{DOUBLEWITHTWODWORDINTREE(0x6c900000,0x00000000)}},
+ {VT_exponent,22,0x3a91e1,{DOUBLEWITHTWODWORDINTREE(0x6ca00000,0x00000000)}},
+ {VT_exponent,22,0x3a91e2,{DOUBLEWITHTWODWORDINTREE(0x6cb00000,0x00000000)}},
+ {VT_exponent,22,0x3a91e3,{DOUBLEWITHTWODWORDINTREE(0x6cc00000,0x00000000)}},
+ {VT_exponent,22,0x3a91e4,{DOUBLEWITHTWODWORDINTREE(0x6cd00000,0x00000000)}},
+ {VT_exponent,22,0x3a91e5,{DOUBLEWITHTWODWORDINTREE(0x6ce00000,0x00000000)}},
+ {VT_exponent,22,0x3a91e6,{DOUBLEWITHTWODWORDINTREE(0x6cf00000,0x00000000)}},
+ {VT_exponent,22,0x3a91e7,{DOUBLEWITHTWODWORDINTREE(0x6d000000,0x00000000)}},
+ {VT_exponent,22,0x3a91e8,{DOUBLEWITHTWODWORDINTREE(0x6d100000,0x00000000)}},
+ {VT_exponent,22,0x3a91e9,{DOUBLEWITHTWODWORDINTREE(0x6d200000,0x00000000)}},
+ {VT_exponent,22,0x3a91ea,{DOUBLEWITHTWODWORDINTREE(0x6d300000,0x00000000)}},
+ {VT_exponent,22,0x3a91eb,{DOUBLEWITHTWODWORDINTREE(0x6d400000,0x00000000)}},
+ {VT_exponent,22,0x3a91ec,{DOUBLEWITHTWODWORDINTREE(0x6d500000,0x00000000)}},
+ {VT_exponent,22,0x3a91ed,{DOUBLEWITHTWODWORDINTREE(0x6d600000,0x00000000)}},
+ {VT_exponent,22,0x3a91ee,{DOUBLEWITHTWODWORDINTREE(0x6d700000,0x00000000)}},
+ {VT_exponent,22,0x3a91ef,{DOUBLEWITHTWODWORDINTREE(0x6d800000,0x00000000)}},
+ {VT_exponent,22,0x3a91f0,{DOUBLEWITHTWODWORDINTREE(0x6d900000,0x00000000)}},
+ {VT_exponent,22,0x3a91f1,{DOUBLEWITHTWODWORDINTREE(0x6da00000,0x00000000)}},
+ {VT_exponent,22,0x3a91f2,{DOUBLEWITHTWODWORDINTREE(0x6db00000,0x00000000)}},
+ {VT_exponent,22,0x3a91f3,{DOUBLEWITHTWODWORDINTREE(0x6dc00000,0x00000000)}},
+ {VT_exponent,22,0x3a91f4,{DOUBLEWITHTWODWORDINTREE(0x6dd00000,0x00000000)}},
+ {VT_exponent,22,0x3a91f5,{DOUBLEWITHTWODWORDINTREE(0x6de00000,0x00000000)}},
+ {VT_exponent,22,0x3a91f6,{DOUBLEWITHTWODWORDINTREE(0x6df00000,0x00000000)}},
+ {VT_exponent,22,0x3a91f7,{DOUBLEWITHTWODWORDINTREE(0x6e000000,0x00000000)}},
+ {VT_exponent,22,0x3a91f8,{DOUBLEWITHTWODWORDINTREE(0x6e100000,0x00000000)}},
+ {VT_exponent,22,0x3a91f9,{DOUBLEWITHTWODWORDINTREE(0x6e200000,0x00000000)}},
+ {VT_exponent,22,0x3a91fa,{DOUBLEWITHTWODWORDINTREE(0x6e300000,0x00000000)}},
+ {VT_exponent,22,0x3a91fb,{DOUBLEWITHTWODWORDINTREE(0x6e400000,0x00000000)}},
+ {VT_exponent,22,0x3a91fc,{DOUBLEWITHTWODWORDINTREE(0x6e500000,0x00000000)}},
+ {VT_exponent,22,0x3a91fd,{DOUBLEWITHTWODWORDINTREE(0x6e600000,0x00000000)}},
+ {VT_exponent,22,0x3a91fe,{DOUBLEWITHTWODWORDINTREE(0x6e700000,0x00000000)}},
+ {VT_exponent,22,0x3a91ff,{DOUBLEWITHTWODWORDINTREE(0x6e800000,0x00000000)}},
+ {VT_exponent,22,0x3a9200,{DOUBLEWITHTWODWORDINTREE(0x6e900000,0x00000000)}},
+ {VT_exponent,22,0x3a9201,{DOUBLEWITHTWODWORDINTREE(0x6ea00000,0x00000000)}},
+ {VT_exponent,22,0x3a9202,{DOUBLEWITHTWODWORDINTREE(0x6eb00000,0x00000000)}},
+ {VT_exponent,22,0x3a9203,{DOUBLEWITHTWODWORDINTREE(0x6ec00000,0x00000000)}},
+ {VT_exponent,22,0x3a9204,{DOUBLEWITHTWODWORDINTREE(0x6ed00000,0x00000000)}},
+ {VT_exponent,22,0x3a9205,{DOUBLEWITHTWODWORDINTREE(0x6ee00000,0x00000000)}},
+ {VT_exponent,22,0x3a9206,{DOUBLEWITHTWODWORDINTREE(0x6ef00000,0x00000000)}},
+ {VT_exponent,22,0x3a9207,{DOUBLEWITHTWODWORDINTREE(0x6f000000,0x00000000)}},
+ {VT_exponent,22,0x3a9208,{DOUBLEWITHTWODWORDINTREE(0x6f100000,0x00000000)}},
+ {VT_exponent,22,0x3a9209,{DOUBLEWITHTWODWORDINTREE(0x6f200000,0x00000000)}},
+ {VT_exponent,22,0x3a920a,{DOUBLEWITHTWODWORDINTREE(0x6f300000,0x00000000)}},
+ {VT_exponent,22,0x3a920b,{DOUBLEWITHTWODWORDINTREE(0x6f400000,0x00000000)}},
+ {VT_exponent,22,0x3a920c,{DOUBLEWITHTWODWORDINTREE(0x6f500000,0x00000000)}},
+ {VT_exponent,22,0x3a920d,{DOUBLEWITHTWODWORDINTREE(0x6f600000,0x00000000)}},
+ {VT_exponent,22,0x3a920e,{DOUBLEWITHTWODWORDINTREE(0x6f700000,0x00000000)}},
+ {VT_exponent,22,0x3a920f,{DOUBLEWITHTWODWORDINTREE(0x6f800000,0x00000000)}},
+ {VT_exponent,22,0x3a9210,{DOUBLEWITHTWODWORDINTREE(0x6f900000,0x00000000)}},
+ {VT_exponent,22,0x3a9211,{DOUBLEWITHTWODWORDINTREE(0x6fa00000,0x00000000)}},
+ {VT_exponent,22,0x3a9212,{DOUBLEWITHTWODWORDINTREE(0x6fb00000,0x00000000)}},
+ {VT_exponent,22,0x3a9213,{DOUBLEWITHTWODWORDINTREE(0x6fc00000,0x00000000)}},
+ {VT_exponent,22,0x3a9214,{DOUBLEWITHTWODWORDINTREE(0x6fd00000,0x00000000)}},
+ {VT_exponent,22,0x3a9215,{DOUBLEWITHTWODWORDINTREE(0x6fe00000,0x00000000)}},
+ {VT_exponent,22,0x3a9216,{DOUBLEWITHTWODWORDINTREE(0x6ff00000,0x00000000)}},
+ {VT_exponent,22,0x3a9217,{DOUBLEWITHTWODWORDINTREE(0x70000000,0x00000000)}},
+ {VT_exponent,22,0x3a9218,{DOUBLEWITHTWODWORDINTREE(0x70100000,0x00000000)}},
+ {VT_exponent,22,0x3a9219,{DOUBLEWITHTWODWORDINTREE(0x70200000,0x00000000)}},
+ {VT_exponent,22,0x3a921a,{DOUBLEWITHTWODWORDINTREE(0x70300000,0x00000000)}},
+ {VT_exponent,22,0x3a921b,{DOUBLEWITHTWODWORDINTREE(0x70400000,0x00000000)}},
+ {VT_exponent,22,0x3a921c,{DOUBLEWITHTWODWORDINTREE(0x70500000,0x00000000)}},
+ {VT_exponent,22,0x3a921d,{DOUBLEWITHTWODWORDINTREE(0x70600000,0x00000000)}},
+ {VT_exponent,22,0x3a921e,{DOUBLEWITHTWODWORDINTREE(0x70700000,0x00000000)}},
+ {VT_exponent,22,0x3a921f,{DOUBLEWITHTWODWORDINTREE(0x70800000,0x00000000)}},
+ {VT_exponent,22,0x3a9220,{DOUBLEWITHTWODWORDINTREE(0x70900000,0x00000000)}},
+ {VT_exponent,22,0x3a9221,{DOUBLEWITHTWODWORDINTREE(0x70a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9222,{DOUBLEWITHTWODWORDINTREE(0x70b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9223,{DOUBLEWITHTWODWORDINTREE(0x70c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9224,{DOUBLEWITHTWODWORDINTREE(0x70d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9225,{DOUBLEWITHTWODWORDINTREE(0x70e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9226,{DOUBLEWITHTWODWORDINTREE(0x70f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9227,{DOUBLEWITHTWODWORDINTREE(0x71000000,0x00000000)}},
+ {VT_exponent,22,0x3a9228,{DOUBLEWITHTWODWORDINTREE(0x71100000,0x00000000)}},
+ {VT_exponent,22,0x3a9229,{DOUBLEWITHTWODWORDINTREE(0x71200000,0x00000000)}},
+ {VT_exponent,22,0x3a922a,{DOUBLEWITHTWODWORDINTREE(0x71300000,0x00000000)}},
+ {VT_exponent,22,0x3a922b,{DOUBLEWITHTWODWORDINTREE(0x71400000,0x00000000)}},
+ {VT_exponent,22,0x3a922c,{DOUBLEWITHTWODWORDINTREE(0x71500000,0x00000000)}},
+ {VT_exponent,22,0x3a922d,{DOUBLEWITHTWODWORDINTREE(0x71600000,0x00000000)}},
+ {VT_exponent,22,0x3a922e,{DOUBLEWITHTWODWORDINTREE(0x71700000,0x00000000)}},
+ {VT_exponent,22,0x3a922f,{DOUBLEWITHTWODWORDINTREE(0x71800000,0x00000000)}},
+ {VT_exponent,22,0x3a9230,{DOUBLEWITHTWODWORDINTREE(0x71900000,0x00000000)}},
+ {VT_exponent,22,0x3a9231,{DOUBLEWITHTWODWORDINTREE(0x71a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9232,{DOUBLEWITHTWODWORDINTREE(0x71b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9233,{DOUBLEWITHTWODWORDINTREE(0x71c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9234,{DOUBLEWITHTWODWORDINTREE(0x71d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9235,{DOUBLEWITHTWODWORDINTREE(0x71e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9236,{DOUBLEWITHTWODWORDINTREE(0x71f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9237,{DOUBLEWITHTWODWORDINTREE(0x72000000,0x00000000)}},
+ {VT_exponent,22,0x3a9238,{DOUBLEWITHTWODWORDINTREE(0x72100000,0x00000000)}},
+ {VT_exponent,22,0x3a9239,{DOUBLEWITHTWODWORDINTREE(0x72200000,0x00000000)}},
+ {VT_exponent,22,0x3a923a,{DOUBLEWITHTWODWORDINTREE(0x72300000,0x00000000)}},
+ {VT_exponent,22,0x3a923b,{DOUBLEWITHTWODWORDINTREE(0x72400000,0x00000000)}},
+ {VT_exponent,22,0x3a923c,{DOUBLEWITHTWODWORDINTREE(0x72500000,0x00000000)}},
+ {VT_exponent,22,0x3a923d,{DOUBLEWITHTWODWORDINTREE(0x72600000,0x00000000)}},
+ {VT_exponent,22,0x3a923e,{DOUBLEWITHTWODWORDINTREE(0x72700000,0x00000000)}},
+ {VT_exponent,22,0x3a923f,{DOUBLEWITHTWODWORDINTREE(0x72800000,0x00000000)}},
+ {VT_exponent,22,0x3a9240,{DOUBLEWITHTWODWORDINTREE(0x72900000,0x00000000)}},
+ {VT_exponent,22,0x3a9241,{DOUBLEWITHTWODWORDINTREE(0x72a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9242,{DOUBLEWITHTWODWORDINTREE(0x72b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9243,{DOUBLEWITHTWODWORDINTREE(0x72c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9244,{DOUBLEWITHTWODWORDINTREE(0x72d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9245,{DOUBLEWITHTWODWORDINTREE(0x72e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9246,{DOUBLEWITHTWODWORDINTREE(0x72f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9247,{DOUBLEWITHTWODWORDINTREE(0x73000000,0x00000000)}},
+ {VT_exponent,22,0x3a9248,{DOUBLEWITHTWODWORDINTREE(0x73100000,0x00000000)}},
+ {VT_exponent,22,0x3a9249,{DOUBLEWITHTWODWORDINTREE(0x73200000,0x00000000)}},
+ {VT_exponent,22,0x3a924a,{DOUBLEWITHTWODWORDINTREE(0x73300000,0x00000000)}},
+ {VT_exponent,22,0x3a924b,{DOUBLEWITHTWODWORDINTREE(0x73400000,0x00000000)}},
+ {VT_exponent,22,0x3a924c,{DOUBLEWITHTWODWORDINTREE(0x73500000,0x00000000)}},
+ {VT_exponent,22,0x3a924d,{DOUBLEWITHTWODWORDINTREE(0x73600000,0x00000000)}},
+ {VT_exponent,22,0x3a924e,{DOUBLEWITHTWODWORDINTREE(0x73700000,0x00000000)}},
+ {VT_exponent,22,0x3a924f,{DOUBLEWITHTWODWORDINTREE(0x73800000,0x00000000)}},
+ {VT_exponent,22,0x3a9250,{DOUBLEWITHTWODWORDINTREE(0x73900000,0x00000000)}},
+ {VT_exponent,22,0x3a9251,{DOUBLEWITHTWODWORDINTREE(0x73a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9252,{DOUBLEWITHTWODWORDINTREE(0x73b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9253,{DOUBLEWITHTWODWORDINTREE(0x73c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9254,{DOUBLEWITHTWODWORDINTREE(0x73d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9255,{DOUBLEWITHTWODWORDINTREE(0x73e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9256,{DOUBLEWITHTWODWORDINTREE(0x73f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9257,{DOUBLEWITHTWODWORDINTREE(0x74000000,0x00000000)}},
+ {VT_exponent,22,0x3a9258,{DOUBLEWITHTWODWORDINTREE(0x74100000,0x00000000)}},
+ {VT_exponent,22,0x3a9259,{DOUBLEWITHTWODWORDINTREE(0x74200000,0x00000000)}},
+ {VT_exponent,22,0x3a925a,{DOUBLEWITHTWODWORDINTREE(0x74300000,0x00000000)}},
+ {VT_exponent,22,0x3a925b,{DOUBLEWITHTWODWORDINTREE(0x74400000,0x00000000)}},
+ {VT_exponent,22,0x3a925c,{DOUBLEWITHTWODWORDINTREE(0x74500000,0x00000000)}},
+ {VT_exponent,22,0x3a925d,{DOUBLEWITHTWODWORDINTREE(0x74600000,0x00000000)}},
+ {VT_exponent,22,0x3a925e,{DOUBLEWITHTWODWORDINTREE(0x74700000,0x00000000)}},
+ {VT_exponent,22,0x3a925f,{DOUBLEWITHTWODWORDINTREE(0x74800000,0x00000000)}},
+ {VT_exponent,22,0x3a9260,{DOUBLEWITHTWODWORDINTREE(0x74900000,0x00000000)}},
+ {VT_exponent,22,0x3a9261,{DOUBLEWITHTWODWORDINTREE(0x74a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9262,{DOUBLEWITHTWODWORDINTREE(0x74b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9263,{DOUBLEWITHTWODWORDINTREE(0x74c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9264,{DOUBLEWITHTWODWORDINTREE(0x74d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9265,{DOUBLEWITHTWODWORDINTREE(0x74e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9266,{DOUBLEWITHTWODWORDINTREE(0x74f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9267,{DOUBLEWITHTWODWORDINTREE(0x75000000,0x00000000)}},
+ {VT_exponent,22,0x3a9268,{DOUBLEWITHTWODWORDINTREE(0x75100000,0x00000000)}},
+ {VT_exponent,22,0x3a9269,{DOUBLEWITHTWODWORDINTREE(0x75200000,0x00000000)}},
+ {VT_exponent,22,0x3a926a,{DOUBLEWITHTWODWORDINTREE(0x75300000,0x00000000)}},
+ {VT_exponent,22,0x3a926b,{DOUBLEWITHTWODWORDINTREE(0x75400000,0x00000000)}},
+ {VT_exponent,22,0x3a926c,{DOUBLEWITHTWODWORDINTREE(0x75500000,0x00000000)}},
+ {VT_exponent,22,0x3a926d,{DOUBLEWITHTWODWORDINTREE(0x75600000,0x00000000)}},
+ {VT_exponent,22,0x3a926e,{DOUBLEWITHTWODWORDINTREE(0x75700000,0x00000000)}},
+ {VT_exponent,22,0x3a926f,{DOUBLEWITHTWODWORDINTREE(0x75800000,0x00000000)}},
+ {VT_exponent,22,0x3a9270,{DOUBLEWITHTWODWORDINTREE(0x75900000,0x00000000)}},
+ {VT_exponent,22,0x3a9271,{DOUBLEWITHTWODWORDINTREE(0x75a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9272,{DOUBLEWITHTWODWORDINTREE(0x75b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9273,{DOUBLEWITHTWODWORDINTREE(0x75c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9274,{DOUBLEWITHTWODWORDINTREE(0x75d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9275,{DOUBLEWITHTWODWORDINTREE(0x75e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9276,{DOUBLEWITHTWODWORDINTREE(0x75f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9277,{DOUBLEWITHTWODWORDINTREE(0x76000000,0x00000000)}},
+ {VT_exponent,22,0x3a9278,{DOUBLEWITHTWODWORDINTREE(0x76100000,0x00000000)}},
+ {VT_exponent,22,0x3a9279,{DOUBLEWITHTWODWORDINTREE(0x76200000,0x00000000)}},
+ {VT_exponent,22,0x3a927a,{DOUBLEWITHTWODWORDINTREE(0x76300000,0x00000000)}},
+ {VT_exponent,22,0x3a927b,{DOUBLEWITHTWODWORDINTREE(0x76400000,0x00000000)}},
+ {VT_exponent,22,0x3a927c,{DOUBLEWITHTWODWORDINTREE(0x76500000,0x00000000)}},
+ {VT_exponent,22,0x3a927d,{DOUBLEWITHTWODWORDINTREE(0x76600000,0x00000000)}},
+ {VT_exponent,22,0x3a927e,{DOUBLEWITHTWODWORDINTREE(0x76700000,0x00000000)}},
+ {VT_exponent,22,0x3a927f,{DOUBLEWITHTWODWORDINTREE(0x76800000,0x00000000)}},
+ {VT_exponent,22,0x3a9280,{DOUBLEWITHTWODWORDINTREE(0x76900000,0x00000000)}},
+ {VT_exponent,22,0x3a9281,{DOUBLEWITHTWODWORDINTREE(0x76a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9282,{DOUBLEWITHTWODWORDINTREE(0x76b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9283,{DOUBLEWITHTWODWORDINTREE(0x76c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9284,{DOUBLEWITHTWODWORDINTREE(0x76d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9285,{DOUBLEWITHTWODWORDINTREE(0x76e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9286,{DOUBLEWITHTWODWORDINTREE(0x76f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9287,{DOUBLEWITHTWODWORDINTREE(0x77000000,0x00000000)}},
+ {VT_exponent,22,0x3a9288,{DOUBLEWITHTWODWORDINTREE(0x77100000,0x00000000)}},
+ {VT_exponent,22,0x3a9289,{DOUBLEWITHTWODWORDINTREE(0x77200000,0x00000000)}},
+ {VT_exponent,22,0x3a928a,{DOUBLEWITHTWODWORDINTREE(0x77300000,0x00000000)}},
+ {VT_exponent,22,0x3a928b,{DOUBLEWITHTWODWORDINTREE(0x77400000,0x00000000)}},
+ {VT_exponent,22,0x3a928c,{DOUBLEWITHTWODWORDINTREE(0x77500000,0x00000000)}},
+ {VT_exponent,22,0x3a928d,{DOUBLEWITHTWODWORDINTREE(0x77600000,0x00000000)}},
+ {VT_exponent,22,0x3a928e,{DOUBLEWITHTWODWORDINTREE(0x77700000,0x00000000)}},
+ {VT_exponent,22,0x3a928f,{DOUBLEWITHTWODWORDINTREE(0x77800000,0x00000000)}},
+ {VT_exponent,22,0x3a9290,{DOUBLEWITHTWODWORDINTREE(0x77900000,0x00000000)}},
+ {VT_exponent,22,0x3a9291,{DOUBLEWITHTWODWORDINTREE(0x77a00000,0x00000000)}},
+ {VT_exponent,22,0x3a9292,{DOUBLEWITHTWODWORDINTREE(0x77b00000,0x00000000)}},
+ {VT_exponent,22,0x3a9293,{DOUBLEWITHTWODWORDINTREE(0x77c00000,0x00000000)}},
+ {VT_exponent,22,0x3a9294,{DOUBLEWITHTWODWORDINTREE(0x77d00000,0x00000000)}},
+ {VT_exponent,22,0x3a9295,{DOUBLEWITHTWODWORDINTREE(0x77e00000,0x00000000)}},
+ {VT_exponent,22,0x3a9296,{DOUBLEWITHTWODWORDINTREE(0x77f00000,0x00000000)}},
+ {VT_exponent,22,0x3a9297,{DOUBLEWITHTWODWORDINTREE(0x78000000,0x00000000)}},
+ {VT_exponent,22,0x3a9298,{DOUBLEWITHTWODWORDINTREE(0x78100000,0x00000000)}},
+ {VT_exponent,22,0x3a9299,{DOUBLEWITHTWODWORDINTREE(0x78200000,0x00000000)}},
+ {VT_exponent,22,0x3a929a,{DOUBLEWITHTWODWORDINTREE(0x78300000,0x00000000)}},
+ {VT_exponent,22,0x3a929b,{DOUBLEWITHTWODWORDINTREE(0x78400000,0x00000000)}},
+ {VT_exponent,22,0x3a929c,{DOUBLEWITHTWODWORDINTREE(0x78500000,0x00000000)}},
+ {VT_exponent,22,0x3a929d,{DOUBLEWITHTWODWORDINTREE(0x78600000,0x00000000)}},
+ {VT_exponent,22,0x3a929e,{DOUBLEWITHTWODWORDINTREE(0x78700000,0x00000000)}},
+ {VT_exponent,22,0x3a929f,{DOUBLEWITHTWODWORDINTREE(0x78800000,0x00000000)}},
+ {VT_exponent,22,0x3a92a0,{DOUBLEWITHTWODWORDINTREE(0x78900000,0x00000000)}},
+ {VT_exponent,22,0x3a92a1,{DOUBLEWITHTWODWORDINTREE(0x78a00000,0x00000000)}},
+ {VT_exponent,22,0x3a92a2,{DOUBLEWITHTWODWORDINTREE(0x78b00000,0x00000000)}},
+ {VT_exponent,22,0x3a92a3,{DOUBLEWITHTWODWORDINTREE(0x78c00000,0x00000000)}},
+ {VT_exponent,22,0x3a92a4,{DOUBLEWITHTWODWORDINTREE(0x78d00000,0x00000000)}},
+ {VT_exponent,22,0x3a92a5,{DOUBLEWITHTWODWORDINTREE(0x78e00000,0x00000000)}},
+ {VT_exponent,22,0x3a92a6,{DOUBLEWITHTWODWORDINTREE(0x78f00000,0x00000000)}},
+ {VT_exponent,22,0x3a92a7,{DOUBLEWITHTWODWORDINTREE(0x79000000,0x00000000)}},
+ {VT_exponent,22,0x3a92a8,{DOUBLEWITHTWODWORDINTREE(0x79100000,0x00000000)}},
+ {VT_exponent,22,0x3a92a9,{DOUBLEWITHTWODWORDINTREE(0x79200000,0x00000000)}},
+ {VT_exponent,22,0x3a92aa,{DOUBLEWITHTWODWORDINTREE(0x79300000,0x00000000)}},
+ {VT_exponent,22,0x3a92ab,{DOUBLEWITHTWODWORDINTREE(0x79400000,0x00000000)}},
+ {VT_exponent,22,0x3a92ac,{DOUBLEWITHTWODWORDINTREE(0x79500000,0x00000000)}},
+ {VT_exponent,22,0x3a92ad,{DOUBLEWITHTWODWORDINTREE(0x79600000,0x00000000)}},
+ {VT_exponent,22,0x3a92ae,{DOUBLEWITHTWODWORDINTREE(0x79700000,0x00000000)}},
+ {VT_exponent,22,0x3a92af,{DOUBLEWITHTWODWORDINTREE(0x79800000,0x00000000)}},
+ {VT_exponent,22,0x3a92b0,{DOUBLEWITHTWODWORDINTREE(0x79900000,0x00000000)}},
+ {VT_exponent,22,0x3a92b1,{DOUBLEWITHTWODWORDINTREE(0x79a00000,0x00000000)}},
+ {VT_exponent,22,0x3a92b2,{DOUBLEWITHTWODWORDINTREE(0x79b00000,0x00000000)}},
+ {VT_exponent,22,0x3a92b3,{DOUBLEWITHTWODWORDINTREE(0x79c00000,0x00000000)}},
+ {VT_exponent,22,0x3a92b4,{DOUBLEWITHTWODWORDINTREE(0x79d00000,0x00000000)}},
+ {VT_exponent,22,0x3a92b5,{DOUBLEWITHTWODWORDINTREE(0x79e00000,0x00000000)}},
+ {VT_exponent,22,0x3a92b6,{DOUBLEWITHTWODWORDINTREE(0x79f00000,0x00000000)}},
+ {VT_exponent,22,0x3a92b7,{DOUBLEWITHTWODWORDINTREE(0x7a000000,0x00000000)}},
+ {VT_exponent,22,0x3a92b8,{DOUBLEWITHTWODWORDINTREE(0x7a100000,0x00000000)}},
+ {VT_exponent,22,0x3a92b9,{DOUBLEWITHTWODWORDINTREE(0x7a200000,0x00000000)}},
+ {VT_exponent,22,0x3a92ba,{DOUBLEWITHTWODWORDINTREE(0x7a300000,0x00000000)}},
+ {VT_exponent,22,0x3a92bb,{DOUBLEWITHTWODWORDINTREE(0x7a400000,0x00000000)}},
+ {VT_exponent,22,0x3a92bc,{DOUBLEWITHTWODWORDINTREE(0x7a500000,0x00000000)}},
+ {VT_exponent,22,0x3a92bd,{DOUBLEWITHTWODWORDINTREE(0x7a600000,0x00000000)}},
+ {VT_exponent,22,0x3a92be,{DOUBLEWITHTWODWORDINTREE(0x7a700000,0x00000000)}},
+ {VT_exponent,22,0x3a92bf,{DOUBLEWITHTWODWORDINTREE(0x7a800000,0x00000000)}},
+ {VT_exponent,22,0x3a92c0,{DOUBLEWITHTWODWORDINTREE(0x7a900000,0x00000000)}},
+ {VT_exponent,22,0x3a92c1,{DOUBLEWITHTWODWORDINTREE(0x7aa00000,0x00000000)}},
+ {VT_exponent,22,0x3a92c2,{DOUBLEWITHTWODWORDINTREE(0x7ab00000,0x00000000)}},
+ {VT_exponent,22,0x3a92c3,{DOUBLEWITHTWODWORDINTREE(0x7ac00000,0x00000000)}},
+ {VT_exponent,22,0x3a92c4,{DOUBLEWITHTWODWORDINTREE(0x7ad00000,0x00000000)}},
+ {VT_exponent,22,0x3a92c5,{DOUBLEWITHTWODWORDINTREE(0x7ae00000,0x00000000)}},
+ {VT_exponent,22,0x3a92c6,{DOUBLEWITHTWODWORDINTREE(0x7af00000,0x00000000)}},
+ {VT_exponent,22,0x3a92c7,{DOUBLEWITHTWODWORDINTREE(0x7b000000,0x00000000)}},
+ {VT_exponent,22,0x3a92c8,{DOUBLEWITHTWODWORDINTREE(0x7b100000,0x00000000)}},
+ {VT_exponent,22,0x3a92c9,{DOUBLEWITHTWODWORDINTREE(0x7b200000,0x00000000)}},
+ {VT_exponent,22,0x3a92ca,{DOUBLEWITHTWODWORDINTREE(0x7b300000,0x00000000)}},
+ {VT_exponent,22,0x3a92cb,{DOUBLEWITHTWODWORDINTREE(0x7b400000,0x00000000)}},
+ {VT_exponent,22,0x3a92cc,{DOUBLEWITHTWODWORDINTREE(0x7b500000,0x00000000)}},
+ {VT_exponent,22,0x3a92cd,{DOUBLEWITHTWODWORDINTREE(0x7b600000,0x00000000)}},
+ {VT_exponent,22,0x3a92ce,{DOUBLEWITHTWODWORDINTREE(0x7b700000,0x00000000)}},
+ {VT_exponent,22,0x3a92cf,{DOUBLEWITHTWODWORDINTREE(0x7b800000,0x00000000)}},
+ {VT_exponent,22,0x3a92d0,{DOUBLEWITHTWODWORDINTREE(0x7b900000,0x00000000)}},
+ {VT_exponent,22,0x3a92d1,{DOUBLEWITHTWODWORDINTREE(0x7ba00000,0x00000000)}},
+ {VT_exponent,22,0x3a92d2,{DOUBLEWITHTWODWORDINTREE(0x7bb00000,0x00000000)}},
+ {VT_exponent,22,0x3a92d3,{DOUBLEWITHTWODWORDINTREE(0x7bc00000,0x00000000)}},
+ {VT_exponent,22,0x3a92d4,{DOUBLEWITHTWODWORDINTREE(0x7bd00000,0x00000000)}},
+ {VT_exponent,22,0x3a92d5,{DOUBLEWITHTWODWORDINTREE(0x7be00000,0x00000000)}},
+ {VT_exponent,22,0x3a92d6,{DOUBLEWITHTWODWORDINTREE(0x7bf00000,0x00000000)}},
+ {VT_exponent,22,0x3a92d7,{DOUBLEWITHTWODWORDINTREE(0x7c000000,0x00000000)}},
+ {VT_exponent,22,0x3a92d8,{DOUBLEWITHTWODWORDINTREE(0x7c100000,0x00000000)}},
+ {VT_exponent,22,0x3a92d9,{DOUBLEWITHTWODWORDINTREE(0x7c200000,0x00000000)}},
+ {VT_exponent,22,0x3a92da,{DOUBLEWITHTWODWORDINTREE(0x7c300000,0x00000000)}},
+ {VT_exponent,22,0x3a92db,{DOUBLEWITHTWODWORDINTREE(0x7c400000,0x00000000)}},
+ {VT_exponent,22,0x3a92dc,{DOUBLEWITHTWODWORDINTREE(0x7c500000,0x00000000)}},
+ {VT_exponent,22,0x3a92dd,{DOUBLEWITHTWODWORDINTREE(0x7c600000,0x00000000)}},
+ {VT_exponent,22,0x3a92de,{DOUBLEWITHTWODWORDINTREE(0x7c700000,0x00000000)}},
+ {VT_exponent,22,0x3a92df,{DOUBLEWITHTWODWORDINTREE(0x7c800000,0x00000000)}},
+ {VT_exponent,22,0x3a92e0,{DOUBLEWITHTWODWORDINTREE(0x7c900000,0x00000000)}},
+ {VT_exponent,22,0x3a92e1,{DOUBLEWITHTWODWORDINTREE(0x7ca00000,0x00000000)}},
+ {VT_exponent,22,0x3a92e2,{DOUBLEWITHTWODWORDINTREE(0x7cb00000,0x00000000)}},
+ {VT_exponent,22,0x3a92e3,{DOUBLEWITHTWODWORDINTREE(0x7cc00000,0x00000000)}},
+ {VT_exponent,22,0x3a92e4,{DOUBLEWITHTWODWORDINTREE(0x7cd00000,0x00000000)}},
+ {VT_exponent,22,0x3a92e5,{DOUBLEWITHTWODWORDINTREE(0x7ce00000,0x00000000)}},
+ {VT_exponent,22,0x3a92e6,{DOUBLEWITHTWODWORDINTREE(0x7cf00000,0x00000000)}},
+ {VT_exponent,22,0x3a92e7,{DOUBLEWITHTWODWORDINTREE(0x7d000000,0x00000000)}},
+ {VT_exponent,22,0x3a92e8,{DOUBLEWITHTWODWORDINTREE(0x7d100000,0x00000000)}},
+ {VT_exponent,22,0x3a92e9,{DOUBLEWITHTWODWORDINTREE(0x7d200000,0x00000000)}},
+ {VT_exponent,22,0x3a92ea,{DOUBLEWITHTWODWORDINTREE(0x7d300000,0x00000000)}},
+ {VT_exponent,22,0x3a92eb,{DOUBLEWITHTWODWORDINTREE(0x7d400000,0x00000000)}},
+ {VT_exponent,22,0x3a92ec,{DOUBLEWITHTWODWORDINTREE(0x7d500000,0x00000000)}},
+ {VT_exponent,22,0x3a92ed,{DOUBLEWITHTWODWORDINTREE(0x7d600000,0x00000000)}},
+ {VT_exponent,22,0x3a92ee,{DOUBLEWITHTWODWORDINTREE(0x7d700000,0x00000000)}},
+ {VT_exponent,22,0x3a92ef,{DOUBLEWITHTWODWORDINTREE(0x7d800000,0x00000000)}},
+ {VT_exponent,22,0x3a92f0,{DOUBLEWITHTWODWORDINTREE(0x7d900000,0x00000000)}},
+ {VT_exponent,22,0x3a92f1,{DOUBLEWITHTWODWORDINTREE(0x7da00000,0x00000000)}},
+ {VT_exponent,22,0x3a92f2,{DOUBLEWITHTWODWORDINTREE(0x7db00000,0x00000000)}},
+ {VT_exponent,22,0x3a92f3,{DOUBLEWITHTWODWORDINTREE(0x7dc00000,0x00000000)}},
+ {VT_exponent,22,0x3a92f4,{DOUBLEWITHTWODWORDINTREE(0x7dd00000,0x00000000)}},
+ {VT_exponent,22,0x3a92f5,{DOUBLEWITHTWODWORDINTREE(0x7de00000,0x00000000)}},
+ {VT_exponent,22,0x3a92f6,{DOUBLEWITHTWODWORDINTREE(0x7df00000,0x00000000)}},
+ {VT_exponent,22,0x3a92f7,{DOUBLEWITHTWODWORDINTREE(0x7e000000,0x00000000)}},
+ {VT_exponent,22,0x3a92f8,{DOUBLEWITHTWODWORDINTREE(0x7e100000,0x00000000)}},
+ {VT_exponent,22,0x3a92f9,{DOUBLEWITHTWODWORDINTREE(0x7e200000,0x00000000)}},
+ {VT_exponent,22,0x3a92fa,{DOUBLEWITHTWODWORDINTREE(0x7e300000,0x00000000)}},
+ {VT_exponent,22,0x3a92fb,{DOUBLEWITHTWODWORDINTREE(0x7e400000,0x00000000)}},
+ {VT_exponent,22,0x3a92fc,{DOUBLEWITHTWODWORDINTREE(0x7e500000,0x00000000)}},
+ {VT_exponent,22,0x3a92fd,{DOUBLEWITHTWODWORDINTREE(0x7e600000,0x00000000)}},
+ {VT_exponent,22,0x3a92fe,{DOUBLEWITHTWODWORDINTREE(0x7e700000,0x00000000)}},
+ {VT_exponent,22,0x3a92ff,{DOUBLEWITHTWODWORDINTREE(0x7e800000,0x00000000)}},
+ {VT_exponent,22,0x3a95a0,{DOUBLEWITHTWODWORDINTREE(0x7e900000,0x00000000)}},
+ {VT_exponent,22,0x3a95a1,{DOUBLEWITHTWODWORDINTREE(0x7ea00000,0x00000000)}},
+ {VT_exponent,22,0x3a95a2,{DOUBLEWITHTWODWORDINTREE(0x7eb00000,0x00000000)}},
+ {VT_exponent,22,0x3a95a3,{DOUBLEWITHTWODWORDINTREE(0x7ec00000,0x00000000)}},
+ {VT_exponent,22,0x3a95a4,{DOUBLEWITHTWODWORDINTREE(0x7ed00000,0x00000000)}},
+ {VT_exponent,22,0x3a95a5,{DOUBLEWITHTWODWORDINTREE(0x7ee00000,0x00000000)}},
+ {VT_exponent,22,0x3a95a6,{DOUBLEWITHTWODWORDINTREE(0x7ef00000,0x00000000)}},
+ {VT_exponent,22,0x3a95a7,{DOUBLEWITHTWODWORDINTREE(0x7f000000,0x00000000)}},
+ {VT_exponent,22,0x3a95a8,{DOUBLEWITHTWODWORDINTREE(0x7f100000,0x00000000)}},
+ {VT_exponent,22,0x3a95a9,{DOUBLEWITHTWODWORDINTREE(0x7f200000,0x00000000)}},
+ {VT_exponent,22,0x3a95aa,{DOUBLEWITHTWODWORDINTREE(0x7f300000,0x00000000)}},
+ {VT_exponent,22,0x3a95ab,{DOUBLEWITHTWODWORDINTREE(0x7f400000,0x00000000)}},
+ {VT_exponent,22,0x3a95ac,{DOUBLEWITHTWODWORDINTREE(0x7f500000,0x00000000)}},
+ {VT_exponent,22,0x3a95ad,{DOUBLEWITHTWODWORDINTREE(0x7f600000,0x00000000)}},
+ {VT_exponent,22,0x3a95ae,{DOUBLEWITHTWODWORDINTREE(0x7f700000,0x00000000)}},
+ {VT_exponent,22,0x3a95af,{DOUBLEWITHTWODWORDINTREE(0x7f800000,0x00000000)}},
+ {VT_exponent,22,0x3b8fe0,{DOUBLEWITHTWODWORDINTREE(0x7f900000,0x00000000)}},
+ {VT_exponent,22,0x3b8fe1,{DOUBLEWITHTWODWORDINTREE(0x7fa00000,0x00000000)}},
+ {VT_exponent,22,0x3b8fe2,{DOUBLEWITHTWODWORDINTREE(0x7fb00000,0x00000000)}},
+ {VT_exponent,22,0x3b8fe3,{DOUBLEWITHTWODWORDINTREE(0x7fc00000,0x00000000)}},
+ {VT_exponent,21,0x68e90,{DOUBLEWITHTWODWORDINTREE(0x7fd00000,0x00000000)}},
+ {VT_exponent,21,0x68e91,{DOUBLEWITHTWODWORDINTREE(0x7fe00000,0x00000000)}},
+ {VT_exponent,21,0x68e98,{DOUBLEWITHTWODWORDINTREE(0x7ff80000,0x00000000)}},
+}; // End of acofdoe array
diff --git a/graphics/asymptote/prc/PRCdouble.h b/graphics/asymptote/prc/PRCdouble.h
new file mode 100644
index 0000000000..4a3a79dccc
--- /dev/null
+++ b/graphics/asymptote/prc/PRCdouble.h
@@ -0,0 +1,140 @@
+#ifndef __PRC_DOUBLE_H
+#define __PRC_DOUBLE_H
+
+#include <cstdlib>
+#include <cmath>
+#include <cstring>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef BYTE_ORDER
+# undef WORDS_BIG_ENDIAN
+# undef WORDS_LITTLE_ENDIAN
+# if BYTE_ORDER == BIG_ENDIAN
+# define WORDS_BIG_ENDIAN 1
+# endif
+# if BYTE_ORDER == LITTLE_ENDIAN
+# define WORDS_LITTLE_ENDIAN 1
+# endif
+#endif
+
+// from Adobe's documentation
+
+union ieee754_double
+{
+ double d;
+ /* This is the IEEE 754 double-precision format. */
+ struct
+ {
+#ifdef WORDS_BIGENDIAN
+ unsigned int negative:1;
+ unsigned int exponent:11;
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa0:20;
+ unsigned int mantissa1:32;
+#else
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa1:32;
+ unsigned int mantissa0:20;
+ unsigned int exponent:11;
+ unsigned int negative:1;
+#endif
+ } ieee;
+};
+
+union ieee754_float
+{
+ float f;
+ /* This is the IEEE 754 float-precision format. */
+ struct {
+#ifdef WORDS_BIGENDIAN
+ unsigned int negative:1;
+ unsigned int exponent:8;
+ unsigned int mantissa:23;
+#else
+ unsigned int mantissa:23;
+ unsigned int exponent:8;
+ unsigned int negative:1;
+#endif
+ } ieee;
+};
+
+enum ValueType {VT_double,VT_exponent};
+
+struct sCodageOfFrequentDoubleOrExponent
+{
+ short Type;
+ short NumberOfBits;
+ unsigned Bits;
+ union {
+ unsigned ul[2];
+ double Value;
+ } u2uod;
+};
+
+#ifdef WORDS_BIGENDIAN
+# define DOUBLEWITHTWODWORD(upper,lower) upper,lower
+# define UPPERPOWER (0)
+# define LOWERPOWER (!UPPERPOWER)
+
+# define NEXTBYTE(pbd) ((pbd)++)
+# define PREVIOUSBYTE(pbd) ((pbd)--)
+# define MOREBYTE(pbd,pbend) ((pbd)<=(pbend))
+# define OFFSETBYTE(pbd,offset) ((pbd)+=offset)
+# define BEFOREBYTE(pbd) ((pbd)-1)
+# define DIFFPOINTERS(p1,p2) ((p1)-(p2))
+# define SEARCHBYTE(pbstart,b,nb) (unsigned char *)memrchr((pbstart),(b),(nb))
+# define BYTEAT(pb,i) *((pb)-(i))
+#else
+# define DOUBLEWITHTWODWORD(upper,lower) lower,upper
+# define UPPERPOWER (1)
+# define LOWERPOWER (!UPPERPOWER)
+
+# define NEXTBYTE(pbd) ((pbd)--)
+# define PREVIOUSBYTE(pbd) ((pbd)++)
+# define MOREBYTE(pbd,pbend) ((pbd)>=(pbend))
+# define OFFSETBYTE(pbd,offset) ((pbd)-=offset)
+# define BEFOREBYTE(pbd) ((pbd)+1)
+# define DIFFPOINTERS(p1,p2) ((unsigned)((p2)-(p1)))
+# define SEARCHBYTE(pbstart,b,nb) (unsigned char *)memchr((pbstart),(b),(nb))
+# define BYTEAT(pb,i) *((pb)+(i))
+#endif
+
+#define MAXLENGTHFORCOMPRESSEDTYPE ((22+1+1+4+6*(1+8))+7)/8
+
+#define NEGATIVE(d) (((union ieee754_double *)&(d))->ieee.negative)
+#define EXPONENT(d) (((union ieee754_double *)&(d))->ieee.exponent)
+#define MANTISSA0(d) (((union ieee754_double *)&(d))->ieee.mantissa0)
+#define MANTISSA1(d) (((union ieee754_double *)&(d))->ieee.mantissa1)
+
+typedef unsigned char PRCbyte;
+typedef unsigned short PRCword;
+typedef unsigned PRCdword;
+
+extern PRCdword stadwZero[2],stadwNegativeZero[2];
+
+#define NUMBEROFELEMENTINACOFDOE (2077)
+
+#ifdef WORDS_BIGENDIAN
+# define DOUBLEWITHTWODWORDINTREE(upper,lower) {upper,lower}
+#else
+# define DOUBLEWITHTWODWORDINTREE(upper,lower) {lower,upper}
+#endif
+extern sCodageOfFrequentDoubleOrExponent acofdoe[NUMBEROFELEMENTINACOFDOE];
+
+struct sCodageOfFrequentDoubleOrExponent* getcofdoe(unsigned,short);
+
+#define STAT_V
+#define STAT_DOUBLE
+
+int stCOFDOECompare(const void*,const void*);
+
+#ifdef WORDS_BIGENDIAN
+#ifndef HAVE_MEMRCHR
+void *memrchr(const void *,int,size_t);
+#endif
+#endif
+
+#endif // __PRC_DOUBLE_H
diff --git a/graphics/asymptote/prc/oPRCFile.cc b/graphics/asymptote/prc/oPRCFile.cc
new file mode 100644
index 0000000000..1f20a681a0
--- /dev/null
+++ b/graphics/asymptote/prc/oPRCFile.cc
@@ -0,0 +1,1921 @@
+/************
+*
+* This file is part of a tool for producing 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include "oPRCFile.h"
+#include <time.h>
+#include <sstream>
+#include <iostream>
+#include <fstream>
+#include <iomanip>
+#include <cstring>
+#include <zlib.h>
+
+namespace prc {
+
+#define WriteUnsignedInteger( value ) out << (uint32_t)(value);
+#define WriteInteger( value ) out << (int32_t)(value);
+#define WriteDouble( value ) out << (double)(value);
+#define WriteString( value ) out << (value);
+#define WriteUncompressedUnsignedInteger( value ) writeUncompressedUnsignedInteger(out, (uint32_t)(value));
+#define WriteUncompressedBlock( value, count ) out.write((char *)(value),(count));
+#define SerializeFileStructureUncompressedUniqueId( value ) (value).serializeFileStructureUncompressedUniqueId(out);
+#define SerializeCompressedUniqueId( value ) (value).serializeCompressedUniqueId(out);
+#define SerializeContentPRCBase write(out);
+#define SerializeRgbColor( value ) (value).serializeRgbColor(out);
+#define SerializePicture( value ) (value).serializePicture(out);
+#define SerializeTextureDefinition( value ) (value)->serializeTextureDefinition(out);
+#define SerializeMarkup( value ) (value)->serializeMarkup(out);
+#define SerializeAnnotationEntity( value ) (value)->serializeAnnotationEntity(out);
+#define SerializeFontKeysSameFont( value ) (value).serializeFontKeysSameFont(out);
+#define SerializeMaterial( value ) (value)->serializeMaterial(out);
+
+#define SerializeUserData UserData(0,0).write(out);
+#define SerializeEmptyContentPRCBase ContentPRCBase(PRC_TYPE_ROOT_PRCBase).serializeContentPRCBase(out);
+#define SerializeCategory1LineStyle( value ) (value)->serializeCategory1LineStyle(out);
+#define SerializeCoordinateSystem( value ) (value)->serializeCoordinateSystem(out);
+#define SerializeRepresentationItem( value ) (value)->serializeRepresentationItem(out);
+#define SerializePartDefinition( value ) (value)->serializePartDefinition(out);
+#define SerializeProductOccurrence( value ) (value)->serializeProductOccurrence(out);
+#define SerializeContextAndBodies( value ) (value)->serializeContextAndBodies(out);
+#define SerializeGeometrySummary( value ) (value)->serializeGeometrySummary(out);
+#define SerializeContextGraphics( value ) (value)->serializeContextGraphics(out);
+#define SerializeStartHeader serializeStartHeader(out);
+#define SerializeUncompressedFiles \
+ { \
+ const uint32_t number_of_uncompressed_files = uncompressed_files.size(); \
+ WriteUncompressedUnsignedInteger (number_of_uncompressed_files) \
+ for(PRCUncompressedFileList::const_iterator it = uncompressed_files.begin(); it != uncompressed_files.end(); it++) \
+ { \
+ WriteUncompressedUnsignedInteger ((*it)->file_size) \
+ WriteUncompressedBlock ((*it)->data, (*it)->file_size) \
+ } \
+ }
+#define SerializeModelFileData serializeModelFileData(modelFile_out); modelFile_out.compress();
+#define SerializeUnit( value ) (value).serializeUnit(out);
+
+using namespace std;
+
+void PRCFileStructure::serializeFileStructureGlobals(PRCbitStream &out)
+{
+ // even though this is technically not part of this section,
+ // it is handled here for convenience
+ const uint32_t number_of_schema = 0;
+ WriteUnsignedInteger (number_of_schema)
+
+ WriteUnsignedInteger (PRC_TYPE_ASM_FileStructureGlobals)
+
+ PRCSingleAttribute sa((int32_t)PRCVersion);
+ PRCAttribute a("__PRC_RESERVED_ATTRIBUTE_PRCInternalVersion");
+ a.addKey(sa);
+ ContentPRCBase cb(PRC_TYPE_ROOT_PRCBase);
+ cb.addAttribute(a);
+ cb.serializeContentPRCBase(out);
+ WriteUnsignedInteger (number_of_referenced_file_structures)
+ // SerializeFileStructureInternalGlobalData
+ WriteDouble (tessellation_chord_height_ratio)
+ WriteDouble (tessellation_angle_degree)
+
+ // SerializeMarkupSerializationHelper
+ WriteString (default_font_family_name)
+
+ const uint32_t number_of_fonts = font_keys_of_font.size();
+ WriteUnsignedInteger (number_of_fonts)
+ for (uint32_t i=0;i<number_of_fonts;i++)
+ {
+ SerializeFontKeysSameFont (font_keys_of_font[i])
+ }
+
+ const uint32_t number_of_colors = colors.size();
+ WriteUnsignedInteger (number_of_colors)
+ for (uint32_t i=0;i<number_of_colors;i++)
+ SerializeRgbColor (colors[i])
+
+ const uint32_t number_of_pictures = pictures.size();
+ WriteUnsignedInteger (number_of_pictures)
+ for (uint32_t i=0;i<number_of_pictures;i++)
+ SerializePicture (pictures[i])
+
+ const uint32_t number_of_texture_definitions = texture_definitions.size();
+ WriteUnsignedInteger (number_of_texture_definitions)
+ for (uint32_t i=0;i<number_of_texture_definitions;i++)
+ SerializeTextureDefinition (texture_definitions[i])
+
+ const uint32_t number_of_materials = materials.size();
+ WriteUnsignedInteger (number_of_materials)
+ for (uint32_t i=0;i<number_of_materials;i++)
+ SerializeMaterial (materials[i])
+
+ // number of line patterns hard coded for now
+ const uint32_t number_of_line_patterns = 1;
+ WriteUnsignedInteger (number_of_line_patterns)
+ PRCLinePattern().serializeLinePattern(out);
+
+ const uint32_t number_of_styles = styles.size();
+ WriteUnsignedInteger (number_of_styles)
+ for (uint32_t i=0;i<number_of_styles;i++)
+ SerializeCategory1LineStyle (styles[i])
+
+ const uint32_t number_of_fill_patterns = 0;
+ WriteUnsignedInteger (number_of_fill_patterns)
+
+ const uint32_t number_of_reference_coordinate_systems = reference_coordinate_systems.size();
+ WriteUnsignedInteger (number_of_reference_coordinate_systems)
+ for (uint32_t i=0;i<number_of_reference_coordinate_systems;i++)
+ SerializeCoordinateSystem (reference_coordinate_systems[i])
+
+ SerializeUserData
+}
+
+void PRCFileStructure::serializeFileStructureTree(PRCbitStream &out)
+{
+ WriteUnsignedInteger (PRC_TYPE_ASM_FileStructureTree)
+
+ SerializeEmptyContentPRCBase
+
+ const uint32_t number_of_part_definitions = part_definitions.size();
+ WriteUnsignedInteger (number_of_part_definitions)
+ for (uint32_t i=0;i<number_of_part_definitions;i++)
+ SerializePartDefinition (part_definitions[i])
+
+ const uint32_t number_of_product_occurrences = product_occurrences.size();
+ WriteUnsignedInteger (number_of_product_occurrences)
+ for (uint32_t i=0;i<number_of_product_occurrences;i++)
+ {
+ product_occurrences[i]->unit_information.unit_from_CAD_file = true;
+ product_occurrences[i]->unit_information.unit = unit;
+ SerializeProductOccurrence (product_occurrences[i])
+ }
+
+ // SerializeFileStructureInternalData
+ WriteUnsignedInteger (PRC_TYPE_ASM_FileStructure)
+ SerializeEmptyContentPRCBase
+ const uint32_t next_available_index = makePRCID();
+ WriteUnsignedInteger (next_available_index)
+ const uint32_t index_product_occurence = number_of_product_occurrences; // Asymptote (oPRCFile) specific - we write the root product last
+ WriteUnsignedInteger (index_product_occurence)
+
+ SerializeUserData
+}
+
+void PRCFileStructure::serializeFileStructureTessellation(PRCbitStream &out)
+{
+ WriteUnsignedInteger (PRC_TYPE_ASM_FileStructureTessellation)
+
+ SerializeEmptyContentPRCBase
+ const uint32_t number_of_tessellations = tessellations.size();
+ WriteUnsignedInteger (number_of_tessellations)
+ for (uint32_t i=0;i<number_of_tessellations;i++)
+ tessellations[i]->serializeBaseTessData(out);
+
+ SerializeUserData
+}
+
+void PRCFileStructure::serializeFileStructureGeometry(PRCbitStream &out)
+{
+ WriteUnsignedInteger (PRC_TYPE_ASM_FileStructureGeometry)
+
+ SerializeEmptyContentPRCBase
+ const uint32_t number_of_contexts = contexts.size();
+ WriteUnsignedInteger (number_of_contexts)
+ for (uint32_t i=0;i<number_of_contexts;i++)
+ SerializeContextAndBodies (contexts[i])
+
+ SerializeUserData
+}
+
+void PRCFileStructure::serializeFileStructureExtraGeometry(PRCbitStream &out)
+{
+ WriteUnsignedInteger (PRC_TYPE_ASM_FileStructureExtraGeometry)
+
+ SerializeEmptyContentPRCBase
+ const uint32_t number_of_contexts = contexts.size();
+ WriteUnsignedInteger (number_of_contexts)
+ for (uint32_t i=0;i<number_of_contexts;i++)
+ {
+ SerializeGeometrySummary (contexts[i])
+ SerializeContextGraphics (contexts[i])
+ }
+
+ SerializeUserData
+}
+
+void oPRCFile::serializeModelFileData(PRCbitStream &out)
+{
+ // even though this is technically not part of this section,
+ // it is handled here for convenience
+ const uint32_t number_of_schema = 0;
+ WriteUnsignedInteger (number_of_schema)
+ WriteUnsignedInteger (PRC_TYPE_ASM_ModelFile)
+
+ PRCSingleAttribute sa((int32_t)PRCVersion);
+ PRCAttribute a("__PRC_RESERVED_ATTRIBUTE_PRCInternalVersion");
+ a.addKey(sa);
+ ContentPRCBase cb(PRC_TYPE_ROOT_PRCBase,"PRC file");
+ cb.addAttribute(a);
+ cb.serializeContentPRCBase(out);
+
+ SerializeUnit (unit)
+
+ out << (uint32_t)1; // 1 product occurrence
+ //UUID
+ SerializeCompressedUniqueId( fileStructures[0]->file_structure_uuid )
+ // index+1
+ out << (uint32_t)fileStructures[0]->product_occurrences.size();
+ // active
+ out << true;
+ out << (uint32_t)0; // index in model file
+
+ SerializeUserData
+}
+
+void makeFileUUID(PRCUniqueId& UUID)
+{
+ // make a UUID
+ static uint32_t count = 0;
+ ++count;
+ // the minimum requirement on UUIDs is that all must be unique in the file
+ UUID.id0 = 0x33595341; // some constant
+ UUID.id1 = (uint32_t)time(NULL); // the time
+ UUID.id2 = count;
+ UUID.id3 = 0xa5a55a5a; // Something random, not seeded by the time, would be nice. But for now, a constant
+ // maybe add something else to make it more unique
+ // so multiple files can be combined
+ // a hash of some data perhaps?
+}
+
+void makeAppUUID(PRCUniqueId& UUID)
+{
+ UUID.id0 = UUID.id1 = UUID.id2 = UUID.id3 = 0;
+}
+
+void PRCUncompressedFile::write(ostream &out) const
+{
+ if(data!=NULL)
+ {
+ WriteUncompressedUnsignedInteger (file_size)
+ out.write((char*)data,file_size);
+ }
+}
+
+uint32_t PRCUncompressedFile::getSize() const
+{
+ return sizeof(file_size)+file_size;
+}
+
+
+void PRCStartHeader::serializeStartHeader(ostream &out) const
+{
+ WriteUncompressedBlock ("PRC",3)
+ WriteUncompressedUnsignedInteger (minimal_version_for_read)
+ WriteUncompressedUnsignedInteger (authoring_version)
+ SerializeFileStructureUncompressedUniqueId( file_structure_uuid );
+ SerializeFileStructureUncompressedUniqueId( application_uuid );
+}
+
+uint32_t PRCStartHeader::getStartHeaderSize() const
+{
+ return 3+(2+2*4)*sizeof(uint32_t);
+}
+
+
+void PRCFileStructure::write(ostream &out)
+{
+ // SerializeFileStructureHeader
+ SerializeStartHeader
+ SerializeUncompressedFiles
+ globals_out.write(out);
+ tree_out.write(out);
+ tessellations_out.write(out);
+ geometry_out.write(out);
+ extraGeometry_out.write(out);
+}
+
+#define SerializeFileStructureGlobals serializeFileStructureGlobals(globals_out); globals_out.compress(); sizes[1]=globals_out.getSize();
+#define SerializeFileStructureTree serializeFileStructureTree(tree_out); tree_out.compress(); sizes[2]=tree_out.getSize();
+#define SerializeFileStructureTessellation serializeFileStructureTessellation(tessellations_out); tessellations_out.compress(); sizes[3]=tessellations_out.getSize();
+#define SerializeFileStructureGeometry serializeFileStructureGeometry(geometry_out); geometry_out.compress(); sizes[4]=geometry_out.getSize();
+#define SerializeFileStructureExtraGeometry serializeFileStructureExtraGeometry(extraGeometry_out); extraGeometry_out.compress(); sizes[5]=extraGeometry_out.getSize();
+#define FlushSerialization resetGraphicsAndName();
+void PRCFileStructure::prepare()
+{
+ uint32_t size = 0;
+ size += getStartHeaderSize();
+ size += sizeof(uint32_t);
+ for(PRCUncompressedFileList::const_iterator it = uncompressed_files.begin(); it != uncompressed_files.end(); it++)
+ size += (*it)->getSize();
+ sizes[0]=size;
+
+ SerializeFileStructureGlobals
+ FlushSerialization
+
+ SerializeFileStructureTree
+ FlushSerialization
+
+ SerializeFileStructureTessellation
+ FlushSerialization
+
+ SerializeFileStructureGeometry
+ FlushSerialization
+
+ SerializeFileStructureExtraGeometry
+ FlushSerialization
+}
+
+uint32_t PRCFileStructure::getSize()
+{
+ uint32_t size = 0;
+ for(size_t i=0; i<6; i++)
+ size += sizes[i];
+ return size;
+}
+
+
+void PRCFileStructureInformation::write(ostream &out)
+{
+ SerializeFileStructureUncompressedUniqueId( UUID );
+
+ WriteUncompressedUnsignedInteger (reserved)
+ WriteUncompressedUnsignedInteger (number_of_offsets)
+ for(uint32_t i = 0; i < number_of_offsets; ++i)
+ {
+ WriteUncompressedUnsignedInteger (offsets[i])
+ }
+}
+
+uint32_t PRCFileStructureInformation::getSize()
+{
+ return (4+2+number_of_offsets)*sizeof(uint32_t);
+}
+
+void PRCHeader::write(ostream &out)
+{
+ SerializeStartHeader
+ WriteUncompressedUnsignedInteger (number_of_file_structures)
+ for(uint32_t i = 0; i < number_of_file_structures; ++i)
+ {
+ fileStructureInformation[i].write(out);
+ }
+ WriteUncompressedUnsignedInteger (model_file_offset)
+ WriteUncompressedUnsignedInteger (file_size)
+ SerializeUncompressedFiles
+}
+
+uint32_t PRCHeader::getSize()
+{
+ uint32_t size = getStartHeaderSize() + sizeof(uint32_t);
+ for(uint32_t i = 0; i < number_of_file_structures; ++i)
+ size += fileStructureInformation[i].getSize();
+ size += 3*sizeof(uint32_t);
+ for(PRCUncompressedFileList::const_iterator it = uncompressed_files.begin(); it != uncompressed_files.end(); it++)
+ size += (*it)->getSize();
+ return size;
+}
+
+void oPRCFile::doGroup(PRCgroup& group)
+{
+ const std::string& name = group.name;
+
+ PRCProductOccurrence*& product_occurrence = group.product_occurrence;
+ PRCProductOccurrence*& parent_product_occurrence = group.parent_product_occurrence;
+ PRCPartDefinition*& part_definition = group.part_definition;
+ PRCPartDefinition*& parent_part_definition = group.parent_part_definition;
+
+ if(group.options.tess)
+ {
+ if(!group.lines.empty())
+ {
+ for(PRCtesslineMap::const_iterator wit=group.lines.begin(); wit!=group.lines.end(); wit++)
+ {
+ bool same_color = true;
+ const PRCtesslineList& lines = wit->second;
+ const PRCRgbColor &color = lines.front().color;
+ for(PRCtesslineList::const_iterator lit=lines.begin(); lit!=lines.end(); lit++)
+ if(color!=lit->color)
+ {
+ same_color = false;
+ break;
+ }
+ map<PRCVector3d,uint32_t> points;
+ PRC3DWireTess *tess = new PRC3DWireTess();
+ if(!same_color)
+ {
+ tess->is_segment_color = true;
+ tess->is_rgba = false;
+ }
+ for(PRCtesslineList::const_iterator lit=lines.begin(); lit!=lines.end(); lit++)
+ {
+ tess->wire_indexes.push_back(lit->point.size());
+ for(uint32_t i=0; i<lit->point.size(); i++)
+ {
+ map<PRCVector3d,uint32_t>::iterator pPoint = points.find(lit->point[i]);
+ if(pPoint!=points.end())
+ tess->wire_indexes.push_back(pPoint->second);
+ else
+ {
+ const uint32_t point_index = tess->coordinates.size();
+ points.insert(make_pair(lit->point[i],point_index));
+ tess->wire_indexes.push_back(point_index);
+ tess->coordinates.push_back(lit->point[i].x);
+ tess->coordinates.push_back(lit->point[i].y);
+ tess->coordinates.push_back(lit->point[i].z);
+ }
+ if(!same_color && i>0)
+ {
+ tess->rgba_vertices.push_back(byte(lit->color.red));
+ tess->rgba_vertices.push_back(byte(lit->color.green));
+ tess->rgba_vertices.push_back(byte(lit->color.blue));
+ }
+ }
+ }
+ const uint32_t tess_index = add3DWireTess(tess);
+ PRCPolyWire *polyWire = new PRCPolyWire();
+ polyWire->index_tessellation = tess_index;
+ if(same_color)
+ polyWire->index_of_line_style = addColourWidth(RGBAColour(color.red,color.green,color.blue),wit->first);
+ else
+ polyWire->index_of_line_style = addColourWidth(RGBAColour(1,1,1),wit->first);
+ part_definition->addPolyWire(polyWire);
+ }
+ }
+// make rectangles pairs of triangles in a tesselation
+ if(!group.rectangles.empty())
+ {
+ bool same_color = true;
+ const uint32_t &style = group.rectangles.front().style;
+ for(PRCtessrectangleList::const_iterator rit=group.rectangles.begin(); rit!=group.rectangles.end(); rit++)
+ if(style!=rit->style)
+ {
+ same_color = false;
+ break;
+ }
+ map<PRCVector3d,uint32_t> points;
+ PRC3DTess *tess = new PRC3DTess();
+ tess->crease_angle = group.options.crease_angle;
+ PRCTessFace *tessFace = new PRCTessFace();
+ tessFace->used_entities_flag=PRC_FACETESSDATA_Triangle;
+ uint32_t triangles = 0;
+ for(PRCtessrectangleList::const_iterator rit=group.rectangles.begin(); rit!=group.rectangles.end(); rit++)
+ {
+ const bool degenerate = (rit->vertices[0]==rit->vertices[1]);
+ uint32_t vertex_indices[4];
+ for(size_t i = (degenerate?1:0); i < 4; ++i)
+ {
+ map<PRCVector3d,uint32_t>::const_iterator pPoint = points.find(rit->vertices[i]);
+ if(pPoint!=points.end())
+ vertex_indices[i] = pPoint->second;
+ else
+ {
+ points.insert(make_pair(rit->vertices[i],(vertex_indices[i] = tess->coordinates.size())));
+ tess->coordinates.push_back(rit->vertices[i].x);
+ tess->coordinates.push_back(rit->vertices[i].y);
+ tess->coordinates.push_back(rit->vertices[i].z);
+ }
+ }
+ if(degenerate)
+ {
+ tess->triangulated_index.push_back(vertex_indices[1]);
+ tess->triangulated_index.push_back(vertex_indices[2]);
+ tess->triangulated_index.push_back(vertex_indices[3]);
+ triangles++;
+ if(!same_color)
+ tessFace->line_attributes.push_back(rit->style);
+ }
+ else
+ {
+ tess->triangulated_index.push_back(vertex_indices[0]);
+ tess->triangulated_index.push_back(vertex_indices[2]);
+ tess->triangulated_index.push_back(vertex_indices[3]);
+ triangles++;
+ if(!same_color)
+ tessFace->line_attributes.push_back(rit->style);
+ tess->triangulated_index.push_back(vertex_indices[3]);
+ tess->triangulated_index.push_back(vertex_indices[1]);
+ tess->triangulated_index.push_back(vertex_indices[0]);
+ triangles++;
+ if(!same_color)
+ tessFace->line_attributes.push_back(rit->style);
+ }
+ }
+ tessFace->sizes_triangulated.push_back(triangles);
+ tess->addTessFace(tessFace);
+ const uint32_t tess_index = add3DTess(tess);
+ PRCPolyBrepModel *polyBrepModel = new PRCPolyBrepModel();
+ polyBrepModel->index_tessellation = tess_index;
+ polyBrepModel->is_closed = group.options.closed;
+ if(same_color)
+ polyBrepModel->index_of_line_style = style;
+ part_definition->addPolyBrepModel(polyBrepModel);
+ }
+ }
+
+ if(!group.quads.empty())
+ {
+ map<PRCVector3d,uint32_t> points;
+ PRC3DTess *tess = new PRC3DTess();
+ tess->crease_angle = group.options.crease_angle;
+ PRCTessFace *tessFace = new PRCTessFace();
+ tessFace->used_entities_flag=PRC_FACETESSDATA_Triangle;
+ uint32_t triangles = 0;
+
+ tessFace->is_rgba = false;
+ for(PRCtessquadList::const_iterator qit=group.quads.begin(); qit!=group.quads.end(); qit++)
+ {
+ const RGBAColour* C = qit->colours;
+ if(C[0].A != 1.0 || C[1].A != 1.0 || C[2].A != 1.0 || C[3].A != 1.0)
+ {
+ tessFace->is_rgba = true;
+ break;
+ }
+ }
+ bool same_colour = true;
+ const RGBAColour& colour = group.quads.front().colours[0];
+ for(PRCtessquadList::const_iterator qit=group.quads.begin(); qit!=group.quads.end(); qit++)
+ {
+ const RGBAColour* C = qit->colours;
+ if(colour!=C[0] || colour!=C[1] || colour!=C[2] || colour!=C[3])
+ {
+ same_colour = false;
+ break;
+ }
+ }
+
+ for(PRCtessquadList::const_iterator qit=group.quads.begin(); qit!=group.quads.end(); qit++)
+ {
+ const RGBAColour* C = qit->colours;
+ const bool degenerate = (qit->vertices[0]==qit->vertices[1]);
+ uint32_t vertex_indices[4];
+ for(size_t i = (degenerate?1:0); i < 4; ++i)
+ {
+ map<PRCVector3d,uint32_t>::const_iterator pPoint = points.find(qit->vertices[i]);
+ if(pPoint!=points.end())
+ vertex_indices[i] = pPoint->second;
+ else
+ {
+ points.insert(make_pair(qit->vertices[i],(vertex_indices[i] = tess->coordinates.size())));
+ tess->coordinates.push_back(qit->vertices[i].x);
+ tess->coordinates.push_back(qit->vertices[i].y);
+ tess->coordinates.push_back(qit->vertices[i].z);
+ }
+ }
+ if(degenerate)
+ {
+ tess->triangulated_index.push_back(vertex_indices[1]);
+ tess->triangulated_index.push_back(vertex_indices[2]);
+ tess->triangulated_index.push_back(vertex_indices[3]);
+ triangles++;
+ if(!same_colour)
+ {
+ tessFace->rgba_vertices.push_back(byte(C[1].R));
+ tessFace->rgba_vertices.push_back(byte(C[1].G));
+ tessFace->rgba_vertices.push_back(byte(C[1].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[1].A));
+
+ tessFace->rgba_vertices.push_back(byte(C[2].R));
+ tessFace->rgba_vertices.push_back(byte(C[2].G));
+ tessFace->rgba_vertices.push_back(byte(C[2].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[2].A));
+
+ tessFace->rgba_vertices.push_back(byte(C[3].R));
+ tessFace->rgba_vertices.push_back(byte(C[3].G));
+ tessFace->rgba_vertices.push_back(byte(C[3].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[3].A));
+ }
+ }
+ else
+ {
+ tess->triangulated_index.push_back(vertex_indices[0]);
+ tess->triangulated_index.push_back(vertex_indices[2]);
+ tess->triangulated_index.push_back(vertex_indices[3]);
+ triangles++;
+ if(!same_colour)
+ {
+ tessFace->rgba_vertices.push_back(byte(C[0].R));
+ tessFace->rgba_vertices.push_back(byte(C[0].G));
+ tessFace->rgba_vertices.push_back(byte(C[0].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[0].A));
+
+ tessFace->rgba_vertices.push_back(byte(C[2].R));
+ tessFace->rgba_vertices.push_back(byte(C[2].G));
+ tessFace->rgba_vertices.push_back(byte(C[2].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[2].A));
+
+ tessFace->rgba_vertices.push_back(byte(C[3].R));
+ tessFace->rgba_vertices.push_back(byte(C[3].G));
+ tessFace->rgba_vertices.push_back(byte(C[3].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[3].A));
+ }
+ tess->triangulated_index.push_back(vertex_indices[3]);
+ tess->triangulated_index.push_back(vertex_indices[1]);
+ tess->triangulated_index.push_back(vertex_indices[0]);
+ triangles++;
+ if(!same_colour)
+ {
+ tessFace->rgba_vertices.push_back(byte(C[3].R));
+ tessFace->rgba_vertices.push_back(byte(C[3].G));
+ tessFace->rgba_vertices.push_back(byte(C[3].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[3].A));
+
+ tessFace->rgba_vertices.push_back(byte(C[1].R));
+ tessFace->rgba_vertices.push_back(byte(C[1].G));
+ tessFace->rgba_vertices.push_back(byte(C[1].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[1].A));
+
+ tessFace->rgba_vertices.push_back(byte(C[0].R));
+ tessFace->rgba_vertices.push_back(byte(C[0].G));
+ tessFace->rgba_vertices.push_back(byte(C[0].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[0].A));
+ }
+ }
+ }
+ tessFace->sizes_triangulated.push_back(triangles);
+ tess->addTessFace(tessFace);
+ const uint32_t tess_index = add3DTess(tess);
+ PRCPolyBrepModel *polyBrepModel = new PRCPolyBrepModel();
+ polyBrepModel->index_tessellation = tess_index;
+ polyBrepModel->is_closed = group.options.closed;
+ if(same_colour)
+ polyBrepModel->index_of_line_style = addColour(colour);
+ part_definition->addPolyBrepModel(polyBrepModel);
+ }
+
+ if(!group.points.empty())
+ {
+ for(PRCpointsetMap::const_iterator pit=group.points.begin(); pit!=group.points.end(); pit++)
+ {
+ PRCPointSet *pointset = new PRCPointSet();
+ pointset->index_of_line_style = pit->first;
+ pointset->point = pit->second;
+ part_definition->addPointSet(pointset);
+ }
+ }
+
+ if(!group.pointsets.empty())
+ {
+ for(std::vector<PRCPointSet*>::iterator pit=group.pointsets.begin(); pit!=group.pointsets.end(); pit++)
+ {
+ part_definition->addPointSet(*pit);
+ }
+ }
+
+ if(!group.polymodels.empty())
+ {
+ for(std::vector<PRCPolyBrepModel*>::iterator pit=group.polymodels.begin(); pit!=group.polymodels.end(); pit++)
+ {
+ (*pit)->is_closed = group.options.closed;
+ part_definition->addPolyBrepModel(*pit);
+ }
+ }
+
+ if(!group.polywires.empty())
+ {
+ for(std::vector<PRCPolyWire*>::iterator pit=group.polywires.begin(); pit!=group.polywires.end(); pit++)
+ {
+ part_definition->addPolyWire(*pit);
+ }
+ }
+
+ if(!group.wires.empty())
+ {
+ PRCTopoContext *wireContext = NULL;
+ const uint32_t context_index = getTopoContext(wireContext);
+ for(PRCwireList::iterator wit=group.wires.begin(); wit!=group.wires.end(); wit++)
+ {
+ PRCWireEdge *wireEdge = new PRCWireEdge;
+ wireEdge->curve_3d = wit->curve;
+ PRCSingleWireBody *wireBody = new PRCSingleWireBody;
+ wireBody->setWireEdge(wireEdge);
+ const uint32_t wire_body_index = wireContext->addSingleWireBody(wireBody);
+ PRCWire *wire = new PRCWire();
+ wire->index_of_line_style = wit->style;
+ wire->context_id = context_index;
+ wire->body_id = wire_body_index;
+ if(wit->transform)
+ wire->index_local_coordinate_system = addTransform(wit->transform);
+ part_definition->addWire(wire);
+ }
+ }
+
+ PRCfaceList &faces = group.faces;
+ if(!faces.empty())
+ {
+ bool same_color = true;
+ const uint32_t style = faces.front().style;
+ for(PRCfaceList::const_iterator fit=faces.begin(); fit!=faces.end(); fit++)
+ if(style!=fit->style)
+ {
+ same_color = false;
+ break;
+ }
+ PRCTopoContext *context = NULL;
+ const uint32_t context_index = getTopoContext(context);
+ context->granularity = group.options.granularity;
+ // Acrobat 9 also does the following:
+ // context->tolerance = group.options.granularity;
+ // context->have_smallest_face_thickness = true;
+ // context->smallest_thickness = group.options.granularity;
+ PRCShell *shell = new PRCShell;
+
+ for(PRCfaceList::iterator fit=faces.begin(); fit!=faces.end(); fit++)
+ {
+ if(fit->transform || group.options.do_break ||
+ (fit->transparent && !group.options.no_break))
+ {
+ PRCShell *shell = new PRCShell;
+ shell->addFace(fit->face);
+ PRCConnex *connex = new PRCConnex;
+ connex->addShell(shell);
+ PRCBrepData *body = new PRCBrepData;
+ body->addConnex(connex);
+ const uint32_t body_index = context->addBrepData(body);
+
+ PRCBrepModel *brepmodel = new PRCBrepModel();
+ brepmodel->index_of_line_style = fit->style;
+ brepmodel->context_id = context_index;
+ brepmodel->body_id = body_index;
+ brepmodel->is_closed = group.options.closed;
+
+ brepmodel->index_local_coordinate_system = addTransform(fit->transform);
+
+ part_definition->addBrepModel(brepmodel);
+ }
+ else
+ {
+ if(!same_color)
+ fit->face->index_of_line_style = fit->style;
+ shell->addFace(fit->face);
+ }
+ }
+ if(shell->face.empty())
+ {
+ delete shell;
+ }
+ else
+ {
+ PRCConnex *connex = new PRCConnex;
+ connex->addShell(shell);
+ PRCBrepData *body = new PRCBrepData;
+ body->addConnex(connex);
+ const uint32_t body_index = context->addBrepData(body);
+ PRCBrepModel *brepmodel = new PRCBrepModel();
+ if(same_color)
+ brepmodel->index_of_line_style = style;
+ brepmodel->context_id = context_index;
+ brepmodel->body_id = body_index;
+ brepmodel->is_closed = group.options.closed;
+ part_definition->addBrepModel(brepmodel);
+ }
+ }
+
+ PRCcompfaceList &compfaces = group.compfaces;
+ if(!compfaces.empty())
+ {
+ bool same_color = true;
+ const uint32_t style = compfaces.front().style;
+ for(PRCcompfaceList::const_iterator fit=compfaces.begin(); fit!=compfaces.end(); fit++)
+ if(style!=fit->style)
+ {
+ same_color = false;
+ break;
+ }
+ PRCTopoContext *context = NULL;
+ const uint32_t context_index = getTopoContext(context);
+ PRCCompressedBrepData *body = new PRCCompressedBrepData;
+
+ body->serial_tolerance=group.options.compression;
+ body->brep_data_compressed_tolerance=0.1*group.options.compression;
+
+ for(PRCcompfaceList::const_iterator fit=compfaces.begin(); fit!=compfaces.end(); fit++)
+ {
+ if(group.options.do_break ||
+ (fit->transparent && !group.options.no_break))
+ {
+ PRCCompressedBrepData *body = new PRCCompressedBrepData;
+ body->face.push_back(fit->face);
+
+ body->serial_tolerance=group.options.compression;
+ body->brep_data_compressed_tolerance=2.8346456*
+ group.options.compression;
+ const uint32_t body_index = context->addCompressedBrepData(body);
+
+ PRCBrepModel *brepmodel = new PRCBrepModel();
+ brepmodel->index_of_line_style = fit->style;
+ brepmodel->context_id = context_index;
+ brepmodel->body_id = body_index;
+ brepmodel->is_closed = group.options.closed;
+
+ part_definition->addBrepModel(brepmodel);
+ }
+ else
+ {
+ if(!same_color)
+ fit->face->index_of_line_style = fit->style;
+ body->face.push_back(fit->face);
+ }
+ }
+ if(body->face.empty())
+ {
+ delete body;
+ }
+ else
+ {
+ const uint32_t body_index = context->addCompressedBrepData(body);
+ PRCBrepModel *brepmodel = new PRCBrepModel();
+ if(same_color)
+ brepmodel->index_of_line_style = style;
+ brepmodel->context_id = context_index;
+ brepmodel->body_id = body_index;
+ brepmodel->is_closed = group.options.closed;
+ part_definition->addBrepModel(brepmodel);
+ }
+ }
+
+ // Simplify and reduce to as simple entities as possible
+ // products with named representation items can not be reduced to sets, since
+ // outside references are already set
+ bool nonamedparts = true;
+ for(PRCRepresentationItemList::const_iterator it=part_definition->representation_item.begin(); it!=part_definition->representation_item.end(); it++)
+ {
+ if (!(*it)->name.empty())
+ {
+ nonamedparts = false;
+ break;
+ }
+ }
+ lastgroupname.clear();
+ lastgroupnames.clear();
+ // First option - reduce to one element in parent
+ if (parent_part_definition && product_occurrence->index_son_occurrence.empty() &&
+ part_definition->representation_item.size() == 1 &&
+ ( name.empty() || part_definition->representation_item.front()->name.empty() ) &&
+ ( !group.transform || part_definition->representation_item.front()->index_local_coordinate_system==m1) )
+ {
+ if(part_definition->representation_item.front()->name.empty() )
+ part_definition->representation_item.front()->name = name;
+ if(part_definition->representation_item.front()->index_local_coordinate_system==m1)
+ part_definition->representation_item.front()->index_local_coordinate_system = addTransform(group.transform);
+ lastgroupname = calculate_unique_name(part_definition->representation_item.front(), parent_product_occurrence);
+ parent_part_definition->addRepresentationItem(part_definition->representation_item.front());
+ part_definition->representation_item.clear();
+ delete product_occurrence; product_occurrence = NULL;
+ delete part_definition; part_definition = NULL;
+ }
+ // Second option - reduce to a set
+ else if (parent_part_definition && product_occurrence->index_son_occurrence.empty() &&
+ !part_definition->representation_item.empty() &&
+ !group.options.do_break && nonamedparts)
+ {
+ PRCSet *set = new PRCSet(name);
+ set->index_local_coordinate_system = addTransform(group.transform);
+ lastgroupname = calculate_unique_name(set, parent_product_occurrence);
+ for(PRCRepresentationItemList::iterator it=part_definition->representation_item.begin(); it!=part_definition->representation_item.end(); it++)
+ {
+ lastgroupnames.push_back(calculate_unique_name(*it, parent_product_occurrence));
+ set->addRepresentationItem(*it);
+ }
+ part_definition->representation_item.clear();
+ parent_part_definition->addSet(set);
+ delete product_occurrence; product_occurrence = NULL;
+ delete part_definition; part_definition = NULL;
+ }
+ // Third option - create product
+ else if ( !product_occurrence->index_son_occurrence.empty() || !part_definition->representation_item.empty())
+ {
+ // if everything is enclosed in one group - drop the root group
+ if (parent_product_occurrence == NULL && group.transform == NULL &&
+ part_definition->representation_item.empty() && product_occurrence->index_son_occurrence.size()==1) {
+ delete part_definition; part_definition = NULL;
+ delete product_occurrence; product_occurrence = NULL;
+ }
+ else
+ {
+ lastgroupname = calculate_unique_name(product_occurrence, NULL);
+ if (part_definition->representation_item.empty()) {
+ delete part_definition; part_definition = NULL;
+ }
+ else
+ {
+ for(PRCRepresentationItemList::const_iterator it=part_definition->representation_item.begin(); it!=part_definition->representation_item.end(); it++)
+ if ((*it)->name.empty())
+ lastgroupnames.push_back(calculate_unique_name(*it, product_occurrence));
+ product_occurrence->index_part = addPartDefinition(part_definition);
+ }
+ if (group.transform) {
+ product_occurrence->location = group.transform;
+ group.transform = NULL;
+ }
+ if (parent_product_occurrence) {
+ parent_product_occurrence->index_son_occurrence.push_back(addProductOccurrence(product_occurrence));
+ }
+ else {
+ addProductOccurrence(product_occurrence);
+ }
+ }
+ }
+ // Last case - absolutely nothing to do
+ else
+ {
+ delete product_occurrence; product_occurrence = NULL;
+ delete part_definition; part_definition = NULL;
+ }
+
+}
+
+std::string oPRCFile::calculate_unique_name(const ContentPRCBase *prc_entity,const ContentPRCBase *prc_occurence)
+{
+ std::stringstream ss (std::stringstream::in | std::stringstream::out);
+ uint8_t *serialization_buffer = NULL;
+ PRCbitStream serialization(serialization_buffer,0u);
+ const PRCFileStructure *pfile_structure = fileStructures[0];
+ const PRCUniqueId& uuid = pfile_structure->file_structure_uuid;
+// ConvertUniqueIdentifierToString (prc_entity)
+// SerializeCompressedUniqueId (file_structure)
+ serialization << uuid.id0 << uuid.id1 << uuid.id2 << uuid.id3;
+// WriteUnsignedInteger (type)
+ serialization << prc_entity->getType();
+// WriteUnsignedInteger (unique_identifier)
+ serialization << prc_entity->getPRCID();
+ if (prc_occurence)
+ {
+// serialization_buffer = Flush serialization (serialization)
+ {
+ const uint32_t size_serialization = serialization.getSize();
+ while(size_serialization == serialization.getSize())
+ serialization << false;
+ }
+// ConvertUniqueIdentifierToString (prc_occurrence_unique_id)
+// SerializeCompressedUniqueId (file_structure)
+ serialization << uuid.id0 << uuid.id1 << uuid.id2 << uuid.id3;
+// WriteUnsignedInteger (type)
+ serialization << (uint32_t)PRC_TYPE_ASM_ProductOccurence;
+// WriteUnsignedInteger (unique_identifier)
+ serialization << prc_occurence->getPRCID();
+ }
+ ss << (prc_entity->name.empty()?"node":prc_entity->name) << '.';
+ const uint32_t size_serialization = serialization.getSize();
+ for(size_t j=0; j<size_serialization; j++)
+ ss << hex << setfill('0') << setw(2) << (uint32_t)(serialization_buffer[j]);
+
+ return ss.str();
+}
+
+bool oPRCFile::finish()
+{
+ if(groups.size()!=1) {
+ fputs("begingroup without matching endgroup",stderr);
+ exit(1);
+ }
+ doGroup(groups.top());
+
+ // write each section's bit data
+ fileStructures[0]->prepare();
+ SerializeModelFileData
+
+ // create the header
+
+ // fill out enough info so that sizes can be computed correctly
+ header.number_of_file_structures = number_of_file_structures;
+ header.fileStructureInformation = new PRCFileStructureInformation[number_of_file_structures];
+ for(uint32_t i = 0; i < number_of_file_structures; ++i)
+ {
+ header.fileStructureInformation[i].UUID = fileStructures[i]->file_structure_uuid;
+ header.fileStructureInformation[i].reserved = 0;
+ header.fileStructureInformation[i].number_of_offsets = 6;
+ header.fileStructureInformation[i].offsets = new uint32_t[6];
+ }
+
+ header.minimal_version_for_read = PRCVersion;
+ header.authoring_version = PRCVersion;
+ makeFileUUID(header.file_structure_uuid);
+ makeAppUUID(header.application_uuid);
+
+ header.file_size = getSize();
+ header.model_file_offset = header.file_size - modelFile_out.getSize();
+
+ uint32_t currentOffset = header.getSize();
+
+ for(uint32_t i = 0; i < number_of_file_structures; ++i)
+ {
+ for(size_t j=0; j<6; j++)
+ {
+ header.fileStructureInformation[i].offsets[j] = currentOffset;
+ currentOffset += fileStructures[i]->sizes[j];
+ }
+ }
+
+ // write the data
+ header.write(output);
+
+ for(uint32_t i = 0; i < number_of_file_structures; ++i)
+ {
+ fileStructures[i]->write(output);
+ }
+
+ modelFile_out.write(output);
+ output.flush();
+
+ for(uint32_t i = 0; i < number_of_file_structures; ++i)
+ delete[] header.fileStructureInformation[i].offsets;
+ delete[] header.fileStructureInformation;
+
+ return true;
+}
+
+uint32_t oPRCFile::getSize()
+{
+ uint32_t size = header.getSize();
+
+ for(uint32_t i = 0; i < number_of_file_structures; ++i)
+ {
+ size += fileStructures[i]->getSize();
+ }
+
+ size += modelFile_out.getSize();
+ return size;
+}
+
+uint32_t PRCFileStructure::addPicture(EPRCPictureDataFormat format, uint32_t size, const uint8_t *p, uint32_t width, uint32_t height, std::string name)
+{
+ uint8_t *data = NULL;
+ uint32_t components=0;
+ PRCPicture picture(name);
+ if(size==0 || p==NULL)
+ { cerr << "image not set" << endl; return m1; }
+ PRCUncompressedFile* uncompressed_file = new PRCUncompressedFile;
+ if(format==KEPRCPicture_PNG || format==KEPRCPicture_JPG)
+ {
+ data = new uint8_t[size];
+ memcpy(data, p, size);
+ uncompressed_files.push_back(uncompressed_file);
+ uncompressed_files.back()->file_size = size;
+ uncompressed_files.back()->data = data;
+ picture.format = format;
+ picture.uncompressed_file_index = uncompressed_files.size()-1;
+ picture.pixel_width = 0; // width and height are ignored for JPG and PNG pictures - but let us keep things clean
+ picture.pixel_height = 0;
+ pictures.push_back(picture);
+ return pictures.size()-1;
+ }
+
+ switch(format)
+ {
+ case KEPRCPicture_BITMAP_RGB_BYTE:
+ components = 3; break;
+ case KEPRCPicture_BITMAP_RGBA_BYTE:
+ components = 4; break;
+ case KEPRCPicture_BITMAP_GREY_BYTE:
+ components = 1; break;
+ case KEPRCPicture_BITMAP_GREYA_BYTE:
+ components = 2; break;
+ default:
+ { cerr << "unknown picture format" << endl; return m1; }
+ }
+ if(width==0 || height==0)
+ { cerr << "width or height parameter not set" << endl; return m1; }
+ if (size < width*height*components)
+ { cerr << "image too small" << endl; return m1; }
+
+ {
+ uint32_t compressedDataSize = 0;
+ const int CHUNK= 1024; // is this reasonable?
+
+ z_stream strm;
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.opaque = Z_NULL;
+ if(deflateInit(&strm,Z_DEFAULT_COMPRESSION) != Z_OK)
+ { cerr << "Compression initialization failed" << endl; return m1; }
+ unsigned int sizeAvailable = deflateBound(&strm,size);
+ uint8_t *compressedData = (uint8_t*) malloc(sizeAvailable);
+ strm.avail_in = size;
+ strm.next_in = (unsigned char*)p;
+ strm.next_out = (unsigned char*)compressedData;
+ strm.avail_out = sizeAvailable;
+
+ int code;
+ unsigned int chunks = 0;
+ while((code = deflate(&strm,Z_FINISH)) == Z_OK)
+ {
+ ++chunks;
+ // strm.avail_out should be 0 if we got Z_OK
+ compressedDataSize = sizeAvailable - strm.avail_out;
+ compressedData = (uint8_t*) realloc(compressedData,CHUNK*chunks);
+ strm.next_out = (Bytef*)(compressedData + compressedDataSize);
+ strm.avail_out += CHUNK;
+ sizeAvailable += CHUNK;
+ }
+ compressedDataSize = sizeAvailable-strm.avail_out;
+
+ if(code != Z_STREAM_END)
+ {
+ deflateEnd(&strm);
+ free(compressedData);
+ { cerr << "Compression error" << endl; return m1; }
+ }
+
+ deflateEnd(&strm);
+ size = compressedDataSize;
+ data = new uint8_t[compressedDataSize];
+ memcpy(data, compressedData, compressedDataSize);
+ free(compressedData);
+ }
+ uncompressed_files.push_back(uncompressed_file);
+ uncompressed_files.back()->file_size = size;
+ uncompressed_files.back()->data = data;
+ picture.format = format;
+ picture.uncompressed_file_index = uncompressed_files.size()-1;
+ picture.pixel_width = width;
+ picture.pixel_height = height;
+ pictures.push_back(picture);
+ return pictures.size()-1;
+}
+
+uint32_t PRCFileStructure::addTextureDefinition(PRCTextureDefinition*& pTextureDefinition)
+{
+ texture_definitions.push_back(pTextureDefinition);
+ pTextureDefinition = NULL;
+ return texture_definitions.size()-1;
+}
+
+uint32_t PRCFileStructure::addRgbColor(const PRCRgbColor &color)
+{
+ colors.push_back(color);
+ return 3*(colors.size()-1);
+}
+
+uint32_t PRCFileStructure::addRgbColorUnique(const PRCRgbColor &color)
+{
+ for(uint32_t i = 0; i < colors.size(); ++i)
+ {
+ if(colors[i] == color)
+ return 3*i;
+ }
+ colors.push_back(color);
+ return 3*(colors.size()-1);
+}
+
+uint32_t oPRCFile::addColor(const PRCRgbColor &color)
+{
+ PRCcolorMap::const_iterator pColor = colorMap.find(color);
+ if(pColor!=colorMap.end())
+ return pColor->second;
+// color_index = addRgbColorUnique(color);
+ const uint32_t color_index = fileStructures[0]->addRgbColor(color);
+ colorMap.insert(make_pair(color,color_index));
+ return color_index;
+}
+
+uint32_t oPRCFile::addColour(const RGBAColour &colour)
+{
+ PRCcolourMap::const_iterator pColour = colourMap.find(colour);
+ if(pColour!=colourMap.end())
+ return pColour->second;
+ const uint32_t color_index = addColor(PRCRgbColor(colour.R, colour.G, colour.B));
+ PRCStyle *style = new PRCStyle();
+ style->line_width = 1.0;
+ style->is_vpicture = false;
+ style->line_pattern_vpicture_index = 0;
+ style->is_material = false;
+ style->color_material_index = color_index;
+ style->is_transparency_defined = (colour.A < 1.0);
+ style->transparency = (uint8_t)(colour.A * 256);
+ style->additional = 0;
+ const uint32_t style_index = fileStructures[0]->addStyle(style);
+ colourMap.insert(make_pair(colour,style_index));
+ return style_index;
+}
+
+uint32_t oPRCFile::addColourWidth(const RGBAColour &colour, double width)
+{
+ RGBAColourWidth colourwidth(colour.R, colour.G, colour.B, colour.A, width);
+ PRCcolourwidthMap::const_iterator pColour = colourwidthMap.find(colourwidth);
+ if(pColour!=colourwidthMap.end())
+ return pColour->second;
+ const uint32_t color_index = addColor(PRCRgbColor(colour.R, colour.G, colour.B));
+ PRCStyle *style = new PRCStyle();
+ style->line_width = width;
+ style->is_vpicture = false;
+ style->line_pattern_vpicture_index = 0;
+ style->is_material = false;
+ style->color_material_index = color_index;
+ style->is_transparency_defined = (colour.A < 1.0);
+ style->transparency = (uint8_t)(colour.A * 256);
+ style->additional = 0;
+ const uint32_t style_index = fileStructures[0]->addStyle(style);
+ colourwidthMap.insert(make_pair(colourwidth,style_index));
+ return style_index;
+}
+
+uint32_t oPRCFile::addTransform(PRCGeneralTransformation3d*& transform)
+{
+ if(!transform)
+ return m1;
+ PRCtransformMap::const_iterator pTransform = transformMap.find(*transform);
+ if(pTransform!=transformMap.end())
+ return pTransform->second;
+ PRCCoordinateSystem *coordinateSystem = new PRCCoordinateSystem();
+ bool transform_replaced = false;
+ if( transform->M(0,1)==0 && transform->M(0,2)==0 &&
+ transform->M(1,0)==0 && transform->M(1,2)==0 &&
+ transform->M(2,0)==0 && transform->M(2,1)==0 &&
+ transform->M(3,0)==0 && transform->M(3,1)==0 && transform->M(3,2)==0 && transform->M(3,3)==1 )
+ {
+ transform_replaced = true;
+ PRCCartesianTransformation3d *carttransform = new PRCCartesianTransformation3d;
+// if(transform->M(0,3)==0 && transform->M(1,3)==0 && transform->M(1,3)==0 &&
+// transform->M(0,0)==1 && transform->M(1,1)==1 && transform->M(2,2)==1 )
+// carttransform->behaviour = PRC_TRANSFORMATION_Identity;
+ if(transform->M(0,3)!=0 || transform->M(1,3)!=0 || transform->M(2,3)!=0)
+ {
+ carttransform->behaviour |= PRC_TRANSFORMATION_Translate;
+ carttransform->origin.Set(transform->M(0,3),transform->M(1,3),transform->M(2,3));
+ }
+ if(transform->M(0,0)!=transform->M(1,1) || transform->M(0,0)!=transform->M(2,2))
+ {
+ carttransform->behaviour |= PRC_TRANSFORMATION_NonUniformScale;
+ carttransform->scale.Set(transform->M(0,0),transform->M(1,1),transform->M(2,2));
+ }
+ else
+ if(transform->M(0,0)!=1)
+ {
+ carttransform->behaviour |= PRC_TRANSFORMATION_Scale;
+ carttransform->uniform_scale=transform->M(0,0);
+ }
+ coordinateSystem->axis_set = carttransform;
+ }
+ else
+ coordinateSystem->axis_set = transform;
+ const uint32_t coordinate_system_index = fileStructures[0]->addCoordinateSystem(coordinateSystem);
+ transformMap.insert(make_pair(*transform,coordinate_system_index));
+ if(transform_replaced)
+ delete transform;
+ transform = NULL;
+ return coordinate_system_index;
+}
+
+uint32_t oPRCFile::addTransform(const double* t)
+{
+ if(!t)
+ return m1;
+ PRCGeneralTransformation3d* transform = new PRCGeneralTransformation3d(t);
+ return addTransform(transform);
+}
+
+uint32_t oPRCFile::addTransform(const double origin[3], const double x_axis[3], const double y_axis[3], double scale)
+{
+ PRCCartesianTransformation3d* transform = new PRCCartesianTransformation3d(origin, x_axis, y_axis, scale);
+ if(transform->behaviour==PRC_TRANSFORMATION_Identity)
+ return m1;
+ PRCCoordinateSystem *coordinateSystem = new PRCCoordinateSystem();
+ coordinateSystem->axis_set = transform;
+ const uint32_t coordinate_system_index = fileStructures[0]->addCoordinateSystem(coordinateSystem);
+ return coordinate_system_index;
+}
+
+uint32_t oPRCFile::addMaterial(const PRCmaterial& m)
+{
+ uint32_t material_index = m1;
+ const PRCmaterialgeneric materialgeneric(m);
+ PRCmaterialgenericMap::const_iterator pMaterialgeneric = materialgenericMap.find(materialgeneric);
+ if(pMaterialgeneric!=materialgenericMap.end())
+ material_index = pMaterialgeneric->second;
+ else
+{
+ PRCMaterialGeneric *materialGeneric = new PRCMaterialGeneric();
+ const PRCRgbColor ambient(m.ambient.R, m.ambient.G, m.ambient.B);
+ materialGeneric->ambient = addColor(ambient);
+ const PRCRgbColor diffuse(m.diffuse.R, m.diffuse.G, m.diffuse.B);
+ materialGeneric->diffuse = addColor(diffuse);
+ const PRCRgbColor emissive(m.emissive.R, m.emissive.G, m.emissive.B);
+
+ materialGeneric->emissive = addColor(emissive);
+ const PRCRgbColor specular(m.specular.R, m.specular.G, m.specular.B);
+ materialGeneric->specular = addColor(specular);
+
+ materialGeneric->shininess = m.shininess;
+ materialGeneric->ambient_alpha = m.ambient.A;
+ materialGeneric->diffuse_alpha = m.diffuse.A;
+ materialGeneric->emissive_alpha = m.emissive.A;
+ materialGeneric->specular_alpha = m.specular.A;
+ material_index = addMaterialGeneric(materialGeneric);
+ materialgenericMap.insert(make_pair(materialgeneric,material_index));
+ }
+ uint32_t color_material_index = m1;
+ if(m.picture_data!=NULL)
+ {
+ uint32_t picture_index = m1;
+ PRCpicture picture(m);
+ PRCpictureMap::const_iterator pPicture = pictureMap.find(picture);
+ if(pPicture!=pictureMap.end())
+ picture_index = pPicture->second;
+ else
+ {
+ picture_index = addPicture(picture);
+ uint8_t* data = new uint8_t[picture.size];
+ memcpy(data,picture.data,picture.size);
+ picture.data = data;
+ pictureMap.insert(make_pair(picture,picture_index));
+ }
+
+ uint32_t texture_definition_index = m1;
+ PRCtexturedefinition texturedefinition(picture_index, m);
+ PRCtexturedefinitionMap::const_iterator pTexturedefinition = texturedefinitionMap.find(texturedefinition);
+ if(pTexturedefinition!=texturedefinitionMap.end())
+ texture_definition_index = pTexturedefinition->second;
+ else
+ {
+ PRCTextureDefinition *TextureDefinition = new PRCTextureDefinition;
+ if (m.picture_size==216688 && m.picture_format==KEPRCPicture_JPG)
+ TextureDefinition->texture_mapping_attribute=PRC_TEXTURE_MAPPING_OPACITY;
+ TextureDefinition->picture_index = picture_index;
+ TextureDefinition->texture_function = m.picture_replace ? KEPRCTextureFunction_Replace : KEPRCTextureFunction_Modulate;
+ TextureDefinition->texture_wrapping_mode_S = m.picture_repeat ? KEPRCTextureWrappingMode_Repeat : KEPRCTextureWrappingMode_ClampToEdge;
+ TextureDefinition->texture_wrapping_mode_T = m.picture_repeat ? KEPRCTextureWrappingMode_Repeat : KEPRCTextureWrappingMode_ClampToEdge;
+ TextureDefinition->texture_mapping_attribute_components = (m.picture_format==KEPRCPicture_BITMAP_RGB_BYTE || m.picture_format==KEPRCPicture_JPG) ? PRC_TEXTURE_MAPPING_COMPONENTS_RGB : PRC_TEXTURE_MAPPING_COMPONENTS_RGBA;
+ texture_definition_index = addTextureDefinition(TextureDefinition);
+ texturedefinitionMap.insert(make_pair(texturedefinition,texture_definition_index));
+ }
+
+ uint32_t texture_application_index = m1;
+ const PRCtextureapplication textureapplication(material_index, texture_definition_index);
+ PRCtextureapplicationMap::const_iterator pTextureapplication = textureapplicationMap.find(textureapplication);
+ if(pTextureapplication!=textureapplicationMap.end())
+ texture_application_index = pTextureapplication->second;
+ else
+ {
+ PRCTextureApplication *TextureApplication = new PRCTextureApplication;
+ TextureApplication->material_generic_index = material_index;
+ TextureApplication->texture_definition_index = texture_definition_index;
+ texture_application_index = addTextureApplication(TextureApplication);
+ textureapplicationMap.insert(make_pair(textureapplication,texture_application_index));
+ }
+
+ color_material_index = texture_application_index;
+ }
+ else
+ color_material_index = material_index;
+
+ uint32_t style_index = m1;
+ PRCstyle style(0,m.alpha,true,color_material_index);
+ PRCstyleMap::const_iterator pStyle = styleMap.find(style);
+ if(pStyle!=styleMap.end())
+ style_index = pStyle->second;
+ else
+ {
+ PRCStyle *Style = new PRCStyle();
+ Style->line_width = 0.0;
+ Style->is_vpicture = false;
+ Style->line_pattern_vpicture_index = 0;
+ Style->is_material = true;
+ Style->is_transparency_defined = (m.alpha < 1.0);
+ Style->transparency = (uint8_t)(m.alpha * 256);
+ Style->additional = 0;
+ Style->color_material_index = color_material_index;
+ style_index = addStyle(Style);
+ styleMap.insert(make_pair(style,style_index));
+ }
+// materialMap.insert(make_pair(material,style_index));
+ return style_index;
+}
+
+void oPRCFile::begingroup(const char *name, PRCoptions *options,
+ const double* t)
+{
+ const PRCgroup &parent_group = groups.top();
+ groups.push(PRCgroup());
+ PRCgroup &group = groups.top();
+ group.name=name;
+ if(options) group.options=*options;
+ if(t&&!isid(t))
+ group.transform = new PRCGeneralTransformation3d(t);
+ group.product_occurrence = new PRCProductOccurrence(name);
+ group.parent_product_occurrence = parent_group.product_occurrence;
+ group.part_definition = new PRCPartDefinition;
+ group.parent_part_definition = parent_group.part_definition;
+}
+
+void oPRCFile::endgroup()
+{
+ if(groups.size()<2) {
+ fputs("begingroup without matching endgroup",stderr);
+ exit(1);
+ }
+ doGroup(groups.top());
+ groups.pop();
+
+// std::cout << lastgroupname << std::endl;
+// for(std::vector<std::string>::const_iterator it=lastgroupnames.begin(); it!=lastgroupnames.end(); it++)
+// std::cout << " " << *it << std::endl;
+
+}
+
+PRCgroup& oPRCFile::findGroup()
+{
+ return groups.top();
+}
+
+void oPRCFile::addPoints(uint32_t n, const double P[][3], const RGBAColour &c, double w)
+{
+ if(n==0 || P==NULL)
+ return;
+ PRCgroup &group = findGroup();
+ PRCPointSet *pointset = new PRCPointSet();
+ group.pointsets.push_back(pointset);
+ pointset->index_of_line_style = addColourWidth(c,w);
+ pointset->point.reserve(n);
+ for(uint32_t i=0; i<n; i++)
+ pointset->point.push_back(PRCVector3d(P[i][0],P[i][1],P[i][2]));
+}
+
+void oPRCFile::useMesh(uint32_t tess_index, uint32_t style_index, const double origin[3], const double x_axis[3], const double y_axis[3], double scale)
+{
+ PRCgroup &group = findGroup();
+ PRCPolyBrepModel *polyBrepModel = new PRCPolyBrepModel();
+ polyBrepModel->index_local_coordinate_system = addTransform(origin, x_axis, y_axis, scale);
+ polyBrepModel->index_tessellation = tess_index;
+ polyBrepModel->is_closed = group.options.closed;
+ polyBrepModel->index_of_line_style = style_index;
+ group.polymodels.push_back(polyBrepModel);
+}
+
+void oPRCFile::useMesh(uint32_t tess_index, uint32_t style_index, const double* t)
+{
+ PRCgroup &group = findGroup();
+ PRCPolyBrepModel *polyBrepModel = new PRCPolyBrepModel();
+ polyBrepModel->index_local_coordinate_system = addTransform(t);
+ polyBrepModel->index_tessellation = tess_index;
+ polyBrepModel->is_closed = group.options.closed;
+ polyBrepModel->index_of_line_style = style_index;
+ group.polymodels.push_back(polyBrepModel);
+}
+
+void oPRCFile::useLines(uint32_t tess_index, uint32_t style_index, const double origin[3], const double x_axis[3], const double y_axis[3], double scale)
+{
+ PRCgroup &group = findGroup();
+ PRCPolyWire *polyWire = new PRCPolyWire();
+ polyWire->index_local_coordinate_system = addTransform(origin, x_axis, y_axis, scale);
+ polyWire->index_tessellation = tess_index;
+ polyWire->index_of_line_style = style_index;
+ group.polywires.push_back(polyWire);
+}
+
+void oPRCFile::useLines(uint32_t tess_index, uint32_t style_index, const double* t)
+{
+ PRCgroup &group = findGroup();
+ PRCPolyWire *polyWire = new PRCPolyWire();
+ polyWire->index_local_coordinate_system = addTransform(t);
+ polyWire->index_tessellation = tess_index;
+ polyWire->index_of_line_style = style_index;
+ group.polywires.push_back(polyWire);
+}
+
+void oPRCFile::addQuads(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][4], const PRCmaterial &m,
+ uint32_t nN, const double N[][3], const uint32_t NI[][4],
+ uint32_t nT, const double T[][2], const uint32_t TI[][4],
+ uint32_t nC, const RGBAColour C[], const uint32_t CI[][4],
+ uint32_t nM, const PRCmaterial M[], const uint32_t MI[], double ca)
+{
+ if(nP==0 || P==NULL || nI==0 || PI==NULL)
+ return;
+ const uint32_t tess_index = createQuadMesh(nP, P, nI, PI, m, nN, N, NI, nT, T, TI, nC, C, CI, nM, M, MI, ca);
+ useMesh(tess_index,m1);
+}
+
+uint32_t oPRCFile::createQuadMesh(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][4], uint32_t style_index,
+ uint32_t nN, const double N[][3], const uint32_t NI[][4],
+ uint32_t nT, const double T[][2], const uint32_t TI[][4],
+ uint32_t nC, const RGBAColour C[], const uint32_t CI[][4],
+ uint32_t nS, const uint32_t S[], const uint32_t SI[], double ca)
+{
+ if(nP==0 || P==NULL || nI==0 || PI==NULL)
+ return m1;
+
+ const bool triangle_color = (nS != 0 && S != NULL && SI != NULL);
+ const bool vertex_color = (nC != 0 && C != NULL && CI != NULL);
+ const bool has_normals = (nN != 0 && N != NULL && NI != NULL);
+ const bool textured = (nT != 0 && T != NULL && TI != NULL);
+
+ PRC3DTess *tess = new PRC3DTess();
+ PRCTessFace *tessFace = new PRCTessFace();
+ tessFace->used_entities_flag = textured ? PRC_FACETESSDATA_TriangleTextured : PRC_FACETESSDATA_Triangle;
+ tessFace->number_of_texture_coordinate_indexes = textured ? 1 : 0;
+ tess->coordinates.reserve(3*nP);
+ for(uint32_t i=0; i<nP; i++)
+ {
+ tess->coordinates.push_back(P[i][0]);
+ tess->coordinates.push_back(P[i][1]);
+ tess->coordinates.push_back(P[i][2]);
+ }
+ if(has_normals)
+ {
+ tess->normal_coordinate.reserve(3*nN);
+ for(uint32_t i=0; i<nN; i++)
+ {
+ tess->normal_coordinate.push_back(N[i][0]);
+ tess->normal_coordinate.push_back(N[i][1]);
+ tess->normal_coordinate.push_back(N[i][2]);
+ }
+ }
+ else
+ tess->crease_angle = ca;
+ if(textured)
+ {
+ tess->texture_coordinate.reserve(2*nT);
+ for(uint32_t i=0; i<nT; i++)
+ {
+ tess->texture_coordinate.push_back(T[i][0]);
+ tess->texture_coordinate.push_back(T[i][1]);
+ }
+ }
+ tess->triangulated_index.reserve(2*(3*nI+(has_normals?3:0)*nI+(textured?3:0)*nI));
+ for(uint32_t i=0; i<nI; i++)
+ {
+ // first triangle
+ if(has_normals)
+ tess->triangulated_index.push_back(3*NI[i][0]);
+ if(textured)
+ tess->triangulated_index.push_back(2*TI[i][0]);
+ tess->triangulated_index.push_back(3*PI[i][0]);
+ if(has_normals)
+ tess->triangulated_index.push_back(3*NI[i][1]);
+ if(textured)
+ tess->triangulated_index.push_back(2*TI[i][1]);
+ tess->triangulated_index.push_back(3*PI[i][1]);
+ if(has_normals)
+ tess->triangulated_index.push_back(3*NI[i][3]);
+ if(textured)
+ tess->triangulated_index.push_back(2*TI[i][3]);
+ tess->triangulated_index.push_back(3*PI[i][3]);
+ // second triangle
+ if(has_normals)
+ tess->triangulated_index.push_back(3*NI[i][1]);
+ if(textured)
+ tess->triangulated_index.push_back(2*TI[i][1]);
+ tess->triangulated_index.push_back(3*PI[i][1]);
+ if(has_normals)
+ tess->triangulated_index.push_back(3*NI[i][2]);
+ if(textured)
+ tess->triangulated_index.push_back(2*TI[i][2]);
+ tess->triangulated_index.push_back(3*PI[i][2]);
+ if(has_normals)
+ tess->triangulated_index.push_back(3*NI[i][3]);
+ if(textured)
+ tess->triangulated_index.push_back(2*TI[i][3]);
+ tess->triangulated_index.push_back(3*PI[i][3]);
+ }
+ tessFace->sizes_triangulated.push_back(2*nI);
+ if(triangle_color)
+ {
+ tessFace->line_attributes.reserve(2*nI);
+ for(uint32_t i=0; i<nI; i++)
+ {
+ tessFace->line_attributes.push_back(SI[i]);
+ tessFace->line_attributes.push_back(SI[i]);
+ }
+ }
+ else
+ {
+ tessFace->line_attributes.push_back(style_index);
+ }
+ if(vertex_color)
+ {
+ tessFace->is_rgba=false;
+ for(uint32_t i=0; i<nI; i++)
+ if(1.0 != C[CI[i][0]].A || 1.0 != C[CI[i][1]].A || 1.0 != C[CI[i][2]].A)
+ {
+ tessFace->is_rgba=true;
+ break;
+ }
+
+ tessFace->rgba_vertices.reserve(2*(tessFace->is_rgba?4:3)*3*nI);
+ for(uint32_t i=0; i<nI; i++)
+ {
+ // first triangle
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].R));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].G));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].A));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].R));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].G));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].A));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].R));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].G));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].A));
+ // second triangle
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].R));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].G));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].A));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].R));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].G));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].A));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].R));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].G));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].A));
+ }
+ }
+ tess->addTessFace(tessFace);
+ const uint32_t tess_index = add3DTess(tess);
+ return tess_index;
+}
+
+/*
+void oPRCFile::addTriangle(const double P[][3], const double T[][2], uint32_t style_index)
+{
+ PRCgroup &group = findGroup();
+
+ group.triangles.push_back(PRCtesstriangle());
+ PRCtesstriangle &triangle = group.triangles.back();
+ for(size_t i = 0; i < 3; i++)
+ {
+ triangle.vertices[i].x = P[i][0];
+ triangle.vertices[i].y = P[i][1];
+ triangle.vertices[i].z = P[i][2];
+ triangle.texcoords[i].x = T[i][0];
+ triangle.texcoords[i].y = T[i][1];
+ }
+ triangle.style = style_index;
+}
+*/
+
+void oPRCFile::addLines(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[],
+ const RGBAColour& c, double w,
+ bool segment_color, uint32_t nC, const RGBAColour C[], uint32_t nCI, const uint32_t CI[])
+{
+ if(nP==0 || P==NULL || nI==0 || PI==NULL)
+ return;
+ const uint32_t tess_index = createLines(nP, P, nI, PI, segment_color, nC, C, nCI, CI);
+ useLines(tess_index, c, w);
+}
+
+uint32_t oPRCFile::createLines(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[],
+ bool segment_color, uint32_t nC, const RGBAColour C[], uint32_t nCI, const uint32_t CI[])
+{
+ if(nP==0 || P==NULL || nI==0 || PI==NULL)
+ return m1;
+
+ const bool vertex_color = (nC != 0 && C != NULL && CI != NULL);
+
+ PRC3DWireTess *tess = new PRC3DWireTess();
+ tess->coordinates.reserve(3*nP);
+ for(uint32_t i=0; i<nP; i++)
+ {
+ tess->coordinates.push_back(P[i][0]);
+ tess->coordinates.push_back(P[i][1]);
+ tess->coordinates.push_back(P[i][2]);
+ }
+ tess->wire_indexes.reserve(nI);
+ for(uint32_t i=0; i<nI;)
+ {
+ tess->wire_indexes.push_back(PI[i]);
+ const uint32_t ni = i+PI[i]+1;
+ for(i++; i<ni; i++)
+ tess->wire_indexes.push_back(3*PI[i]);
+ }
+ if(vertex_color)
+ {
+ tess->is_segment_color = segment_color;
+ tess->is_rgba=false;
+ for(uint32_t i=0; i<nCI; i++)
+ if(1.0 != C[CI[i]].A)
+ {
+ tess->is_rgba=true;
+ break;
+ }
+ tess->rgba_vertices.reserve((tess->is_rgba?4:3)*nCI);
+ for(uint32_t i=0; i<nCI; i++)
+ {
+ tess->rgba_vertices.push_back(byte(C[CI[i]].R));
+ tess->rgba_vertices.push_back(byte(C[CI[i]].G));
+ tess->rgba_vertices.push_back(byte(C[CI[i]].B));
+ if(tess->is_rgba)
+ tess->rgba_vertices.push_back(byte(C[CI[i]].A));
+ }
+ }
+ const uint32_t tess_index = add3DWireTess(tess);
+ return tess_index;
+}
+
+#define PRCFACETRANSFORM const double origin[3], const double x_axis[3], const double y_axis[3], double scale, const double* t
+
+void oPRCFile::addHemisphere(double radius, const PRCmaterial &m, PRCFACETRANSFORM)
+{
+ ADDFACE(PRCSphere)
+ SETTRANSF
+ surface->uv_domain.min.x = 0;
+ surface->uv_domain.max.x = 2*pi;
+ surface->uv_domain.min.y = 0;
+ surface->uv_domain.max.y = 0.5*pi;
+ surface->radius = radius;
+}
+
+void oPRCFile::addSphere(double radius, const PRCmaterial &m, PRCFACETRANSFORM)
+{
+ ADDFACE(PRCSphere)
+ SETTRANSF
+ surface->uv_domain.min.x = 0;
+ surface->uv_domain.max.x = 2*pi;
+ surface->uv_domain.min.y =-0.5*pi;
+ surface->uv_domain.max.y = 0.5*pi;
+ surface->radius = radius;
+}
+
+void oPRCFile::addDisk(double radius, const PRCmaterial &m, PRCFACETRANSFORM)
+{
+ ADDFACE(PRCRuled)
+ SETTRANSF
+ PRCCircle *first_curve = new PRCCircle;
+ first_curve->radius = radius;
+ surface->first_curve = first_curve;
+ PRCCircle *second_curve = new PRCCircle;
+ second_curve->radius = 0;
+ surface->second_curve = second_curve;
+
+ surface->uv_domain.min.x = 0;
+ surface->uv_domain.max.x = 1;
+ surface->uv_domain.min.y = 0;
+ surface->uv_domain.max.y = 2*pi;
+ surface->parameterization_on_v_coeff_a = -1;
+ surface->parameterization_on_v_coeff_b = 2*pi;
+}
+
+void oPRCFile::addCylinder(double radius, double height, const PRCmaterial &m, PRCFACETRANSFORM)
+{
+ ADDFACE(PRCCylinder)
+ SETTRANSF
+ surface->uv_domain.min.x = 0;
+ surface->uv_domain.max.x = 2*pi;
+ surface->uv_domain.min.y = (height>0)?0:height;
+ surface->uv_domain.max.y = (height>0)?height:0;
+ surface->radius = radius;
+}
+
+void oPRCFile::addCone(double radius, double height, const PRCmaterial &m, PRCFACETRANSFORM)
+{
+ ADDFACE(PRCCone)
+ SETTRANSF
+ surface->uv_domain.min.x = 0;
+ surface->uv_domain.max.x = 2*pi;
+ surface->uv_domain.min.y = (height>0)?0:height;
+ surface->uv_domain.max.y = (height>0)?height:0;
+ surface->bottom_radius = radius;
+ surface->semi_angle = -atan(radius/height);;
+}
+
+void oPRCFile::addTorus(double major_radius, double minor_radius, double angle1, double angle2, const PRCmaterial &m, PRCFACETRANSFORM)
+{
+ ADDFACE(PRCTorus)
+ SETTRANSF
+ surface->uv_domain.min.x = (angle1/180)*pi;
+ surface->uv_domain.max.x = (angle2/180)*pi;
+ surface->uv_domain.min.y = 0;
+ surface->uv_domain.max.y = 2*pi;
+ surface->major_radius = major_radius;
+ surface->minor_radius = minor_radius;
+}
+
+#undef ADDWIRE
+#undef SETTRANSF
+
+uint32_t PRCFileStructure::addMaterialGeneric(PRCMaterialGeneric*& pMaterialGeneric)
+{
+ materials.push_back(pMaterialGeneric);
+ pMaterialGeneric = NULL;
+ return materials.size()-1;
+}
+
+uint32_t PRCFileStructure::addTextureApplication(PRCTextureApplication*& pTextureApplication)
+{
+ materials.push_back(pTextureApplication);
+ pTextureApplication = NULL;
+ return materials.size()-1;
+}
+
+uint32_t PRCFileStructure::addStyle(PRCStyle*& pStyle)
+{
+ styles.push_back(pStyle);
+ pStyle = NULL;
+ return styles.size()-1;
+}
+
+uint32_t PRCFileStructure::addPartDefinition(PRCPartDefinition*& pPartDefinition)
+{
+ part_definitions.push_back(pPartDefinition);
+ pPartDefinition = NULL;
+ return part_definitions.size()-1;
+}
+
+uint32_t PRCFileStructure::addProductOccurrence(PRCProductOccurrence*& pProductOccurrence)
+{
+ product_occurrences.push_back(pProductOccurrence);
+ pProductOccurrence = NULL;
+ return product_occurrences.size()-1;
+}
+
+uint32_t PRCFileStructure::addTopoContext(PRCTopoContext*& pTopoContext)
+{
+ contexts.push_back(pTopoContext);
+ pTopoContext = NULL;
+ return contexts.size()-1;
+}
+
+uint32_t PRCFileStructure::getTopoContext(PRCTopoContext*& pTopoContext)
+{
+ pTopoContext = new PRCTopoContext;
+ contexts.push_back(pTopoContext);
+ return contexts.size()-1;
+}
+
+uint32_t PRCFileStructure::add3DTess(PRC3DTess*& p3DTess)
+{
+ tessellations.push_back(p3DTess);
+ p3DTess = NULL;
+ return tessellations.size()-1;
+}
+
+uint32_t PRCFileStructure::add3DWireTess(PRC3DWireTess*& p3DWireTess)
+{
+ tessellations.push_back(p3DWireTess);
+ p3DWireTess = NULL;
+ return tessellations.size()-1;
+}
+/*
+uint32_t PRCFileStructure::addMarkupTess(PRCMarkupTess*& pMarkupTess)
+{
+ tessellations.push_back(pMarkupTess);
+ pMarkupTess = NULL;
+ return tessellations.size()-1;
+}
+
+uint32_t PRCFileStructure::addMarkup(PRCMarkup*& pMarkup)
+{
+ markups.push_back(pMarkup);
+ pMarkup = NULL;
+ return markups.size()-1;
+}
+
+uint32_t PRCFileStructure::addAnnotationItem(PRCAnnotationItem*& pAnnotationItem)
+{
+ annotation_entities.push_back(pAnnotationItem);
+ pAnnotationItem = NULL;
+ return annotation_entities.size()-1;
+}
+*/
+uint32_t PRCFileStructure::addCoordinateSystem(PRCCoordinateSystem*& pCoordinateSystem)
+{
+ reference_coordinate_systems.push_back(pCoordinateSystem);
+ pCoordinateSystem = NULL;
+ return reference_coordinate_systems.size()-1;
+}
+
+uint32_t PRCFileStructure::addCoordinateSystemUnique(PRCCoordinateSystem*& pCoordinateSystem)
+{
+ for(uint32_t i = 0; i < reference_coordinate_systems.size(); ++i)
+ {
+ if(*(reference_coordinate_systems[i])==*pCoordinateSystem) {
+ pCoordinateSystem = NULL;
+ return i;
+ }
+ }
+ reference_coordinate_systems.push_back(pCoordinateSystem);
+ pCoordinateSystem = NULL;
+ return reference_coordinate_systems.size()-1;
+}
+
+}
diff --git a/graphics/asymptote/prc/oPRCFile.h b/graphics/asymptote/prc/oPRCFile.h
new file mode 100644
index 0000000000..d0bbdc1ea6
--- /dev/null
+++ b/graphics/asymptote/prc/oPRCFile.h
@@ -0,0 +1,1364 @@
+/************
+*
+* This file is part of a tool for producing 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#ifndef __O_PRC_FILE_H
+#define __O_PRC_FILE_H
+
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <map>
+#include <set>
+#include <list>
+#include <stack>
+#include <string>
+#include <cstring>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "PRC.h"
+#include "PRCbitStream.h"
+#include "writePRC.h"
+
+namespace prc {
+
+class oPRCFile;
+class PRCFileStructure;
+
+// Map [0,1] to [0,255]
+inline uint8_t byte(double r)
+{
+ if(r < 0.0) r=0.0;
+ else if(r > 1.0) r=1.0;
+ int a=(int)(256.0*r);
+ if(a == 256) a=255;
+ return a;
+}
+
+struct RGBAColour
+{
+ RGBAColour(double r=0.0, double g=0.0, double b=0.0, double a=1.0) :
+ R(r), G(g), B(b), A(a) {}
+ double R,G,B,A;
+
+ void Set(double r, double g, double b, double a=1.0)
+ {
+ R = r; G = g; B = b; A = a;
+ }
+ bool operator==(const RGBAColour &c) const
+ {
+ return (R==c.R && G==c.G && B==c.B && A==c.A);
+ }
+ bool operator!=(const RGBAColour &c) const
+ {
+ return !(R==c.R && G==c.G && B==c.B && A==c.A);
+ }
+ bool operator<(const RGBAColour &c) const
+ {
+ if(R!=c.R)
+ return (R<c.R);
+ if(G!=c.G)
+ return (G<c.G);
+ if(B!=c.B)
+ return (B<c.B);
+ return (A<c.A);
+ }
+ friend RGBAColour operator * (const RGBAColour& a, const double d)
+ { return RGBAColour(a.R*d,a.G*d,a.B*d,a.A*d); }
+ friend RGBAColour operator * (const double d, const RGBAColour& a)
+ { return RGBAColour(a.R*d,a.G*d,a.B*d,a.A*d); }
+
+};
+typedef std::map<RGBAColour,uint32_t> PRCcolourMap;
+
+struct RGBAColourWidth
+{
+ RGBAColourWidth(double r=0.0, double g=0.0, double b=0.0, double a=1.0, double w=1.0) :
+ R(r), G(g), B(b), A(a), W(w) {}
+ double R,G,B,A,W;
+
+ bool operator==(const RGBAColourWidth &c) const
+ {
+ return (R==c.R && G==c.G && B==c.B && A==c.A && W==c.W);
+ }
+ bool operator!=(const RGBAColourWidth &c) const
+ {
+ return !(R==c.R && G==c.G && B==c.B && A==c.A && W==c.W);
+ }
+ bool operator<(const RGBAColourWidth &c) const
+ {
+ if(R!=c.R)
+ return (R<c.R);
+ if(G!=c.G)
+ return (G<c.G);
+ if(B!=c.B)
+ return (B<c.B);
+ if(A!=c.A)
+ return (A<c.A);
+ return (W<c.W);
+ }
+};
+typedef std::map<RGBAColourWidth,uint32_t> PRCcolourwidthMap;
+
+typedef std::map<PRCRgbColor,uint32_t> PRCcolorMap;
+
+struct PRCmaterial
+{
+ PRCmaterial() : alpha(1.0),shininess(1.0),
+ picture_data(NULL), picture_format(KEPRCPicture_BITMAP_RGB_BYTE), picture_width(0), picture_height(0), picture_size(0),
+ picture_replace(false), picture_repeat(false) {}
+ PRCmaterial(const RGBAColour &a, const RGBAColour &d, const RGBAColour &e,
+ const RGBAColour &s, double p, double h,
+ const uint8_t* pic=NULL, EPRCPictureDataFormat picf=KEPRCPicture_BITMAP_RGB_BYTE,
+ uint32_t picw=0, uint32_t pich=0, uint32_t pics=0, bool picreplace=false, bool picrepeat=false) :
+ ambient(a), diffuse(d), emissive(e), specular(s), alpha(p), shininess(h),
+ picture_data(pic), picture_format(picf), picture_width(picw), picture_height(pich), picture_size(pics),
+ picture_replace(picreplace), picture_repeat(picrepeat) {
+ if(picture_size==0)
+ {
+ if (picture_format==KEPRCPicture_BITMAP_RGB_BYTE)
+ picture_size = picture_width*picture_height*3;
+ if (picture_format==KEPRCPicture_BITMAP_RGBA_BYTE)
+ picture_size = picture_width*picture_height*4;
+ if (picture_format==KEPRCPicture_BITMAP_GREY_BYTE)
+ picture_size = picture_width*picture_height*1;
+ if (picture_format==KEPRCPicture_BITMAP_GREYA_BYTE)
+ picture_size = picture_width*picture_height*2;
+ }
+ }
+ RGBAColour ambient,diffuse,emissive,specular;
+ double alpha,shininess;
+ const uint8_t* picture_data;
+ EPRCPictureDataFormat picture_format;
+ uint32_t picture_width;
+ uint32_t picture_height;
+ uint32_t picture_size;
+ bool picture_replace; // replace material color with texture color? if false - just modify
+ bool picture_repeat; // repeat texture? if false - clamp to edge
+
+ bool operator==(const PRCmaterial &m) const
+ {
+ return (ambient==m.ambient && diffuse==m.diffuse && emissive==m.emissive
+ && specular==m.specular && alpha==m.alpha && shininess==m.shininess
+ && picture_replace==m.picture_replace && picture_repeat==m.picture_repeat
+ && picture_format==m.picture_format
+ && picture_width==m.picture_width && picture_height==m.picture_height && picture_size==m.picture_size
+ && (picture_data==m.picture_data || memcmp(picture_data,m.picture_data,picture_size)==0) );
+ }
+ bool operator<(const PRCmaterial &m) const
+ {
+ if(ambient!=m.ambient)
+ return (ambient<m.ambient);
+ if(diffuse!=m.diffuse)
+ return (diffuse<m.diffuse);
+ if(emissive!=m.emissive)
+ return (emissive<m.emissive);
+ if(specular!=m.specular)
+ return (specular<m.specular);
+ if(alpha!=m.alpha)
+ return (alpha<m.alpha);
+ if(shininess!=m.shininess)
+ return (shininess<m.shininess);
+ if(picture_replace!=m.picture_replace)
+ return (picture_replace<m.picture_replace);
+ if(picture_repeat!=m.picture_repeat)
+ return (picture_repeat<m.picture_repeat);
+ if(picture_format!=m.picture_format)
+ return (picture_format<m.picture_format);
+ if(picture_width!=m.picture_width)
+ return (picture_width<m.picture_width);
+ if(picture_height!=m.picture_height)
+ return (picture_height<m.picture_height);
+ if(picture_size!=m.picture_size)
+ return (picture_size<m.picture_size);
+ if(picture_data!=m.picture_data)
+ return (memcmp(picture_data,m.picture_data,picture_size)<0);
+ return false;
+ }
+};
+typedef std::map<PRCmaterial,uint32_t> PRCmaterialMap;
+
+struct PRCpicture
+{
+ PRCpicture() :
+ data(NULL), format(KEPRCPicture_BITMAP_RGB_BYTE),
+ width(0), height(0), size(0) {}
+ PRCpicture(const uint8_t* pic, EPRCPictureDataFormat picf,
+ uint32_t picw, uint32_t pich, uint32_t pics=0) :
+ data(pic), format(picf),
+ width(picw), height(pich), size(pics)
+ {
+ if(size==0)
+ {
+ if (format==KEPRCPicture_BITMAP_RGB_BYTE)
+ size = width*height*3;
+ if (format==KEPRCPicture_BITMAP_RGBA_BYTE)
+ size = width*height*4;
+ if (format==KEPRCPicture_BITMAP_GREY_BYTE)
+ size = width*height*1;
+ if (format==KEPRCPicture_BITMAP_GREYA_BYTE)
+ size = width*height*2;
+ }
+ }
+ PRCpicture(const PRCmaterial& m) :
+ data(m.picture_data), format(m.picture_format),
+ width(m.picture_width), height(m.picture_height), size(m.picture_size) {}
+
+ const uint8_t* data;
+ EPRCPictureDataFormat format;
+ uint32_t width;
+ uint32_t height;
+ uint32_t size;
+ bool operator==(const PRCpicture& p) const
+ {
+ return ( format==p.format
+ && width==p.width && height==p.height && size==p.size
+ && (data==p.data || memcmp(data,p.data,size)==0) );
+ }
+ bool operator<(const PRCpicture& p) const
+ {
+ if(format!=p.format)
+ return (format<p.format);
+ if(width!=p.width)
+ return (width<p.width);
+ if(height!=p.height)
+ return (height<p.height);
+ if(size!=p.size)
+ return (size<p.size);
+ if(data!=p.data)
+ return (memcmp(data,p.data,size)<0);
+ return false;
+ }
+};
+
+typedef std::map<PRCpicture,uint32_t> PRCpictureMap;
+
+struct PRCmaterialgeneric
+{
+ PRCmaterialgeneric() : alpha(1.0),shininess(1.0) {}
+ PRCmaterialgeneric(const RGBAColour& a, const RGBAColour& d, const RGBAColour& e,
+ const RGBAColour& s, double p, double h) :
+ ambient(a), diffuse(d), emissive(e), specular(s), alpha(p), shininess(h) {}
+ PRCmaterialgeneric(const PRCmaterial& m) :
+ ambient(m.ambient), diffuse(m.diffuse), emissive(m.emissive), specular(m.specular), alpha(m.alpha), shininess(m.shininess) {}
+ RGBAColour ambient,diffuse,emissive,specular;
+ double alpha,shininess;
+
+ bool operator==(const PRCmaterialgeneric& m) const
+ {
+ return (ambient==m.ambient && diffuse==m.diffuse && emissive==m.emissive
+ && specular==m.specular && alpha==m.alpha && shininess==m.shininess);
+ }
+ bool operator<(const PRCmaterialgeneric& m) const
+ {
+ if(ambient!=m.ambient)
+ return (ambient<m.ambient);
+ if(diffuse!=m.diffuse)
+ return (diffuse<m.diffuse);
+ if(emissive!=m.emissive)
+ return (emissive<m.emissive);
+ if(specular!=m.specular)
+ return (specular<m.specular);
+ if(alpha!=m.alpha)
+ return (alpha<m.alpha);
+ if(shininess!=m.shininess)
+ return (shininess<m.shininess);
+ return false;
+ }
+};
+typedef std::map<PRCmaterialgeneric,uint32_t> PRCmaterialgenericMap;
+
+struct PRCtexturedefinition
+{
+ PRCtexturedefinition() :
+ picture_index(m1), picture_replace(false), picture_repeat(false) {}
+ PRCtexturedefinition(uint32_t picindex, bool picreplace=false, bool picrepeat=false) :
+ picture_index(picindex), picture_replace(picreplace), picture_repeat(picrepeat) {}
+ PRCtexturedefinition(uint32_t picindex, const PRCmaterial& m) :
+ picture_index(picindex), picture_replace(m.picture_replace), picture_repeat(m.picture_repeat) {}
+ uint32_t picture_index;
+ bool picture_replace; // replace material color with texture color? if false - just modify
+ bool picture_repeat; // repeat texture? if false - clamp to edge
+
+ bool operator==(const PRCtexturedefinition& t) const
+ {
+ return (picture_index==t.picture_index
+ && picture_replace==t.picture_replace && picture_repeat==t.picture_repeat);
+ }
+ bool operator<(const PRCtexturedefinition& t) const
+ {
+ if(picture_index!=t.picture_index)
+ return (picture_index<t.picture_index);
+ if(picture_replace!=t.picture_replace)
+ return (picture_replace<t.picture_replace);
+ if(picture_repeat!=t.picture_repeat)
+ return (picture_repeat<t.picture_repeat);
+ return false;
+ }
+};
+typedef std::map<PRCtexturedefinition,uint32_t> PRCtexturedefinitionMap;
+
+struct PRCtextureapplication
+{
+ PRCtextureapplication() :
+ material_generic_index(m1), texture_definition_index(m1) {}
+ PRCtextureapplication(uint32_t matindex, uint32_t texindex) :
+ material_generic_index(matindex), texture_definition_index(texindex) {}
+ uint32_t material_generic_index;
+ uint32_t texture_definition_index;
+
+ bool operator==(const PRCtextureapplication& t) const
+ {
+ return (material_generic_index==t.material_generic_index
+ && texture_definition_index==t.texture_definition_index);
+ }
+ bool operator<(const PRCtextureapplication& t) const
+ {
+ if(material_generic_index!=t.material_generic_index)
+ return (material_generic_index<t.material_generic_index);
+ if(texture_definition_index!=t.texture_definition_index)
+ return (texture_definition_index<t.texture_definition_index);
+ return false;
+ }
+};
+typedef std::map<PRCtextureapplication,uint32_t> PRCtextureapplicationMap;
+
+struct PRCstyle
+{
+ PRCstyle() :
+ line_width(0), alpha(1), is_material(false), color_material_index(m1) {}
+ PRCstyle(double linewidth, double alph, bool ismat, uint32_t colindex=m1) :
+ line_width(linewidth), alpha(alph), is_material(ismat), color_material_index(colindex) {}
+ double line_width;
+ double alpha;
+ bool is_material;
+ uint32_t color_material_index;
+
+ bool operator==(const PRCstyle& s) const
+ {
+ return (line_width==s.line_width && alpha==s.alpha && is_material==s.is_material
+ && color_material_index==s.color_material_index);
+ }
+ bool operator<(const PRCstyle& s) const
+ {
+ if(line_width!=s.line_width)
+ return (line_width<s.line_width);
+ if(alpha!=s.alpha)
+ return (alpha<s.alpha);
+ if(is_material!=s.is_material)
+ return (is_material<s.is_material);
+ if(color_material_index!=s.color_material_index)
+ return (color_material_index<s.color_material_index);
+ return false;
+ }
+};
+typedef std::map<PRCstyle,uint32_t> PRCstyleMap;
+
+struct PRCtessrectangle // rectangle
+{
+ PRCVector3d vertices[4];
+ uint32_t style;
+};
+typedef std::vector<PRCtessrectangle> PRCtessrectangleList;
+
+struct PRCtessquad // rectangle
+{
+ PRCVector3d vertices[4];
+ RGBAColour colours[4];
+};
+typedef std::vector<PRCtessquad> PRCtessquadList;
+/*
+struct PRCtesstriangle // textured triangle
+{
+ PRCtesstriangle() :
+ style(m1) {}
+ PRCVector3d vertices[3];
+// PRCVector3d normals[3];
+// RGBAColour colors[3];
+ PRCVector2d texcoords[3];
+ uint32_t style;
+};
+typedef std::vector<PRCtesstriangle> PRCtesstriangleList;
+*/
+struct PRCtessline // polyline
+{
+ std::vector<PRCVector3d> point;
+ PRCRgbColor color;
+};
+typedef std::list<PRCtessline> PRCtesslineList;
+typedef std::map<double, PRCtesslineList> PRCtesslineMap;
+
+struct PRCface
+{
+ PRCface() : transform(NULL), face(NULL) {}
+ uint32_t style;
+ bool transparent;
+ PRCGeneralTransformation3d* transform;
+ PRCFace* face;
+};
+typedef std::vector <PRCface> PRCfaceList;
+
+struct PRCcompface
+{
+ PRCcompface() : face(NULL) {}
+ uint32_t style;
+ bool transparent;
+ PRCCompressedFace* face;
+};
+typedef std::vector <PRCcompface> PRCcompfaceList;
+
+struct PRCwire
+{
+ PRCwire() : style(m1), transform(NULL), curve(NULL) {}
+ uint32_t style;
+ PRCGeneralTransformation3d* transform;
+ PRCCurve* curve;
+};
+typedef std::vector <PRCwire> PRCwireList;
+
+typedef std::map <uint32_t,std::vector<PRCVector3d> > PRCpointsetMap;
+
+class PRCoptions
+{
+public:
+ double compression;
+ double granularity;
+
+ bool closed; // render the surface as one-sided; may yield faster rendering
+ bool tess; // use tessellated mesh to store straight patches
+ bool do_break; //
+ bool no_break; // do not render transparent patches as one-faced nodes
+ double crease_angle; // crease angle for meshes
+
+ PRCoptions(double compression=0.0, double granularity=0.0, bool closed=false,
+ bool tess=false, bool do_break=true, bool no_break=false, double crease_angle=25.8419)
+ : compression(compression), granularity(granularity), closed(closed),
+ tess(tess), do_break(do_break), no_break(no_break), crease_angle(crease_angle) {}
+};
+
+class PRCgroup
+{
+ public:
+ PRCgroup() :
+ product_occurrence(NULL), parent_product_occurrence(NULL), part_definition(NULL), parent_part_definition(NULL), transform(NULL) {}
+ PRCgroup(const std::string& name) :
+ product_occurrence(NULL), parent_product_occurrence(NULL), part_definition(NULL), parent_part_definition(NULL), transform(NULL), name(name) {}
+ PRCProductOccurrence *product_occurrence, *parent_product_occurrence;
+ PRCPartDefinition *part_definition, *parent_part_definition;
+ PRCfaceList faces;
+ PRCcompfaceList compfaces;
+ PRCtessrectangleList rectangles;
+// PRCtesstriangleList triangles;
+ PRCtessquadList quads;
+ PRCtesslineMap lines;
+ PRCwireList wires;
+ PRCpointsetMap points;
+ std::vector<PRCPointSet*> pointsets;
+ std::vector<PRCPolyBrepModel*> polymodels;
+ std::vector<PRCPolyWire*> polywires;
+ PRCGeneralTransformation3d* transform;
+ std::string name;
+ PRCoptions options;
+};
+
+void makeFileUUID(PRCUniqueId&);
+void makeAppUUID(PRCUniqueId&);
+
+class PRCUncompressedFile
+{
+ public:
+ PRCUncompressedFile() : file_size(0), data(NULL) {}
+ PRCUncompressedFile(uint32_t fs, uint8_t *d) : file_size(fs), data(d) {}
+ ~PRCUncompressedFile() { if(data != NULL) delete[] data; }
+ uint32_t file_size;
+ uint8_t *data;
+
+ void write(std::ostream&) const;
+
+ uint32_t getSize() const;
+};
+typedef std::deque <PRCUncompressedFile*> PRCUncompressedFileList;
+
+class PRCStartHeader
+{
+ public:
+ uint32_t minimal_version_for_read; // PRCVersion
+ uint32_t authoring_version; // PRCVersion
+ PRCUniqueId file_structure_uuid;
+ PRCUniqueId application_uuid; // should be 0
+
+ PRCStartHeader() :
+ minimal_version_for_read(PRCVersion), authoring_version(PRCVersion) {}
+ void serializeStartHeader(std::ostream&) const;
+
+ uint32_t getStartHeaderSize() const;
+};
+
+class PRCFileStructure : public PRCStartHeader
+{
+ public:
+ uint32_t number_of_referenced_file_structures;
+ double tessellation_chord_height_ratio;
+ double tessellation_angle_degree;
+ std::string default_font_family_name;
+ std::vector<PRCRgbColor> colors;
+ std::vector<PRCPicture> pictures;
+ PRCUncompressedFileList uncompressed_files;
+ PRCTextureDefinitionList texture_definitions;
+ PRCMaterialList materials;
+ PRCStyleList styles;
+ PRCCoordinateSystemList reference_coordinate_systems;
+ std::vector<PRCFontKeysSameFont> font_keys_of_font;
+ PRCPartDefinitionList part_definitions;
+ PRCProductOccurrenceList product_occurrences;
+// PRCMarkupList markups;
+// PRCAnnotationItemList annotation_entities;
+ double unit;
+ PRCTopoContextList contexts;
+ PRCTessList tessellations;
+
+ uint32_t sizes[6];
+ uint8_t *globals_data;
+ PRCbitStream globals_out; // order matters: PRCbitStream must be initialized last
+ uint8_t *tree_data;
+ PRCbitStream tree_out;
+ uint8_t *tessellations_data;
+ PRCbitStream tessellations_out;
+ uint8_t *geometry_data;
+ PRCbitStream geometry_out;
+ uint8_t *extraGeometry_data;
+ PRCbitStream extraGeometry_out;
+
+ ~PRCFileStructure () {
+ for(PRCUncompressedFileList::iterator it=uncompressed_files.begin(); it!=uncompressed_files.end(); ++it) delete *it;
+ for(PRCTextureDefinitionList::iterator it=texture_definitions.begin(); it!=texture_definitions.end(); ++it) delete *it;
+ for(PRCMaterialList::iterator it=materials.begin(); it!=materials.end(); ++it) delete *it;
+ for(PRCStyleList::iterator it=styles.begin(); it!=styles.end(); ++it) delete *it;
+ for(PRCTopoContextList::iterator it=contexts.begin(); it!=contexts.end(); ++it) delete *it;
+ for(PRCTessList::iterator it=tessellations.begin(); it!=tessellations.end(); ++it) delete *it;
+ for(PRCPartDefinitionList::iterator it=part_definitions.begin(); it!=part_definitions.end(); ++it) delete *it;
+ for(PRCProductOccurrenceList::iterator it=product_occurrences.begin(); it!=product_occurrences.end(); ++it) delete *it;
+ for(PRCCoordinateSystemList::iterator it=reference_coordinate_systems.begin(); it!=reference_coordinate_systems.end(); it++)
+ delete *it;
+
+ free(globals_data);
+ free(tree_data);
+ free(tessellations_data);
+ free(geometry_data);
+ free(extraGeometry_data);
+ }
+
+ PRCFileStructure() :
+ number_of_referenced_file_structures(0),
+ tessellation_chord_height_ratio(2000.0),tessellation_angle_degree(40.0),
+ default_font_family_name(""),
+ unit(1),
+ globals_data(NULL),globals_out(globals_data,0),
+ tree_data(NULL),tree_out(tree_data,0),
+ tessellations_data(NULL),tessellations_out(tessellations_data,0),
+ geometry_data(NULL),geometry_out(geometry_data,0),
+ extraGeometry_data(NULL),extraGeometry_out(extraGeometry_data,0) {}
+ void write(std::ostream&);
+ void prepare();
+ uint32_t getSize();
+ void serializeFileStructureGlobals(PRCbitStream&);
+ void serializeFileStructureTree(PRCbitStream&);
+ void serializeFileStructureTessellation(PRCbitStream&);
+ void serializeFileStructureGeometry(PRCbitStream&);
+ void serializeFileStructureExtraGeometry(PRCbitStream&);
+ uint32_t addPicture(EPRCPictureDataFormat format, uint32_t size, const uint8_t *picture, uint32_t width=0, uint32_t height=0, std::string name="");
+ uint32_t addTextureDefinition(PRCTextureDefinition*& pTextureDefinition);
+ uint32_t addRgbColor(const PRCRgbColor &color);
+ uint32_t addRgbColorUnique(const PRCRgbColor &color);
+ uint32_t addMaterialGeneric(PRCMaterialGeneric*& pMaterialGeneric);
+ uint32_t addTextureApplication(PRCTextureApplication*& pTextureApplication);
+ uint32_t addStyle(PRCStyle*& pStyle);
+ uint32_t addPartDefinition(PRCPartDefinition*& pPartDefinition);
+ uint32_t addProductOccurrence(PRCProductOccurrence*& pProductOccurrence);
+ uint32_t addTopoContext(PRCTopoContext*& pTopoContext);
+ uint32_t getTopoContext(PRCTopoContext*& pTopoContext);
+ uint32_t add3DTess(PRC3DTess*& p3DTess);
+ uint32_t add3DWireTess(PRC3DWireTess*& p3DWireTess);
+/*
+ uint32_t addMarkupTess(PRCMarkupTess*& pMarkupTess);
+ uint32_t addMarkup(PRCMarkup*& pMarkup);
+ uint32_t addAnnotationItem(PRCAnnotationItem*& pAnnotationItem);
+ */
+ uint32_t addCoordinateSystem(PRCCoordinateSystem*& pCoordinateSystem);
+ uint32_t addCoordinateSystemUnique(PRCCoordinateSystem*& pCoordinateSystem);
+};
+
+class PRCFileStructureInformation
+{
+ public:
+ PRCUniqueId UUID;
+ uint32_t reserved; // 0
+ uint32_t number_of_offsets;
+ uint32_t *offsets;
+
+ void write(std::ostream&);
+
+ uint32_t getSize();
+};
+
+class PRCHeader : public PRCStartHeader
+{
+ public :
+ uint32_t number_of_file_structures;
+ PRCFileStructureInformation *fileStructureInformation;
+ uint32_t model_file_offset;
+ uint32_t file_size; // not documented
+ PRCUncompressedFileList uncompressed_files;
+
+ void write(std::ostream&);
+ uint32_t getSize();
+};
+
+typedef std::map <PRCGeneralTransformation3d,uint32_t> PRCtransformMap;
+
+inline double X(const double *v) {return v[0];}
+inline double Y(const double *v) {return v[1];}
+inline double Z(const double *v) {return v[2];}
+
+class oPRCFile
+{
+ public:
+ oPRCFile(std::ostream &os, double u=1, uint32_t n=1) :
+ number_of_file_structures(n),
+ fileStructures(new PRCFileStructure*[n]),
+ unit(u),
+ modelFile_data(NULL),modelFile_out(modelFile_data,0),
+ fout(NULL),output(os)
+ {
+ for(uint32_t i = 0; i < number_of_file_structures; ++i)
+ {
+ fileStructures[i] = new PRCFileStructure();
+ fileStructures[i]->minimal_version_for_read = PRCVersion;
+ fileStructures[i]->authoring_version = PRCVersion;
+ makeFileUUID(fileStructures[i]->file_structure_uuid);
+ makeAppUUID(fileStructures[i]->application_uuid);
+ fileStructures[i]->unit = u;
+ }
+
+ groups.push(PRCgroup());
+ PRCgroup &group = groups.top();
+ group.name="root";
+ group.transform = NULL;
+ group.product_occurrence = new PRCProductOccurrence(group.name);
+ group.parent_product_occurrence = NULL;
+ group.part_definition = new PRCPartDefinition;
+ group.parent_part_definition = NULL;
+ }
+
+ oPRCFile(const std::string &name, double u=1, uint32_t n=1) :
+ number_of_file_structures(n),
+ fileStructures(new PRCFileStructure*[n]),
+ unit(u),
+ modelFile_data(NULL),modelFile_out(modelFile_data,0),
+ fout(new std::ofstream(name.c_str(),
+ std::ios::out|std::ios::binary|std::ios::trunc)),
+ output(*fout)
+ {
+ for(uint32_t i = 0; i < number_of_file_structures; ++i)
+ {
+ fileStructures[i] = new PRCFileStructure();
+ fileStructures[i]->minimal_version_for_read = PRCVersion;
+ fileStructures[i]->authoring_version = PRCVersion;
+ makeFileUUID(fileStructures[i]->file_structure_uuid);
+ makeAppUUID(fileStructures[i]->application_uuid);
+ fileStructures[i]->unit = u;
+ }
+
+ groups.push(PRCgroup());
+ PRCgroup &group = groups.top();
+ group.name="root";
+ group.transform = NULL;
+ group.product_occurrence = new PRCProductOccurrence(group.name);
+ group.parent_product_occurrence = NULL;
+ group.part_definition = new PRCPartDefinition;
+ group.parent_part_definition = NULL;
+ }
+
+ ~oPRCFile()
+ {
+ for(uint32_t i = 0; i < number_of_file_structures; ++i)
+ delete fileStructures[i];
+ delete[] fileStructures;
+ if(fout != NULL)
+ delete fout;
+ free(modelFile_data);
+ for(PRCpictureMap::iterator it=pictureMap.begin(); it!=pictureMap.end(); ++it) delete it->first.data;
+ }
+
+ void begingroup(const char *name, PRCoptions *options=NULL,
+ const double* t=NULL);
+ void endgroup();
+
+ std::string lastgroupname;
+ std::vector<std::string> lastgroupnames;
+ std::string calculate_unique_name(const ContentPRCBase *prc_entity,const ContentPRCBase *prc_occurence);
+
+ bool finish();
+ uint32_t getSize();
+
+ const uint32_t number_of_file_structures;
+ PRCFileStructure **fileStructures;
+ PRCHeader header;
+ PRCUnit unit;
+ uint8_t *modelFile_data;
+ PRCbitStream modelFile_out; // order matters: PRCbitStream must be initialized last
+ PRCcolorMap colorMap;
+ PRCcolourMap colourMap;
+ PRCcolourwidthMap colourwidthMap;
+ PRCmaterialgenericMap materialgenericMap;
+ PRCtexturedefinitionMap texturedefinitionMap;
+ PRCtextureapplicationMap textureapplicationMap;
+ PRCstyleMap styleMap;
+ PRCpictureMap pictureMap;
+ PRCgroup rootGroup;
+ PRCtransformMap transformMap;
+ std::stack<PRCgroup> groups;
+ PRCgroup& findGroup();
+ void doGroup(PRCgroup& group);
+ uint32_t addColor(const PRCRgbColor &color);
+ uint32_t addColour(const RGBAColour &colour);
+ uint32_t addColourWidth(const RGBAColour &colour, double width);
+ uint32_t addLineMaterial(const RGBAColour& c, double width)
+ { return addColourWidth(c,width); }
+ uint32_t addMaterial(const PRCmaterial &material);
+ uint32_t addTransform(PRCGeneralTransformation3d*& transform);
+ uint32_t addTransform(const double* t);
+ uint32_t addTransform(const double origin[3], const double x_axis[3], const double y_axis[3], double scale);
+template<class V>
+void addPoint(const V P, const RGBAColour &c, double w=1.0)
+{
+ PRCgroup &group = findGroup();
+ group.points[addColourWidth(c,w)].push_back(PRCVector3d(X(P),Y(P),Z(P)));
+}
+ void addPoints(uint32_t n, const double P[][3], const RGBAColour &c, double w=1.0);
+ void addLines(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[],
+ const RGBAColour& c, double w,
+ bool segment_color, uint32_t nC, const RGBAColour C[], uint32_t nCI, const uint32_t CI[]);
+ uint32_t createLines(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[],
+ bool segment_color, uint32_t nC, const RGBAColour C[], uint32_t nCI, const uint32_t CI[]);
+template<class V>
+ void addTriangles(uint32_t nP, const V P[], uint32_t nI, const uint32_t PI[][3], const PRCmaterial &m,
+ uint32_t nN, const V N[], const uint32_t NI[][3],
+ uint32_t nT, const double T[][2], const uint32_t TI[][3],
+ uint32_t nC, const RGBAColour C[], const uint32_t CI[][3],
+ uint32_t nM, const PRCmaterial M[], const uint32_t MI[], double ca)
+{
+ if(nP==0 || P==NULL || nI==0 || PI==NULL)
+ return;
+ const uint32_t tess_index = createTriangleMesh(nP, P, nI, PI, m, nN, N, NI, nT, T, TI, nC, C, CI, nM, M, MI, ca);
+ useMesh(tess_index,m1);
+}
+template<class V>
+ uint32_t createTriangleMesh(uint32_t nP, const V P[], uint32_t nI, const uint32_t PI[][3], const PRCmaterial& m,
+ uint32_t nN, const V N[], const uint32_t NI[][3],
+ uint32_t nT, const double T[][2], const uint32_t TI[][3],
+ uint32_t nC, const RGBAColour C[], const uint32_t CI[][3],
+ uint32_t nM, const PRCmaterial M[], const uint32_t MI[], double ca)
+ {
+ const uint32_t style = addMaterial(m);
+ if(M!=NULL && nM>0)
+ {
+ uint32_t* const styles = new uint32_t[nM];
+ for(uint32_t i=0; i<nM; i++)
+ styles[i]=addMaterial(M[i]);
+ const uint32_t meshid = createTriangleMesh(nP, P, nI, PI, style, nN, N, NI, nT, T, TI, nC, C, CI, nM, styles, MI, ca);
+ delete[] styles;
+ return meshid;
+ }
+ else
+ return createTriangleMesh(nP, P, nI, PI, style, nN, N, NI, nT, T, TI, nC, C, CI, 0, NULL, NULL, ca);
+ }
+
+template<class V>
+uint32_t createTriangleMesh(uint32_t nP, const V P[], uint32_t nI, const uint32_t PI[][3], const uint32_t style_index,
+uint32_t nN, const V N[], const uint32_t NI[][3],
+ uint32_t nT, const double T[][2], const uint32_t TI[][3],
+ uint32_t nC, const RGBAColour C[], const uint32_t CI[][3],
+ uint32_t nS, const uint32_t S[], const uint32_t SI[], double ca)
+{
+ if(nP==0 || P==NULL || nI==0 || PI==NULL)
+ return m1;
+
+ const bool triangle_color = (nS != 0 && S != NULL && SI != NULL);
+ const bool vertex_color = (nC != 0 && C != NULL && CI != NULL);
+ const bool has_normals = (nN != 0 && N != NULL && NI != NULL);
+ const bool textured = (nT != 0 && T != NULL && TI != NULL);
+
+ PRC3DTess *tess = new PRC3DTess();
+ PRCTessFace *tessFace = new PRCTessFace();
+ tessFace->used_entities_flag = textured ? PRC_FACETESSDATA_TriangleTextured : PRC_FACETESSDATA_Triangle;
+ tessFace->number_of_texture_coordinate_indexes = textured ? 1 : 0;
+ tess->coordinates.reserve(3*nP);
+ for(uint32_t i=0; i<nP; i++)
+ {
+ tess->coordinates.push_back(X(P[i]));
+ tess->coordinates.push_back(Y(P[i]));
+ tess->coordinates.push_back(Z(P[i]));
+ }
+ if(has_normals)
+ {
+ tess->normal_coordinate.reserve(3*nN);
+ for(uint32_t i=0; i<nN; i++)
+ {
+ tess->normal_coordinate.push_back(X(N[i]));
+ tess->normal_coordinate.push_back(Y(N[i]));
+ tess->normal_coordinate.push_back(Z(N[i]));
+ }
+ }
+ else
+ tess->crease_angle = ca;
+ if(textured)
+ {
+ tess->texture_coordinate.reserve(2*nT);
+ for(uint32_t i=0; i<nT; i++)
+ {
+ tess->texture_coordinate.push_back(T[i][0]);
+ tess->texture_coordinate.push_back(T[i][1]);
+ }
+ }
+ tess->triangulated_index.reserve(3*nI+(has_normals?3:0)*nI+(textured?3:0)*nI);
+ for(uint32_t i=0; i<nI; i++)
+ {
+ if(has_normals)
+ tess->triangulated_index.push_back(3*NI[i][0]);
+ if(textured)
+ tess->triangulated_index.push_back(2*TI[i][0]);
+ tess->triangulated_index.push_back(3*PI[i][0]);
+ if(has_normals)
+ tess->triangulated_index.push_back(3*NI[i][1]);
+ if(textured)
+ tess->triangulated_index.push_back(2*TI[i][1]);
+ tess->triangulated_index.push_back(3*PI[i][1]);
+ if(has_normals)
+ tess->triangulated_index.push_back(3*NI[i][2]);
+ if(textured)
+ tess->triangulated_index.push_back(2*TI[i][2]);
+ tess->triangulated_index.push_back(3*PI[i][2]);
+ }
+ tessFace->sizes_triangulated.push_back(nI);
+ if(triangle_color)
+ {
+ tessFace->line_attributes.reserve(nI);
+ for(uint32_t i=0; i<nI; i++)
+ tessFace->line_attributes.push_back(SI[i]);
+ }
+ else if (style_index != m1 )
+ {
+ tessFace->line_attributes.push_back(style_index);
+ }
+ if(vertex_color)
+ {
+ tessFace->is_rgba=false;
+ for(uint32_t i=0; i<nI; i++)
+ if(1.0 != C[CI[i][0]].A || 1.0 != C[CI[i][1]].A || 1.0 != C[CI[i][2]].A)
+ {
+ tessFace->is_rgba=true;
+ break;
+ }
+
+ tessFace->rgba_vertices.reserve((tessFace->is_rgba?4:3)*3*nI);
+ for(uint32_t i=0; i<nI; i++)
+ {
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].R));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].G));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].A));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].R));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].G));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].A));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].R));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].G));
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].B));
+ if(tessFace->is_rgba)
+ tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].A));
+ }
+ }
+ tess->addTessFace(tessFace);
+ const uint32_t tess_index = add3DTess(tess);
+ return tess_index;
+}
+
+ void addQuads(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][4], const PRCmaterial &m,
+ uint32_t nN, const double N[][3], const uint32_t NI[][4],
+ uint32_t nT, const double T[][2], const uint32_t TI[][4],
+ uint32_t nC, const RGBAColour C[], const uint32_t CI[][4],
+ uint32_t nM, const PRCmaterial M[], const uint32_t MI[], double ca);
+ uint32_t createQuadMesh(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][4], uint32_t style_index,
+ uint32_t nN, const double N[][3], const uint32_t NI[][4],
+ uint32_t nT, const double T[][2], const uint32_t TI[][4],
+ uint32_t nC, const RGBAColour C[], const uint32_t CI[][4],
+ uint32_t nS, const uint32_t S[], const uint32_t SI[], double ca);
+ uint32_t createQuadMesh(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][4], const PRCmaterial& m,
+ uint32_t nN, const double N[][3], const uint32_t NI[][4],
+ uint32_t nT, const double T[][2], const uint32_t TI[][4],
+ uint32_t nC, const RGBAColour C[], const uint32_t CI[][4],
+ uint32_t nM, const PRCmaterial M[], const uint32_t MI[], double ca)
+ {
+ const uint32_t style = addMaterial(m);
+ if(M!=NULL && nM>0)
+ {
+ uint32_t* const styles = new uint32_t[nM];
+ for(uint32_t i=0; i<nM; i++)
+ styles[i]=addMaterial(M[i]);
+ const uint32_t meshid = createQuadMesh(nP, P, nI, PI, style, nN, N, NI, nT, T, TI, nC, C, CI, nM, styles, MI, ca);
+ delete[] styles;
+ return meshid;
+ }
+ else
+ return createQuadMesh(nP, P, nI, PI, style, nN, N, NI, nT, T, TI, nC, C, CI, 0, NULL, NULL, ca);
+ }
+#define PRCTRANSFORM const double origin[3]=NULL, const double x_axis[3]=NULL, const double y_axis[3]=NULL, double scale=1, const double* t=NULL
+#define PRCCARTRANSFORM const double origin[3], const double x_axis[3], const double y_axis[3], double scale
+#define PRCGENTRANSFORM const double* t=NULL
+#define PRCNOMATERIALINDEX m1
+
+#define ADDWIRE(curvtype) \
+ PRCgroup &group = findGroup(); \
+ group.wires.push_back(PRCwire()); \
+ PRCwire &wire = group.wires.back(); \
+ curvtype *curve = new curvtype; \
+ wire.curve = curve; \
+ wire.style = addColour(c);
+
+#define ADDFACE(surftype) \
+ PRCgroup &group = findGroup(); \
+ group.faces.push_back(PRCface()); \
+ PRCface& face = group.faces.back(); \
+ surftype *surface = new surftype; \
+ face.face = new PRCFace; \
+ face.face->base_surface = surface; \
+ face.transparent = m.alpha < 1.0; \
+ face.style = addMaterial(m);
+
+#define ADDCOMPFACE \
+ PRCgroup &group = findGroup(); \
+ group.compfaces.push_back(PRCcompface()); \
+ PRCcompface& face = group.compfaces.back(); \
+ PRCCompressedFace *compface = new PRCCompressedFace; \
+ face.face = compface; \
+ face.transparent = m.alpha < 1.0; \
+ face.style = addMaterial(m);
+
+inline bool isid(const double* t)
+{
+ return(
+ t[0]==1 && t[1]==0 && t[2]==0 && t[3]==0 &&
+ t[4]==0 && t[5]==1 && t[6]==0 && t[7]==0 &&
+ t[8]==0 && t[9]==0 && t[10]==1 && t[11]==0 &&
+ t[12]==0 && t[13]==0 && t[14]==0 && t[15]==1);
+}
+
+#define SETTRANSF \
+ if(t&&!isid(t)) \
+ face.transform = new PRCGeneralTransformation3d(t); \
+ if(origin) surface->origin.Set(origin[0],origin[1],origin[2]); \
+ if(x_axis) surface->x_axis.Set(x_axis[0],x_axis[1],x_axis[2]); \
+ if(y_axis) surface->y_axis.Set(y_axis[0],y_axis[1],y_axis[2]); \
+ surface->scale = scale; \
+ surface->geometry_is_2D = false; \
+ if(surface->origin!=PRCVector3d(0.0,0.0,0.0)) \
+ surface->behaviour = surface->behaviour | PRC_TRANSFORMATION_Translate; \
+ if(surface->x_axis!=PRCVector3d(1.0,0.0,0.0)||surface->y_axis!=PRCVector3d(0.0,1.0,0.0)) \
+ surface->behaviour = surface->behaviour | PRC_TRANSFORMATION_Rotate; \
+ if(surface->scale!=1) \
+ surface->behaviour = surface->behaviour | PRC_TRANSFORMATION_Scale; \
+ surface->has_transformation = (surface->behaviour != PRC_TRANSFORMATION_Identity);
+
+ void useMesh(uint32_t tess_index, uint32_t style_index, PRCGENTRANSFORM);
+ void useMesh(uint32_t tess_index, const PRCmaterial& m, PRCGENTRANSFORM)
+ { useMesh(tess_index,addMaterial(m),t); }
+ void useMesh(uint32_t tess_index, uint32_t style_index, PRCCARTRANSFORM);
+ void useMesh(uint32_t tess_index, const PRCmaterial& m, PRCCARTRANSFORM)
+ { useMesh(tess_index,addMaterial(m),origin, x_axis, y_axis, scale); }
+
+ void useLines(uint32_t tess_index, uint32_t style_index, PRCGENTRANSFORM);
+ void useLines(uint32_t tess_index, const RGBAColour& c, double w, PRCGENTRANSFORM)
+ { useLines(tess_index, addLineMaterial(c,w), t); }
+ void useLines(uint32_t tess_index, uint32_t style_index, PRCCARTRANSFORM);
+ void useLines(uint32_t tess_index, const RGBAColour& c, double w, PRCCARTRANSFORM)
+ { useLines(tess_index,addLineMaterial(c,w),origin, x_axis, y_axis, scale); }
+
+// void addTriangle(const double P[][3], const double T[][2], uint32_t style_index);
+
+template<class V>
+void addLine(uint32_t n, const V P[], const RGBAColour &c, double w=1.0)
+{
+ PRCgroup &group = findGroup();
+ if(group.options.tess)
+ {
+ group.lines[w].push_back(PRCtessline());
+ PRCtessline& line = group.lines[w].back();
+ line.color.red = c.R;
+ line.color.green = c.G;
+ line.color.blue = c.B;
+ for(uint32_t i=0; i<n; i++)
+ line.point.push_back(PRCVector3d(X(P[i]),Y(P[i]),Z(P[i])));
+ }
+ else
+ {
+ ADDWIRE(PRCPolyLine)
+ curve->point.resize(n);
+ for(uint32_t i=0; i<n; i++)
+ curve->point[i].Set(X(P[i]),Y(P[i]),Z(P[i]));
+ curve->interval.min = 0;
+ curve->interval.max = curve->point.size()-1;
+ }
+}
+template<class V>
+void addBezierCurve(uint32_t n, const V cP[], const RGBAColour &c)
+{
+ ADDWIRE(PRCNURBSCurve)
+ curve->is_rational = false;
+ curve->degree = 3;
+ const size_t NUMBER_OF_POINTS = n;
+ curve->control_point.resize(NUMBER_OF_POINTS);
+ for(size_t i = 0; i < NUMBER_OF_POINTS; ++i)
+ curve->control_point[i].Set(X(cP[i]),Y(cP[i]),Z(cP[i]));
+ curve->knot.resize(3+NUMBER_OF_POINTS+1);
+ curve->knot[0] = 1;
+ for(size_t i = 1; i < 3+NUMBER_OF_POINTS; ++i)
+ curve->knot[i] = (i+2)/3; // integer division is intentional
+ curve->knot[3+NUMBER_OF_POINTS] = (3+NUMBER_OF_POINTS+1)/3;
+}
+
+template<class V>
+void addCurve(uint32_t d, uint32_t n, const V cP[], const double *k, const RGBAColour &c, const double w[])
+{
+ ADDWIRE(PRCNURBSCurve)
+ curve->is_rational = (w!=NULL);
+ curve->degree = d;
+ curve->control_point.resize(n);
+ for(uint32_t i = 0; i < n; i++)
+ if(w)
+ curve->control_point[i].Set(X(cP[i])*w[i],Y(cP[i])*w[i],Z(cP[i])*w[i],
+ w[i]);
+ else
+ curve->control_point[i].Set(X(cP[i]),Y(cP[i]),Z(cP[i]));
+ curve->knot.resize(d+n+1);
+ for(uint32_t i = 0; i < d+n+1; i++)
+ curve->knot[i] = k[i];
+}
+
+template<class V>
+void addQuad(const V P[], const RGBAColour C[])
+{
+ PRCgroup &group = findGroup();
+
+ group.quads.push_back(PRCtessquad());
+ PRCtessquad &quad = group.quads.back();
+ for(size_t i = 0; i < 4; i++)
+ {
+ quad.vertices[i].x = X(P[i]);
+ quad.vertices[i].y = Y(P[i]);
+ quad.vertices[i].z = Z(P[i]);
+ quad.colours[i] = C[i];
+ }
+}
+
+template<class V>
+void addRectangle(const V P[], const PRCmaterial &m)
+{
+ PRCgroup &group = findGroup();
+ if(group.options.tess)
+ {
+ group.rectangles.push_back(PRCtessrectangle());
+ PRCtessrectangle &rectangle = group.rectangles.back();
+ rectangle.style = addMaterial(m);
+ for(size_t i = 0; i < 4; i++)
+ {
+ rectangle.vertices[i].x = X(P[i]);
+ rectangle.vertices[i].y = Y(P[i]);
+ rectangle.vertices[i].z = Z(P[i]);
+ }
+ }
+ else if(group.options.compression == 0.0)
+ {
+ ADDFACE(PRCNURBSSurface)
+
+ surface->is_rational = false;
+ surface->degree_in_u = 1;
+ surface->degree_in_v = 1;
+ surface->control_point.resize(4);
+ for(size_t i = 0; i < 4; ++i)
+ {
+ surface->control_point[i].x = X(P[i]);
+ surface->control_point[i].y = Y(P[i]);
+ surface->control_point[i].z = Z(P[i]);
+ }
+ surface->knot_u.resize(4);
+ surface->knot_v.resize(4);
+ surface->knot_v[0] = surface->knot_u[0] = 1;
+ surface->knot_v[1] = surface->knot_u[1] = 3;
+ surface->knot_v[2] = surface->knot_u[2] = 4;
+ surface->knot_v[3] = surface->knot_u[3] = 4;
+ }
+ else
+ {
+ ADDCOMPFACE
+
+ compface->degree = 1;
+ compface->control_point.resize(4);
+ for(size_t i = 0; i < 4; ++i)
+ {
+ compface->control_point[i].x = X(P[i]);
+ compface->control_point[i].y = Y(P[i]);
+ compface->control_point[i].z = Z(P[i]);
+ }
+ }
+}
+
+template<class V>
+void addPatch(const V cP[], const PRCmaterial &m)
+{
+ PRCgroup &group = findGroup();
+ if(group.options.compression == 0.0)
+ {
+ ADDFACE(PRCNURBSSurface)
+
+ surface->is_rational = false;
+ surface->degree_in_u = 3;
+ surface->degree_in_v = 3;
+ surface->control_point.resize(16);
+ for(size_t i = 0; i < 16; ++i)
+ {
+ surface->control_point[i].x = X(cP[i]);
+ surface->control_point[i].y = Y(cP[i]);
+ surface->control_point[i].z = Z(cP[i]);
+ }
+ surface->knot_u.resize(8);
+ surface->knot_v.resize(8);
+ surface->knot_v[0] = surface->knot_u[0] = 1;
+ surface->knot_v[1] = surface->knot_u[1] = 1;
+ surface->knot_v[2] = surface->knot_u[2] = 1;
+ surface->knot_v[3] = surface->knot_u[3] = 1;
+ surface->knot_v[4] = surface->knot_u[4] = 2;
+ surface->knot_v[5] = surface->knot_u[5] = 2;
+ surface->knot_v[6] = surface->knot_u[6] = 2;
+ surface->knot_v[7] = surface->knot_u[7] = 2;
+ }
+ else
+ {
+ ADDCOMPFACE
+
+ compface->degree = 3;
+ compface->control_point.resize(16);
+ for(size_t i = 0; i < 16; ++i)
+ {
+ compface->control_point[i].x = X(cP[i]);
+ compface->control_point[i].y = Y(cP[i]);
+ compface->control_point[i].z = Z(cP[i]);
+ }
+ }
+}
+
+template<class V>
+void addSurface(uint32_t dU, uint32_t dV, uint32_t nU, uint32_t nV,
+ const V cP[], const double *kU,
+ const double *kV, const PRCmaterial &m,
+ const double w[])
+{
+ ADDFACE(PRCNURBSSurface)
+
+ surface->is_rational = (w!=NULL);
+ surface->degree_in_u = dU;
+ surface->degree_in_v = dV;
+ surface->control_point.resize(nU*nV);
+ for(size_t i = 0; i < nU*nV; i++)
+ if(w)
+ surface->control_point[i]=PRCControlPoint(X(cP[i])*w[i],Y(cP[i])*w[i],Z(cP[i])*w[i],w[i]);
+ else
+ surface->control_point[i]=PRCControlPoint(X(cP[i]),Y(cP[i]),Z(cP[i]));
+ surface->knot_u.insert(surface->knot_u.end(), kU, kU+(dU+nU+1));
+ surface->knot_v.insert(surface->knot_v.end(), kV, kV+(dV+nV+1));
+}
+template<class V>
+void addTube(uint32_t n, const V cP[], const V oP[], bool straight, const PRCmaterial &m, PRCTRANSFORM)
+{
+ ADDFACE(PRCBlend01)
+ SETTRANSF
+ if(straight)
+ {
+ PRCPolyLine *center_curve = new PRCPolyLine;
+ center_curve->point.resize(n);
+ for(uint32_t i=0; i<n; i++)
+ center_curve->point[i].Set(X(cP[i]),Y(cP[i]),Z(cP[i]));
+ center_curve->interval.min = 0;
+ center_curve->interval.max = center_curve->point.size()-1;
+ surface->center_curve = center_curve;
+
+ PRCPolyLine *origin_curve = new PRCPolyLine;
+ origin_curve->point.resize(n);
+ for(uint32_t i=0; i<n; i++)
+ origin_curve->point[i].Set(X(oP[i]),Y(oP[i]),Z(oP[i]));
+ origin_curve->interval.min = 0;
+ origin_curve->interval.max = origin_curve->point.size()-1;
+ surface->origin_curve = origin_curve;
+
+ surface->uv_domain.min.x = 0;
+ surface->uv_domain.max.x = 2*pi;
+ surface->uv_domain.min.y = 0;
+ surface->uv_domain.max.y = n-1;
+ }
+ else
+ {
+ PRCNURBSCurve *center_curve = new PRCNURBSCurve;
+ center_curve->is_rational = false;
+ center_curve->degree = 3;
+ const uint32_t CENTER_NUMBER_OF_POINTS = n;
+ center_curve->control_point.resize(CENTER_NUMBER_OF_POINTS);
+ for(uint32_t i = 0; i < CENTER_NUMBER_OF_POINTS; ++i)
+ center_curve->control_point[i].Set(X(cP[i]),Y(cP[i]),Z(cP[i]));
+ center_curve->knot.resize(3+CENTER_NUMBER_OF_POINTS+1);
+ center_curve->knot[0] = 1;
+ for(uint32_t i = 1; i < 3+CENTER_NUMBER_OF_POINTS; ++i)
+ center_curve->knot[i] = (i+2)/3; // integer division is intentional
+ center_curve->knot[3+CENTER_NUMBER_OF_POINTS] = (3+CENTER_NUMBER_OF_POINTS+1)/3;
+ surface->center_curve = center_curve;
+
+ PRCNURBSCurve *origin_curve = new PRCNURBSCurve;
+ origin_curve->is_rational = false;
+ origin_curve->degree = 3;
+ const uint32_t ORIGIN_NUMBER_OF_POINTS = n;
+ origin_curve->control_point.resize(ORIGIN_NUMBER_OF_POINTS);
+ for(uint32_t i = 0; i < ORIGIN_NUMBER_OF_POINTS; ++i)
+ origin_curve->control_point[i].Set(X(oP[i]),Y(oP[i]),Z(oP[i]));
+ origin_curve->knot.resize(3+ORIGIN_NUMBER_OF_POINTS+1);
+ origin_curve->knot[0] = 1;
+ for(size_t i = 1; i < 3+ORIGIN_NUMBER_OF_POINTS; ++i)
+ origin_curve->knot[i] = (i+2)/3; // integer division is intentional
+ origin_curve->knot[3+ORIGIN_NUMBER_OF_POINTS] = (3+ORIGIN_NUMBER_OF_POINTS+1)/3;
+ surface->origin_curve = origin_curve;
+
+ surface->uv_domain.min.x = 0;
+ surface->uv_domain.max.x = 2*pi;
+ surface->uv_domain.min.y = 1; // first knot
+ surface->uv_domain.max.y = (3+CENTER_NUMBER_OF_POINTS+1)/3; // last knot
+ }
+}
+ void addHemisphere(double radius, const PRCmaterial& m, PRCTRANSFORM);
+ void addSphere(double radius, const PRCmaterial& m, PRCTRANSFORM);
+ void addDisk(double radius, const PRCmaterial& m, PRCTRANSFORM);
+ void addCylinder(double radius, double height, const PRCmaterial& m, PRCTRANSFORM);
+ void addCone(double radius, double height, const PRCmaterial& m, PRCTRANSFORM);
+ void addTorus(double major_radius, double minor_radius, double angle1, double angle2, const PRCmaterial& m, PRCTRANSFORM);
+#undef PRCTRANSFORM
+#undef PRCCARTRANSFORM
+#undef PRCGENTRANSFORM
+#undef ADDCOMPFACE
+
+ uint32_t addPicture(EPRCPictureDataFormat format, uint32_t size, const uint8_t *picture, uint32_t width=0, uint32_t height=0,
+ std::string name="", uint32_t fileStructure=0)
+ { return fileStructures[fileStructure]->addPicture(format, size, picture, width, height, name); }
+ uint32_t addPicture(const PRCpicture& pic,
+ std::string name="", uint32_t fileStructure=0)
+ { return fileStructures[fileStructure]->addPicture(pic.format, pic.size, pic.data, pic.width, pic.height, name); }
+ uint32_t addTextureDefinition(PRCTextureDefinition*& pTextureDefinition, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addTextureDefinition(pTextureDefinition);
+ }
+ uint32_t addTextureApplication(PRCTextureApplication*& pTextureApplication, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addTextureApplication(pTextureApplication);
+ }
+ uint32_t addRgbColor(const PRCRgbColor &color,
+ uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addRgbColor(color);
+ }
+ uint32_t addRgbColorUnique(const PRCRgbColor &color,
+ uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addRgbColorUnique(color);
+ }
+ uint32_t addMaterialGeneric(PRCMaterialGeneric*& pMaterialGeneric,
+ uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addMaterialGeneric(pMaterialGeneric);
+ }
+ uint32_t addStyle(PRCStyle*& pStyle, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addStyle(pStyle);
+ }
+ uint32_t addPartDefinition(PRCPartDefinition*& pPartDefinition, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addPartDefinition(pPartDefinition);
+ }
+ uint32_t addProductOccurrence(PRCProductOccurrence*& pProductOccurrence, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addProductOccurrence(pProductOccurrence);
+ }
+ uint32_t addTopoContext(PRCTopoContext*& pTopoContext, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addTopoContext(pTopoContext);
+ }
+ uint32_t getTopoContext(PRCTopoContext*& pTopoContext, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->getTopoContext(pTopoContext);
+ }
+ uint32_t add3DTess(PRC3DTess*& p3DTess, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->add3DTess(p3DTess);
+ }
+ uint32_t add3DWireTess(PRC3DWireTess*& p3DWireTess, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->add3DWireTess(p3DWireTess);
+ }
+/*
+ uint32_t addMarkupTess(PRCMarkupTess*& pMarkupTess, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addMarkupTess(pMarkupTess);
+ }
+ uint32_t addMarkup(PRCMarkup*& pMarkup, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addMarkup(pMarkup);
+ }
+ uint32_t addAnnotationItem(PRCAnnotationItem*& pAnnotationItem, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addAnnotationItem(pAnnotationItem);
+ }
+ */
+ uint32_t addCoordinateSystem(PRCCoordinateSystem*& pCoordinateSystem, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addCoordinateSystem(pCoordinateSystem);
+ }
+ uint32_t addCoordinateSystemUnique(PRCCoordinateSystem*& pCoordinateSystem, uint32_t fileStructure=0)
+ {
+ return fileStructures[fileStructure]->addCoordinateSystemUnique(pCoordinateSystem);
+ }
+ private:
+ void serializeModelFileData(PRCbitStream&);
+ std::ofstream *fout;
+ std::ostream &output;
+};
+
+}
+
+#endif // __O_PRC_FILE_H
diff --git a/graphics/asymptote/prc/test.asy b/graphics/asymptote/prc/test.asy
new file mode 100644
index 0000000000..21463f2eef
--- /dev/null
+++ b/graphics/asymptote/prc/test.asy
@@ -0,0 +1,5 @@
+settings.outformat="pdf";
+
+import embed;
+
+label(embed("test.prc","poster,3Droo=25",1500,500));
diff --git a/graphics/asymptote/prc/test.cc b/graphics/asymptote/prc/test.cc
new file mode 100644
index 0000000000..baf942fc7d
--- /dev/null
+++ b/graphics/asymptote/prc/test.cc
@@ -0,0 +1,954 @@
+/************
+*
+* This file is part of a tool for producing 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+#include <string>
+#include "oPRCFile.h"
+
+using namespace std;
+
+extern const double pi;
+
+int main()
+{
+ #if 0
+ // List of pictures used; keep track of memory allocated to free it in the end
+ // shared pointers or garbage collector may be an alternative
+ uint8_t *picture1 = NULL;
+ uint8_t *picture2 = NULL;
+ uint8_t *picture3 = NULL;
+ uint8_t *picture4 = NULL;
+
+ oPRCFile file("test.prc");
+
+ const size_t N_COLOURS = 32;
+ RGBAColour colours[N_COLOURS];
+ for(size_t i = 0; i < N_COLOURS; ++i)
+ {
+ colours[i%N_COLOURS].R = 0.0;
+ colours[i%N_COLOURS].G = (i%N_COLOURS)/static_cast<double>(N_COLOURS);
+ colours[i%N_COLOURS].B = 0.95;
+ colours[i%N_COLOURS].A = 0.75;
+ }
+
+ PRCmaterial materials[N_COLOURS];
+ for(size_t i = 0; i < N_COLOURS; ++i)
+ {
+ materials[i%N_COLOURS].diffuse.R = 0.0;
+ materials[i%N_COLOURS].diffuse.G = (i%N_COLOURS)/static_cast<double>(N_COLOURS);
+ materials[i%N_COLOURS].diffuse.B = 0.95;
+ materials[i%N_COLOURS].diffuse.A = 0.75;
+ materials[i%N_COLOURS].specular.R = 0.01*0.0;
+ materials[i%N_COLOURS].specular.G = 0.01*(i%N_COLOURS)/static_cast<double>(N_COLOURS);
+ materials[i%N_COLOURS].specular.B = 0.01*0.95;
+ materials[i%N_COLOURS].specular.A = 0.01*0.75;
+ materials[i%N_COLOURS].emissive.R = 0.20*0.0;
+ materials[i%N_COLOURS].emissive.G = 0.20*(i%N_COLOURS)/static_cast<double>(N_COLOURS);
+ materials[i%N_COLOURS].emissive.B = 0.20*0.95;
+ materials[i%N_COLOURS].emissive.A = 0.20*0.75;
+ materials[i%N_COLOURS].ambient.R = 0.05*0.0;
+ materials[i%N_COLOURS].ambient.G = 0.05*(i%N_COLOURS)/static_cast<double>(N_COLOURS);
+ materials[i%N_COLOURS].ambient.B = 0.05*0.95;
+ materials[i%N_COLOURS].ambient.A = 0.05*0.75;
+ materials[i%N_COLOURS].alpha = 0.75;
+ materials[i%N_COLOURS].shininess = 0.1;
+ }
+
+ if(1) {
+ double knotsU[] = {1,1,1,1,2,2,2,2};
+ double knotsV[] = {1,1,1,1,2,2,2,2};
+ const size_t NUMBER_OF_PATCHES = 32;
+ double controlPoints[NUMBER_OF_PATCHES][16][3] =
+ {
+ { // Patch 0
+ {1.4,0,2.4},{1.4,-0.784,2.4},{0.784,-1.4,2.4},{0,-1.4,2.4},
+ {1.3375,0,2.53125},{1.3375,-0.749,2.53125},{0.749,-1.3375,2.53125},{0,-1.3375,2.53125},
+ {1.4375,0,2.53125},{1.4375,-0.805,2.53125},{0.805,-1.4375,2.53125},{0,-1.4375,2.53125},
+ {1.5,0,2.4},{1.5,-0.84,2.4},{0.84,-1.5,2.4},{0,-1.5,2.4},
+ },
+ { // Patch 1
+ {0,-1.4,2.4},{-0.784,-1.4,2.4},{-1.4,-0.784,2.4},{-1.4,0,2.4},
+ {0,-1.3375,2.53125},{-0.749,-1.3375,2.53125},{-1.3375,-0.749,2.53125},{-1.3375,0,2.53125},
+ {0,-1.4375,2.53125},{-0.805,-1.4375,2.53125},{-1.4375,-0.805,2.53125},{-1.4375,0,2.53125},
+ {0,-1.5,2.4},{-0.84,-1.5,2.4},{-1.5,-0.84,2.4},{-1.5,0,2.4},
+ },
+ { // Patch 2
+ {-1.4,0,2.4},{-1.4,0.784,2.4},{-0.784,1.4,2.4},{0,1.4,2.4},
+ {-1.3375,0,2.53125},{-1.3375,0.749,2.53125},{-0.749,1.3375,2.53125},{0,1.3375,2.53125},
+ {-1.4375,0,2.53125},{-1.4375,0.805,2.53125},{-0.805,1.4375,2.53125},{0,1.4375,2.53125},
+ {-1.5,0,2.4},{-1.5,0.84,2.4},{-0.84,1.5,2.4},{0,1.5,2.4},
+ },
+ { // Patch 3
+ {0,1.4,2.4},{0.784,1.4,2.4},{1.4,0.784,2.4},{1.4,0,2.4},
+ {0,1.3375,2.53125},{0.749,1.3375,2.53125},{1.3375,0.749,2.53125},{1.3375,0,2.53125},
+ {0,1.4375,2.53125},{0.805,1.4375,2.53125},{1.4375,0.805,2.53125},{1.4375,0,2.53125},
+ {0,1.5,2.4},{0.84,1.5,2.4},{1.5,0.84,2.4},{1.5,0,2.4},
+ },
+ { // Patch 4
+ {1.5,0,2.4},{1.5,-0.84,2.4},{0.84,-1.5,2.4},{0,-1.5,2.4},
+ {1.75,0,1.875},{1.75,-0.98,1.875},{0.98,-1.75,1.875},{0,-1.75,1.875},
+ {2,0,1.35},{2,-1.12,1.35},{1.12,-2,1.35},{0,-2,1.35},
+ {2,0,0.9},{2,-1.12,0.9},{1.12,-2,0.9},{0,-2,0.9},
+ },
+ { // Patch 5
+ {0,-1.5,2.4},{-0.84,-1.5,2.4},{-1.5,-0.84,2.4},{-1.5,0,2.4},
+ {0,-1.75,1.875},{-0.98,-1.75,1.875},{-1.75,-0.98,1.875},{-1.75,0,1.875},
+ {0,-2,1.35},{-1.12,-2,1.35},{-2,-1.12,1.35},{-2,0,1.35},
+ {0,-2,0.9},{-1.12,-2,0.9},{-2,-1.12,0.9},{-2,0,0.9},
+ },
+ { // Patch 6
+ {-1.5,0,2.4},{-1.5,0.84,2.4},{-0.84,1.5,2.4},{0,1.5,2.4},
+ {-1.75,0,1.875},{-1.75,0.98,1.875},{-0.98,1.75,1.875},{0,1.75,1.875},
+ {-2,0,1.35},{-2,1.12,1.35},{-1.12,2,1.35},{0,2,1.35},
+ {-2,0,0.9},{-2,1.12,0.9},{-1.12,2,0.9},{0,2,0.9},
+ },
+ { // Patch 7
+ {0,1.5,2.4},{0.84,1.5,2.4},{1.5,0.84,2.4},{1.5,0,2.4},
+ {0,1.75,1.875},{0.98,1.75,1.875},{1.75,0.98,1.875},{1.75,0,1.875},
+ {0,2,1.35},{1.12,2,1.35},{2,1.12,1.35},{2,0,1.35},
+ {0,2,0.9},{1.12,2,0.9},{2,1.12,0.9},{2,0,0.9},
+ },
+ { // Patch 8
+ {2,0,0.9},{2,-1.12,0.9},{1.12,-2,0.9},{0,-2,0.9},
+ {2,0,0.45},{2,-1.12,0.45},{1.12,-2,0.45},{0,-2,0.45},
+ {1.5,0,0.225},{1.5,-0.84,0.225},{0.84,-1.5,0.225},{0,-1.5,0.225},
+ {1.5,0,0.15},{1.5,-0.84,0.15},{0.84,-1.5,0.15},{0,-1.5,0.15},
+ },
+ { // Patch 9
+ {0,-2,0.9},{-1.12,-2,0.9},{-2,-1.12,0.9},{-2,0,0.9},
+ {0,-2,0.45},{-1.12,-2,0.45},{-2,-1.12,0.45},{-2,0,0.45},
+ {0,-1.5,0.225},{-0.84,-1.5,0.225},{-1.5,-0.84,0.225},{-1.5,0,0.225},
+ {0,-1.5,0.15},{-0.84,-1.5,0.15},{-1.5,-0.84,0.15},{-1.5,0,0.15},
+ },
+ { // Patch 10
+ {-2,0,0.9},{-2,1.12,0.9},{-1.12,2,0.9},{0,2,0.9},
+ {-2,0,0.45},{-2,1.12,0.45},{-1.12,2,0.45},{0,2,0.45},
+ {-1.5,0,0.225},{-1.5,0.84,0.225},{-0.84,1.5,0.225},{0,1.5,0.225},
+ {-1.5,0,0.15},{-1.5,0.84,0.15},{-0.84,1.5,0.15},{0,1.5,0.15},
+ },
+ { // Patch 11
+ {0,2,0.9},{1.12,2,0.9},{2,1.12,0.9},{2,0,0.9},
+ {0,2,0.45},{1.12,2,0.45},{2,1.12,0.45},{2,0,0.45},
+ {0,1.5,0.225},{0.84,1.5,0.225},{1.5,0.84,0.225},{1.5,0,0.225},
+ {0,1.5,0.15},{0.84,1.5,0.15},{1.5,0.84,0.15},{1.5,0,0.15},
+ },
+ { // Patch 12
+ {-1.6,0,2.025},{-1.6,-0.3,2.025},{-1.5,-0.3,2.25},{-1.5,0,2.25},
+ {-2.3,0,2.025},{-2.3,-0.3,2.025},{-2.5,-0.3,2.25},{-2.5,0,2.25},
+ {-2.7,0,2.025},{-2.7,-0.3,2.025},{-3,-0.3,2.25},{-3,0,2.25},
+ {-2.7,0,1.8},{-2.7,-0.3,1.8},{-3,-0.3,1.8},{-3,0,1.8},
+ },
+ { // Patch 13
+ {-1.5,0,2.25},{-1.5,0.3,2.25},{-1.6,0.3,2.025},{-1.6,0,2.025},
+ {-2.5,0,2.25},{-2.5,0.3,2.25},{-2.3,0.3,2.025},{-2.3,0,2.025},
+ {-3,0,2.25},{-3,0.3,2.25},{-2.7,0.3,2.025},{-2.7,0,2.025},
+ {-3,0,1.8},{-3,0.3,1.8},{-2.7,0.3,1.8},{-2.7,0,1.8},
+ },
+ { // Patch 14
+ {-2.7,0,1.8},{-2.7,-0.3,1.8},{-3,-0.3,1.8},{-3,0,1.8},
+ {-2.7,0,1.575},{-2.7,-0.3,1.575},{-3,-0.3,1.35},{-3,0,1.35},
+ {-2.5,0,1.125},{-2.5,-0.3,1.125},{-2.65,-0.3,0.9375},{-2.65,0,0.9375},
+ {-2,0,0.9},{-2,-0.3,0.9},{-1.9,-0.3,0.6},{-1.9,0,0.6},
+ },
+ { // Patch 15
+ {-3,0,1.8},{-3,0.3,1.8},{-2.7,0.3,1.8},{-2.7,0,1.8},
+ {-3,0,1.35},{-3,0.3,1.35},{-2.7,0.3,1.575},{-2.7,0,1.575},
+ {-2.65,0,0.9375},{-2.65,0.3,0.9375},{-2.5,0.3,1.125},{-2.5,0,1.125},
+ {-1.9,0,0.6},{-1.9,0.3,0.6},{-2,0.3,0.9},{-2,0,0.9},
+ },
+ { // Patch 16
+ {1.7,0,1.425},{1.7,-0.66,1.425},{1.7,-0.66,0.6},{1.7,0,0.6},
+ {2.6,0,1.425},{2.6,-0.66,1.425},{3.1,-0.66,0.825},{3.1,0,0.825},
+ {2.3,0,2.1},{2.3,-0.25,2.1},{2.4,-0.25,2.025},{2.4,0,2.025},
+ {2.7,0,2.4},{2.7,-0.25,2.4},{3.3,-0.25,2.4},{3.3,0,2.4},
+ },
+ { // Patch 17
+ {1.7,0,0.6},{1.7,0.66,0.6},{1.7,0.66,1.425},{1.7,0,1.425},
+ {3.1,0,0.825},{3.1,0.66,0.825},{2.6,0.66,1.425},{2.6,0,1.425},
+ {2.4,0,2.025},{2.4,0.25,2.025},{2.3,0.25,2.1},{2.3,0,2.1},
+ {3.3,0,2.4},{3.3,0.25,2.4},{2.7,0.25,2.4},{2.7,0,2.4},
+ },
+ { // Patch 18
+ {2.7,0,2.4},{2.7,-0.25,2.4},{3.3,-0.25,2.4},{3.3,0,2.4},
+ {2.8,0,2.475},{2.8,-0.25,2.475},{3.525,-0.25,2.49375},{3.525,0,2.49375},
+ {2.9,0,2.475},{2.9,-0.15,2.475},{3.45,-0.15,2.5125},{3.45,0,2.5125},
+ {2.8,0,2.4},{2.8,-0.15,2.4},{3.2,-0.15,2.4},{3.2,0,2.4},
+ },
+ { // Patch 19
+ {3.3,0,2.4},{3.3,0.25,2.4},{2.7,0.25,2.4},{2.7,0,2.4},
+ {3.525,0,2.49375},{3.525,0.25,2.49375},{2.8,0.25,2.475},{2.8,0,2.475},
+ {3.45,0,2.5125},{3.45,0.15,2.5125},{2.9,0.15,2.475},{2.9,0,2.475},
+ {3.2,0,2.4},{3.2,0.15,2.4},{2.8,0.15,2.4},{2.8,0,2.4},
+ },
+ { // Patch 20
+ {0,0,3.15},{0,0,3.15},{0,0,3.15},{0,0,3.15},
+ {0.8,0,3.15},{0.8,-0.45,3.15},{0.45,-0.8,3.15},{0,-0.8,3.15},
+ {0,0,2.85},{0,0,2.85},{0,0,2.85},{0,0,2.85},
+ {0.2,0,2.7},{0.2,-0.112,2.7},{0.112,-0.2,2.7},{0,-0.2,2.7},
+ },
+ { // Patch 21
+ {0,0,3.15},{0,0,3.15},{0,0,3.15},{0,0,3.15},
+ {0,-0.8,3.15},{-0.45,-0.8,3.15},{-0.8,-0.45,3.15},{-0.8,0,3.15},
+ {0,0,2.85},{0,0,2.85},{0,0,2.85},{0,0,2.85},
+ {0,-0.2,2.7},{-0.112,-0.2,2.7},{-0.2,-0.112,2.7},{-0.2,0,2.7},
+ },
+ { // Patch 22
+ {0,0,3.15},{0,0,3.15},{0,0,3.15},{0,0,3.15},
+ {-0.8,0,3.15},{-0.8,0.45,3.15},{-0.45,0.8,3.15},{0,0.8,3.15},
+ {0,0,2.85},{0,0,2.85},{0,0,2.85},{0,0,2.85},
+ {-0.2,0,2.7},{-0.2,0.112,2.7},{-0.112,0.2,2.7},{0,0.2,2.7},
+ },
+ { // Patch 23
+ {0,0,3.15},{0,0,3.15},{0,0,3.15},{0,0,3.15},
+ {0,0.8,3.15},{0.45,0.8,3.15},{0.8,0.45,3.15},{0.8,0,3.15},
+ {0,0,2.85},{0,0,2.85},{0,0,2.85},{0,0,2.85},
+ {0,0.2,2.7},{0.112,0.2,2.7},{0.2,0.112,2.7},{0.2,0,2.7},
+ },
+ { // Patch 24
+ {0.2,0,2.7},{0.2,-0.112,2.7},{0.112,-0.2,2.7},{0,-0.2,2.7},
+ {0.4,0,2.55},{0.4,-0.224,2.55},{0.224,-0.4,2.55},{0,-0.4,2.55},
+ {1.3,0,2.55},{1.3,-0.728,2.55},{0.728,-1.3,2.55},{0,-1.3,2.55},
+ {1.3,0,2.4},{1.3,-0.728,2.4},{0.728,-1.3,2.4},{0,-1.3,2.4},
+ },
+ { // Patch 25
+ {0,-0.2,2.7},{-0.112,-0.2,2.7},{-0.2,-0.112,2.7},{-0.2,0,2.7},
+ {0,-0.4,2.55},{-0.224,-0.4,2.55},{-0.4,-0.224,2.55},{-0.4,0,2.55},
+ {0,-1.3,2.55},{-0.728,-1.3,2.55},{-1.3,-0.728,2.55},{-1.3,0,2.55},
+ {0,-1.3,2.4},{-0.728,-1.3,2.4},{-1.3,-0.728,2.4},{-1.3,0,2.4},
+ },
+ { // Patch 26
+ {-0.2,0,2.7},{-0.2,0.112,2.7},{-0.112,0.2,2.7},{0,0.2,2.7},
+ {-0.4,0,2.55},{-0.4,0.224,2.55},{-0.224,0.4,2.55},{0,0.4,2.55},
+ {-1.3,0,2.55},{-1.3,0.728,2.55},{-0.728,1.3,2.55},{0,1.3,2.55},
+ {-1.3,0,2.4},{-1.3,0.728,2.4},{-0.728,1.3,2.4},{0,1.3,2.4},
+ },
+ { // Patch 27
+ {0,0.2,2.7},{0.112,0.2,2.7},{0.2,0.112,2.7},{0.2,0,2.7},
+ {0,0.4,2.55},{0.224,0.4,2.55},{0.4,0.224,2.55},{0.4,0,2.55},
+ {0,1.3,2.55},{0.728,1.3,2.55},{1.3,0.728,2.55},{1.3,0,2.55},
+ {0,1.3,2.4},{0.728,1.3,2.4},{1.3,0.728,2.4},{1.3,0,2.4},
+ },
+ { // Patch 28
+ {0,0,0},{0,0,0},{0,0,0},{0,0,0},
+ {1.425,0,0},{1.425,0.798,0},{0.798,1.425,0},{0,1.425,0},
+ {1.5,0,0.075},{1.5,0.84,0.075},{0.84,1.5,0.075},{0,1.5,0.075},
+ {1.5,0,0.15},{1.5,0.84,0.15},{0.84,1.5,0.15},{0,1.5,0.15},
+ },
+ { // Patch 29
+ {0,0,0},{0,0,0},{0,0,0},{0,0,0},
+ {0,1.425,0},{-0.798,1.425,0},{-1.425,0.798,0},{-1.425,0,0},
+ {0,1.5,0.075},{-0.84,1.5,0.075},{-1.5,0.84,0.075},{-1.5,0,0.075},
+ {0,1.5,0.15},{-0.84,1.5,0.15},{-1.5,0.84,0.15},{-1.5,0,0.15},
+ },
+ { // Patch 30
+ {0,0,0},{0,0,0},{0,0,0},{0,0,0},
+ {-1.425,0,0},{-1.425,-0.798,0},{-0.798,-1.425,0},{0,-1.425,0},
+ {-1.5,0,0.075},{-1.5,-0.84,0.075},{-0.84,-1.5,0.075},{0,-1.5,0.075},
+ {-1.5,0,0.15},{-1.5,-0.84,0.15},{-0.84,-1.5,0.15},{0,-1.5,0.15},
+ },
+ { // Patch 31
+ {0,0,0},{0,0,0},{0,0,0},{0,0,0},
+ {0,-1.425,0},{0.798,-1.425,0},{1.425,-0.798,0},{1.425,0,0},
+ {0,-1.5,0.075},{0.84,-1.5,0.075},{1.5,-0.84,0.075},{1.5,0,0.075},
+ {0,-1.5,0.15},{0.84,-1.5,0.15},{1.5,-0.84,0.15},{1.5,0,0.15},
+ },
+ };
+ file.begingroup("Teapot");
+ for(size_t i = 0; i < NUMBER_OF_PATCHES; ++i)
+ {
+ if(1) file.addPatch(controlPoints[i],materials[i%N_COLOURS]);
+ if(0) file.addSurface(3,3,4,4,controlPoints[i],knotsU,knotsV,materials[i%N_COLOURS],NULL); // use (too) general API for the same result as above
+ }
+ file.endgroup();
+
+ double t[4][4];
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=6;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=0;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+
+ PRCoptions teapotopt;
+ teapotopt.no_break = true;
+ teapotopt.do_break = false;
+ teapotopt.compression = 0.0001;
+ // force joining together of patches, damaging transparency
+ file.begingroup("Teapot rendered in the way of opaque surfaces and transferred",&teapotopt,t);
+ for(size_t i = 0; i < NUMBER_OF_PATCHES; ++i)
+ {
+ file.addPatch(controlPoints[i],materials[i%N_COLOURS]);
+ }
+ file.endgroup();
+ }
+
+ const size_t NUMBER_OF_POINTS = 31;
+ double points[NUMBER_OF_POINTS][3];
+ for(size_t i = 0; i < NUMBER_OF_POINTS; ++i)
+ {
+ points[i][0] = 3.5*cos(3.0*i/NUMBER_OF_POINTS*2.0*pi);
+ points[i][1] = 3.5*sin(3.0*i/NUMBER_OF_POINTS*2.0*pi);
+ points[i][2] = 5.0*i/NUMBER_OF_POINTS-1.0;
+ }
+ const size_t NUMBER_OF_WIRES = 2;
+ double shifted_points[NUMBER_OF_WIRES][NUMBER_OF_POINTS][3];
+ for(size_t wire = 0; wire < NUMBER_OF_WIRES; ++wire)
+ for(size_t point = 0; point < NUMBER_OF_POINTS; ++point)
+ {
+ shifted_points[wire][point][0] = points[point][0];
+ shifted_points[wire][point][1] = points[point][1];
+ shifted_points[wire][point][2] = points[point][2]+0.1*wire+0.1;
+ }
+ double knots[3+NUMBER_OF_POINTS+1];
+ knots[0] = 1;
+ for(size_t i = 1; i < 3+NUMBER_OF_POINTS; ++i)
+ {
+ knots[i] = (i+2)/3; // integer division is intentional
+ }
+ knots[3+NUMBER_OF_POINTS] = (3+NUMBER_OF_POINTS+1)/3;
+
+ PRCoptions grpopt;
+ grpopt.no_break = true;
+ grpopt.do_break = false;
+ grpopt.tess = true;
+ if(1){
+ double point1[3] = {11,0,0};
+ double point2[3] = {12,0,0};
+ double points[2][3] = {{9,0,0},{10,0,0}};
+ file.begingroup("points",&grpopt);
+ file.addPoint(point1, RGBAColour(1.0,0.0,0.0));
+ file.addPoint(point2, RGBAColour(1.0,0.0,0.0));
+ file.addPoints(2, points, RGBAColour(1.0,0.0,0.0,0.5),10);
+ file.endgroup();
+ }
+
+ if(1){
+ PRCoptions grpopt;
+ grpopt.no_break = true;
+ grpopt.do_break = false;
+ grpopt.tess = true;
+ grpopt.closed = true;
+
+ double t[4][4];
+
+ const size_t nP = 5;
+ double P[nP][3] = {{0,0,0},{1,0,0},{1,1,0},{0,1,0},{0,2,0}};
+ const size_t nI = 3;
+ uint32_t PI[nI][3] = {{0,1,3},{1,2,3},{3,2,4}};
+ const size_t nM = 2;
+ PRCmaterial M[nM];
+ M[0] = PRCmaterial(
+ RGBAColour(0.0,0.0,0.18),
+ RGBAColour(0.0,0.0,0.878431),
+ RGBAColour(0.0,0.0,0.32),
+ RGBAColour(0.0,0.0,0.072),
+ 1.0,0.1);
+ M[1] = PRCmaterial(
+ RGBAColour(0.18,0.0,0.0),
+ RGBAColour(0.878431,0.0,0.0),
+ RGBAColour(0.32,0.0,0.0),
+ RGBAColour(0.072,0.0,0.0),
+ 0.5,0.1);
+ uint32_t MI[nI] = {0,1,0};
+ const size_t nN = 2;
+ double N[nN][3] = {{0,0,1},{0,0,-1}};
+ uint32_t NI[nI][3] = {{0,0,0},{0,0,0},{1,1,1}};
+
+ const uint32_t nC = 3;
+ RGBAColour C[nC];
+ uint32_t CI[nI][3] = {{0,0,0},{1,1,1},{1,1,2}};
+
+ PRCmaterial materialGreen(
+ RGBAColour(0.0,0.18,0.0),
+ RGBAColour(0.0,0.878431,0.0),
+ RGBAColour(0.0,0.32,0.0),
+ RGBAColour(0.0,0.072,0.0),
+ 1.0,0.1);
+
+ if(1){
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=-1;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ file.begingroup("triangles_onecolor_with_normals",&grpopt,t);
+ file.addTriangles(nP, P, nI, PI, materialGreen, nN, N, NI, 0, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL);
+ file.endgroup();
+ }
+
+ if(1){
+ file.begingroup("triangles_onecolor",&grpopt);
+ file.addTriangles(nP, P, nI, PI, materialGreen, 0, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL);
+ file.endgroup();
+ }
+
+ if(1){
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=1;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ file.begingroup("triangles_manymaterials",&grpopt,t);
+ file.addTriangles(nP, P, nI, PI, materialGreen, 0, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, nM, M, MI);
+ file.endgroup();
+ }
+
+ if(1){
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=2;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ PRCmaterial materialBase(
+ RGBAColour(0.1,0.1,0.1,1),
+ RGBAColour(1,1,1,1),
+ RGBAColour(0.1,0.1,0.1,1),
+ RGBAColour(0.1,0.1,0.1,1),
+ 1.0,0.1);
+ C[0] = RGBAColour(1,0,0,0.1);
+ C[1] = RGBAColour(0,1,0,0.5);
+ C[2] = RGBAColour(0,0,1,0.9);
+ file.begingroup("triangles_rgba_vertexcolors_on_opaque_a_component_of_vertexcolor_ignored",&grpopt,t);
+ file.addTriangles(nP, P, nI, PI, materialBase, 0, NULL, NULL, 0, NULL, NULL, nC, C, CI, 0, NULL, NULL);
+ file.endgroup();
+
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=3;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ PRCmaterial materialTransparent(
+ RGBAColour(0.1,0.1,0.1,0.3),
+ RGBAColour(1,1,1,0.3),
+ RGBAColour(0.1,0.1,0.1,0.3),
+ RGBAColour(0.1,0.1,0.1,0.3),
+ 0.3,0.1);
+ C[0] = RGBAColour(1,0,0,0.1);
+ C[1] = RGBAColour(0,1,0,0.5);
+ C[2] = RGBAColour(0,0,1,0.9);
+ file.begingroup("triangles_rgba_vertexcolors_on_transparent_a_component_of_vertexcolor_ignored",&grpopt,t);
+ file.addTriangles(nP, P, nI, PI, materialTransparent, 0, NULL, NULL, 0, NULL, NULL, nC, C, CI, 0, NULL, NULL);
+ file.endgroup();
+
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=4;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ C[0] = RGBAColour(1,0,0,0.5);
+ C[1] = RGBAColour(0,1,0,0.5);
+ C[2] = RGBAColour(0,0,1,0.5);
+ file.begingroup("triangles_rgb_vertexcolors_on_transparent_may_not_work_in_OpenGL",&grpopt,t);
+ file.addTriangles(nP, P, nI, PI, materialTransparent, 0, NULL, NULL, 0, NULL, NULL, nC, C, CI, 0, NULL, NULL);
+ file.endgroup();
+ }
+
+ if(1){
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=5;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ const uint32_t picture_width=2;
+ const uint32_t picture_height=2;
+ const uint8_t picRGB[picture_width*picture_height*3] =
+ {255,0,0, 0,255,0, 0,0,255, 0,0,0 };
+// {255,255,0, 255,0,0, 255,0,0, 255,0,0 };
+// { 255,0,0, 255,255,0, 255,255,0, 255,255,255 };
+// {255,0,0, 0,255,0, 0,0,255, 0,0,0 };
+
+ const uint8_t picRGBA[picture_width*picture_height*4] =
+ {255,0,0,255, 0,255,0,150, 0,0,255,150, 0,0,0,100 };
+// (1,0) 2 3 (1,1)
+// (0,0) 0 1 (1,0)
+ uint8_t *pictureRGB = new uint8_t[picture_width*picture_height*3];
+ for(size_t i=0; i<picture_width*picture_height*3; i++) pictureRGB[i]=picRGB[i];
+ picture1 = pictureRGB;
+ uint8_t *pictureRGBA = new uint8_t[picture_width*picture_height*4];
+ for(size_t i=0; i<picture_width*picture_height*4; i++) pictureRGBA[i]=picRGBA[i];
+ picture2 = pictureRGBA;
+ const uint32_t nT = 4;
+ const double T[nT][2] = { {0.1,0.1}, {0.9,0.1}, {0.9,0.9}, {0.9,0.1} };
+ uint32_t TI[nI][3] = {{0,1,3},{1,2,3},{3,2,3}};
+
+ PRCmaterial materialBase(
+ RGBAColour(0.1,0.1,0.1,1),
+ RGBAColour(1,1,1,1),
+ RGBAColour(0.1,0.1,0.1,1),
+ RGBAColour(0.1,0.1,0.1,1),
+ 1.0,0.1,
+ pictureRGB, picture_width, picture_height, false, false);
+ file.begingroup("triangles_rgb_texture",&grpopt,t);
+ file.addTriangles(nP, P, nI, PI, materialBase, 0, NULL, NULL, nT, T, TI, 0, NULL, NULL, 0, NULL, NULL);
+ file.endgroup();
+
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=6;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ PRCmaterial materialTransparent(
+ RGBAColour(0.1,0.1,0.1,0.3),
+ RGBAColour(1,1,1,0.3),
+ RGBAColour(0.1,0.1,0.1,0.3),
+ RGBAColour(0.1,0.1,0.1,0.3),
+ 0.3,0.1,
+ pictureRGBA, picture_width, picture_height, true, true);
+ file.begingroup("triangles_rgba_texture_replacing",&grpopt,t);
+ file.addTriangles(nP, P, nI, PI, materialTransparent, 0, NULL, NULL, nT, T, TI, 0, NULL, NULL, 0, NULL, NULL);
+ file.endgroup();
+ }
+
+ }
+
+ if(1){
+ PRCoptions grpopt;
+ grpopt.no_break = true;
+ grpopt.do_break = false;
+ grpopt.tess = true;
+ grpopt.closed = true;
+
+ double t[4][4];
+
+ const size_t nP = 6;
+ double P[nP][3] = {{3+0,0,0},{3+1,0,0},{3+0,1,0},{3+1,1,0},{3+0,2,0},{3+1,2,0}};
+ const size_t nI = 2;
+ uint32_t PI[nI][4] = {{0,1,3,2},{2,3,5,4}};
+ const size_t nM = 2;
+ PRCmaterial M[nM];
+ M[0] = PRCmaterial(
+ RGBAColour(0.0,0.0,0.18),
+ RGBAColour(0.0,0.0,0.878431),
+ RGBAColour(0.0,0.0,0.32),
+ RGBAColour(0.0,0.0,0.072),
+ 1.0,0.1);
+ M[1] = PRCmaterial(
+ RGBAColour(0.18,0.0,0.0),
+ RGBAColour(0.878431,0.0,0.0),
+ RGBAColour(0.32,0.0,0.0),
+ RGBAColour(0.072,0.0,0.0),
+ 0.5,0.1);
+ uint32_t MI[nI] = {0,1};
+ const size_t nN = 2;
+ double N[nN][3] = {{0,0,1},{0,0,-1}};
+ uint32_t NI[nI][4] = {{0,0,0,0},{1,1,1,1}};
+
+ const uint32_t nC = 3;
+ RGBAColour C[nC];
+ uint32_t CI[nI][4] = {{0,0,1,1},{1,1,2,2}};
+ C[0] = RGBAColour(1,0,0,0.5);
+ C[1] = RGBAColour(0,1,0,0.5);
+ C[2] = RGBAColour(0,0,1,0.5);
+
+ PRCmaterial materialGreen(
+ RGBAColour(0.0,0.18,0.0),
+ RGBAColour(0.0,0.878431,0.0),
+ RGBAColour(0.0,0.32,0.0),
+ RGBAColour(0.0,0.072,0.0),
+ 1.0,0.1);
+
+ PRCmaterial materialBase(
+ RGBAColour(0.1,0.1,0.1,1),
+ RGBAColour(1,1,1,1),
+ RGBAColour(0.1,0.1,0.1,1),
+ RGBAColour(0.1,0.1,0.1,1),
+ 1.0,0.1);
+
+ PRCmaterial materialTransparent(
+ RGBAColour(0.1,0.1,0.1,0.3),
+ RGBAColour(1,1,1,0.3),
+ RGBAColour(0.1,0.1,0.1,0.3),
+ RGBAColour(0.1,0.1,0.1,0.3),
+ 0.3,0.1);
+
+ if(1){
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=-1;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ file.begingroup("quads_onecolor_with_normals",&grpopt,t);
+ file.addQuads(nP, P, nI, PI, materialGreen, nN, N, NI, 0, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL);
+ file.endgroup();
+ }
+
+ if(1){
+ file.begingroup("quads_onecolor",&grpopt);
+ file.addQuads(nP, P, nI, PI, materialGreen, 0, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL);
+ file.endgroup();
+ }
+
+ if(1){
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=1;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ file.begingroup("quads_manymaterials",&grpopt,t);
+ file.addQuads(nP, P, nI, PI, materialGreen, 0, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, nM, M, MI);
+ file.endgroup();
+ }
+
+ if(1){
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=2;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ file.begingroup("quads_rgb_vertexcolors_on_transparent_may_not_work_in_OpenGL",&grpopt,t);
+ file.addQuads(nP, P, nI, PI, materialTransparent, 0, NULL, NULL, 0, NULL, NULL, nC, C, CI, 0, NULL, NULL);
+ file.endgroup();
+ }
+
+ if(1){
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=5;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ const uint32_t picture_width=2;
+ const uint32_t picture_height=2;
+ const uint8_t picRGB[picture_width*picture_height*3] =
+ {255,0,0, 0,255,0, 0,0,255, 0,0,0 };
+// {255,255,0, 255,0,0, 255,0,0, 255,0,0 };
+// { 255,0,0, 255,255,0, 255,255,0, 255,255,255 };
+// {255,0,0, 0,255,0, 0,0,255, 0,0,0 };
+
+ const uint8_t picRGBA[picture_width*picture_height*4] =
+ {255,0,0,255, 0,255,0,150, 0,0,255,150, 0,0,0,100 };
+// (1,0) 2 3 (1,1)
+// (0,0) 0 1 (1,0)
+ uint8_t *pictureRGB = new uint8_t[picture_width*picture_height*3];
+ for(size_t i=0; i<picture_width*picture_height*3; i++) pictureRGB[i]=picRGB[i];
+ picture3 = pictureRGB;
+ uint8_t *pictureRGBA = new uint8_t[picture_width*picture_height*4];
+ for(size_t i=0; i<picture_width*picture_height*4; i++) pictureRGBA[i]=picRGBA[i];
+ picture4 = pictureRGBA;
+ const uint32_t nT = 3;
+ const double T[nT][2] = { {0.1,0.1}, {0.5,0.5}, {0.9,0.9} };
+ uint32_t TI[nI][4] = {{0,0,1,1},{1,1,2,2}};
+
+ PRCmaterial materialBase(
+ RGBAColour(0.1,0.1,0.1,1),
+ RGBAColour(1,1,1,1),
+ RGBAColour(0.1,0.1,0.1,1),
+ RGBAColour(0.1,0.1,0.1,1),
+ 1.0,0.1,
+ pictureRGB, picture_width, picture_height, false, false);
+ file.begingroup("quads_rgb_texture",&grpopt,t);
+ file.addQuads(nP, P, nI, PI, materialBase, 0, NULL, NULL, nT, T, TI, 0, NULL, NULL, 0, NULL, NULL);
+ file.endgroup();
+
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=6;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ PRCmaterial materialTransparent(
+ RGBAColour(0.1,0.1,0.1,0.3),
+ RGBAColour(1,1,1,0.3),
+ RGBAColour(0.1,0.1,0.1,0.3),
+ RGBAColour(0.1,0.1,0.1,0.3),
+ 0.6,0.1,
+ pictureRGBA, picture_width, picture_height, true, true);
+ file.begingroup("quads_rgba_texture_replacing",&grpopt,t);
+ file.addQuads(nP, P, nI, PI, materialTransparent, 0, NULL, NULL, nT, T, TI, 0, NULL, NULL, 0, NULL, NULL);
+ file.endgroup();
+ }
+
+ }
+
+ if(1){
+ file.begingroup("polyline",&grpopt);
+ file.addLine(NUMBER_OF_POINTS, points, RGBAColour(1.0,0.0,0.0));
+ file.endgroup();
+
+ file.begingroup("polylines",&grpopt);
+ file.addLine(NUMBER_OF_POINTS, shifted_points[0], RGBAColour(0.0,1.0,0.0),2.0);
+ file.addLine(NUMBER_OF_POINTS, shifted_points[1], RGBAColour(1.0,1.0,0.0),2.0);
+ file.endgroup();
+ }
+
+ if(1){
+ PRCoptions grpopt;
+ grpopt.no_break = true;
+ grpopt.do_break = false;
+ grpopt.tess = true;
+ grpopt.closed = true;
+
+ double t[4][4];
+
+ const size_t nP = 5;
+ double P[nP][3] = {{0,0,0},{1,0,0},{1,1,0},{0,1,0},{0,2,0}};
+ const size_t nI = 1+5 + 1+3;
+ uint32_t PI[nI] = {5,0,1,2,3,0, 3,2,4,3 }; // square of 5 points, wire of 2 points
+ const uint32_t nC = 5; // number of colors
+ RGBAColour C[nC]; // color for segments
+ C[0] = RGBAColour(1,0,0);
+ C[1] = RGBAColour(0,1,0);
+ C[2] = RGBAColour(0,0,1);
+ C[3] = RGBAColour(0,0,0);
+ C[4] = RGBAColour(1,1,0);
+ const uint32_t nCI = 5-1 + 3-1; // number of segments
+ uint32_t CI[nCI] = { 0,1,2,3, 4,4 };
+
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=5;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ file.begingroup("polyline_indexed_one_color",&grpopt,t);
+ file.addLines(nP, P, nI, PI, RGBAColour(1,0,0), 1, false, 0, NULL, 0, NULL);
+ file.endgroup();
+
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=6;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ file.begingroup("polyline_indexed_color_per_segment",&grpopt,t);
+ file.addLines(nP, P, nI, PI, RGBAColour(1,0,0), 2, true, nC, C, nCI, CI);
+ file.endgroup();
+
+ t[0][0]=1; t[0][1]=0; t[0][2]=0; t[0][3]=0;
+ t[1][0]=0; t[1][1]=1; t[1][2]=0; t[1][3]=0;
+ t[2][0]=0; t[2][1]=0; t[2][2]=1; t[2][3]=7;
+ t[3][0]=0; t[3][1]=0; t[3][2]=0; t[3][3]=1;
+ const uint32_t nCI2 = 5 + 3; // number of vertices
+ uint32_t CI2[nCI2] = { 0,1,2,3,0, 4,4,4 };
+ file.begingroup("polyline_indexed_color_per_vertex_is_broken",&grpopt,t);
+ file.addLines(nP, P, nI, PI, RGBAColour(1,0,0), 2, false, nC, C, nCI2, CI2);
+ file.endgroup();
+ }
+
+ if(1)
+ {
+ file.begingroup("bezier_wire");
+ file.addBezierCurve(NUMBER_OF_POINTS,points,RGBAColour(1.0,1.0,1.0));
+ file.endgroup();
+ }
+ if(1)
+ {
+ file.begingroup("NURBS_wire");
+ file.addCurve(3, NUMBER_OF_POINTS, points, knots, RGBAColour(1.0,1.0,1.0), NULL); // genarl API for the above
+ file.endgroup();
+ }
+
+// following box examples show a) different ways to represent a surface consisting of flat rectangles
+// b) that the only way to have almost working transparency is a set of NURBS bodies.
+// (Or may be other topology types like plane also work
+// demonstration how non-transparent materials work the same for all kinds of objects
+
+ if(1) { // demonstration how non-transparent materials work the same for all kinds of objects
+ const size_t NUMBER_OF_PATCHES = 6;
+ double vertices[NUMBER_OF_PATCHES][4][3] =
+ {
+ { // Patch 0
+ {-1,-1,-1},
+ { 1,-1,-1},
+ {-1, 1,-1},
+ { 1, 1,-1}
+ },
+ { // Patch 1
+ {-1,-1, 1},
+ { 1,-1, 1},
+ {-1, 1, 1},
+ { 1, 1, 1}
+ },
+ { // Patch 2
+ {-1,-1,-1},
+ { 1,-1,-1},
+ {-1,-1, 1},
+ { 1,-1, 1}
+ },
+ { // Patch 3
+ {-1, 1,-1},
+ { 1, 1,-1},
+ {-1, 1, 1},
+ { 1, 1, 1}
+ },
+ { // Patch 4
+ {-1,-1,-1},
+ {-1, 1,-1},
+ {-1,-1, 1},
+ {-1, 1, 1}
+ },
+ { // Patch 5
+ { 1,-1,-1},
+ { 1, 1,-1},
+ { 1,-1, 1},
+ { 1, 1, 1}
+ }
+ };
+ const size_t NUMBER_OF_BOXES = 6;
+ double shifted_vertices[NUMBER_OF_BOXES][NUMBER_OF_PATCHES][4][3];
+ for(size_t box = 0; box < NUMBER_OF_BOXES; ++box)
+ for(size_t patch = 0; patch < NUMBER_OF_PATCHES; ++patch)
+ for(size_t i = 0; i < 4; ++i)
+ {
+ shifted_vertices[box][patch][i][0] = vertices[patch][i][0]+3*box;
+ shifted_vertices[box][patch][i][1] = vertices[patch][i][1];
+ shifted_vertices[box][patch][i][2] = vertices[patch][i][2]-2;
+ }
+ PRCmaterial materialGreen(
+ RGBAColour(0.0,0.18,0.0),
+ RGBAColour(0.0,0.878431,0.0),
+ RGBAColour(0.0,0.32,0.0),
+ RGBAColour(0.0,0.072,0.0),
+ 1.0,0.1);
+
+ PRCoptions grpopt;
+ file.begingroup("TransparentBox");
+ grpopt.no_break = false;
+ grpopt.do_break = true;
+ grpopt.tess = false;
+ file.begingroup("TransparentBoxSetOfNURBSBodies",&grpopt);
+ for(size_t patch = 0; patch < NUMBER_OF_PATCHES; ++patch)
+ {
+ file.addRectangle(shifted_vertices[0][patch], materials[(patch*5)%N_COLOURS]);
+ }
+ file.endgroup();
+ grpopt.no_break = true;
+ grpopt.do_break = false;
+ grpopt.tess = false;
+ file.begingroup("TransparentBoxNURBSFaces",&grpopt);
+ for(size_t patch = 0; patch < NUMBER_OF_PATCHES; ++patch)
+ {
+ file.addRectangle(shifted_vertices[1][patch], materials[(patch*5)%N_COLOURS]);
+ }
+ file.endgroup();
+ grpopt.no_break = true;
+ grpopt.do_break = false;
+ grpopt.tess = true;
+ file.begingroup("TransparentBoxTessellated",&grpopt);
+ for(size_t patch = 0; patch < NUMBER_OF_PATCHES; ++patch)
+ {
+ file.addRectangle(shifted_vertices[2][patch], materials[(patch*5)%N_COLOURS]);
+ }
+ file.endgroup();
+ file.endgroup();
+
+ file.begingroup("Box");
+ grpopt.no_break = false;
+ grpopt.do_break = false;
+ grpopt.tess = true;
+ file.begingroup("BoxTessellated",&grpopt);
+ for(size_t patch = 0; patch < NUMBER_OF_PATCHES; ++patch)
+ {
+ file.addRectangle(shifted_vertices[3][patch], materialGreen);
+ }
+ file.endgroup();
+ grpopt.no_break = true;
+ grpopt.do_break = false;
+ grpopt.tess = false;
+ file.begingroup("BoxNURBSFaces",&grpopt);
+ for(size_t patch = 0; patch < NUMBER_OF_PATCHES; ++patch)
+ {
+ file.addRectangle(shifted_vertices[4][patch], materialGreen);
+ }
+ file.endgroup();
+ grpopt.no_break = false;
+ grpopt.do_break = true;
+ grpopt.tess = false;
+ file.begingroup("BoxSetOfNURBSBodies",&grpopt);
+ for(size_t patch = 0; patch < NUMBER_OF_PATCHES; ++patch)
+ {
+ file.addRectangle(shifted_vertices[5][patch], materialGreen);
+ }
+ file.endgroup();
+ file.endgroup();
+ }
+
+ if(1) {
+ PRCmaterial materialGreen(
+ RGBAColour(0.0,0.18,0.0),
+ RGBAColour(0.0,0.878431,0.0),
+ RGBAColour(0.0,0.32,0.0),
+ RGBAColour(0.0,0.072,0.0),
+ 1.0,0.1);
+ PRCoptions grpopt;
+ grpopt.closed = true;
+
+ file.begingroup("Complex elements, one-sided");
+
+ const double disk_origin[3] = {11,0,2};
+ const double disk_x_axis[3] = {1,0,0};
+ const double disk_y_axis[3] = {0,-1,0};
+ const double disk_scale = 2;
+ file.begingroup("disk",&grpopt);
+ file.addDisk(1,materialGreen,disk_origin,disk_x_axis,disk_y_axis,disk_scale);
+ file.endgroup();
+ const double hs_origin[3] = {11,0,2};
+ const double hs_x_axis[3] = {1,0,0};
+ const double hs_y_axis[3] = {0,1,0};
+ const double hs_scale = 2;
+ file.begingroup("hemisphere",&grpopt);
+ file.addHemisphere(1,materialGreen,hs_origin,hs_x_axis,hs_y_axis,hs_scale);
+ file.endgroup();
+ const double cyl_origin[3] = {11,0,1};
+ const double cyl_x_axis[3] = {1,0,0};
+ const double cyl_y_axis[3] = {0,1,0};
+ const double cyl_scale = 1;
+ file.begingroup("cylinder",&grpopt);
+ file.addCylinder(1,1,materialGreen,cyl_origin,cyl_x_axis,cyl_y_axis,cyl_scale);
+ file.endgroup();
+ const double cone_origin[3] = {11,0,1};
+ const double cone_x_axis[3] = {1,0,0};
+ const double cone_y_axis[3] = {0,-1,0};
+ const double cone_scale = 1;
+ file.begingroup("cone",&grpopt);
+ file.addCone(1,1,materialGreen,cone_origin,cone_x_axis,cone_y_axis,cone_scale);
+ file.endgroup();
+ const double sp_origin[3] = {11,0,-1};
+ const double sp_x_axis[3] = {1,0,0};
+ const double sp_y_axis[3] = {0,1,0};
+ const double sp_scale = 1;
+ file.begingroup("sphere",&grpopt);
+ file.addSphere(0.5,materialGreen,sp_origin,sp_x_axis,sp_y_axis,sp_scale);
+ file.endgroup();
+ const double tor_origin[3] = {11,0,0};
+ const double tor_x_axis[3] = {1,0,0};
+ const double tor_y_axis[3] = {0,1,0};
+ const double tor_scale = 1;
+ file.begingroup("torus",&grpopt);
+ file.addTorus(0.5,0.1,0,360,materialGreen,tor_origin,tor_x_axis,tor_y_axis,tor_scale);
+ file.endgroup();
+
+ const size_t NUMBER_OF_POINTS = 4;
+ double cpoints[NUMBER_OF_POINTS][3];
+ cpoints[0][0] = 1; cpoints[0][1] = 0; cpoints[0][2] = 0;
+ cpoints[1][0] = 1; cpoints[1][1] = 0.552284749830793; cpoints[1][2] = 0;
+ cpoints[2][0] = 0.552284749830793; cpoints[2][1] = 1; cpoints[2][2] = 0;
+ cpoints[3][0] = 0; cpoints[3][1] = 1; cpoints[3][2] = 0;
+ double opoints[NUMBER_OF_POINTS][3];
+ opoints[0][0] = 1.1*1; opoints[0][1] = 1.1*0; opoints[0][2] = 0;
+ opoints[1][0] = 1.1*1; opoints[1][1] = 1.1*0.552284749830793; opoints[1][2] = 0;
+ opoints[2][0] = 1.1*0.552284749830793; opoints[2][1] = 1.1*1; opoints[2][2] = 0;
+ opoints[3][0] = 1.1*0; opoints[3][1] = 1.1*1; opoints[3][2] = 0;
+ const double tube_origin[3] = {11,0,0};
+ const double tube_x_axis[3] = {1,0,0};
+ const double tube_y_axis[3] = {0,1,0};
+ const double tube_scale = 1;
+ file.begingroup("tube",&grpopt);
+ file.addTube(NUMBER_OF_POINTS,cpoints,opoints,false,materialGreen,tube_origin,tube_x_axis,tube_y_axis,tube_scale);
+ file.endgroup();
+
+ file.endgroup();
+ }
+
+ file.finish();
+
+ delete[] picture1;
+ delete[] picture2;
+ delete[] picture3;
+ delete[] picture4;
+
+#endif
+ return 0;
+}
+
diff --git a/graphics/asymptote/prc/writePRC.cc b/graphics/asymptote/prc/writePRC.cc
new file mode 100644
index 0000000000..a2877b0899
--- /dev/null
+++ b/graphics/asymptote/prc/writePRC.cc
@@ -0,0 +1,2085 @@
+/************
+*
+* This file is part of a tool for producing 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#include "writePRC.h"
+#include <climits>
+#include <cassert>
+
+// debug print includes
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <sstream>
+
+#if !defined(__GNUC__) || defined(__clang__)
+#include <vector>
+#endif
+
+using namespace std;
+
+#ifndef __GNUC_PREREQ
+#define __GNUC_PREREQ(maj, min) (0)
+#endif
+
+// Count leading zeros.
+uint32_t CLZ(uint32_t a)
+{
+#if __GNUC_PREREQ(3,4)
+ return __builtin_clz(a);
+#else
+// find the log base 2 of a 32-bit integer
+ static const int MultiplyDeBruijnBitPosition[32] = {
+ 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30,
+ 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31
+ };
+
+ a |= a >> 1; // first round down to one less than a power of 2
+ a |= a >> 2;
+ a |= a >> 4;
+ a |= a >> 8;
+ a |= a >> 16;
+
+ return 31-MultiplyDeBruijnBitPosition[(uint32_t)(a * 0x07C4ACDDU) >> 27];
+#endif
+}
+
+// Portable integer implementation of ceil(log2(x)).
+uint32_t Log2(uint32_t x)
+{
+ assert(x != 0);
+ uint32_t L=31-CLZ(x);
+ return ((uint32_t) 1 << L == x) ? L : L+1;
+}
+
+#define WriteUnsignedInteger( value ) pbs << (uint32_t)(value);
+#define WriteInteger( value ) pbs << (int32_t)(value);
+#define WriteCharacter( value ) pbs << (uint8_t)(value);
+#define WriteDouble( value ) pbs << (double)(value);
+#define WriteBit( value ) pbs << (bool)(value);
+#define WriteBoolean( value ) pbs << (bool)(value);
+#define WriteString( value ) pbs << (value);
+#define SerializeContentPRCBase serializeContentPRCBase(pbs);
+#define SerializeGraphics serializeGraphics(pbs);
+#define SerializePRCBaseWithGraphics { serializeContentPRCBase(pbs); serializeGraphics(pbs); }
+#define SerializeRepresentationItemContent serializeRepresentationItemContent(pbs);
+#define SerializeRepresentationItem( value ) (value)->serializeRepresentationItem(pbs);
+#define SerializeMarkup( value ) (value).serializeMarkup(pbs);
+#define SerializeReferenceUniqueIdentifier( value ) (value).serializeReferenceUniqueIdentifier(pbs);
+#define SerializeContentBaseTessData serializeContentBaseTessData(pbs);
+#define SerializeTessFace( value ) (value)->serializeTessFace(pbs);
+#define SerializeUserData UserData(0,0).write(pbs);
+#define SerializeLineAttr( value ) pbs << (uint32_t)((value)+1);
+#define SerializeVector3d( value ) (value).serializeVector3d(pbs);
+#define SerializeVector2d( value ) (value).serializeVector2d(pbs);
+#define SerializeName( value ) writeName(pbs, (value));
+#define SerializeInterval( value ) (value).serializeInterval(pbs);
+// #define SerializeBoundingBox( value ) (value).serializeBoundingBox(pbs);
+#define SerializeDomain( value ) (value).serializeDomain(pbs);
+#define SerializeParameterization serializeParameterization(pbs);
+#define SerializeUVParameterization serializeUVParameterization(pbs);
+#define SerializeTransformation serializeTransformation(pbs);
+#define SerializeBaseTopology serializeBaseTopology(pbs);
+#define SerializeBaseGeometry serializeBaseGeometry(pbs);
+#define SerializePtrCurve( value ) {WriteBoolean( false ); if((value)==NULL) pbs << (uint32_t)PRC_TYPE_ROOT; else (value)->serializeCurve(pbs);}
+#define SerializePtrSurface( value ) {WriteBoolean( false ); if((value)==NULL) pbs << (uint32_t)PRC_TYPE_ROOT; else (value)->serializeSurface(pbs);}
+#define SerializePtrTopology( value ) {WriteBoolean( false ); if((value)==NULL) pbs << (uint32_t)PRC_TYPE_ROOT; else (value)->serializeTopoItem(pbs);}
+#define SerializeContentCurve serializeContentCurve(pbs);
+#define SerializeContentWireEdge serializeContentWireEdge(pbs);
+#define SerializeContentBody serializeContentBody(pbs);
+#define SerializeTopoContext serializeTopoContext(pbs);
+#define SerializeContextAndBodies( value ) (value).serializeContextAndBodies(pbs);
+#define SerializeBody( value ) (value)->serializeBody(pbs);
+#define ResetCurrentGraphics resetGraphics();
+#define SerializeContentSurface serializeContentSurface(pbs);
+#define SerializeCompressedUniqueId( value ) (value).serializeCompressedUniqueId(pbs);
+#define SerializeUnit( value ) (value).serializeUnit(pbs);
+#define SerializeBoundingBox serializeBoundingBox(pbs);
+#define SerializeAttributeEntry serializeAttributeEntry(pbs);
+#define SerializeContentSingleAttribute( value ) (value).serializeSingleAttribute(pbs);
+#define SerializeAttribute( value ) (value).serializeAttribute(pbs);
+#define SerializeAttributeData serializeAttributes(pbs);
+#define WriteUncompressedUnsignedInteger( value ) writeUncompressedUnsignedInteger(out, (uint32_t)(value));
+#define SerializeFileStructureUncompressedUniqueId( value ) (value).serializeFileStructureUncompressedUniqueId(out);
+
+void writeUncompressedUnsignedInteger(ostream &out, uint32_t data)
+{
+#ifdef WORDS_BIGENDIAN
+ out.write(((char*)&data)+3,1);
+ out.write(((char*)&data)+2,1);
+ out.write(((char*)&data)+1,1);
+ out.write(((char*)&data)+0,1);
+#else
+ out.write(((char*)&data)+0,1);
+ out.write(((char*)&data)+1,1);
+ out.write(((char*)&data)+2,1);
+ out.write(((char*)&data)+3,1);
+#endif
+}
+
+double PRCVector3d::Length()
+{
+ return sqrt(x*x+y*y+z*z);
+}
+
+bool PRCVector3d::Normalize()
+{
+ double fLength=Length();
+ if(fLength < FLT_EPSILON) return false;
+ double factor=1.0/fLength;
+ x *= factor;
+ y *= factor;
+ z *= factor;
+ return true;
+}
+
+double PRCVector2d::Length()
+{
+ return sqrt(x*x+y*y);
+}
+
+bool PRCVector2d::Normalize()
+{
+ double fLength=Length();
+ if(fLength < FLT_EPSILON) return false;
+ double factor=1.0/fLength;
+ x *= factor;
+ y *= factor;
+
+ return true;
+}
+
+void PRCVector2d::serializeVector2d(PRCbitStream &pbs)
+{
+ WriteDouble (x)
+ WriteDouble (y)
+}
+
+uint32_t makeCADID()
+{
+ static uint32_t ID = 1;
+ return ID++;
+}
+
+uint32_t makePRCID()
+{
+ static uint32_t ID = 1;
+ return ID++;
+}
+
+bool type_eligible_for_reference(uint32_t type)
+{
+ if(
+ type == PRC_TYPE_MISC_EntityReference ||
+ type == PRC_TYPE_MISC_MarkupLinkedItem ||
+ type == PRC_TYPE_RI_BrepModel ||
+ type == PRC_TYPE_RI_Curve ||
+ type == PRC_TYPE_RI_Direction ||
+ type == PRC_TYPE_RI_Plane ||
+ type == PRC_TYPE_RI_PointSet ||
+ type == PRC_TYPE_RI_PolyBrepModel ||
+ type == PRC_TYPE_RI_PolyWire ||
+ type == PRC_TYPE_RI_Set ||
+ type == PRC_TYPE_RI_CoordinateSystem ||
+ type == PRC_TYPE_ASM_ProductOccurence ||
+ type == PRC_TYPE_ASM_PartDefinition ||
+ type == PRC_TYPE_ASM_Filter ||
+ type == PRC_TYPE_MKP_View ||
+ type == PRC_TYPE_MKP_Markup ||
+ type == PRC_TYPE_MKP_Leader ||
+ type == PRC_TYPE_MKP_AnnotationItem ||
+ type == PRC_TYPE_MKP_AnnotationSet ||
+ type == PRC_TYPE_MKP_AnnotationReference ||
+ type == PRC_TYPE_GRAPH_Style ||
+ type == PRC_TYPE_GRAPH_Material ||
+ type == PRC_TYPE_GRAPH_TextureApplication ||
+ type == PRC_TYPE_GRAPH_TextureDefinition ||
+ type == PRC_TYPE_GRAPH_LinePattern ||
+ type == PRC_TYPE_GRAPH_DottingPattern ||
+ type == PRC_TYPE_GRAPH_HatchingPattern ||
+ type == PRC_TYPE_GRAPH_SolidPattern ||
+ type == PRC_TYPE_GRAPH_VPicturePattern ||
+ type == PRC_TYPE_GRAPH_AmbientLight ||
+ type == PRC_TYPE_GRAPH_PointLight ||
+ type == PRC_TYPE_GRAPH_DirectionalLight ||
+ type == PRC_TYPE_GRAPH_SpotLight ||
+ type == PRC_TYPE_GRAPH_SceneDisplayParameters ||
+ type == PRC_TYPE_GRAPH_Camera
+ )
+ return true;
+ else
+ return false;
+}
+
+void UserData::write(PRCbitStream &pbs)
+{
+ pbs << size;
+ if(size > 0) {
+ uint32_t quot=size/8;
+ uint32_t rem=size-8*quot;
+ for(uint32_t i = 0; i < quot; ++i)
+ pbs << data[i];
+ for(uint32_t j = 0; j < rem; ++j) // 0-based, big endian bit counting
+ pbs << (bool)((data[quot] & (0x80 >> j))!=0);
+ }
+}
+
+void PRCAttributeEntry::serializeAttributeEntry(PRCbitStream &pbs) const
+{
+ WriteBoolean (title_is_integer)
+ if (title_is_integer)
+ WriteUnsignedInteger (title_integer)
+ else
+ WriteString (title_text)
+}
+
+void PRCSingleAttribute::serializeSingleAttribute(PRCbitStream &pbs) const
+{
+ SerializeAttributeEntry
+ WriteUnsignedInteger (type)
+ switch (type)
+ {
+ case KEPRCModellerAttributeTypeInt:
+ WriteInteger (value.integer)
+ break;
+ case KEPRCModellerAttributeTypeReal:
+ WriteDouble (value.real)
+ break;
+ case KEPRCModellerAttributeTypeTime:
+ WriteUnsignedInteger (value.time)
+ break;
+ case KEPRCModellerAttributeTypeString:
+ WriteString (value_text)
+ break;
+ default:
+ break;
+ }
+}
+
+void PRCAttribute::serializeAttribute(PRCbitStream &pbs) const
+{
+ WriteUnsignedInteger (PRC_TYPE_MISC_Attribute)
+
+ SerializeAttributeEntry
+ const uint32_t size_of_attribute_keys = attribute_keys.size();
+ WriteUnsignedInteger (size_of_attribute_keys)
+ for(uint32_t i=0;i<size_of_attribute_keys;i++)
+ SerializeContentSingleAttribute (attribute_keys[i])
+}
+
+void PRCAttributes::serializeAttributes(PRCbitStream &pbs) const
+{
+ if (attributes.empty()) { // shortcut for most typical case
+ const uint32_t number_of_attributes = 0;
+ WriteUnsignedInteger (number_of_attributes)
+ return;
+ }
+ const uint32_t number_of_attributes = attributes.size();
+ WriteUnsignedInteger (number_of_attributes)
+ for(PRCAttributeList::const_iterator it = attributes.begin(); it != attributes.end(); ++it)
+ {
+ SerializeAttribute(*it)
+ }
+}
+
+void ContentPRCBase::serializeContentPRCBase(PRCbitStream &pbs) const
+{
+ SerializeAttributeData
+
+ SerializeName (name)
+ if (type_eligible_for_reference(type))
+ {
+ WriteUnsignedInteger (CAD_identifier)
+ WriteUnsignedInteger (CAD_persistent_identifier)
+ WriteUnsignedInteger (PRC_unique_identifier)
+ }
+}
+
+
+bool IsCompressedType(uint32_t type)
+{
+ return (type == PRC_TYPE_TOPO_BrepDataCompress || type == PRC_TYPE_TOPO_SingleWireBodyCompress || type == PRC_TYPE_TESS_3D_Compressed);
+}
+
+void PRCReferenceUniqueIdentifier::serializeReferenceUniqueIdentifier(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_MISC_ReferenceOnPRCBase)
+ WriteUnsignedInteger (type)
+ const bool reference_in_same_file_structure = true;
+ WriteBoolean (reference_in_same_file_structure)
+// if (!reference_in_same_file_structure)
+// SerializeCompressedUniqueId (target_file_structure)
+ WriteUnsignedInteger (unique_identifier)
+}
+
+void PRCRgbColor::serializeRgbColor(PRCbitStream &pbs)
+{
+ WriteDouble (red)
+ WriteDouble (green)
+ WriteDouble (blue)
+}
+
+void PRCPicture::serializePicture(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_GRAPH_Picture)
+ SerializeContentPRCBase
+ WriteInteger (format) //see Types for picture files
+ WriteUnsignedInteger (uncompressed_file_index+1)
+ WriteUnsignedInteger (pixel_width)
+ WriteUnsignedInteger (pixel_height)
+}
+
+void PRCTextureDefinition::serializeTextureDefinition(PRCbitStream &pbs)
+{
+ uint32_t i=0; // universal index for PRC standart compatibility
+ const uint8_t texture_dimension = 2;
+ const uint32_t texture_mapping_attributes = texture_mapping_attribute;
+ const uint32_t size_texture_mapping_attributes_intensities = 1;
+ const double *texture_mapping_attributes_intensities = &texture_mapping_attribute_intensity;
+ const uint32_t size_texture_mapping_attributes_components = 1;
+ const uint8_t *texture_mapping_attributes_components = &texture_mapping_attribute_components;
+ const EPRCTextureMappingType eMappingType = KEPRCTextureMappingType_Stored;
+
+ const double red = 1.0;
+ const double green = 1.0;
+ const double blue = 1.0;
+ const double alpha = 1.0;
+ const EPRCTextureBlendParameter blend_src_rgb = KEPRCTextureBlendParameter_Unknown;
+ const EPRCTextureBlendParameter blend_dst_rgb = KEPRCTextureBlendParameter_Unknown;
+ const EPRCTextureBlendParameter blend_src_alpha = KEPRCTextureBlendParameter_Unknown;
+ const EPRCTextureBlendParameter blend_dst_alpha = KEPRCTextureBlendParameter_Unknown;
+ const EPRCTextureAlphaTest alpha_test = KEPRCTextureAlphaTest_Unknown;
+ const double alpha_test_reference = 1.0;
+ const EPRCTextureWrappingMode texture_wrapping_mode_R = KEPRCTextureWrappingMode_ClampToBorder;
+ const bool texture_transformation = false;
+
+ WriteUnsignedInteger (PRC_TYPE_GRAPH_TextureDefinition)
+
+ SerializeContentPRCBase
+
+ WriteUnsignedInteger (picture_index+1)
+ WriteCharacter (texture_dimension)
+
+ // SerializeTextureMappingType
+ WriteInteger (eMappingType) // Texture mapping type
+ // if (eMappingType == TEXTURE_MAPPING_OPERATOR)
+ // {
+ // WriteInteger (eMappingOperator) // Texture mapping operator
+ // WriteInteger (transformation)
+ // if (transformation)
+ // SerializeCartesianTransformation3d (transformation)
+ // }
+
+ WriteUnsignedInteger (texture_mapping_attributes) // Texture mapping attributes
+ WriteUnsignedInteger (size_texture_mapping_attributes_intensities)
+ for (i=0;i<size_texture_mapping_attributes_intensities;i++)
+ WriteDouble (texture_mapping_attributes_intensities[i])
+ WriteUnsignedInteger (size_texture_mapping_attributes_components)
+ for (i=0;i<size_texture_mapping_attributes_components;i++)
+ WriteCharacter (texture_mapping_attributes_components[i])
+
+ WriteInteger (texture_function)
+ // reserved for future use; see Texture function
+ if (texture_function == KEPRCTextureFunction_Blend)
+ {
+ WriteDouble (red) // blend color component in the range [0.0,1.0]
+ WriteDouble (green) // blend color component in the range [0.0,1.0]
+ WriteDouble (blue) // blend color component in the range [0.0,1.0]
+ WriteDouble (alpha) // blend color component in the range [0.0,1.0]
+ }
+
+ WriteInteger (blend_src_rgb) // Texture blend parameter
+ // reserved for future use; see Texture blend parameter
+ if (blend_src_rgb != KEPRCTextureBlendParameter_Unknown)
+ WriteInteger (blend_dst_rgb) // Texture blend parameter
+
+ WriteInteger (blend_src_alpha) // Texture blend parameter
+ // reserved for future use; see Texture blend parameter
+ if (blend_src_alpha != KEPRCTextureBlendParameter_Unknown)
+ WriteInteger (blend_dst_alpha) // Texture blend parameter
+
+ WriteCharacter (texture_applying_mode) // Texture applying mode
+ if (texture_applying_mode & PRC_TEXTURE_APPLYING_MODE_ALPHATEST)
+ {
+ WriteInteger (alpha_test) // Texture alpha test
+ WriteDouble (alpha_test_reference)
+ }
+
+ WriteInteger (texture_wrapping_mode_S) // Texture wrapping mode
+ if (texture_dimension > 1)
+ WriteInteger (texture_wrapping_mode_T) // Texture wrapping mode
+ if (texture_dimension > 2 )
+ WriteInteger (texture_wrapping_mode_R) // Texture wrapping mode
+
+ WriteBit (texture_transformation)
+// if (texture_transformation)
+// SerializeTextureTransformation (texture_transformation)
+}
+
+void PRCMaterialGeneric::serializeMaterialGeneric(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_GRAPH_Material)
+ SerializeContentPRCBase
+ WriteUnsignedInteger (ambient + 1)
+ WriteUnsignedInteger (diffuse + 1)
+ WriteUnsignedInteger (emissive + 1)
+ WriteUnsignedInteger (specular + 1)
+ WriteDouble (shininess)
+ WriteDouble (ambient_alpha)
+ WriteDouble (diffuse_alpha)
+ WriteDouble (emissive_alpha)
+ WriteDouble (specular_alpha)
+}
+
+void PRCTextureApplication::serializeTextureApplication(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_GRAPH_TextureApplication)
+ SerializeContentPRCBase
+
+ WriteUnsignedInteger (material_generic_index+1)
+ WriteUnsignedInteger (texture_definition_index+1)
+ WriteUnsignedInteger (next_texture_index+1)
+ WriteUnsignedInteger (UV_coordinates_index+1)
+}
+
+void PRCLinePattern::serializeLinePattern(PRCbitStream &pbs)
+{
+ uint32_t i = 0;
+ WriteUnsignedInteger (PRC_TYPE_GRAPH_LinePattern)
+ SerializeContentPRCBase
+
+ const uint32_t size_lengths = lengths.size();
+ WriteUnsignedInteger (size_lengths)
+ for (i=0;i<size_lengths;i++)
+ WriteDouble (lengths[i])
+ WriteDouble (phase)
+ WriteBoolean (is_real_length)
+}
+
+
+void PRCStyle::serializeCategory1LineStyle(PRCbitStream &pbs)
+{
+ const bool is_additional_1_defined = (additional!=0);
+ const uint8_t additional_1 = additional;
+ const bool is_additional_2_defined = false;
+ const uint8_t additional_2 = 0;
+ const bool is_additional_3_defined = false;
+ const uint8_t additional_3 = 0;
+ WriteUnsignedInteger (PRC_TYPE_GRAPH_Style)
+ SerializeContentPRCBase
+ WriteDouble (line_width)
+ WriteBoolean (is_vpicture)
+ WriteUnsignedInteger (line_pattern_vpicture_index + 1)
+ WriteBoolean (is_material)
+ WriteUnsignedInteger (color_material_index + 1)
+ WriteBoolean (is_transparency_defined)
+ if (is_transparency_defined)
+ WriteCharacter (transparency)
+ WriteBoolean (is_additional_1_defined)
+ if (is_additional_1_defined)
+ WriteCharacter (additional_1)
+ WriteBoolean (is_additional_2_defined)
+ if (is_additional_2_defined)
+ WriteCharacter (additional_2)
+ WriteBoolean (is_additional_3_defined)
+ if (is_additional_3_defined)
+ WriteCharacter (additional_3)
+}
+
+std::string currentName;
+
+void writeName(PRCbitStream &pbs,const std::string &name)
+{
+ pbs << (name == currentName);
+ if(name != currentName)
+ {
+ pbs << name;
+ currentName = name;
+ }
+}
+
+void resetName()
+{
+ currentName = "";
+}
+
+uint32_t current_layer_index = m1;
+uint32_t current_index_of_line_style = m1;
+uint16_t current_behaviour_bit_field = 1;
+
+void writeGraphics(PRCbitStream &pbs,uint32_t l,uint32_t i,uint16_t b,bool force)
+{
+ if(force || current_layer_index != l || current_index_of_line_style != i || current_behaviour_bit_field != b)
+ {
+ pbs << false << (uint32_t)(l+1) << (uint32_t)(i+1)
+ << (uint8_t)(b&0xFF) << (uint8_t)((b>>8)&0xFF);
+ current_layer_index = l;
+ current_index_of_line_style = i;
+ current_behaviour_bit_field = b;
+ }
+ else
+ pbs << true;
+}
+
+void writeGraphics(PRCbitStream &pbs,const PRCGraphics &graphics,bool force)
+{
+ if(force || current_layer_index != graphics.layer_index || current_index_of_line_style != graphics.index_of_line_style || current_behaviour_bit_field != graphics.behaviour_bit_field)
+ {
+ pbs << false
+ << (uint32_t)(graphics.layer_index+1)
+ << (uint32_t)(graphics.index_of_line_style+1)
+ << (uint8_t)(graphics.behaviour_bit_field&0xFF)
+ << (uint8_t)((graphics.behaviour_bit_field>>8)&0xFF);
+ current_layer_index = graphics.layer_index;
+ current_index_of_line_style = graphics.index_of_line_style;
+ current_behaviour_bit_field = graphics.behaviour_bit_field;
+ }
+ else
+ pbs << true;
+}
+
+void PRCGraphics::serializeGraphics(PRCbitStream &pbs)
+{
+ if(current_layer_index != this->layer_index || current_index_of_line_style != this->index_of_line_style || current_behaviour_bit_field != this->behaviour_bit_field)
+ {
+ pbs << false
+ << (uint32_t)(this->layer_index+1)
+ << (uint32_t)(this->index_of_line_style+1)
+ << (uint8_t)(this->behaviour_bit_field&0xFF)
+ << (uint8_t)((this->behaviour_bit_field>>8)&0xFF);
+ current_layer_index = this->layer_index;
+ current_index_of_line_style = this->index_of_line_style;
+ current_behaviour_bit_field = this->behaviour_bit_field;
+ }
+ else
+ pbs << true;
+}
+
+void PRCGraphics::serializeGraphicsForced(PRCbitStream &pbs)
+{
+ pbs << false
+ << (uint32_t)(this->layer_index+1)
+ << (uint32_t)(this->index_of_line_style+1)
+ << (uint8_t)(this->behaviour_bit_field&0xFF)
+ << (uint8_t)((this->behaviour_bit_field>>8)&0xFF);
+ current_layer_index = this->layer_index;
+ current_index_of_line_style = this->index_of_line_style;
+ current_behaviour_bit_field = this->behaviour_bit_field;
+}
+
+void resetGraphics()
+{
+ current_layer_index = m1;
+ current_index_of_line_style = m1;
+ current_behaviour_bit_field = 1;
+}
+
+void resetGraphicsAndName()
+{
+ resetGraphics(); resetName();
+}
+
+void PRCMarkup::serializeMarkup(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_MKP_Markup)
+ SerializeContentPRCBase
+ SerializeGraphics
+ WriteUnsignedInteger (type)
+ WriteUnsignedInteger (sub_type)
+ const uint32_t number_of_linked_items = 0;
+ WriteUnsignedInteger (number_of_linked_items)
+// for (i=0;i<number_of_linked_items;i++)
+// SerializeReferenceUniqueIdentifier (linked_items[i])
+ const uint32_t number_of_leaders = 0;
+ WriteUnsignedInteger (number_of_leaders)
+// for (i=0;i<number_of_leaders;i++)
+// SerializeReferenceUniqueIdentifier (leaders[i])
+ WriteUnsignedInteger (index_tessellation + 1)
+ SerializeUserData
+}
+
+void PRCAnnotationItem::serializeAnnotationItem(PRCbitStream &pbs)
+{
+// group___tf_annotation_item_____serialize2.html
+// group___tf_annotation_item_____serialize_content2.html
+// group___tf_annotation_entity_____serialize_content2.html
+ WriteUnsignedInteger (PRC_TYPE_MKP_AnnotationItem)
+ SerializeContentPRCBase
+ SerializeGraphics
+ SerializeReferenceUniqueIdentifier (markup)
+ SerializeUserData
+}
+
+void PRCRepresentationItemContent::serializeRepresentationItemContent(PRCbitStream &pbs)
+{
+ SerializeContentPRCBase
+ SerializeGraphics
+ WriteUnsignedInteger (index_local_coordinate_system + 1)
+ WriteUnsignedInteger (index_tessellation + 1)
+}
+
+void PRCBrepModel::serializeBrepModel(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_RI_BrepModel)
+
+ SerializeRepresentationItemContent
+ WriteBit (has_brep_data)
+ if (has_brep_data)
+ {
+ WriteUnsignedInteger (context_id+1)
+ WriteUnsignedInteger (body_id+1)
+ }
+ WriteBoolean (is_closed)
+ SerializeUserData
+}
+
+void PRCPolyBrepModel::serializePolyBrepModel(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_RI_PolyBrepModel)
+
+ SerializeRepresentationItemContent
+ WriteBoolean (is_closed)
+ SerializeUserData
+}
+
+void PRCPointSet::serializePointSet(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_RI_PointSet)
+
+ SerializeRepresentationItemContent
+
+ const uint32_t number_of_points = point.size();
+ WriteUnsignedInteger (number_of_points)
+ for (uint32_t i=0;i<number_of_points;i++)
+ {
+ SerializeVector3d (point[i])
+ }
+ SerializeUserData
+}
+
+void PRCSet::serializeSet(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_RI_Set)
+
+ SerializeRepresentationItemContent
+
+ const uint32_t number_of_elements = elements.size();
+ WriteUnsignedInteger (number_of_elements)
+ for (uint32_t i=0;i<number_of_elements;i++)
+ {
+ SerializeRepresentationItem (elements[i])
+ }
+ SerializeUserData
+}
+
+uint32_t PRCSet::addBrepModel(PRCBrepModel*& pBrepModel)
+{
+ elements.push_back(pBrepModel);
+ pBrepModel = NULL;
+ return elements.size()-1;
+}
+
+uint32_t PRCSet::addPolyBrepModel(PRCPolyBrepModel*& pPolyBrepModel)
+{
+ elements.push_back(pPolyBrepModel);
+ pPolyBrepModel = NULL;
+ return elements.size()-1;
+}
+
+uint32_t PRCSet::addPointSet(PRCPointSet*& pPointSet)
+{
+ elements.push_back(pPointSet);
+ pPointSet = NULL;
+ return elements.size()-1;
+}
+
+uint32_t PRCSet::addSet(PRCSet*& pSet)
+{
+ elements.push_back(pSet);
+ pSet = NULL;
+ return elements.size()-1;
+}
+
+uint32_t PRCSet::addWire(PRCWire*& pWire)
+{
+ elements.push_back(pWire);
+ pWire = NULL;
+ return elements.size()-1;
+}
+
+uint32_t PRCSet::addPolyWire(PRCPolyWire*& pPolyWire)
+{
+ elements.push_back(pPolyWire);
+ pPolyWire = NULL;
+ return elements.size()-1;
+}
+
+uint32_t PRCSet::addRepresentationItem(PRCRepresentationItem*& pRepresentationItem)
+{
+ elements.push_back(pRepresentationItem);
+ pRepresentationItem = NULL;
+ return elements.size()-1;
+}
+
+void PRCWire::serializeWire(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_RI_Curve)
+
+ SerializeRepresentationItemContent
+ WriteBit (has_wire_body)
+ if (has_wire_body)
+ {
+ WriteUnsignedInteger (context_id+1)
+ WriteUnsignedInteger (body_id+1)
+ }
+
+ SerializeUserData
+}
+
+void PRCPolyWire::serializePolyWire(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_RI_PolyWire)
+
+ SerializeRepresentationItemContent
+ SerializeUserData
+}
+
+void PRCGeneralTransformation3d::serializeGeneralTransformation3d(PRCbitStream &pbs) const
+{
+ WriteUnsignedInteger (PRC_TYPE_MISC_GeneralTransformation)
+ // Like Fortran, PRC uses transposed (column-major) format!
+ for (int j=0;j<4;j++)
+ for (int i=0;i<4;i++)
+ WriteDouble(mat[i][j]);
+}
+
+void PRCCartesianTransformation3d::serializeCartesianTransformation3d(PRCbitStream &pbs) const
+{
+ WriteUnsignedInteger (PRC_TYPE_MISC_CartesianTransformation)
+ WriteCharacter ( behaviour )
+ if (behaviour & PRC_TRANSFORMATION_Translate)
+ SerializeVector3d ( origin )
+ if (behaviour & PRC_TRANSFORMATION_NonOrtho)
+ {
+ SerializeVector3d ( X )
+ SerializeVector3d ( Y )
+ SerializeVector3d ( Z )
+ }
+ else if (behaviour & PRC_TRANSFORMATION_Rotate)
+ {
+ SerializeVector3d ( X )
+ SerializeVector3d ( Y )
+ }
+
+ if (behaviour & PRC_TRANSFORMATION_NonUniformScale)
+ {
+ SerializeVector3d ( scale )
+ }
+ else if (behaviour & PRC_TRANSFORMATION_Scale)
+ {
+ WriteDouble ( uniform_scale )
+ }
+
+ if (behaviour & PRC_TRANSFORMATION_Homogeneous)
+ {
+ WriteDouble ( X_homogeneous_coord )
+ WriteDouble ( Y_homogeneous_coord )
+ WriteDouble ( Z_homogeneous_coord )
+ WriteDouble ( origin_homogeneous_coord )
+ }
+}
+
+void PRCTransformation::serializeTransformation(PRCbitStream &pbs)
+{
+ WriteBit ( has_transformation )
+ if (has_transformation)
+ {
+ WriteCharacter ( behaviour )
+ if ( geometry_is_2D )
+ {
+ if (behaviour & PRC_TRANSFORMATION_Translate)
+ SerializeVector2d ( origin )
+ if (behaviour & PRC_TRANSFORMATION_Rotate)
+ {
+ SerializeVector2d ( x_axis )
+ SerializeVector2d ( y_axis )
+ }
+ if (behaviour & PRC_TRANSFORMATION_Scale)
+ WriteDouble ( scale )
+ }
+ else
+ {
+ if (behaviour & PRC_TRANSFORMATION_Translate)
+ SerializeVector3d ( origin )
+ if (behaviour & PRC_TRANSFORMATION_Rotate)
+ {
+ SerializeVector3d ( x_axis )
+ SerializeVector3d ( y_axis )
+ }
+ if (behaviour & PRC_TRANSFORMATION_Scale)
+ WriteDouble ( scale )
+ }
+ }
+}
+void PRCCoordinateSystem::serializeCoordinateSystem(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_RI_CoordinateSystem)
+
+ SerializeRepresentationItemContent
+ axis_set->serializeTransformation3d(pbs);
+ SerializeUserData
+}
+
+void PRCFontKeysSameFont::serializeFontKeysSameFont(PRCbitStream &pbs)
+{
+ uint32_t i=0; // universal index for PRC standart compatibility
+ WriteString (font_name)
+ WriteUnsignedInteger (char_set)
+ const uint32_t number_of_font_keys = font_keys.size();
+ WriteUnsignedInteger (number_of_font_keys)
+ for (i=0;i<number_of_font_keys;i++)
+ {
+ WriteUnsignedInteger (font_keys[i].font_size + 1)
+ WriteCharacter (font_keys[i].attributes)
+ }
+}
+
+void SerializeArrayRGBA (const std::vector<uint8_t> &rgba_vertices,const bool is_rgba, PRCbitStream &pbs)
+{
+ uint32_t i = 0;
+ uint32_t j = 0;
+// number_by_vector can be assigned a value of 3 (RGB) or 4 (RGBA).
+// number_of_vectors is equal to number_of_colors / number_by_vector.
+ const uint32_t number_by_vector=is_rgba?4:3;
+ const std::vector<uint8_t> &vector_color = rgba_vertices;
+ const uint32_t number_of_colors=vector_color.size();
+ const uint32_t number_of_vectors=number_of_colors / number_by_vector;
+ // first one
+ for (i=0;i<number_by_vector;i++)
+ WriteCharacter (vector_color[i])
+
+ for (i=1;i<number_of_vectors;i++)
+ {
+ bool b_same = true;
+ for (j=0;j<number_by_vector;j++)
+ {
+ if ((vector_color[i*number_by_vector+j] - vector_color[(i-1)*number_by_vector+j]) != 0)
+ {
+ b_same = false;
+ break;
+ }
+ }
+ WriteBoolean (b_same)
+ if (!b_same)
+ {
+ for (j=0;j<number_by_vector;j++)
+ WriteCharacter (vector_color[i*number_by_vector+j])
+ }
+ }
+}
+
+void PRCTessFace::serializeTessFace(PRCbitStream &pbs)
+{
+ uint32_t i=0; // universal index for PRC standart compatibility
+ WriteUnsignedInteger (PRC_TYPE_TESS_Face)
+
+ const uint32_t size_of_line_attributes=line_attributes.size();
+ WriteUnsignedInteger (size_of_line_attributes)
+ for (i=0;i<size_of_line_attributes;i++)
+ SerializeLineAttr (line_attributes[i])
+
+ WriteUnsignedInteger (start_wire)
+ const uint32_t size_of_sizes_wire=sizes_wire.size();
+ WriteUnsignedInteger (size_of_sizes_wire)
+ for (i=0;i<size_of_sizes_wire;i++)
+ WriteUnsignedInteger (sizes_wire[i])
+
+ WriteUnsignedInteger (used_entities_flag)
+
+ WriteUnsignedInteger (start_triangulated)
+ const uint32_t size_of_sizes_triangulated=sizes_triangulated.size();
+ WriteUnsignedInteger (size_of_sizes_triangulated)
+ for (i=0;i<size_of_sizes_triangulated;i++)
+ WriteUnsignedInteger (sizes_triangulated[i])
+
+ if(number_of_texture_coordinate_indexes==0 &&
+ used_entities_flag &
+ (
+ PRC_FACETESSDATA_PolyfaceTextured|
+ PRC_FACETESSDATA_TriangleTextured|
+ PRC_FACETESSDATA_TriangleFanTextured|
+ PRC_FACETESSDATA_TriangleStripeTextured|
+ PRC_FACETESSDATA_PolyfaceOneNormalTextured|
+ PRC_FACETESSDATA_TriangleOneNormalTextured|
+ PRC_FACETESSDATA_TriangleFanOneNormalTextured|
+ PRC_FACETESSDATA_TriangleStripeOneNormalTextured
+ ))
+ WriteUnsignedInteger (1) // workaround for error of not setting number_of_texture_coordinate_indexes
+ else
+ WriteUnsignedInteger (number_of_texture_coordinate_indexes)
+
+ const bool has_vertex_colors = !rgba_vertices.empty();
+ WriteBoolean (has_vertex_colors)
+ if (has_vertex_colors)
+ {
+ WriteBoolean (is_rgba)
+ const bool b_optimised=false;
+ WriteBoolean (b_optimised)
+ if (!b_optimised)
+ {
+ SerializeArrayRGBA (rgba_vertices, is_rgba, pbs);
+ }
+ else
+ {
+ // not described
+ }
+ }
+ if (size_of_line_attributes)
+ WriteUnsignedInteger (behaviour)
+}
+
+void PRCContentBaseTessData::serializeContentBaseTessData(PRCbitStream &pbs)
+{
+ uint32_t i=0; // universal index for PRC standart compatibility
+ WriteBoolean (is_calculated)
+ const uint32_t number_of_coordinates = coordinates.size();
+ WriteUnsignedInteger (number_of_coordinates)
+ for (i=0;i<number_of_coordinates;i++)
+ WriteDouble (coordinates[i])
+}
+
+void PRC3DTess::serialize3DTess(PRCbitStream &pbs)
+{
+ uint32_t i=0; // universal index for PRC standart compatibility
+ WriteUnsignedInteger (PRC_TYPE_TESS_3D)
+ SerializeContentBaseTessData
+ WriteBoolean (has_faces)
+ WriteBoolean (has_loops)
+ const bool must_recalculate_normals=normal_coordinate.empty();
+ WriteBoolean (must_recalculate_normals)
+ if (must_recalculate_normals)
+ {
+ const uint8_t normals_recalculation_flags=0;
+ // not used; should be zero
+ WriteCharacter (normals_recalculation_flags)
+ // definition similar to VRML
+ WriteDouble (crease_angle)
+ }
+
+ const uint32_t number_of_normal_coordinates=normal_coordinate.size();
+ WriteUnsignedInteger (number_of_normal_coordinates)
+ for (i=0;i<number_of_normal_coordinates;i++)
+ WriteDouble (normal_coordinate[i])
+
+ const uint32_t number_of_wire_indices=wire_index.size();
+ WriteUnsignedInteger (number_of_wire_indices)
+ for (i=0;i<number_of_wire_indices;i++)
+ WriteUnsignedInteger (wire_index[i])
+
+ // note : those can be single triangles, triangle fans or stripes
+ const uint32_t number_of_triangulated_indices=triangulated_index.size();
+ WriteUnsignedInteger (number_of_triangulated_indices)
+ for (i=0;i<number_of_triangulated_indices;i++)
+ WriteUnsignedInteger (triangulated_index[i])
+
+ const uint32_t number_of_face_tessellation=face_tessellation.size();
+ WriteUnsignedInteger (number_of_face_tessellation)
+ for (i=0;i<number_of_face_tessellation;i++)
+ SerializeTessFace (face_tessellation[i])
+
+ const uint32_t number_of_texture_coordinates=texture_coordinate.size();
+ WriteUnsignedInteger (number_of_texture_coordinates)
+ for (i=0;i<number_of_texture_coordinates;i++)
+ WriteDouble (texture_coordinate[i])
+}
+
+void PRC3DTess::addTessFace(PRCTessFace*& pTessFace)
+{
+ face_tessellation.push_back(pTessFace);
+ pTessFace = NULL;
+}
+
+void PRC3DWireTess::serialize3DWireTess(PRCbitStream &pbs)
+{
+// group___tf3_d_wire_tess_data_____serialize2.html
+// group___tf3_d_wire_tess_data_____serialize_content2.html
+ uint32_t i=0; // universal index for PRC standart compatibility
+ WriteUnsignedInteger (PRC_TYPE_TESS_3D_Wire)
+ SerializeContentBaseTessData
+ const uint32_t number_of_wire_indexes=wire_indexes.size();
+ WriteUnsignedInteger (number_of_wire_indexes)
+ for (i=0;i<number_of_wire_indexes;i++)
+ WriteUnsignedInteger (wire_indexes[i])
+
+ const bool has_vertex_colors = !rgba_vertices.empty();
+ WriteBoolean (has_vertex_colors)
+ if (has_vertex_colors)
+ {
+ WriteBoolean (is_rgba)
+ WriteBoolean (is_segment_color)
+ const bool b_optimised=false;
+ WriteBoolean (b_optimised)
+ if (!b_optimised)
+ {
+ SerializeArrayRGBA (rgba_vertices, is_rgba, pbs);
+ }
+ else
+ {
+ // not described
+ }
+ }
+}
+
+void PRCMarkupTess::serializeMarkupTess(PRCbitStream &pbs)
+{
+// group___tf_markup_tess_data_____serialize2.html
+// group___tf_markup_tess_data_____serialize_content2.html
+ uint32_t i=0; // universal index for PRC standart compatibility
+ WriteUnsignedInteger (PRC_TYPE_TESS_Markup)
+ SerializeContentBaseTessData
+
+ const uint32_t number_of_codes=codes.size();
+ WriteUnsignedInteger (number_of_codes)
+ for (i=0;i<number_of_codes;i++)
+ WriteUnsignedInteger (codes[i])
+ const uint32_t number_of_texts=texts.size();
+ WriteUnsignedInteger (number_of_texts)
+ for (i=0;i<number_of_texts;i++)
+ WriteString (texts[i])
+ WriteString (label) // label of tessellation
+ WriteCharacter (behaviour)
+}
+
+void writeUnit(PRCbitStream &out,bool fromCAD,double unit)
+{
+ out << fromCAD << unit;
+}
+
+void writeEmptyMarkups(PRCbitStream &out)
+{
+ out << (uint32_t)0 // # of linked items
+ << (uint32_t)0 // # of leaders
+ << (uint32_t)0 // # of markups
+ << (uint32_t)0; // # of annotation entities
+}
+
+void PRCBaseTopology::serializeBaseTopology(PRCbitStream &pbs)
+{
+ WriteBoolean (base_information)
+ if (base_information)
+ {
+ SerializeAttributeData
+ SerializeName (name)
+ WriteUnsignedInteger (identifier)
+ }
+}
+
+void PRCBaseGeometry::serializeBaseGeometry(PRCbitStream &pbs)
+{
+ WriteBoolean (base_information)
+ if (base_information)
+ {
+ SerializeAttributeData
+ SerializeName (name)
+ WriteUnsignedInteger (identifier)
+ }
+}
+
+void PRCContentBody::serializeContentBody(PRCbitStream &pbs)
+{
+ SerializeBaseTopology
+ WriteCharacter ( behavior )
+}
+
+void PRCBoundingBox::serializeBoundingBox(PRCbitStream &pbs)
+{
+ SerializeVector3d ( min )
+ SerializeVector3d ( max )
+}
+
+void PRCDomain::serializeDomain(PRCbitStream &pbs)
+{
+ SerializeVector2d ( min )
+ SerializeVector2d ( max )
+}
+
+void PRCInterval::serializeInterval(PRCbitStream &pbs)
+{
+ WriteDouble ( min )
+ WriteDouble ( max )
+}
+
+void PRCParameterization::serializeParameterization(PRCbitStream &pbs)
+{
+ SerializeInterval ( interval )
+ WriteDouble ( parameterization_coeff_a )
+ WriteDouble ( parameterization_coeff_b )
+}
+
+void PRCUVParameterization::serializeUVParameterization(PRCbitStream &pbs)
+{
+ WriteBoolean ( swap_uv )
+ SerializeDomain ( uv_domain )
+ WriteDouble ( parameterization_on_u_coeff_a )
+ WriteDouble ( parameterization_on_v_coeff_a )
+ WriteDouble ( parameterization_on_u_coeff_b )
+ WriteDouble ( parameterization_on_v_coeff_b )
+}
+
+void PRCContentSurface::serializeContentSurface(PRCbitStream &pbs)
+{
+ SerializeBaseGeometry
+ WriteUnsignedInteger ( extend_info )
+}
+
+void PRCNURBSSurface::serializeNURBSSurface(PRCbitStream &pbs)
+{
+ uint32_t i=0;
+// uint32_t i=0, j=0;
+ WriteUnsignedInteger (PRC_TYPE_SURF_NURBS)
+
+ SerializeContentSurface
+ WriteBoolean ( is_rational )
+ WriteUnsignedInteger ( degree_in_u )
+ WriteUnsignedInteger ( degree_in_v )
+ const uint32_t highest_index_of_knots_in_u = knot_u.size()-1;
+ const uint32_t highest_index_of_knots_in_v = knot_v.size()-1;
+ const uint32_t highest_index_of_control_point_in_u = highest_index_of_knots_in_u - degree_in_u - 1;
+ const uint32_t highest_index_of_control_point_in_v = highest_index_of_knots_in_v - degree_in_v - 1;
+ WriteUnsignedInteger ( highest_index_of_control_point_in_u )
+ WriteUnsignedInteger ( highest_index_of_control_point_in_v )
+ WriteUnsignedInteger ( highest_index_of_knots_in_u )
+ WriteUnsignedInteger ( highest_index_of_knots_in_v )
+ for (i=0; i < (highest_index_of_control_point_in_u+1)*(highest_index_of_control_point_in_v+1); i++)
+ {
+ WriteDouble ( control_point[i].x )
+ WriteDouble ( control_point[i].y )
+ WriteDouble ( control_point[i].z )
+ if (is_rational)
+ WriteDouble ( control_point[i].w )
+ }
+// for (i=0; i<=highest_index_of_control_point_in_u; i++)
+// {
+// for (j=0; j<=highest_index_of_control_point_in_v; j++)
+// {
+// WriteDouble ( control_point[i*(highest_index_of_control_point_in_u+1)+j].x )
+// WriteDouble ( control_point[i*(highest_index_of_control_point_in_u+1)+j].y )
+// WriteDouble ( control_point[i*(highest_index_of_control_point_in_u+1)+j].z )
+// if (is_rational)
+// WriteDouble ( control_point[i*(highest_index_of_control_point_in_u+1)+j].w )
+// }
+// }
+ for (i=0; i<=highest_index_of_knots_in_u; i++)
+ WriteDouble ( knot_u[i] )
+ for (i=0; i<=highest_index_of_knots_in_v; i++)
+ WriteDouble ( knot_v[i] )
+ WriteUnsignedInteger ( knot_type )
+ WriteUnsignedInteger ( surface_form )
+}
+
+void writeUnsignedIntegerWithVariableBitNumber(PRCbitStream &pbs, uint32_t value, uint32_t bit_number)
+{
+ uint32_t i;
+ for(i=0; i<bit_number; i++)
+ {
+ if( value >= 1u<<(bit_number - 1 - i) )
+ {
+ WriteBoolean (true)
+
+ value -= 1u<<(bit_number - 1 - i);
+ }
+ else
+ {
+ WriteBoolean (false)
+ }
+ }
+}
+#define WriteUnsignedIntegerWithVariableBitNumber( value, bit_number ) writeUnsignedIntegerWithVariableBitNumber( pbs, (value), (bit_number) );
+
+void writeIntegerWithVariableBitNumber(PRCbitStream &pbs, int32_t iValue, uint32_t uBitNumber)
+{
+ WriteBoolean(iValue<0);
+ WriteUnsignedIntegerWithVariableBitNumber(abs(iValue), uBitNumber - 1);
+}
+#define WriteIntegerWithVariableBitNumber( value, bit_number ) writeIntegerWithVariableBitNumber( pbs, (value), (bit_number) );
+
+void writeDoubleWithVariableBitNumber(PRCbitStream &pbs, double dValue,double dTolerance, unsigned uBitNumber)
+{
+// calling functions must ensure no overflow
+ int32_t iTempValue = (int32_t) ( dValue / dTolerance );
+ WriteIntegerWithVariableBitNumber(iTempValue, uBitNumber);
+}
+#define WriteDoubleWithVariableBitNumber( value, bit_number ) writeDoubleWithVariableBitNumber( pbs, (value), (bit_number) );
+
+uint32_t GetNumberOfBitsUsedToStoreUnsignedInteger(uint32_t uValue)
+{
+ uint32_t uNbBit=2;
+ uint32_t uTemp = 2;
+ while(uValue >= uTemp)
+ {
+ uTemp*=2;
+ uNbBit++;
+ }
+ return uNbBit-1;
+}
+
+void writeNumberOfBitsThenUnsignedInteger(PRCbitStream &pbs, uint32_t unsigned_integer)
+{
+ uint32_t number_of_bits = GetNumberOfBitsUsedToStoreUnsignedInteger( unsigned_integer );
+ WriteUnsignedIntegerWithVariableBitNumber ( number_of_bits, 5 )
+ WriteUnsignedIntegerWithVariableBitNumber ( unsigned_integer, number_of_bits )
+}
+#define WriteNumberOfBitsThenUnsignedInteger( value ) writeNumberOfBitsThenUnsignedInteger( pbs, value );
+
+uint32_t GetNumberOfBitsUsedToStoreInteger(int32_t iValue)
+{
+ return GetNumberOfBitsUsedToStoreUnsignedInteger(abs(iValue))+1;
+}
+
+int32_t intdiv(double dValue, double dTolerance)
+{
+ double ratio=fabs(dValue)/dTolerance;
+ assert(ratio <= INT_MAX);
+ int32_t iTempValue=(int32_t) ratio;
+ if(ratio - iTempValue >= 0.5) iTempValue++;
+ if(dValue < 0)
+ return -iTempValue;
+ else
+ return iTempValue;
+}
+
+// round dValue to nearest multiple of dTolerance
+double roundto(double dValue, double dTolerance)
+{
+ return intdiv(dValue, dTolerance) * dTolerance;
+}
+
+PRCVector3d roundto(PRCVector3d vec, double dTolerance)
+{
+ PRCVector3d res;
+ res.x = roundto(vec.x,dTolerance);
+ res.y = roundto(vec.y,dTolerance);
+ res.z = roundto(vec.z,dTolerance);
+ return res;
+}
+
+uint32_t GetNumberOfBitsUsedToStoreDouble(double dValue, double dTolerance )
+{
+ return GetNumberOfBitsUsedToStoreInteger(intdiv(dValue,dTolerance));
+}
+
+struct itriple
+{
+ int32_t x;
+ int32_t y;
+ int32_t z;
+};
+
+uint32_t GetNumberOfBitsUsedToStoreTripleInteger(const itriple &iTriple)
+{
+ const uint32_t x_bits = GetNumberOfBitsUsedToStoreInteger(iTriple.x);
+ const uint32_t y_bits = GetNumberOfBitsUsedToStoreInteger(iTriple.y);
+ const uint32_t z_bits = GetNumberOfBitsUsedToStoreInteger(iTriple.z);
+ uint32_t bits = x_bits;
+ if(y_bits > bits)
+ bits = y_bits;
+ if(z_bits > bits)
+ bits = z_bits;
+ return bits;
+}
+
+itriple iroundto(PRCVector3d vec, double dTolerance)
+{
+ itriple res;
+ res.x = intdiv(vec.x, dTolerance);
+ res.y = intdiv(vec.y, dTolerance);
+ res.z = intdiv(vec.z, dTolerance);
+ return res;
+}
+
+void PRCCompressedFace::serializeCompressedFace(PRCbitStream &pbs, double brep_data_compressed_tolerance)
+{
+ serializeCompressedAnaNurbs( pbs, brep_data_compressed_tolerance );
+}
+#define SerializeCompressedFace( value ) (value)->serializeCompressedFace( pbs, brep_data_compressed_tolerance );
+
+void PRCCompressedFace::serializeContentCompressedFace(PRCbitStream &pbs)
+{
+ WriteBoolean ( orientation_surface_with_shell )
+ const bool surface_is_trimmed = false;
+ WriteBoolean ( surface_is_trimmed )
+}
+
+void PRCCompressedFace::serializeCompressedAnaNurbs(PRCbitStream &pbs, double brep_data_compressed_tolerance)
+{
+ // WriteCompressedEntityType ( PRC_HCG_AnaNurbs )
+ const bool is_a_curve = false;
+ WriteBoolean ( is_a_curve )
+ WriteUnsignedIntegerWithVariableBitNumber (13 , 4)
+ serializeContentCompressedFace( pbs );
+ serializeCompressedNurbs( pbs, brep_data_compressed_tolerance );
+}
+
+void PRCCompressedFace::serializeCompressedNurbs(PRCbitStream &pbs, double brep_data_compressed_tolerance)
+{
+ const double nurbs_tolerance = 0.2*brep_data_compressed_tolerance;
+ const uint32_t degree_in_u = degree;
+ const uint32_t degree_in_v = degree;
+
+ WriteUnsignedIntegerWithVariableBitNumber ( degree_in_u, 5)
+ WriteUnsignedIntegerWithVariableBitNumber ( degree_in_v, 5)
+
+ const uint32_t number_of_knots_in_u = 4; // 0011 or 00001111 knot vector - just 2 spans
+ WriteUnsignedIntegerWithVariableBitNumber (number_of_knots_in_u - 2, 16)
+ uint32_t number_bit = degree_in_u ? Log2( degree_in_u + 2 ) : 2;
+ WriteBoolean (false) // Multiplicity_is_already_stored - no
+ WriteUnsignedIntegerWithVariableBitNumber( degree_in_u+1,number_bit)
+ WriteBoolean (true) // Multiplicity_is_already_stored - yes
+ const uint32_t number_of_knots_in_v = 4; // 0011 or 00001111 knot vector - just 2 spans
+ WriteUnsignedIntegerWithVariableBitNumber (number_of_knots_in_v - 2, 16)
+ number_bit = degree_in_v ? Log2( degree_in_v + 2 ) : 2;
+ WriteBoolean (false) // Multiplicity_is_already_stored - no
+ WriteUnsignedIntegerWithVariableBitNumber( degree_in_v+1,number_bit)
+ WriteBoolean (true) // Multiplicity_is_already_stored - yes
+
+ const bool is_closed_u = false;
+ WriteBoolean ( is_closed_u )
+ const bool is_closed_v = false;
+ WriteBoolean ( is_closed_v )
+
+ const uint32_t number_of_control_point_in_u = degree_in_u + 1;
+ const uint32_t number_of_control_point_in_v = degree_in_v + 1;
+
+#if defined(__GNUC__) && !defined(__clang__)
+ PRCVector3d P[number_of_control_point_in_u][number_of_control_point_in_v];
+#else
+ vector<vector<PRCVector3d> > P(number_of_control_point_in_u, vector<PRCVector3d>(number_of_control_point_in_v));
+#endif
+ for(uint32_t i=0;i<number_of_control_point_in_u;i++)
+ for(uint32_t j=0;j<number_of_control_point_in_v;j++)
+ P[i][j] = control_point[i*number_of_control_point_in_v+j];
+#ifdef __GNUC__
+ itriple compressed_control_point[number_of_control_point_in_u][number_of_control_point_in_v];
+ uint32_t control_point_type[number_of_control_point_in_u][number_of_control_point_in_v];
+#else
+ vector<vector<itriple> > compressed_control_point(number_of_control_point_in_u, vector<itriple>(number_of_control_point_in_v));
+ vector<vector<uint32_t> > control_point_type(number_of_control_point_in_u, vector<uint32_t>(number_of_control_point_in_v));
+#endif
+
+ uint32_t number_of_bits_for_isomin = 1;
+ uint32_t number_of_bits_for_rest = 1;
+
+ for(uint32_t j = 1; j < number_of_control_point_in_v; j++)
+ {
+ compressed_control_point[0][j] = iroundto(P[0][j]-P[0][j-1], nurbs_tolerance );
+ P[0][j] = P[0][j-1] + roundto(P[0][j]-P[0][j-1], nurbs_tolerance);
+ uint32_t bit_size = GetNumberOfBitsUsedToStoreTripleInteger(compressed_control_point[0][j]);
+ if (bit_size > number_of_bits_for_isomin)
+ number_of_bits_for_isomin = bit_size;
+ }
+
+ for(uint32_t i = 1; i < number_of_control_point_in_u; i++)
+ {
+ compressed_control_point[i][0] = iroundto(P[i][0]-P[i-1][0], nurbs_tolerance );
+ P[i][0] = P[i-1][0] + roundto(P[i][0]-P[i-1][0], nurbs_tolerance);
+ uint32_t bit_size = GetNumberOfBitsUsedToStoreTripleInteger(compressed_control_point[i][0]);
+ if (bit_size > number_of_bits_for_isomin)
+ number_of_bits_for_isomin = bit_size;
+ }
+
+ for(uint32_t i=1;i<number_of_control_point_in_u;i++)
+ for(uint32_t j=1;j<number_of_control_point_in_v;j++)
+ {
+ compressed_control_point[i][j].x = 0;
+ compressed_control_point[i][j].y = 0;
+ compressed_control_point[i][j].z = 0;
+
+ PRCVector3d V = P[i-1][j] - P[i-1][j-1];
+ PRCVector3d U = P[i][j-1] - P[i-1][j-1];
+ PRCVector3d Pc = P[i][j] - (P[i-1][j-1] + U + V);
+
+ if(Pc.Length() < nurbs_tolerance)
+ {
+ control_point_type[i][j] = 0;
+ P[i][j] = P[i-1][j-1] + U + V;
+ }
+ else
+ {
+ PRCVector3d N = U*V;
+ PRCVector3d Ue = U;
+ PRCVector3d Ne = N;
+ if( V.Length() < FLT_EPSILON || !Ue.Normalize() || !Ne.Normalize())
+ {
+ control_point_type[i][j] = 3;
+ // Pc = roundto(Pc, nurbs_tolerance); // not sure if this rounding really happens, need to experiment, docs imply but do not state
+ compressed_control_point[i][j] = iroundto(Pc, nurbs_tolerance);
+ P[i][j] = P[i-1][j-1] + U + V + roundto(Pc, nurbs_tolerance); // see above
+ }
+ else
+ {
+ PRCVector3d NUe = Ne*Ue;
+ double x = Pc.Dot(Ue);
+ double y = Pc.Dot(NUe);
+ double z = Pc.Dot(Ne);
+
+ if(x*x+y*y<nurbs_tolerance*nurbs_tolerance)
+ {
+ control_point_type[i][j] = 1;
+ compressed_control_point[i][j] = iroundto(PRCVector3d(0.0,0.0,z), nurbs_tolerance);
+ P[i][j] = P[i-1][j-1] + U + V + roundto(z, nurbs_tolerance)*Ne; // see above
+ }
+ else
+ {
+ if(fabs(z)<nurbs_tolerance/2)
+ {
+ control_point_type[i][j] = 2;
+ compressed_control_point[i][j] = iroundto(PRCVector3d(x,y,0), nurbs_tolerance);
+ P[i][j] = P[i-1][j-1] + U + V + roundto(x, nurbs_tolerance)*Ue + roundto(y, nurbs_tolerance)*NUe; // see above
+ }
+ else
+ {
+ control_point_type[i][j] = 3;
+ compressed_control_point[i][j] = iroundto(Pc, nurbs_tolerance);
+ P[i][j] = P[i-1][j-1] + U + V + roundto(Pc, nurbs_tolerance); // see above
+ }
+ }
+ }
+ }
+ uint32_t bit_size = GetNumberOfBitsUsedToStoreTripleInteger(compressed_control_point[i][j]);
+ if (bit_size > number_of_bits_for_rest)
+ number_of_bits_for_rest = bit_size;
+ }
+
+ if( number_of_bits_for_rest == 2 ) number_of_bits_for_rest--; // really I think it must be unconditional, but so it seems to be done in Adobe Acrobat (9.3)
+ WriteUnsignedIntegerWithVariableBitNumber ( number_of_bits_for_isomin, 20 )
+ WriteUnsignedIntegerWithVariableBitNumber ( number_of_bits_for_rest, 20 )
+ WriteDouble ( P[0][0].x )
+ WriteDouble ( P[0][0].y )
+ WriteDouble ( P[0][0].z )
+
+ for(uint32_t j = 1; j < number_of_control_point_in_v; j++)
+ {
+ WriteIntegerWithVariableBitNumber(compressed_control_point[0][j].x, number_of_bits_for_isomin+1)
+ WriteIntegerWithVariableBitNumber(compressed_control_point[0][j].y, number_of_bits_for_isomin+1)
+ WriteIntegerWithVariableBitNumber(compressed_control_point[0][j].z, number_of_bits_for_isomin+1)
+ }
+
+ for(uint32_t i = 1; i < number_of_control_point_in_u; i++)
+ {
+ WriteIntegerWithVariableBitNumber(compressed_control_point[i][0].x, number_of_bits_for_isomin+1)
+ WriteIntegerWithVariableBitNumber(compressed_control_point[i][0].y, number_of_bits_for_isomin+1)
+ WriteIntegerWithVariableBitNumber(compressed_control_point[i][0].z, number_of_bits_for_isomin+1)
+ }
+
+ for(uint32_t i = 1; i < number_of_control_point_in_u; i++)
+ {
+ for(uint32_t j = 1; j < number_of_control_point_in_v; j++)
+ {
+ WriteUnsignedIntegerWithVariableBitNumber ( control_point_type[i][j], 2 )
+
+ if(control_point_type[i][j] == 1)
+ {
+ WriteIntegerWithVariableBitNumber ( compressed_control_point[i][j].z, number_of_bits_for_rest+1 )
+ }
+ else if(control_point_type[i][j] == 2)
+ {
+ WriteIntegerWithVariableBitNumber ( compressed_control_point[i][j].x, number_of_bits_for_rest+1 )
+ WriteIntegerWithVariableBitNumber ( compressed_control_point[i][j].y, number_of_bits_for_rest+1 )
+ }
+ else if(control_point_type[i][j] == 3)
+ {
+ WriteIntegerWithVariableBitNumber ( compressed_control_point[i][j].x, number_of_bits_for_rest+1 )
+ WriteIntegerWithVariableBitNumber ( compressed_control_point[i][j].y, number_of_bits_for_rest+1 )
+ WriteIntegerWithVariableBitNumber ( compressed_control_point[i][j].z, number_of_bits_for_rest+1 )
+ }
+ }
+ }
+
+ const uint32_t type_param_u = 0;
+ WriteBoolean( type_param_u == 0 )
+ const uint32_t type_param_v = 0;
+ WriteBoolean( type_param_v == 0 )
+ const bool is_rational = false;
+ WriteBoolean( is_rational )
+}
+
+void PRCCompressedBrepData::serializeCompressedShell(PRCbitStream &pbs)
+{
+ uint32_t i;
+ const uint32_t number_of_face = face.size();
+ WriteBoolean ( number_of_face == 1 )
+
+ if( number_of_face != 1 )
+ WriteNumberOfBitsThenUnsignedInteger (number_of_face)
+
+ for( i=0; i < number_of_face; i++)
+ SerializeCompressedFace ( face[i] )
+
+ const bool is_an_iso_face = false;
+ for( i=0; i < number_of_face; i++)
+ WriteBoolean ( is_an_iso_face )
+}
+
+void PRCCompressedBrepData::serializeCompressedBrepData(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger ( PRC_TYPE_TOPO_BrepDataCompress )
+ SerializeContentBody
+
+ WriteDouble ( brep_data_compressed_tolerance )
+ const uint32_t number_of_bits_to_store_reference = 1;
+ WriteNumberOfBitsThenUnsignedInteger ( number_of_bits_to_store_reference )
+ const uint32_t number_vertex_iso = 0;
+ WriteUnsignedIntegerWithVariableBitNumber ( number_vertex_iso, number_of_bits_to_store_reference )
+ const uint32_t number_edge_iso = 0;
+ WriteUnsignedIntegerWithVariableBitNumber ( number_edge_iso, number_of_bits_to_store_reference )
+
+ const uint32_t number_of_shell = 1;
+ const uint32_t number_of_connex = 1;
+ WriteBoolean ( number_of_shell == 1 && number_of_connex == 1 )
+ serializeCompressedShell( pbs );
+
+ uint32_t i;
+ const uint32_t number_of_faces = face.size();
+ for(i=0; i< number_of_faces; i++)
+ face[i]->serializeBaseTopology( pbs );
+}
+
+void PRCBlend01::serializeBlend01(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_SURF_Blend01)
+
+ SerializeContentSurface
+ SerializeTransformation
+ SerializeUVParameterization
+ SerializePtrCurve ( center_curve )
+ SerializePtrCurve ( origin_curve )
+ SerializePtrCurve ( tangent_curve )
+}
+
+void PRCRuled::serializeRuled(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_SURF_Ruled)
+
+ SerializeContentSurface
+ SerializeTransformation
+ SerializeUVParameterization
+ SerializePtrCurve ( first_curve )
+ SerializePtrCurve ( second_curve )
+}
+
+void PRCSphere::serializeSphere(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_SURF_Sphere)
+
+ SerializeContentSurface
+ SerializeTransformation
+ SerializeUVParameterization
+ WriteDouble ( radius )
+}
+
+void PRCCone::serializeCone(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_SURF_Cone)
+
+ SerializeContentSurface
+ SerializeTransformation
+ SerializeUVParameterization
+ WriteDouble ( bottom_radius )
+ WriteDouble ( semi_angle )
+}
+
+void PRCCylinder::serializeCylinder(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_SURF_Cylinder)
+
+ SerializeContentSurface
+ SerializeTransformation
+ SerializeUVParameterization
+ WriteDouble ( radius )
+}
+
+void PRCTorus::serializeTorus(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_SURF_Torus)
+
+ SerializeContentSurface
+ SerializeTransformation
+ SerializeUVParameterization
+ WriteDouble ( major_radius )
+ WriteDouble ( minor_radius )
+}
+
+void PRCFace::serializeFace(PRCbitStream &pbs)
+{
+ uint32_t i = 0;
+ WriteUnsignedInteger (PRC_TYPE_TOPO_Face)
+
+ SerializeBaseTopology
+ SerializePtrSurface ( base_surface )
+ WriteBit ( have_surface_trim_domain )
+ if ( have_surface_trim_domain )
+ SerializeDomain ( surface_trim_domain )
+ WriteBit ( have_tolerance )
+ if ( have_tolerance )
+ WriteDouble ( tolerance )
+ WriteUnsignedInteger ( number_of_loop )
+ WriteInteger ( outer_loop_index )
+ for (i=0;i<number_of_loop;i++)
+ {
+// SerializePtrTopology ( loop[i] )
+ }
+}
+
+void PRCShell::serializeShell(PRCbitStream &pbs)
+{
+ uint32_t i = 0;
+ WriteUnsignedInteger (PRC_TYPE_TOPO_Shell)
+
+ SerializeBaseTopology
+ WriteBoolean ( shell_is_closed )
+ uint32_t number_of_face = face.size();
+ WriteUnsignedInteger ( number_of_face )
+ for (i=0;i<number_of_face;i++)
+ {
+ SerializePtrTopology ( face[i] )
+ WriteCharacter ( orientation_surface_with_shell[i] )
+ }
+}
+
+void PRCShell::addFace(PRCFace*& pFace, uint8_t orientation)
+{
+ face.push_back(pFace);
+ pFace = NULL;
+ orientation_surface_with_shell.push_back(orientation);
+}
+
+void PRCConnex::serializeConnex(PRCbitStream &pbs)
+{
+ uint32_t i = 0;
+ WriteUnsignedInteger (PRC_TYPE_TOPO_Connex)
+
+ SerializeBaseTopology
+ uint32_t number_of_shell = shell.size();
+ WriteUnsignedInteger ( number_of_shell )
+ for (i=0;i<number_of_shell;i++)
+ {
+ SerializePtrTopology ( shell[i] )
+ }
+}
+
+void PRCConnex::addShell(PRCShell*& pShell)
+{
+ shell.push_back(pShell);
+ pShell = NULL;
+}
+
+#define have_bbox( behavior ) (behavior!=0)
+void PRCBrepData::serializeBrepData(PRCbitStream &pbs)
+{
+ uint32_t i = 0;
+ WriteUnsignedInteger ( PRC_TYPE_TOPO_BrepData)
+
+ SerializeContentBody
+ uint32_t number_of_connex = connex.size();
+ WriteUnsignedInteger ( number_of_connex )
+ for ( i=0; i<number_of_connex; i++)
+ {
+ SerializePtrTopology ( connex[i] )
+ }
+ if ( have_bbox(behavior) )
+ SerializeBoundingBox
+}
+#undef have_bbox
+
+void PRCBrepData::addConnex(PRCConnex*& pConnex)
+{
+ connex.push_back(pConnex);
+ pConnex = NULL;
+}
+
+void PRCContentWireEdge::serializeContentWireEdge(PRCbitStream &pbs)
+{
+ SerializeBaseTopology
+ SerializePtrCurve ( curve_3d )
+ WriteBit ( has_curve_trim_interval )
+ if ( has_curve_trim_interval )
+ SerializeInterval ( curve_trim_interval )
+}
+
+void PRCWireEdge::serializeWireEdge(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_TOPO_WireEdge)
+ SerializeContentWireEdge
+}
+
+void PRCContentCurve::serializeContentCurve(PRCbitStream &pbs)
+{
+ SerializeBaseGeometry
+ WriteUnsignedInteger ( extend_info )
+ WriteBoolean ( is_3d )
+}
+
+void PRCNURBSCurve::serializeNURBSCurve(PRCbitStream &pbs)
+{
+ uint32_t i=0;
+ WriteUnsignedInteger (PRC_TYPE_CRV_NURBS)
+
+ SerializeContentCurve
+ WriteBoolean ( is_rational )
+ WriteUnsignedInteger ( degree )
+ uint32_t highest_index_of_control_point = control_point.size()-1;
+ uint32_t highest_index_of_knots = knot.size()-1;
+ WriteUnsignedInteger ( highest_index_of_control_point )
+ WriteUnsignedInteger ( highest_index_of_knots )
+ for (i=0; i<=highest_index_of_control_point; i++)
+ {
+ WriteDouble ( control_point[i].x )
+ WriteDouble ( control_point[i].y )
+ if (is_3d)
+ WriteDouble ( control_point[i].z )
+ if (is_rational)
+ WriteDouble ( control_point[i].w )
+ }
+ for (i=0; i<=highest_index_of_knots; i++)
+ WriteDouble ( knot[i] )
+ WriteUnsignedInteger ( knot_type )
+ WriteUnsignedInteger ( curve_form )
+}
+
+void PRCPolyLine::serializePolyLine(PRCbitStream &pbs)
+{
+ uint32_t i=0;
+ WriteUnsignedInteger (PRC_TYPE_CRV_PolyLine)
+
+ SerializeContentCurve
+ SerializeTransformation
+ SerializeParameterization
+ uint32_t number_of_point = point.size();
+ WriteUnsignedInteger ( number_of_point )
+ for (i=0; i<number_of_point; i++)
+ {
+ if (is_3d)
+ SerializeVector3d ( point[i] )
+ else
+ SerializeVector2d ( point[i] )
+ }
+}
+
+void PRCCircle::serializeCircle(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_CRV_Circle)
+
+ SerializeContentCurve
+ SerializeTransformation
+ SerializeParameterization
+ WriteDouble ( radius )
+}
+
+void PRCComposite::serializeComposite(PRCbitStream &pbs)
+{
+ uint32_t i=0;
+ WriteUnsignedInteger (PRC_TYPE_CRV_Composite)
+
+ SerializeContentCurve
+ SerializeTransformation
+ SerializeParameterization
+ uint32_t number_of_curves = base_curve.size();
+ WriteUnsignedInteger ( number_of_curves )
+ for (i=0; i<number_of_curves; i++)
+ {
+ SerializePtrCurve ( base_curve[i] )
+ WriteBoolean ( base_sense[i] )
+ }
+ WriteBoolean ( is_closed )
+}
+
+void PRCTopoContext::serializeTopoContext(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger (PRC_TYPE_TOPO_Context)
+
+ SerializeContentPRCBase
+ WriteCharacter ( behaviour )
+ WriteDouble ( granularity )
+ WriteDouble ( tolerance )
+ WriteBoolean ( have_smallest_face_thickness )
+ if ( have_smallest_face_thickness )
+ WriteDouble ( smallest_thickness )
+ WriteBoolean ( have_scale )
+ if ( have_scale )
+ WriteDouble ( scale )
+}
+
+void PRCTopoContext::serializeContextAndBodies(PRCbitStream &pbs)
+{
+ uint32_t i=0;
+ SerializeTopoContext
+ uint32_t number_of_bodies = body.size();
+ WriteUnsignedInteger (number_of_bodies)
+ for (i=0;i<number_of_bodies;i++)
+ SerializeBody (body[i])
+}
+
+void PRCTopoContext::serializeGeometrySummary(PRCbitStream &pbs)
+{
+ uint32_t i=0;
+ uint32_t number_of_bodies = body.size();
+ WriteUnsignedInteger (number_of_bodies)
+ for (i=0;i<number_of_bodies;i++)
+ {
+ WriteUnsignedInteger ( body[i]->serialType() )
+ if ( IsCompressedType(body[i]->serialType()) )
+ {
+ WriteDouble ( body[i]->serialTolerance() )
+ }
+ }
+}
+
+void PRCTopoContext::serializeContextGraphics(PRCbitStream &pbs)
+{
+ uint32_t i=0, j=0, k=0, l=0;
+ ResetCurrentGraphics
+ uint32_t number_of_body = body.size();
+ PRCGraphicsList element;
+ bool has_graphics = false;
+ for (i=0;i<number_of_body;i++)
+ {
+ if ( body[i]->topo_item_type == PRC_TYPE_TOPO_BrepData && dynamic_cast<PRCBrepData*>(body[i]))
+ {
+ PRCBrepData *body_i = dynamic_cast<PRCBrepData*>(body[i]);
+ for (j=0;j<body_i->connex.size();j++)
+ {
+ for(k=0;k<body_i->connex[j]->shell.size();k++)
+ {
+ for( l=0;l<body_i->connex[j]->shell[k]->face.size();l++)
+ {
+ element.push_back( body_i->connex[j]->shell[k]->face[l] );
+ has_graphics = has_graphics || body_i->connex[j]->shell[k]->face[l]->has_graphics();
+ }
+ }
+ }
+ }
+ else if ( body[i]->topo_item_type == PRC_TYPE_TOPO_BrepDataCompress && dynamic_cast<PRCCompressedBrepData*>(body[i]))
+ {
+ PRCCompressedBrepData *body_i = dynamic_cast<PRCCompressedBrepData*>(body[i]);
+ for( l=0;l<body_i->face.size();l++)
+ {
+ element.push_back( body_i->face[l] );
+ has_graphics = has_graphics || body_i->face[l]->has_graphics();
+ }
+ }
+ }
+ uint32_t number_of_treat_type = 0;
+ if (has_graphics && !element.empty())
+ number_of_treat_type = 1;
+ WriteUnsignedInteger (number_of_treat_type)
+ for (i=0;i<number_of_treat_type;i++)
+ {
+ const uint32_t element_type = PRC_TYPE_TOPO_Face;
+ WriteUnsignedInteger (element_type)
+ const uint32_t number_of_element = element.size();
+ WriteUnsignedInteger (number_of_element)
+ for (j=0;j<number_of_element;j++)
+ {
+ WriteBoolean ( element[j]->has_graphics() )
+ if (element[j]->has_graphics())
+ {
+ element[j]->serializeGraphics(pbs);
+ }
+ }
+ }
+}
+
+uint32_t PRCTopoContext::addSingleWireBody(PRCSingleWireBody*& pSingleWireBody)
+{
+ body.push_back(pSingleWireBody);
+ pSingleWireBody = NULL;
+ return body.size()-1;
+}
+
+uint32_t PRCTopoContext::addBrepData(PRCBrepData*& pBrepData)
+{
+ body.push_back(pBrepData);
+ pBrepData = NULL;
+ return body.size()-1;
+}
+
+uint32_t PRCTopoContext::addCompressedBrepData(PRCCompressedBrepData*& pCompressedBrepData)
+{
+ body.push_back(pCompressedBrepData);
+ pCompressedBrepData = NULL;
+ return body.size()-1;
+}
+
+void PRCSingleWireBody::serializeSingleWireBody(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger ( PRC_TYPE_TOPO_SingleWireBody)
+
+ SerializeContentBody
+ SerializePtrTopology ( wire_edge )
+}
+
+void PRCUniqueId::serializeCompressedUniqueId(PRCbitStream &pbs) const
+{
+ WriteUnsignedInteger (id0)
+ WriteUnsignedInteger (id1)
+ WriteUnsignedInteger (id2)
+ WriteUnsignedInteger (id3)
+}
+
+void PRCUniqueId::serializeFileStructureUncompressedUniqueId(std::ostream& out) const
+{
+ WriteUncompressedUnsignedInteger (id0)
+ WriteUncompressedUnsignedInteger (id1)
+ WriteUncompressedUnsignedInteger (id2)
+ WriteUncompressedUnsignedInteger (id3)
+}
+
+void PRCUnit::serializeUnit(PRCbitStream &pbs)
+{
+ WriteBoolean (unit_from_CAD_file)
+ WriteDouble (unit)
+}
+
+void PRCProductOccurrence::serializeProductOccurrence(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger ( PRC_TYPE_ASM_ProductOccurence )
+
+ SerializePRCBaseWithGraphics
+
+// SerializeReferencesOfProductOccurrence
+ WriteUnsignedInteger (index_part+1)
+ WriteUnsignedInteger (index_prototype+1)
+ if (index_prototype != m1)
+ {
+ WriteBoolean (prototype_in_same_file_structure)
+ if (!prototype_in_same_file_structure)
+ SerializeCompressedUniqueId (prototype_file_structure)
+ }
+ WriteUnsignedInteger(index_external_data+1)
+ if (index_external_data != m1)
+ {
+ WriteBoolean (external_data_in_same_file_structure)
+ if (!external_data_in_same_file_structure)
+ SerializeCompressedUniqueId (external_data_file_structure)
+ }
+ const uint32_t number_of_son_product_occurrences = index_son_occurrence.size();
+ WriteUnsignedInteger (number_of_son_product_occurrences)
+ for (uint32_t i=0;i<number_of_son_product_occurrences;i++)
+ WriteUnsignedInteger (index_son_occurrence[i])
+
+ WriteCharacter (product_behaviour)
+
+// SerializeProductInformation (product_information)
+ SerializeUnit (unit_information)
+ WriteCharacter (product_information_flags)
+ WriteInteger (product_load_status)
+
+ const bool has_location = location != NULL;
+ WriteBit (has_location)
+ if (has_location)
+ location->serializeTransformation3d (pbs);
+
+ WriteUnsignedInteger (0) // number_of_references
+
+// SerializeMarkups (markups)
+ WriteUnsignedInteger (0) // number_of_linked_items
+ WriteUnsignedInteger (0) // number_of_leaders
+ WriteUnsignedInteger (0) // number_of_markups
+ WriteUnsignedInteger (0) // number_of_annotation_entities
+
+
+ WriteUnsignedInteger (0) // number_of_views
+ WriteBit (false) // has_entity_filter
+ WriteUnsignedInteger (0) // number_of_display_filters
+ WriteUnsignedInteger (0) // number_of_scene_display_parameters
+
+ SerializeUserData
+}
+
+uint32_t PRCPartDefinition::addBrepModel(PRCBrepModel*& pBrepModel)
+{
+ representation_item.push_back(pBrepModel);
+ pBrepModel = NULL;
+ return representation_item.size()-1;
+}
+
+uint32_t PRCPartDefinition::addPolyBrepModel(PRCPolyBrepModel*& pPolyBrepModel)
+{
+ representation_item.push_back(pPolyBrepModel);
+ pPolyBrepModel = NULL;
+ return representation_item.size()-1;
+}
+
+uint32_t PRCPartDefinition::addPointSet(PRCPointSet*& pPointSet)
+{
+ representation_item.push_back(pPointSet);
+ pPointSet = NULL;
+ return representation_item.size()-1;
+}
+
+uint32_t PRCPartDefinition::addSet(PRCSet*& pSet)
+{
+ representation_item.push_back(pSet);
+ pSet = NULL;
+ return representation_item.size()-1;
+}
+
+uint32_t PRCPartDefinition::addWire(PRCWire*& pWire)
+{
+ representation_item.push_back(pWire);
+ pWire = NULL;
+ return representation_item.size()-1;
+}
+
+uint32_t PRCPartDefinition::addPolyWire(PRCPolyWire*& pPolyWire)
+{
+ representation_item.push_back(pPolyWire);
+ pPolyWire = NULL;
+ return representation_item.size()-1;
+}
+
+uint32_t PRCPartDefinition::addRepresentationItem(PRCRepresentationItem*& pRepresentationItem)
+{
+ representation_item.push_back(pRepresentationItem);
+ pRepresentationItem = NULL;
+ return representation_item.size()-1;
+}
+
+void PRCPartDefinition::serializePartDefinition(PRCbitStream &pbs)
+{
+ WriteUnsignedInteger ( PRC_TYPE_ASM_PartDefinition )
+
+ SerializePRCBaseWithGraphics
+ SerializeBoundingBox
+
+ uint32_t number_of_representation_items = representation_item.size();
+ WriteUnsignedInteger (number_of_representation_items)
+ for (uint32_t i=0;i<number_of_representation_items;i++)
+ SerializeRepresentationItem (representation_item[i])
+
+ // SerializeMarkups (markups)
+ WriteUnsignedInteger (0) // number_of_linked_items
+ WriteUnsignedInteger (0) // number_of_leaders
+ WriteUnsignedInteger (0) // number_of_markups
+ WriteUnsignedInteger (0) // number_of_annotation_entities
+
+ WriteUnsignedInteger (0) // number_of_views
+ SerializeUserData
+}
diff --git a/graphics/asymptote/prc/writePRC.h b/graphics/asymptote/prc/writePRC.h
new file mode 100644
index 0000000000..7a9313e45c
--- /dev/null
+++ b/graphics/asymptote/prc/writePRC.h
@@ -0,0 +1,1472 @@
+/************
+*
+* This file is part of a tool for producing 3D content in the PRC format.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*************/
+
+#ifndef __WRITE_PRC_H
+#define __WRITE_PRC_H
+#include <string>
+#include <vector>
+#include <deque>
+#include <list>
+
+#include <map>
+#include <iostream>
+#include "PRCbitStream.h"
+#include "PRC.h"
+#include <float.h>
+#include <math.h>
+
+static const uint32_t m1=(uint32_t)-1;
+static const double pi=acos(-1.0);
+
+class PRCVector3d
+{
+public :
+ double x;
+ double y;
+ double z;
+ PRCVector3d() :
+ x(0), y(0), z(0) {}
+ PRCVector3d(double fx, double fy, double fz) :
+ x(fx), y(fy), z(fz) {}
+ PRCVector3d(const double c[], double fx=0, double fy=0, double fz=0) :
+ x(c?c[0]:fx), y(c?c[1]:fy), z(c?c[2]:fz) {}
+ PRCVector3d(const PRCVector3d& sVector3d) :
+ x(sVector3d.x), y(sVector3d.y), z(sVector3d.z) {}
+
+ void Set(double fx, double fy, double fz)
+ { x = fx; y = fy; z = fz; }
+ double Dot(const PRCVector3d & sPt) const
+ { return(x*sPt.x)+(y*sPt.y)+(z*sPt.z); }
+ double LengthSquared()
+ { return(x*x+y*y+z*z); }
+
+ friend PRCVector3d operator + (const PRCVector3d& a, const PRCVector3d& b)
+ { return PRCVector3d(a.x+b.x,a.y+b.y,a.z+b.z); }
+ friend PRCVector3d operator - (const PRCVector3d& a)
+ { return PRCVector3d(-a.x,-a.y,-a.z); }
+ friend PRCVector3d operator - (const PRCVector3d& a, const PRCVector3d& b)
+ { return PRCVector3d(a.x-b.x,a.y-b.y,a.z-b.z); }
+ friend PRCVector3d operator * (const PRCVector3d& a, const double d)
+ { return PRCVector3d(a.x*d,a.y*d,a.z*d); }
+ friend PRCVector3d operator * (const double d, const PRCVector3d& a)
+ { return PRCVector3d(a.x*d,a.y*d,a.z*d); }
+ friend PRCVector3d operator / (const PRCVector3d& a, const double d)
+ { return PRCVector3d(a.x/d,a.y/d,a.z/d); }
+ friend PRCVector3d operator * (const PRCVector3d& a, const PRCVector3d& b)
+ { return PRCVector3d((a.y*b.z)-(a.z*b.y), (a.z*b.x)-(a.x*b.z), (a.x*b.y)-(a.y*b.x)); }
+
+ void write(PRCbitStream &out) { out << x << y << z; }
+ void serializeVector3d(PRCbitStream &pbs) const { pbs << x << y << z; }
+ void serializeVector2d(PRCbitStream &pbs) const { pbs << x << y; }
+
+ double Length();
+ bool Normalize();
+
+ bool operator==(const PRCVector3d &v) const
+ {
+ return x==v.x && y==v.y && z==v.z;
+ }
+ bool operator!=(const PRCVector3d &v) const
+ {
+ return !(x==v.x && y==v.y && z==v.z);
+ }
+ bool operator<(const PRCVector3d &v) const
+ {
+ if(x!=v.x)
+ return (x<v.x);
+ if(y!=v.y)
+ return (y<v.y);
+ return (z<v.z);
+ }
+ friend std::ostream& operator << (std::ostream& out, const PRCVector3d& v)
+ {
+ out << "(" << v.x << "," << v.y << "," << v.z << ")";
+ return out;
+ }
+};
+/*
+class UUID
+{
+ public:
+ UUID(uint32_t u0, uint32_t u1, uint32_t u2, uint32_t u3) :
+ id0(u0),id1(u1),id2(u2),id3(u3) {}
+ void write(PRCbitStream &out)
+ {
+ out << id0 << id1 << id2 << id3;
+ }
+ private:
+ uint32_t id0,id1,id2,id3;
+}; */
+
+void writeUncompressedUnsignedInteger(std::ostream &out, uint32_t data);
+
+void writeUnit(PRCbitStream &,bool,double);
+
+void writeEmptyMarkups(PRCbitStream&);
+
+class UserData
+{
+ public:
+ UserData(uint32_t s = 0, uint8_t* d = 0) : size(s),data(d) {}
+ void write(PRCbitStream&);
+ private:
+ uint32_t size;
+ uint8_t* data;
+};
+
+struct PRCAttributeEntry
+{
+ PRCAttributeEntry() : title_is_integer(false) {}
+ PRCAttributeEntry(uint32_t integer) : title_is_integer(true)
+ {
+ title_integer = integer;
+ }
+ PRCAttributeEntry(const std::string &text) : title_is_integer(false)
+ {
+ title_text = text;
+ }
+ void serializeAttributeEntry(PRCbitStream&) const;
+ bool title_is_integer;
+ std::string title_text;
+ uint32_t title_integer;
+};
+
+class PRCSingleAttribute : public PRCAttributeEntry
+{
+ public:
+ PRCSingleAttribute() : type(KEPRCModellerAttributeTypeNull) {}
+ PRCSingleAttribute(int32_t integer) : PRCAttributeEntry(), type(KEPRCModellerAttributeTypeInt)
+ {
+ value.integer = integer;
+ }
+ PRCSingleAttribute(double real) : PRCAttributeEntry(), type(KEPRCModellerAttributeTypeReal)
+ {
+ value.real = real;
+ }
+ PRCSingleAttribute(uint32_t time) : PRCAttributeEntry(), type(KEPRCModellerAttributeTypeTime)
+ {
+ value.time = time;
+ }
+ PRCSingleAttribute(const std::string &text) : PRCAttributeEntry(), type(KEPRCModellerAttributeTypeString)
+ {
+ value_text = text;}
+ PRCSingleAttribute(uint32_t title, int32_t integer) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeInt)
+ {
+ value.integer = integer;
+ }
+ PRCSingleAttribute(uint32_t title, double real) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeReal)
+ {
+ value.real = real;
+ }
+ PRCSingleAttribute(uint32_t title, uint32_t time) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeTime)
+ {
+ value.time = time;
+ }
+ PRCSingleAttribute(uint32_t title, const std::string &text) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeString)
+ {
+ value_text = text;
+ }
+ PRCSingleAttribute(const std::string title, int32_t integer) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeInt)
+ {
+ value.integer = integer;
+ }
+ PRCSingleAttribute(const std::string title, double real) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeReal)
+ {
+ value.real = real;
+ }
+ PRCSingleAttribute(const std::string title, uint32_t time) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeTime)
+ {
+ value.time = time;
+ }
+ PRCSingleAttribute(const std::string title, const std::string &text) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeString)
+ {
+ value_text = text;
+ }
+ void serializeSingleAttribute(PRCbitStream&) const;
+ EPRCModellerAttributeType type;
+ union PRCSingleAttributeData
+ {
+ int32_t integer;
+ double real;
+ uint32_t time;
+ } value;
+ std::string value_text;
+};
+
+class PRCAttribute : public PRCAttributeEntry
+{
+ public:
+ PRCAttribute() : PRCAttributeEntry() {}
+ PRCAttribute(uint32_t title) : PRCAttributeEntry(title) {}
+ PRCAttribute(const std::string title) : PRCAttributeEntry(title) {}
+ void serializeAttribute(PRCbitStream &) const;
+ PRCSingleAttribute& newKey() { attribute_keys.resize(attribute_keys.size()+1); return attribute_keys.back(); }
+ void addKey(const PRCSingleAttribute &key) { attribute_keys.push_back(key); }
+ std::deque<PRCSingleAttribute> attribute_keys;
+};
+
+typedef std::list<PRCAttribute> PRCAttributeList;
+
+class PRCAttributes
+{
+ public:
+ void serializeAttributes(PRCbitStream&) const;
+ PRCAttribute& newAttribute() { attributes.push_front(PRCAttribute()); return attributes.front(); }
+ void addAttribute(const PRCAttribute &attribute) { attributes.push_front(attribute); }
+ PRCAttributeList attributes;
+};
+
+bool type_eligible_for_reference(uint32_t type);
+uint32_t makeCADID();
+uint32_t makePRCID();
+
+class ContentPRCBase : public PRCAttributes
+{
+ public:
+ ContentPRCBase(uint32_t t, std::string n="") :
+ type(t),name(n),CAD_identifier(0), CAD_persistent_identifier(0), PRC_unique_identifier(0)
+ {
+ if(type_eligible_for_reference(type))
+ {
+ CAD_identifier = makeCADID();
+ PRC_unique_identifier = makePRCID();
+ }
+ }
+ void serializeContentPRCBase(PRCbitStream&) const;
+ uint32_t getPRCID() const { return PRC_unique_identifier; }
+ uint32_t getType() const { return type; }
+ uint32_t type;
+ std::string name;
+ uint32_t CAD_identifier, CAD_persistent_identifier, PRC_unique_identifier;
+};
+
+class PRCReferenceUniqueIdentifier
+{
+public:
+ PRCReferenceUniqueIdentifier() :
+ type(0), unique_identifier(m1) {}
+ void serializeReferenceUniqueIdentifier(PRCbitStream&);
+ uint32_t type;
+// bool reference_in_same_file_structure;
+// PRCUniqueId target_file_structure;
+ uint32_t unique_identifier;
+};
+
+extern std::string currentName;
+void writeName(PRCbitStream&,const std::string&);
+void resetName();
+
+extern uint32_t current_layer_index;
+extern uint32_t current_index_of_line_style;
+extern uint16_t current_behaviour_bit_field;
+
+void writeGraphics(PRCbitStream&,uint32_t=m1,uint32_t=m1,uint16_t=1,bool=false);
+void resetGraphics();
+
+void resetGraphicsAndName();
+
+struct PRCRgbColor
+{
+ PRCRgbColor(double r=0.0, double g=0.0, double b=0.0) :
+ red(r), green(g), blue(b) {}
+ double red,green,blue;
+ void serializeRgbColor(PRCbitStream&);
+
+ bool operator==(const PRCRgbColor &c) const
+ {
+ return (red==c.red && green==c.green && blue==c.blue);
+ }
+ bool operator!=(const PRCRgbColor &c) const
+ {
+ return !(red==c.red && green==c.green && blue==c.blue);
+ }
+ bool operator<(const PRCRgbColor &c) const
+ {
+ if(red!=c.red)
+ return (red<c.red);
+ if(green!=c.green)
+ return (green<c.green);
+ return (blue<c.blue);
+ }
+};
+
+class PRCPicture : public ContentPRCBase
+{
+public:
+ PRCPicture(std::string n="") :
+ ContentPRCBase(PRC_TYPE_GRAPH_Picture,n), format(KEPRCPicture_PNG), uncompressed_file_index(m1), pixel_width(0), pixel_height(0) {}
+ void serializePicture(PRCbitStream&);
+ EPRCPictureDataFormat format;
+ uint32_t uncompressed_file_index;
+ uint32_t pixel_width;
+ uint32_t pixel_height;
+};
+
+struct PRCVector2d
+{
+ PRCVector2d() :
+ x(0.0), y(0.0) {}
+ PRCVector2d(double X, double Y) :
+ x(X), y(Y) {}
+ void serializeVector2d(PRCbitStream&);
+ double x;
+ double y;
+ PRCVector2d(const double c[], double fx=0, double fy=0) :
+ x(c?c[0]:fx), y(c?c[1]:fy) {}
+ PRCVector2d(const PRCVector2d& sVector2d) :
+ x(sVector2d.x), y(sVector2d.y) {}
+
+ void Set(double fx, double fy)
+ { x = fx; y = fy; }
+ double Dot(const PRCVector2d & sPt) const
+ { return(x*sPt.x)+(y*sPt.y); }
+ double LengthSquared()
+ { return(x*x+y*y); }
+
+ friend PRCVector2d operator + (const PRCVector2d& a, const PRCVector2d& b)
+ { return PRCVector2d(a.x+b.x,a.y+b.y); }
+ friend PRCVector2d operator - (const PRCVector2d& a)
+ { return PRCVector2d(-a.x,-a.y); }
+ friend PRCVector2d operator - (const PRCVector2d& a, const PRCVector2d& b)
+ { return PRCVector2d(a.x-b.x,a.y-b.y); }
+ friend PRCVector2d operator * (const PRCVector2d& a, const double d)
+ { return PRCVector2d(a.x*d,a.y*d); }
+ friend PRCVector2d operator * (const double d, const PRCVector2d& a)
+ { return PRCVector2d(a.x*d,a.y*d); }
+ friend PRCVector2d operator / (const PRCVector2d& a, const double d)
+ { return PRCVector2d(a.x/d,a.y/d); }
+
+ double Length();
+ bool Normalize();
+
+ bool operator==(const PRCVector2d &v) const
+ {
+ return x==v.x && y==v.y;
+ }
+ bool operator!=(const PRCVector2d &v) const
+ {
+ return !(x==v.x && y==v.y);
+ }
+ bool operator<(const PRCVector2d &v) const
+ {
+ if(x!=v.x)
+ return (x<v.x);
+ return (y<v.y);
+ }
+ friend std::ostream& operator << (std::ostream& out, const PRCVector2d& v)
+ {
+ out << "(" << v.x << "," << v.y << ")";
+ return out;
+ }
+};
+
+class PRCTextureDefinition : public ContentPRCBase
+{
+public:
+ PRCTextureDefinition(std::string n="") :
+ ContentPRCBase(PRC_TYPE_GRAPH_TextureDefinition,n), picture_index(m1), texture_mapping_attribute(PRC_TEXTURE_MAPPING_DIFFUSE),
+ texture_mapping_attribute_intensity(1.0), texture_mapping_attribute_components(PRC_TEXTURE_MAPPING_COMPONENTS_RGBA),
+ texture_function(KEPRCTextureFunction_Modulate), texture_applying_mode(PRC_TEXTURE_APPLYING_MODE_NONE),
+ texture_wrapping_mode_S(KEPRCTextureWrappingMode_Unknown), texture_wrapping_mode_T(KEPRCTextureWrappingMode_Unknown) // ,
+ // texture_transformation(false), texture_flip_S(false), texture_flip_T(false),
+ // behaviour(PRC_TRANSFORMATION_Identity), scale(1.0,1.0), uniform_scale(1.0)
+ {}
+ void serializeTextureDefinition(PRCbitStream&);
+ uint32_t picture_index;
+ uint32_t texture_mapping_attribute;
+ double texture_mapping_attribute_intensity;
+ uint8_t texture_mapping_attribute_components;
+ EPRCTextureFunction texture_function;
+ uint8_t texture_applying_mode;
+ EPRCTextureWrappingMode texture_wrapping_mode_S;
+ EPRCTextureWrappingMode texture_wrapping_mode_T;
+ // bool texture_transformation;
+ // bool texture_flip_S;
+ // bool texture_flip_T;
+ // uint8_t behaviour;
+ // PRCVector2d origin;
+ // PRCVector2d X;
+ // PRCVector2d Y;
+ // PRCVector2d scale;
+ // double uniform_scale;
+ // double X_homegeneous_coord;
+ // double Y_homegeneous_coord;
+ // double origin_homegeneous_coord;
+};
+typedef std::deque <PRCTextureDefinition*> PRCTextureDefinitionList;
+
+class PRCMaterial
+{
+public:
+ virtual ~PRCMaterial() {}
+ virtual void serializeMaterial(PRCbitStream&) = 0;
+};
+typedef std::deque <PRCMaterial*> PRCMaterialList;
+
+class PRCMaterialGeneric : public ContentPRCBase, public PRCMaterial
+{
+public:
+ PRCMaterialGeneric(std::string n="") :
+ ContentPRCBase(PRC_TYPE_GRAPH_Material,n),
+ ambient(m1), diffuse(m1), emissive(m1), specular(m1),
+ shininess(0.0),
+ ambient_alpha(1.0), diffuse_alpha(1.0), emissive_alpha(1.0), specular_alpha(1.0)
+ {}
+ void serializeMaterialGeneric(PRCbitStream&);
+ void serializeMaterial(PRCbitStream &pbs) { serializeMaterialGeneric(pbs); }
+ uint32_t picture_index;
+ uint32_t ambient;
+ uint32_t diffuse;
+ uint32_t emissive;
+ uint32_t specular;
+ double shininess;
+ double ambient_alpha;
+ double diffuse_alpha;
+ double emissive_alpha;
+ double specular_alpha;
+
+ bool operator==(const PRCMaterialGeneric &m) const
+ {
+ return (ambient==m.ambient && diffuse==m.diffuse && emissive==m.emissive && specular==m.specular && shininess==m.shininess &&
+ ambient_alpha==m.ambient_alpha && diffuse_alpha==m.diffuse_alpha && emissive_alpha==m.emissive_alpha && specular_alpha==m.specular_alpha);
+ }
+};
+
+class PRCTextureApplication : public ContentPRCBase, public PRCMaterial
+{
+public:
+ PRCTextureApplication(std::string n="") :
+ ContentPRCBase(PRC_TYPE_GRAPH_TextureApplication,n),
+ material_generic_index(m1), texture_definition_index(m1),
+ next_texture_index(m1), UV_coordinates_index(0)
+ {}
+ void serializeTextureApplication(PRCbitStream&);
+ void serializeMaterial(PRCbitStream &pbs) { serializeTextureApplication(pbs); }
+ uint32_t material_generic_index;
+ uint32_t texture_definition_index;
+ uint32_t next_texture_index;
+ uint32_t UV_coordinates_index;
+};
+
+class PRCLinePattern : public ContentPRCBase
+{
+public:
+ PRCLinePattern(std::string n="") :
+ ContentPRCBase(PRC_TYPE_GRAPH_LinePattern,n),
+ phase(0), is_real_length(false) {}
+ void serializeLinePattern(PRCbitStream&);
+ std::vector<double> lengths;
+ double phase;
+ bool is_real_length;
+};
+typedef std::deque <PRCLinePattern*> PRCLinePatternList;
+
+class PRCStyle : public ContentPRCBase
+{
+public:
+ PRCStyle(std::string n="") :
+ ContentPRCBase(PRC_TYPE_GRAPH_Style,n), line_width(0.0), is_vpicture(false), line_pattern_vpicture_index(m1),
+ is_material(false), color_material_index(m1), is_transparency_defined(false), transparency(255), additional(0)
+ {}
+ void serializeCategory1LineStyle(PRCbitStream&);
+ double line_width;
+ bool is_vpicture;
+ uint32_t line_pattern_vpicture_index;
+ bool is_material;
+ uint32_t color_material_index;
+ bool is_transparency_defined;
+ uint8_t transparency;
+ uint8_t additional;
+};
+typedef std::deque <PRCStyle*> PRCStyleList;
+
+class PRCTessFace
+{
+public:
+ PRCTessFace() :
+ start_wire(0), used_entities_flag(0),
+ start_triangulated(0), number_of_texture_coordinate_indexes(0),
+ is_rgba(false), behaviour(PRC_GRAPHICS_Show)
+ {}
+ void serializeTessFace(PRCbitStream&);
+ std::vector<uint32_t> line_attributes;
+ uint32_t start_wire; // specifing bounding wire seems not to work as of Acrobat/Reader 9.2
+ std::vector<uint32_t> sizes_wire; // specifing bounding wire seems not to work as of Acrobat/Reader 9.2
+ uint32_t used_entities_flag;
+ uint32_t start_triangulated;
+ std::vector<uint32_t> sizes_triangulated;
+ uint32_t number_of_texture_coordinate_indexes;
+ bool is_rgba;
+ std::vector<uint8_t> rgba_vertices;
+ uint32_t behaviour;
+};
+typedef std::deque <PRCTessFace*> PRCTessFaceList;
+
+class PRCContentBaseTessData
+{
+public:
+ PRCContentBaseTessData() :
+ is_calculated(false) {}
+ void serializeContentBaseTessData(PRCbitStream&);
+ bool is_calculated;
+ std::vector<double> coordinates;
+};
+
+class PRCTess : public PRCContentBaseTessData
+{
+public:
+ virtual ~PRCTess() {}
+ virtual void serializeBaseTessData(PRCbitStream &pbs) = 0;
+};
+typedef std::deque <PRCTess*> PRCTessList;
+
+class PRC3DTess : public PRCTess
+{
+public:
+ PRC3DTess() :
+ has_faces(false), has_loops(false),
+ crease_angle(25.8419) // arccos(0.9), default found in Acrobat output
+ {}
+ ~PRC3DTess() { for(PRCTessFaceList::iterator it=face_tessellation.begin(); it!=face_tessellation.end(); ++it) delete *it; }
+ void serialize3DTess(PRCbitStream&);
+ void serializeBaseTessData(PRCbitStream &pbs) { serialize3DTess(pbs); }
+ void addTessFace(PRCTessFace*& pTessFace);
+
+ bool has_faces;
+ bool has_loops;
+ double crease_angle;
+ std::vector<double> normal_coordinate;
+ std::vector<uint32_t> wire_index; // specifing bounding wire seems not to work as of Acrobat/Reader 9.2
+ std::vector<uint32_t> triangulated_index;
+ PRCTessFaceList face_tessellation;
+ std::vector<double> texture_coordinate;
+};
+
+class PRC3DWireTess : public PRCTess
+{
+public:
+ PRC3DWireTess() :
+ is_rgba(false), is_segment_color(false) {}
+ void serialize3DWireTess(PRCbitStream&);
+ void serializeBaseTessData(PRCbitStream &pbs) { serialize3DWireTess(pbs); }
+
+ bool is_rgba;
+ bool is_segment_color;
+ std::vector<uint32_t> wire_indexes;
+ std::vector<uint8_t> rgba_vertices;
+};
+
+class PRCMarkupTess : public PRCTess
+{
+public:
+ PRCMarkupTess() :
+ behaviour(0)
+ {}
+ void serializeMarkupTess(PRCbitStream&);
+ void serializeBaseTessData(PRCbitStream &pbs) { serializeMarkupTess(pbs); }
+
+ std::vector<uint32_t> codes;
+ std::vector<std::string> texts;
+ std::string label;
+ uint8_t behaviour;
+};
+
+class PRCGraphics
+{
+public:
+ PRCGraphics() : layer_index(m1), index_of_line_style(m1), behaviour_bit_field(PRC_GRAPHICS_Show) {}
+ void serializeGraphics(PRCbitStream&);
+ void serializeGraphicsForced(PRCbitStream&);
+ bool has_graphics() { return (index_of_line_style!=m1 || layer_index!=m1 || behaviour_bit_field!=PRC_GRAPHICS_Show) ; }
+ uint32_t layer_index;
+ uint32_t index_of_line_style;
+ uint16_t behaviour_bit_field;
+};
+typedef std::deque <PRCGraphics*> PRCGraphicsList;
+
+void writeGraphics(PRCbitStream&,const PRCGraphics&,bool=false);
+
+class PRCMarkup: public PRCGraphics, public ContentPRCBase
+{
+public:
+ PRCMarkup(std::string n="") :
+ ContentPRCBase(PRC_TYPE_MKP_Markup,n),
+ type(KEPRCMarkupType_Unknown), sub_type(KEPRCMarkupSubType_Unknown), index_tessellation(m1) {}
+ void serializeMarkup(PRCbitStream&);
+ EPRCMarkupType type;
+ EPRCMarkupSubType sub_type;
+// vector<PRCReferenceUniqueIdentifier> linked_items;
+// vector<PRCReferenceUniqueIdentifier> leaders;
+ uint32_t index_tessellation;
+};
+typedef std::deque <PRCMarkup*> PRCMarkupList;
+
+class PRCAnnotationItem: public PRCGraphics, public ContentPRCBase
+{
+public:
+ PRCAnnotationItem(std::string n="") :
+ ContentPRCBase(PRC_TYPE_MKP_AnnotationItem,n) {}
+ void serializeAnnotationItem(PRCbitStream&);
+ void serializeAnnotationEntity(PRCbitStream &pbs) { serializeAnnotationItem(pbs); }
+ PRCReferenceUniqueIdentifier markup;
+};
+typedef std::deque <PRCAnnotationItem*> PRCAnnotationItemList;
+
+class PRCRepresentationItemContent: public PRCGraphics, public ContentPRCBase
+{
+public:
+ PRCRepresentationItemContent(uint32_t t, std::string n="") :
+ ContentPRCBase(t,n),
+ index_local_coordinate_system(m1), index_tessellation(m1) {}
+ void serializeRepresentationItemContent(PRCbitStream&);
+ uint32_t index_local_coordinate_system;
+ uint32_t index_tessellation;
+};
+
+class PRCRepresentationItem : public PRCRepresentationItemContent
+{
+public:
+ PRCRepresentationItem(uint32_t t, std::string n="") :
+ PRCRepresentationItemContent(t,n) {}
+ virtual ~PRCRepresentationItem() {}
+ virtual void serializeRepresentationItem(PRCbitStream &pbs) = 0;
+};
+typedef std::deque <PRCRepresentationItem*> PRCRepresentationItemList;
+
+class PRCBrepModel : public PRCRepresentationItem
+{
+public:
+ PRCBrepModel(std::string n="") :
+ PRCRepresentationItem(PRC_TYPE_RI_BrepModel,n), has_brep_data(true), context_id(m1), body_id(m1), is_closed(false) {}
+ void serializeBrepModel(PRCbitStream&);
+ void serializeRepresentationItem(PRCbitStream &pbs) { serializeBrepModel(pbs); }
+ bool has_brep_data;
+ uint32_t context_id;
+ uint32_t body_id;
+ bool is_closed;
+};
+
+class PRCPolyBrepModel : public PRCRepresentationItem
+{
+public:
+ PRCPolyBrepModel(std::string n="") :
+ PRCRepresentationItem(PRC_TYPE_RI_PolyBrepModel,n), is_closed(false) {}
+ void serializePolyBrepModel(PRCbitStream&);
+ void serializeRepresentationItem(PRCbitStream &pbs) { serializePolyBrepModel(pbs); }
+ bool is_closed;
+};
+
+class PRCPointSet : public PRCRepresentationItem
+{
+public:
+ PRCPointSet(std::string n="") :
+ PRCRepresentationItem(PRC_TYPE_RI_PointSet,n) {}
+ void serializePointSet(PRCbitStream&);
+ void serializeRepresentationItem(PRCbitStream &pbs) { serializePointSet(pbs); }
+ std::vector<PRCVector3d> point;
+};
+
+class PRCWire : public PRCRepresentationItem
+{
+public:
+ PRCWire(std::string n="") :
+ PRCRepresentationItem(PRC_TYPE_RI_Curve,n), has_wire_body(true), context_id(m1), body_id(m1) {}
+ void serializeWire(PRCbitStream&);
+ void serializeRepresentationItem(PRCbitStream &pbs) { serializeWire(pbs); }
+ bool has_wire_body;
+ uint32_t context_id;
+ uint32_t body_id;
+};
+
+class PRCPolyWire : public PRCRepresentationItem
+{
+public:
+ PRCPolyWire(std::string n="") :
+ PRCRepresentationItem(PRC_TYPE_RI_PolyWire,n) {}
+ void serializePolyWire(PRCbitStream&);
+ void serializeRepresentationItem(PRCbitStream &pbs) { serializePolyWire(pbs); }
+};
+
+class PRCSet : public PRCRepresentationItem
+{
+public:
+ PRCSet(std::string n="") :
+ PRCRepresentationItem(PRC_TYPE_RI_Set,n) {}
+ ~PRCSet() { for(PRCRepresentationItemList::iterator it=elements.begin(); it!=elements.end(); ++it) delete *it; }
+ void serializeSet(PRCbitStream&);
+ void serializeRepresentationItem(PRCbitStream &pbs) { serializeSet(pbs); }
+ uint32_t addBrepModel(PRCBrepModel*& pBrepModel);
+ uint32_t addPolyBrepModel(PRCPolyBrepModel*& pPolyBrepModel);
+ uint32_t addPointSet(PRCPointSet*& pPointSet);
+ uint32_t addSet(PRCSet*& pSet);
+ uint32_t addWire(PRCWire*& pWire);
+ uint32_t addPolyWire(PRCPolyWire*& pPolyWire);
+ uint32_t addRepresentationItem(PRCRepresentationItem*& pRepresentationItem);
+ PRCRepresentationItemList elements;
+};
+
+class PRCTransformation3d
+{
+public:
+ virtual ~PRCTransformation3d() {}
+ virtual void serializeTransformation3d(PRCbitStream&) const =0;
+};
+typedef std::deque <PRCTransformation3d*> PRCTransformation3dList;
+
+class PRCGeneralTransformation3d : public PRCTransformation3d
+{
+public:
+ PRCGeneralTransformation3d()
+ {
+ setidentity();
+ }
+ PRCGeneralTransformation3d(const double t[])
+ {
+ set(t);
+ }
+
+ void serializeGeneralTransformation3d(PRCbitStream&) const;
+ void serializeTransformation3d(PRCbitStream& pbs) const { serializeGeneralTransformation3d(pbs); }
+ double mat[4][4];
+ bool operator==(const PRCGeneralTransformation3d &t) const
+ {
+ for (size_t i=0;i<4;i++)
+ for (size_t j=0;j<4;j++)
+ if(mat[i][j]!=t.mat[i][j])
+ return false;
+ return true;
+ }
+ bool operator<(const PRCGeneralTransformation3d &t) const
+ {
+ for (size_t i=0;i<4;i++)
+ for (size_t j=0;j<4;j++)
+ if(mat[i][j]!=t.mat[i][j])
+ {
+ return (mat[i][j]<t.mat[i][j]);
+ }
+ return false;
+ }
+ void set(const double t[])
+ {
+ if(t!=NULL)
+ for (size_t i=0;i<4;i++)
+ for (size_t j=0;j<4;j++)
+ mat[i][j]=t[4*i+j];
+ else
+ setidentity();
+ }
+ void setidentity()
+ {
+ mat[0][0]=1; mat[0][1]=0; mat[0][2]=0; mat[0][3]=0;
+ mat[1][0]=0; mat[1][1]=1; mat[1][2]=0; mat[1][3]=0;
+ mat[2][0]=0; mat[2][1]=0; mat[2][2]=1; mat[2][3]=0;
+ mat[3][0]=0; mat[3][1]=0; mat[3][2]=0; mat[3][3]=1;
+ }
+ bool isidtransform() const {
+ return(
+ mat[0][0]==1 && mat[0][1]==0 && mat[0][2]==0 && mat[0][3]==0 &&
+ mat[1][0]==0 && mat[1][1]==1 && mat[1][2]==0 && mat[1][3]==0 &&
+ mat[2][0]==0 && mat[2][1]==0 && mat[2][2]==1 && mat[2][3]==0 &&
+ mat[3][0]==0 && mat[3][1]==0 && mat[3][2]==0 && mat[3][3]==1);
+ }
+ bool isnotidtransform() const {
+ return !isidtransform();
+ }
+ double M(size_t i, size_t j) const {
+ // Like Fortran, PRC uses transposed (column-major) format!
+ return mat[j][i];
+ }
+};
+typedef std::deque <PRCGeneralTransformation3d> PRCGeneralTransformation3dList;
+
+class PRCCartesianTransformation3d : public PRCTransformation3d
+{
+public:
+ PRCCartesianTransformation3d() :
+ behaviour(PRC_TRANSFORMATION_Identity), origin(0.0,0.0,0.0), X(1.0,0.0,0.0), Y(0.0,1.0,0.0), Z(0.0,0.0,1.0),
+ scale(1.0,1.0,1.0), uniform_scale(1.0),
+ X_homogeneous_coord(0.0), Y_homogeneous_coord(0.0), Z_homogeneous_coord(0.0), origin_homogeneous_coord(1.0) {}
+ PRCCartesianTransformation3d(const double o[3], const double x[3], const double y[3], double sc) :
+ behaviour(PRC_TRANSFORMATION_Identity), origin(o,0.0,0.0,0.0), X(x,1.0,0.0,0.0), Y(y,0.0,1.0,0.0), Z(0.0,0.0,1.0),
+ scale(1.0,1.0,1.0), uniform_scale(sc),
+ X_homogeneous_coord(0.0), Y_homogeneous_coord(0.0), Z_homogeneous_coord(0.0), origin_homogeneous_coord(1.0)
+ {
+ if(origin!=PRCVector3d(0.0,0.0,0.0))
+ behaviour = behaviour | PRC_TRANSFORMATION_Translate;
+ if(X!=PRCVector3d(1.0,0.0,0.0) || Y!=PRCVector3d(0.0,1.0,0.0))
+ behaviour = behaviour | PRC_TRANSFORMATION_Rotate;
+ if(uniform_scale!=1)
+ behaviour = behaviour | PRC_TRANSFORMATION_Scale;
+ }
+ void serializeCartesianTransformation3d(PRCbitStream& pbs) const;
+ void serializeTransformation3d(PRCbitStream& pbs) const { serializeCartesianTransformation3d(pbs); }
+ uint8_t behaviour;
+ PRCVector3d origin;
+ PRCVector3d X;
+ PRCVector3d Y;
+ PRCVector3d Z;
+ PRCVector3d scale;
+ double uniform_scale;
+ double X_homogeneous_coord;
+ double Y_homogeneous_coord;
+ double Z_homogeneous_coord;
+ double origin_homogeneous_coord;
+ bool operator==(const PRCCartesianTransformation3d &t) const
+ {
+ return behaviour==t.behaviour && origin==t.origin && X==t.X && Y==t.Y && Z==t.Z && scale==t.scale && uniform_scale==t.uniform_scale &&
+ X_homogeneous_coord==t.X_homogeneous_coord && Y_homogeneous_coord==t.Y_homogeneous_coord &&
+ Z_homogeneous_coord==t.Z_homogeneous_coord && origin_homogeneous_coord==t.origin_homogeneous_coord;
+ }
+};
+
+class PRCTransformation
+{
+public:
+ PRCTransformation() :
+ has_transformation(false), geometry_is_2D(false), behaviour(PRC_TRANSFORMATION_Identity),
+ origin(0.0,0.0,0.0), x_axis(1.0,0.0,0.0), y_axis(0.0,1.0,0.0), scale(1) {}
+ void serializeTransformation(PRCbitStream&);
+ bool has_transformation;
+ bool geometry_is_2D;
+ uint8_t behaviour;
+ PRCVector3d origin;
+ PRCVector3d x_axis;
+ PRCVector3d y_axis;
+ double scale;
+};
+
+class PRCCoordinateSystem : public PRCRepresentationItem
+{
+public:
+ PRCCoordinateSystem(std::string n="") :
+ PRCRepresentationItem(PRC_TYPE_RI_CoordinateSystem,n), axis_set(NULL) {}
+ ~PRCCoordinateSystem() { delete axis_set; }
+ void serializeCoordinateSystem(PRCbitStream&);
+ void serializeRepresentationItem(PRCbitStream &pbs) { serializeCoordinateSystem(pbs); }
+ void setAxisSet(PRCGeneralTransformation3d*& transform) { axis_set = transform; transform = NULL; }
+ void setAxisSet(PRCCartesianTransformation3d*& transform) { axis_set = transform; transform = NULL; }
+ PRCTransformation3d *axis_set;
+ bool operator==(const PRCCoordinateSystem &t) const
+ {
+ if(index_local_coordinate_system!=t.index_local_coordinate_system)
+ return false;
+ PRCGeneralTransformation3d* axis_set_general = dynamic_cast<PRCGeneralTransformation3d*>(axis_set);
+ PRCGeneralTransformation3d* t_axis_set_general = dynamic_cast<PRCGeneralTransformation3d*>(t.axis_set);
+ PRCCartesianTransformation3d* axis_set_cartesian = dynamic_cast<PRCCartesianTransformation3d*>(axis_set);
+ PRCCartesianTransformation3d* t_axis_set_cartesian = dynamic_cast<PRCCartesianTransformation3d*>(t.axis_set);
+ if(axis_set_general!=NULL)
+ return (t_axis_set_general!=NULL?(*axis_set_general==*t_axis_set_general):false);
+ if(axis_set_cartesian!=NULL)
+ return (t_axis_set_cartesian!=NULL?(*axis_set_cartesian==*t_axis_set_cartesian):false);
+ return false;
+ }
+};
+typedef std::deque <PRCCoordinateSystem*> PRCCoordinateSystemList;
+
+struct PRCFontKey
+{
+ uint32_t font_size;
+ uint8_t attributes;
+};
+
+class PRCFontKeysSameFont
+{
+public:
+ void serializeFontKeysSameFont(PRCbitStream&);
+ std::string font_name;
+ uint32_t char_set;
+ std::vector<PRCFontKey> font_keys;
+
+};
+
+// Topology
+class PRCBaseGeometry : public PRCAttributes
+{
+public:
+ PRCBaseGeometry() :
+ base_information(false), identifier(0) {}
+ PRCBaseGeometry(std::string n, uint32_t id = 0) :
+ base_information(true),name(n),identifier(id) {}
+ void serializeBaseGeometry(PRCbitStream&);
+ bool base_information;
+ std::string name;
+ uint32_t identifier;
+};
+
+class PRCBoundingBox
+{
+public:
+ PRCBoundingBox() : min(0.0,0.0,0.0), max(0.0,0.0,0.0) {}
+ PRCBoundingBox(const PRCVector3d &m1, const PRCVector3d& m2) : min(m1),max(m2) {}
+ void serializeBoundingBox(PRCbitStream &pbs);
+ PRCVector3d min;
+ PRCVector3d max;
+};
+
+class PRCDomain
+{
+public:
+ void serializeDomain(PRCbitStream &pbs);
+ PRCVector2d min;
+ PRCVector2d max;
+};
+
+class PRCInterval
+{
+public:
+ PRCInterval() : min(0), max(0) {}
+ PRCInterval(double m, double M) : min(m), max(M) {}
+ void serializeInterval(PRCbitStream &pbs);
+ double min;
+ double max;
+};
+
+class PRCParameterization
+{
+public:
+ PRCParameterization() : parameterization_coeff_a(1), parameterization_coeff_b(0) {}
+ PRCParameterization(double min, double max) : interval(min, max), parameterization_coeff_a(1), parameterization_coeff_b(0) {}
+ void serializeParameterization(PRCbitStream &pbs);
+ PRCInterval interval;
+ double parameterization_coeff_a;
+ double parameterization_coeff_b;
+};
+
+class PRCUVParameterization
+{
+public:
+ PRCUVParameterization() : swap_uv(false),
+ parameterization_on_u_coeff_a(1), parameterization_on_v_coeff_a(1),
+ parameterization_on_u_coeff_b(0), parameterization_on_v_coeff_b(0) {}
+ void serializeUVParameterization(PRCbitStream &pbs);
+ bool swap_uv;
+ PRCDomain uv_domain;
+ double parameterization_on_u_coeff_a;
+ double parameterization_on_v_coeff_a;
+ double parameterization_on_u_coeff_b;
+ double parameterization_on_v_coeff_b;
+};
+
+class PRCControlPoint
+{
+public:
+ PRCControlPoint() :
+ x(0), y(0), z(0), w(1) {}
+ PRCControlPoint(double X, double Y, double Z=0, double W=1) :
+ x(X), y(Y), z(Z), w(W) {}
+ PRCControlPoint(const PRCVector3d &v) :
+ x(v.x), y(v.y), z(v.z), w(1) {}
+ void Set(double fx, double fy, double fz, double fw=1)
+ { x = fx; y = fy; z = fz; w = fw; }
+ double x;
+ double y;
+ double z;
+ double w;
+};
+
+class PRCContentSurface: public PRCBaseGeometry
+{
+public:
+ PRCContentSurface() :
+ PRCBaseGeometry(), extend_info(KEPRCExtendTypeNone) {}
+ PRCContentSurface(std::string n) :
+ PRCBaseGeometry(n,makeCADID()),extend_info(KEPRCExtendTypeNone) {}
+ void serializeContentSurface(PRCbitStream&);
+ EPRCExtendType extend_info;
+};
+
+class PRCSurface : public PRCContentSurface
+{
+public:
+ PRCSurface() :
+ PRCContentSurface() {}
+ PRCSurface(std::string n) :
+ PRCContentSurface(n) {}
+ virtual ~PRCSurface() {}
+ virtual void serializeSurface(PRCbitStream &pbs) = 0;
+};
+
+class PRCNURBSSurface : public PRCSurface
+{
+public:
+ PRCNURBSSurface() :
+ PRCSurface(), knot_type(KEPRCKnotTypeUnspecified), surface_form(KEPRCBSplineSurfaceFormUnspecified) {}
+ PRCNURBSSurface(std::string n) :
+ PRCSurface(n), knot_type(KEPRCKnotTypeUnspecified), surface_form(KEPRCBSplineSurfaceFormUnspecified) {}
+ void serializeNURBSSurface(PRCbitStream &pbs);
+ void serializeSurface(PRCbitStream &pbs) { serializeNURBSSurface(pbs); }
+ bool is_rational;
+ uint32_t degree_in_u;
+ uint32_t degree_in_v;
+ std::vector<PRCControlPoint> control_point;
+ std::vector<double> knot_u;
+ std::vector<double> knot_v;
+ const EPRCKnotType knot_type;
+ const EPRCBSplineSurfaceForm surface_form;
+};
+
+class PRCContentCurve: public PRCBaseGeometry
+{
+public:
+ PRCContentCurve() :
+ PRCBaseGeometry(), extend_info(KEPRCExtendTypeNone), is_3d(true) {}
+ PRCContentCurve(std::string n) :
+ PRCBaseGeometry(n,makeCADID()),extend_info(KEPRCExtendTypeNone), is_3d(true) {}
+ void serializeContentCurve(PRCbitStream&);
+ EPRCExtendType extend_info;
+ bool is_3d;
+};
+
+class PRCCurve : public PRCContentCurve
+{
+public:
+ PRCCurve() :
+ PRCContentCurve() {}
+ PRCCurve(std::string n) :
+ PRCContentCurve(n) {}
+ virtual ~PRCCurve() {}
+ virtual void serializeCurve(PRCbitStream &pbs) = 0;
+};
+typedef std::deque <PRCCurve*> PRCCurveList;
+
+class PRCNURBSCurve : public PRCCurve
+{
+public:
+ PRCNURBSCurve() :
+ PRCCurve(), knot_type(KEPRCKnotTypeUnspecified), curve_form(KEPRCBSplineCurveFormUnspecified) {}
+ PRCNURBSCurve(std::string n) :
+ PRCCurve(n), knot_type(KEPRCKnotTypeUnspecified), curve_form(KEPRCBSplineCurveFormUnspecified) {}
+ void serializeNURBSCurve(PRCbitStream &pbs);
+ void serializeCurve(PRCbitStream &pbs) { serializeNURBSCurve(pbs); }
+ bool is_rational;
+ uint32_t degree;
+ std::vector<PRCControlPoint> control_point;
+ std::vector<double> knot;
+ const EPRCKnotType knot_type;
+ const EPRCBSplineCurveForm curve_form;
+};
+
+class PRCPolyLine : public PRCCurve, public PRCTransformation, public PRCParameterization
+{
+public:
+ PRCPolyLine() :
+ PRCCurve() {}
+ PRCPolyLine(std::string n) :
+ PRCCurve(n) {}
+ void serializePolyLine(PRCbitStream &pbs);
+ void serializeCurve(PRCbitStream &pbs) { serializePolyLine(pbs); }
+ std::vector<PRCVector3d> point;
+};
+
+class PRCCircle : public PRCCurve, public PRCTransformation, public PRCParameterization
+{
+public:
+ PRCCircle() :
+ PRCCurve(), PRCParameterization(0,2*pi) {}
+ PRCCircle(std::string n) :
+ PRCCurve(n), PRCParameterization(0,2*pi) {}
+ void serializeCircle(PRCbitStream &pbs);
+ void serializeCurve(PRCbitStream &pbs) { serializeCircle(pbs); }
+ double radius;
+};
+
+class PRCComposite : public PRCCurve, public PRCTransformation, public PRCParameterization
+{
+public:
+ PRCComposite() :
+ PRCCurve() {}
+ PRCComposite(std::string n) :
+ PRCCurve(n) {}
+ void serializeComposite(PRCbitStream &pbs);
+ void serializeCurve(PRCbitStream &pbs) { serializeComposite(pbs); }
+ PRCCurveList base_curve;
+ std::vector<bool> base_sense;
+ bool is_closed;
+};
+
+class PRCBlend01 : public PRCSurface, public PRCTransformation, public PRCUVParameterization
+{
+public:
+ PRCBlend01() :
+ PRCSurface(), center_curve(NULL), origin_curve(NULL), tangent_curve(NULL) {}
+ PRCBlend01(std::string n) :
+ PRCSurface(n), center_curve(NULL), origin_curve(NULL), tangent_curve(NULL) {}
+ ~PRCBlend01() { delete center_curve; delete origin_curve; delete tangent_curve; }
+ void serializeBlend01(PRCbitStream &pbs);
+ void serializeSurface(PRCbitStream &pbs) { serializeBlend01(pbs); }
+// void setCenterCurve (PRCCurve*& curve) { center_curve = curve; curve = NULL; }
+// void setOriginCurve (PRCCurve*& curve) { origin_curve = curve; curve = NULL; }
+// void setTangentCurve(PRCCurve*& curve) { tangent_curve = curve; curve = NULL; }
+ PRCCurve* center_curve;
+ PRCCurve* origin_curve;
+ PRCCurve* tangent_curve;
+};
+
+class PRCRuled : public PRCSurface, public PRCTransformation, public PRCUVParameterization
+{
+public:
+ PRCRuled() :
+ PRCSurface(), first_curve(NULL), second_curve(NULL) {}
+ PRCRuled(std::string n) :
+ PRCSurface(n) {}
+ ~PRCRuled() { delete first_curve; delete second_curve; }
+ void serializeRuled(PRCbitStream &pbs);
+ void serializeSurface(PRCbitStream &pbs) { serializeRuled(pbs); }
+// void setFirstCurve(PRCCurve*& curve) { first_curve = curve; curve = NULL; }
+// void setSecondCurve(PRCCurve*& curve) { second_curve = curve; curve = NULL; }
+ PRCCurve* first_curve;
+ PRCCurve* second_curve;
+};
+
+class PRCSphere : public PRCSurface, public PRCTransformation, public PRCUVParameterization
+{
+public:
+ PRCSphere() :
+ PRCSurface() {}
+ PRCSphere(std::string n) :
+ PRCSurface(n) {}
+ void serializeSphere(PRCbitStream &pbs);
+ void serializeSurface(PRCbitStream &pbs) { serializeSphere(pbs); }
+ double radius;
+};
+
+class PRCCone : public PRCSurface, public PRCTransformation, public PRCUVParameterization
+{
+public:
+ PRCCone() :
+ PRCSurface() {}
+ PRCCone(std::string n) :
+ PRCSurface(n) {}
+ void serializeCone(PRCbitStream &pbs);
+ void serializeSurface(PRCbitStream &pbs) { serializeCone(pbs); }
+ double bottom_radius;
+ double semi_angle;
+};
+
+class PRCCylinder : public PRCSurface, public PRCTransformation, public PRCUVParameterization
+{
+public:
+ PRCCylinder() :
+ PRCSurface() {}
+ PRCCylinder(std::string n) :
+ PRCSurface(n) {}
+ void serializeCylinder(PRCbitStream &pbs);
+ void serializeSurface(PRCbitStream &pbs) { serializeCylinder(pbs); }
+ double radius;
+};
+
+class PRCTorus : public PRCSurface, public PRCTransformation, public PRCUVParameterization
+{
+public:
+ PRCTorus() :
+ PRCSurface() {}
+ PRCTorus(std::string n) :
+ PRCSurface(n) {}
+ void serializeTorus(PRCbitStream &pbs);
+ void serializeSurface(PRCbitStream &pbs) { serializeTorus(pbs); }
+ double major_radius;
+ double minor_radius;
+};
+
+class PRCBaseTopology : public PRCAttributes
+{
+public:
+ PRCBaseTopology() :
+ base_information(false),identifier(0) {}
+ PRCBaseTopology(std::string n, uint32_t id = 0) :
+ base_information(true),name(n),identifier(id) {}
+ void serializeBaseTopology(PRCbitStream&);
+ bool base_information;
+ std::string name;
+ uint32_t identifier;
+};
+
+class PRCTopoItem
+{
+public:
+ virtual ~PRCTopoItem() {}
+ virtual void serializeTopoItem(PRCbitStream&)=0;
+};
+
+class PRCContentBody: public PRCBaseTopology
+{
+public:
+ PRCContentBody() :
+ PRCBaseTopology(), behavior(0) {}
+ PRCContentBody(std::string n) :
+ PRCBaseTopology(n,makeCADID()), behavior(0) {}
+ void serializeContentBody(PRCbitStream&);
+ uint8_t behavior;
+};
+
+class PRCBody : public PRCContentBody, public PRCTopoItem
+{
+public:
+ PRCBody() :
+ PRCContentBody(), topo_item_type(PRC_TYPE_ROOT) {}
+ PRCBody(uint32_t tit) :
+ PRCContentBody(), topo_item_type(tit) {}
+ PRCBody(uint32_t tit, std::string n) :
+ PRCContentBody(n), topo_item_type(tit) {}
+ virtual ~PRCBody() {}
+ virtual void serializeBody(PRCbitStream &pbs) = 0;
+ void serializeTopoItem(PRCbitStream &pbs) { serializeBody(pbs); }
+ uint32_t serialType() { return topo_item_type; }
+ virtual double serialTolerance() { return 0; }
+ const uint32_t topo_item_type;
+};
+typedef std::deque <PRCBody*> PRCBodyList;
+
+class PRCContentWireEdge : public PRCBaseTopology
+{
+public:
+ PRCContentWireEdge() :
+ PRCBaseTopology(), curve_3d(NULL), has_curve_trim_interval(false) {}
+ PRCContentWireEdge(std::string n) :
+ PRCBaseTopology(n,makeCADID()), curve_3d(NULL), has_curve_trim_interval(false) {}
+ ~PRCContentWireEdge() { delete curve_3d; }
+ void serializeContentWireEdge(PRCbitStream &pbs);
+// void setCurve(PRCCurve*& curve) { curve_3d = curve; curve = NULL; }
+ PRCCurve* curve_3d;
+ bool has_curve_trim_interval;
+ PRCInterval curve_trim_interval;
+};
+
+class PRCWireEdge : public PRCContentWireEdge, public PRCTopoItem
+{
+public:
+ void serializeWireEdge(PRCbitStream &pbs);
+ void serializeTopoItem(PRCbitStream &pbs) { serializeWireEdge(pbs); }
+};
+
+class PRCSingleWireBody : public PRCBody
+{
+public:
+ PRCSingleWireBody() :
+ PRCBody(PRC_TYPE_TOPO_SingleWireBody), wire_edge(NULL) {}
+ PRCSingleWireBody(std::string n) :
+ PRCBody(PRC_TYPE_TOPO_SingleWireBody, n), wire_edge(NULL) {}
+ ~PRCSingleWireBody() { delete wire_edge; }
+ void serializeSingleWireBody(PRCbitStream &pbs);
+ void serializeBody(PRCbitStream &pbs) { serializeSingleWireBody(pbs); }
+ void setWireEdge(PRCWireEdge*& wireEdge) { wire_edge = wireEdge; wireEdge = NULL; }
+ PRCWireEdge* wire_edge;
+};
+
+class PRCFace : public PRCBaseTopology, public PRCTopoItem, public PRCGraphics
+{
+public:
+ PRCFace() :
+ PRCBaseTopology(), base_surface(NULL), have_surface_trim_domain(false), have_tolerance(false), tolerance(0), number_of_loop(0), outer_loop_index(-1) {}
+ PRCFace(std::string n) :
+ PRCBaseTopology(n,makeCADID()), base_surface(NULL), have_surface_trim_domain(false), have_tolerance(false), tolerance(0), number_of_loop(0), outer_loop_index(-1) {}
+ ~PRCFace() { delete base_surface; }
+ void serializeFace(PRCbitStream &pbs);
+ void serializeTopoItem(PRCbitStream &pbs) { serializeFace(pbs); }
+ void setBaseSurface(PRCSurface*& surface) { base_surface = surface; surface = NULL; }
+ PRCSurface *base_surface;
+ const bool have_surface_trim_domain;
+ PRCDomain surface_trim_domain;
+ const bool have_tolerance;
+ const double tolerance;
+ const uint32_t number_of_loop;
+ const int32_t outer_loop_index;
+// PRCLoopList loop;
+};
+typedef std::deque <PRCFace*> PRCFaceList;
+
+class PRCShell : public PRCBaseTopology, public PRCTopoItem
+{
+public:
+ PRCShell() :
+ PRCBaseTopology(), shell_is_closed(false) {}
+ PRCShell(std::string n) :
+ PRCBaseTopology(n,makeCADID()), shell_is_closed(false) {}
+ ~PRCShell() { for(PRCFaceList::iterator it=face.begin(); it!=face.end(); ++it) delete *it; }
+ void serializeShell(PRCbitStream &pbs);
+ void serializeTopoItem(PRCbitStream &pbs) { serializeShell(pbs); }
+ void addFace(PRCFace*& pFace, uint8_t orientation=2);
+ bool shell_is_closed;
+ PRCFaceList face;
+ std::vector<uint8_t> orientation_surface_with_shell;
+};
+typedef std::deque <PRCShell*> PRCShellList;
+
+class PRCConnex : public PRCBaseTopology, public PRCTopoItem
+{
+public:
+ PRCConnex() :
+ PRCBaseTopology() {}
+ PRCConnex(std::string n) :
+ PRCBaseTopology(n,makeCADID()) {}
+ ~PRCConnex() { for(PRCShellList::iterator it=shell.begin(); it!=shell.end(); ++it) delete *it; }
+ void serializeConnex(PRCbitStream &pbs);
+ void serializeTopoItem(PRCbitStream &pbs) { serializeConnex(pbs); }
+ void addShell(PRCShell*& pShell);
+ PRCShellList shell;
+};
+typedef std::deque <PRCConnex*> PRCConnexList;
+
+class PRCBrepData : public PRCBody, public PRCBoundingBox
+{
+public:
+ PRCBrepData() :
+ PRCBody(PRC_TYPE_TOPO_BrepData) {}
+ PRCBrepData(std::string n) :
+ PRCBody(PRC_TYPE_TOPO_BrepData, n) {}
+ ~PRCBrepData() { for(PRCConnexList::iterator it=connex.begin(); it!=connex.end(); ++it) delete *it; }
+ void serializeBrepData(PRCbitStream &pbs);
+ void serializeBody(PRCbitStream &pbs) { serializeBrepData(pbs); }
+ void addConnex(PRCConnex*& pConnex);
+ PRCConnexList connex;
+};
+
+// For now - treat just the case of Bezier surfaces cubic 4x4 or linear 2x2
+class PRCCompressedFace : public PRCBaseTopology, public PRCGraphics
+{
+public:
+ PRCCompressedFace() :
+ PRCBaseTopology(), orientation_surface_with_shell(true), degree(0) {}
+ PRCCompressedFace(std::string n) :
+ PRCBaseTopology(n,makeCADID()), orientation_surface_with_shell(true), degree(0) {}
+ void serializeCompressedFace(PRCbitStream &pbs, double brep_data_compressed_tolerance);
+ void serializeContentCompressedFace(PRCbitStream &pbs);
+ void serializeCompressedAnaNurbs(PRCbitStream &pbs, double brep_data_compressed_tolerance);
+ void serializeCompressedNurbs(PRCbitStream &pbs, double brep_data_compressed_tolerance);
+ bool orientation_surface_with_shell;
+ uint32_t degree;
+ std::vector<PRCVector3d> control_point;
+};
+typedef std::deque <PRCCompressedFace*> PRCCompressedFaceList;
+
+// For now - treat just the case of one connex/one shell
+class PRCCompressedBrepData : public PRCBody
+{
+public:
+ PRCCompressedBrepData() :
+ PRCBody(PRC_TYPE_TOPO_BrepDataCompress), serial_tolerance(0), brep_data_compressed_tolerance(0) {}
+ PRCCompressedBrepData(std::string n) :
+ PRCBody(PRC_TYPE_TOPO_BrepDataCompress, n), serial_tolerance(0), brep_data_compressed_tolerance(0) {}
+ ~PRCCompressedBrepData() { for(PRCCompressedFaceList::iterator it=face.begin(); it!=face.end(); ++it) delete *it; }
+ void serializeCompressedBrepData(PRCbitStream &pbs);
+ void serializeBody(PRCbitStream &pbs) { serializeCompressedBrepData(pbs); }
+ void serializeCompressedShell(PRCbitStream &pbs);
+ double serialTolerance() { return serial_tolerance; }
+ double serial_tolerance;
+ double brep_data_compressed_tolerance;
+ PRCCompressedFaceList face;
+};
+
+class PRCTopoContext : public ContentPRCBase
+{
+public:
+ PRCTopoContext(std::string n="") :
+ ContentPRCBase(PRC_TYPE_TOPO_Context,n), behaviour(0), granularity(1), tolerance(0),
+ have_smallest_face_thickness(false), smallest_thickness(0), have_scale(false), scale(1) {}
+ ~PRCTopoContext() { for(PRCBodyList::iterator it=body.begin(); it!=body.end(); ++it) delete *it; }
+ void serializeTopoContext(PRCbitStream&);
+ void serializeContextAndBodies(PRCbitStream&);
+ void serializeGeometrySummary(PRCbitStream&);
+ void serializeContextGraphics(PRCbitStream&);
+ uint32_t addSingleWireBody(PRCSingleWireBody*& body);
+ uint32_t addBrepData(PRCBrepData*& body);
+ uint32_t addCompressedBrepData(PRCCompressedBrepData*& body);
+ uint8_t behaviour;
+ double granularity;
+ double tolerance;
+ bool have_smallest_face_thickness;
+ double smallest_thickness;
+ bool have_scale;
+ double scale;
+ PRCBodyList body;
+};
+typedef std::deque <PRCTopoContext*> PRCTopoContextList;
+
+class PRCUniqueId
+{
+public:
+ PRCUniqueId() : id0(0), id1(0), id2(0), id3(0) {}
+ void serializeCompressedUniqueId(PRCbitStream&) const;
+ void serializeFileStructureUncompressedUniqueId(std::ostream& out) const;
+ uint32_t id0;
+ uint32_t id1;
+ uint32_t id2;
+ uint32_t id3;
+};
+
+class PRCUnit
+{
+public:
+ PRCUnit() : unit_from_CAD_file(false), unit(1) {}
+ PRCUnit(double u, bool ufcf=true) : unit_from_CAD_file(ufcf), unit(u) {}
+ void serializeUnit(PRCbitStream&);
+ bool unit_from_CAD_file;
+ double unit;
+};
+
+class PRCProductOccurrence: public PRCGraphics, public ContentPRCBase
+{
+public:
+ PRCProductOccurrence(std::string n="") :
+ ContentPRCBase(PRC_TYPE_ASM_ProductOccurence,n),
+ index_part(m1),
+ index_prototype(m1), prototype_in_same_file_structure(true),
+ index_external_data(m1), external_data_in_same_file_structure(true),
+ product_behaviour(0), product_information_flags(0), product_load_status(KEPRCProductLoadStatus_Loaded),
+ location(NULL) {}
+ ~PRCProductOccurrence() { delete location; }
+ void setLocation(PRCGeneralTransformation3d*& transform) { location = transform; transform = NULL; }
+ void serializeProductOccurrence(PRCbitStream&);
+ uint32_t index_part;
+ uint32_t index_prototype;
+ bool prototype_in_same_file_structure;
+ PRCUniqueId prototype_file_structure;
+ uint32_t index_external_data;
+ bool external_data_in_same_file_structure;
+ PRCUniqueId external_data_file_structure;
+ std::vector<uint32_t> index_son_occurrence;
+ uint8_t product_behaviour;
+ PRCUnit unit_information;
+ uint8_t product_information_flags;
+ EPRCProductLoadStatus product_load_status;
+ PRCGeneralTransformation3d *location;
+};
+typedef std::deque <PRCProductOccurrence*> PRCProductOccurrenceList;
+
+class PRCPartDefinition: public PRCGraphics, public ContentPRCBase, public PRCBoundingBox
+{
+public:
+ PRCPartDefinition(std::string n="") :
+ ContentPRCBase(PRC_TYPE_ASM_PartDefinition,n) {}
+ ~PRCPartDefinition() { for(PRCRepresentationItemList::iterator it=representation_item.begin(); it!=representation_item.end(); ++it) delete *it; }
+ void serializePartDefinition(PRCbitStream&);
+ uint32_t addBrepModel(PRCBrepModel*& pBrepModel);
+ uint32_t addPolyBrepModel(PRCPolyBrepModel*& pPolyBrepModel);
+ uint32_t addPointSet(PRCPointSet*& pPointSet);
+ uint32_t addSet(PRCSet*& pSet);
+ uint32_t addWire(PRCWire*& pWire);
+ uint32_t addPolyWire(PRCPolyWire*& pPolyWire);
+ uint32_t addRepresentationItem(PRCRepresentationItem*& pRepresentationItem);
+ PRCRepresentationItemList representation_item;
+};
+typedef std::deque <PRCPartDefinition*> PRCPartDefinitionList;
+
+#endif //__WRITE_PRC_H