Added VRML conversion of 'translation' and 'center' to mm on read and 0.1 inch on write
This commit is contained in:
parent
ef62a5f153
commit
9a0b020806
|
@ -260,7 +260,13 @@ bool SCENEGRAPH::WriteVRML( std::ofstream& aFile, bool aReuseFlag )
|
|||
aFile << " Transform {\n";
|
||||
}
|
||||
|
||||
S3D::FormatPoint( tmp, center );
|
||||
// convert center to 1VRML unit = 0.1 inch
|
||||
SGPOINT pt = center;
|
||||
pt.x /= 2.54;
|
||||
pt.y /= 2.54;
|
||||
pt.z /= 2.54;
|
||||
|
||||
S3D::FormatPoint( tmp, pt );
|
||||
aFile << " center " << tmp << "\n";
|
||||
S3D::FormatOrientation( tmp, rotation_axis, rotation_angle );
|
||||
aFile << " rotation " << tmp << "\n";
|
||||
|
@ -268,7 +274,13 @@ bool SCENEGRAPH::WriteVRML( std::ofstream& aFile, bool aReuseFlag )
|
|||
aFile << " scale " << tmp << "\n";
|
||||
S3D::FormatOrientation( tmp, scale_axis, scale_angle );
|
||||
aFile << " scaleOrientation " << tmp << "\n";
|
||||
S3D::FormatPoint( tmp, translation );
|
||||
|
||||
// convert translation to 1VRML unit = 0.1 inch
|
||||
pt = translation;
|
||||
pt.x /= 2.54;
|
||||
pt.y /= 2.54;
|
||||
pt.z /= 2.54;
|
||||
S3D::FormatPoint( tmp, pt );
|
||||
aFile << " translation " << tmp << "\n";
|
||||
|
||||
aFile << " children [\n";
|
||||
|
|
|
@ -173,6 +173,11 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
// convert from 1 VRML Unit = 0.1 inch to 1 VRML Unit = 1 mm
|
||||
center.x *= 2.54;
|
||||
center.y *= 2.54;
|
||||
center.z *= 2.54;
|
||||
}
|
||||
else if( !glob.compare( "rotation" ) )
|
||||
{
|
||||
|
@ -233,6 +238,11 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
// convert from 1 VRML Unit = 0.1 inch to 1 VRML Unit = 1 mm
|
||||
translation.x *= 2.54;
|
||||
translation.y *= 2.54;
|
||||
translation.z *= 2.54;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -188,6 +188,11 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
// convert from 1 VRML Unit = 0.1 inch to 1 VRML Unit = 1 mm
|
||||
center.x *= 2.54;
|
||||
center.y *= 2.54;
|
||||
center.z *= 2.54;
|
||||
}
|
||||
else if( !glob.compare( "rotation" ) )
|
||||
{
|
||||
|
@ -248,6 +253,11 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
// convert from 1 VRML Unit = 0.1 inch to 1 VRML Unit = 1 mm
|
||||
translation.x *= 2.54;
|
||||
translation.y *= 2.54;
|
||||
translation.z *= 2.54;
|
||||
}
|
||||
else if( !glob.compare( "children" ) )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue