mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0030402: Data Exchange - exported VRML file has broken location information
This commit is contained in:
@@ -296,7 +296,8 @@ void VrmlData_ShapeConvert::Convert (const Standard_Boolean theExtractFaces,
|
||||
Handle(VrmlData_Group) aTrans = new VrmlData_Group (myScene, 0L,
|
||||
Standard_True);
|
||||
gp_Trsf aTrsf (aLoc);
|
||||
if (fabs(myScale - 1.) > Precision::Confusion()) {
|
||||
if (fabs(myScale - 1.) > Precision::Confusion())
|
||||
{
|
||||
const gp_XYZ aTransl = aTrsf.TranslationPart() * myScale;
|
||||
aTrsf.SetTranslationPart (aTransl);
|
||||
}
|
||||
@@ -704,7 +705,8 @@ void VrmlData_ShapeConvert::addShape (const Handle(VrmlData_Group)& theParent,
|
||||
gp_Trsf aTrsf(aLoc);
|
||||
if (fabs(myScale - 1.) > Precision::Confusion())
|
||||
{
|
||||
aTrsf.SetScaleFactor(myScale);
|
||||
const gp_XYZ aTransl = aTrsf.TranslationPart() * myScale;
|
||||
aTrsf.SetTranslationPart(aTransl);
|
||||
}
|
||||
aTrans->SetTransform(aTrsf);
|
||||
myScene.AddNode(aTrans, Standard_False);
|
||||
@@ -741,8 +743,10 @@ void VrmlData_ShapeConvert::addInstance (const Handle(VrmlData_Group)& theParent
|
||||
// Create a Transform grouping node
|
||||
aTrans = new VrmlData_Group(myScene, 0L, Standard_True);
|
||||
gp_Trsf aTrsf(aLoc);
|
||||
if (fabs(myScale - 1.) > Precision::Confusion()) {
|
||||
aTrsf.SetScaleFactor(myScale);
|
||||
if (fabs(myScale - 1.) > Precision::Confusion())
|
||||
{
|
||||
const gp_XYZ aTransl = aTrsf.TranslationPart() * myScale;
|
||||
aTrsf.SetTranslationPart(aTransl);
|
||||
}
|
||||
aTrans->SetTransform(aTrsf);
|
||||
myScene.AddNode(aTrans, theParent.IsNull());
|
||||
@@ -802,7 +806,8 @@ void VrmlData_ShapeConvert::addAssembly (const Handle(VrmlData_Group)& theParent
|
||||
if (!aLoc.IsIdentity())
|
||||
{
|
||||
gp_Trsf aTrsf(aLoc);
|
||||
if (fabs(myScale - 1.) > Precision::Confusion()) {
|
||||
if (fabs(myScale - 1.) > Precision::Confusion())
|
||||
{
|
||||
const gp_XYZ aTransl = aTrsf.TranslationPart() * myScale;
|
||||
aTrsf.SetTranslationPart(aTransl);
|
||||
}
|
||||
|
@@ -53,6 +53,7 @@
|
||||
#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <ViewerTest.hxx>
|
||||
#include <VrmlAPI.hxx>
|
||||
@@ -239,6 +240,8 @@ static Standard_Integer loadvrml
|
||||
}
|
||||
|
||||
VrmlData_Scene aScene;
|
||||
Standard_Real anOCCUnit = UnitsMethods::GetCasCadeLengthUnit();
|
||||
aScene.SetLinearScale(1000. / anOCCUnit);
|
||||
|
||||
aScene.SetVrmlDir (aVrmlDir);
|
||||
aScene << aStream;
|
||||
|
@@ -11,7 +11,7 @@ vdisplay -dispMode 1 v
|
||||
vfit
|
||||
|
||||
set anArea [triarea v]
|
||||
checkreal "Triangulation area" [lindex $anArea 0] 5341500. 1. 1e-6
|
||||
checkreal "Triangulation area" [lindex $anArea 0] 5341500. 1. 1e+6
|
||||
checktrinfo v -tri 12 -nod 24
|
||||
|
||||
#vdump $::imagedir/${::casename}.png
|
||||
|
47
tests/bugs/xde/bug30402
Normal file
47
tests/bugs/xde/bug30402
Normal file
@@ -0,0 +1,47 @@
|
||||
puts "========="
|
||||
puts "OCC30402"
|
||||
puts "========="
|
||||
puts ""
|
||||
############################################################################
|
||||
# Data Exchange - exported VRML file has broken location information
|
||||
############################################################################
|
||||
|
||||
set filename bug26657
|
||||
param xstep.cascade.unit MM
|
||||
ReadStep D [locate_data_file bug26657.stp]
|
||||
XGetOneShape a D
|
||||
incmesh a 0.001
|
||||
vinit Driver1/Viewer1/View1
|
||||
vdisplay a
|
||||
vfit
|
||||
vdump ${imagedir}/${test_image}_1.png
|
||||
|
||||
file delete -force ${imagedir}/${filename}.wrl
|
||||
WriteVrml D ${imagedir}/${filename}.wrl
|
||||
loadvrml b ${imagedir}/${filename}.wrl
|
||||
vinit Driver1/Viewer2/View1
|
||||
vdisplay b
|
||||
vfit
|
||||
vdump ${imagedir}/${test_image}_2.png
|
||||
|
||||
set sprops_a [sprops a]
|
||||
regexp {Mass\s*:\s*([0-9.e+-]+)} $sprops_a prop_s res_a_Area
|
||||
regexp {X += +([-0-9.+eE]+)} $sprops_a full res_a_X
|
||||
regexp {Y += +([-0-9.+eE]+)} $sprops_a full res_a_Y
|
||||
regexp {Z += +([-0-9.+eE]+)} $sprops_a full res_a_Z
|
||||
|
||||
set sprops_b [sprops b]
|
||||
regexp {Mass\s*:\s*([0-9.e+-]+)} $sprops_b prop_s res_b_Area
|
||||
regexp {X += +([-0-9.+eE]+)} $sprops_b full res_b_X
|
||||
regexp {Y += +([-0-9.+eE]+)} $sprops_b full res_b_Y
|
||||
regexp {Z += +([-0-9.+eE]+)} $sprops_b full res_b_Z
|
||||
|
||||
if { ([expr abs($res_a_Area - $res_b_Area)] > 1.e-4) } {
|
||||
puts "Error: Bad area of face"
|
||||
}
|
||||
|
||||
if { ([expr abs($res_a_X - $res_b_X)] > 1.e-4) ||
|
||||
([expr abs($res_a_Y - $res_b_Y)] > 1.e-4) ||
|
||||
([expr abs($res_a_Z - $res_b_Z)] > 1.e-4) } {
|
||||
puts "Error: Location problem"
|
||||
}
|
Reference in New Issue
Block a user