1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
aml
94e01d856b 0027112: GeomAPI_Interpolate produces wrong result
Support of the approximation of natural boundary condition (f''= 0)
2016-02-20 09:53:06 +03:00
81 changed files with 2187 additions and 2106 deletions

View File

@@ -5,27 +5,25 @@ if(FLAGS_ALREADY_INCLUDED)
endif()
set(FLAGS_ALREADY_INCLUDED 1)
if (MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp:precise")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp:precise")
add_definitions(/fp:precise)
endif()
# set compiler short name and choose SSE2 option for appropriate MSVC compilers
# ONLY for 32-bit
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
if (MSVC80 OR MSVC90 OR MSVC10)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
add_definitions(/arch:SSE2)
endif()
endif()
if (WIN32)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4996")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -wd4996")
add_definitions (-wd4996)
elseif (APPLE)
add_definitions (-fexceptions -fPIC -DOCC_CONVERT_SIGNALS)
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions -fPIC")
add_definitions(-DOCC_CONVERT_SIGNALS)
add_definitions (-fexceptions -fPIC -DOCC_CONVERT_SIGNALS)
endif()
# enable structured exceptions for MSVC

View File

@@ -340,7 +340,7 @@ public:
{
if (!myView().IsNull())
{
myView()->SetProj(V3d_Yneg);
myView()->SetProj(V3d_Xpos);
}
}
@@ -362,7 +362,7 @@ public:
{
if (!myView().IsNull())
{
myView()->SetProj(V3d_Xneg);
myView()->SetProj(V3d_Ypos);
}
}
@@ -373,7 +373,7 @@ public:
{
if (!myView().IsNull())
{
myView()->SetProj(V3d_Ypos);
myView()->SetProj(V3d_Xneg);
}
}
@@ -384,7 +384,7 @@ public:
{
if (!myView().IsNull())
{
myView()->SetProj(V3d_Xpos);
myView()->SetProj(V3d_Yneg);
}
}

View File

@@ -353,7 +353,7 @@ public:
{
if (!myView().IsNull())
{
myView()->SetProj (V3d_Yneg);
myView()->SetProj (V3d_Xpos);
}
}
@@ -375,7 +375,7 @@ public:
{
if (!myView().IsNull())
{
myView()->SetProj (V3d_Xneg);
myView()->SetProj (V3d_Ypos);
}
}
@@ -386,7 +386,7 @@ public:
{
if (!myView().IsNull())
{
myView()->SetProj (V3d_Ypos);
myView()->SetProj (V3d_Xneg);
}
}
@@ -397,7 +397,7 @@ public:
{
if (!myView().IsNull())
{
myView()->SetProj (V3d_Xpos);
myView()->SetProj (V3d_Yneg);
}
}

View File

@@ -1009,20 +1009,20 @@ namespace IE_WinForms
curForm.View.FrontView();
break;
case 6:
curForm.View.BackView();
break;
case 7:
curForm.View.TopView();
break;
case 8:
curForm.View.BottomView();
break;
case 9:
case 7:
curForm.View.LeftView();
break;
case 10:
case 8:
curForm.View.BackView();
break;
case 9:
curForm.View.RightView();
break;
case 10:
curForm.View.BottomView();
break;
case 11:
curForm.View.AxoView();
break;

View File

@@ -236,10 +236,10 @@ void CViewer3dView::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/)
void CViewer3dView::OnBUTTONBack()
{
myView->SetProj(V3d_Ypos);
myView->SetProj(V3d_Xneg);
TCollection_AsciiString Message("\
myView->SetProj(V3d_Ypos);\n\
myView->SetProj(V3d_Xneg);\n\
");
// Update The Result Message Dialog
@@ -247,10 +247,10 @@ GetDocument()->UpdateResultMessageDlg("SetProj",Message);
} // See the back View
void CViewer3dView::OnBUTTONFront()
{
myView->SetProj(V3d_Yneg);
myView->SetProj(V3d_Xpos);
TCollection_AsciiString Message("\
myView->SetProj(V3d_Yneg);\n\
myView->SetProj(V3d_Xpos);\n\
");
// Update The Result Message Dialog
@@ -282,10 +282,10 @@ GetDocument()->UpdateResultMessageDlg("SetProj",Message);
void CViewer3dView::OnBUTTONLeft()
{
myView->SetProj(V3d_Xneg);
myView->SetProj(V3d_Ypos);
TCollection_AsciiString Message("\
myView->SetProj(V3d_Xneg);\n\
myView->SetProj(V3d_Ypos);\n\
");
// Update The Result Message Dialog
@@ -293,10 +293,10 @@ GetDocument()->UpdateResultMessageDlg("SetProj",Message);
} // See the left View
void CViewer3dView::OnBUTTONRight()
{
myView->SetProj(V3d_Xpos);
myView->SetProj(V3d_Yneg);
TCollection_AsciiString Message("\
myView->SetProj(V3d_Xpos);\n\
myView->SetProj(V3d_Yneg);\n\
");
// Update The Result Message Dialog

View File

@@ -400,25 +400,25 @@ void CSelectionDialog::OnBottomView()
void CSelectionDialog::OnLeftView()
{
myActiveView->SetProj(V3d_Xneg);
myActiveView->SetProj(V3d_Ypos);
OnDisplay(true);
}
void CSelectionDialog::OnRightView()
{
myActiveView->SetProj(V3d_Xpos);
myActiveView->SetProj(V3d_Yneg);
OnDisplay(true);
}
void CSelectionDialog::OnFrontView()
{
myActiveView->SetProj(V3d_Yneg);
myActiveView->SetProj(V3d_Xpos);
OnDisplay(true);
}
void CSelectionDialog::OnBackView()
{
myActiveView->SetProj(V3d_Ypos);
myActiveView->SetProj(V3d_Xneg);
OnDisplay(true);
}

View File

@@ -236,9 +236,9 @@ void CAnimationView3D::OnSize(UINT /*nType*/, int cx, int cy)
}
void CAnimationView3D::OnBUTTONBack()
{ myView->SetProj(V3d_Ypos); } // See the back View
{ myView->SetProj(V3d_Xneg); } // See the back View
void CAnimationView3D::OnBUTTONFront()
{ myView->SetProj(V3d_Yneg); } // See the front View
{ myView->SetProj(V3d_Xpos); } // See the front View
void CAnimationView3D::OnBUTTONBottom()
{ myView->SetProj(V3d_Zneg); } // See the bottom View
@@ -246,9 +246,9 @@ void CAnimationView3D::OnBUTTONTop()
{ myView->SetProj(V3d_Zpos); } // See the top View
void CAnimationView3D::OnBUTTONLeft()
{ myView->SetProj(V3d_Xneg); } // See the left View
{ myView->SetProj(V3d_Ypos); } // See the left View
void CAnimationView3D::OnBUTTONRight()
{ myView->SetProj(V3d_Xpos); } // See the right View
{ myView->SetProj(V3d_Yneg); } // See the right View
void CAnimationView3D::OnBUTTONAxo()
{ myView->SetProj(V3d_XposYnegZpos); } // See the axonometric View

View File

@@ -171,13 +171,13 @@ void OCC_3dView::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/)
// See the back View
void OCC_3dView::OnBUTTONBack()
{
myView->SetProj(V3d_Ypos);
myView->SetProj(V3d_Xneg);
}
// See the front View
void OCC_3dView::OnBUTTONFront()
{
myView->SetProj(V3d_Yneg);
myView->SetProj(V3d_Xpos);
}
// See the bottom View
@@ -195,13 +195,13 @@ void OCC_3dView::OnBUTTONTop()
// See the left View
void OCC_3dView::OnBUTTONLeft()
{
myView->SetProj(V3d_Xneg);
myView->SetProj(V3d_Ypos);
}
// See the right View
void OCC_3dView::OnBUTTONRight()
{
myView->SetProj(V3d_Xpos);
myView->SetProj(V3d_Yneg);
}
// See the axonometric View

View File

@@ -154,12 +154,12 @@ void View::globalPan()
void View::front()
{
myView->SetProj( V3d_Yneg );
myView->SetProj( V3d_Xpos );
}
void View::back()
{
myView->SetProj( V3d_Ypos );
myView->SetProj( V3d_Xneg );
}
void View::top()
@@ -174,12 +174,12 @@ void View::bottom()
void View::left()
{
myView->SetProj( V3d_Xneg );
myView->SetProj( V3d_Ypos );
}
void View::right()
{
myView->SetProj( V3d_Xpos );
myView->SetProj( V3d_Yneg );
}
void View::axo()

View File

@@ -1,283 +0,0 @@
# The following example constructs ANC-101 object of CAM-I.
#
# This model was used as a test part for comparing modeling systems in 1979 and
# again in 1983. The tests were organized by Computer Aided Manufacturing
# International (CAM-I).
#
#Category: Modeling
#Title: ANC101 (classic test for CAD modeling from CAM-I)
pload MODELING
set my_pi 3.1415926535897931
set aModelHeight 178.25
set aPlatformLength 426.25
set aPlatformWidth 201.5
set aPlatformHeight 58.9
set aPrismLength 279
set aPrismWidth 155
set aPrismHeight [expr $aModelHeight - $aPlatformHeight]
set aPrismXOffset [expr $aPlatformLength - $aPrismLength - 69.75]
set aPrismYOffset [expr ($aPlatformWidth - $aPrismWidth)/2]
#================================================================================
# A base of the model
box _platform $aPlatformLength $aPlatformWidth $aPlatformHeight
# Make screw holes on the platform
set aScrewHoleRadius [expr 26.2/2]
set aScrewHoleOffset 31
pcylinder _screwhole $aScrewHoleRadius $aPlatformHeight
ttranslate _screwhole $aScrewHoleOffset $aScrewHoleOffset 0
bcut _platform _platform _screwhole
reset _screwhole
ttranslate _screwhole [expr $aPlatformLength - $aScrewHoleOffset] $aScrewHoleOffset 0
bcut _platform _platform _screwhole
reset _screwhole
ttranslate _screwhole [expr $aPlatformLength - $aScrewHoleOffset] [expr $aPlatformWidth - $aScrewHoleOffset] 0
bcut _platform _platform _screwhole
reset _screwhole
ttranslate _screwhole $aScrewHoleOffset [expr $aPlatformWidth - $aScrewHoleOffset] 0
bcut _platform _platform _screwhole
reset _screwhole
# Back side cave
set aCaveLength 81.38
set aCaveDepth 10
set aCaveWidth 19.38
set aBottomLevel [expr $aPlatformHeight/2 - $aCaveWidth/2]
set aTopLevel [expr $aPlatformHeight/2 + $aCaveWidth/2]
beziercurve t_bcurve 4 0 $aCaveLength $aBottomLevel 3 0 [expr $aCaveLength + $aCaveWidth/2] $aBottomLevel 6 0 [expr $aCaveLength + $aCaveWidth/2] $aTopLevel 6 0 $aCaveLength $aTopLevel 3
vertex t_v1 0 $aCaveLength $aBottomLevel
vertex t_v2 0 $aCaveLength $aTopLevel
mkedge t_e1 t_bcurve
edge t_e2 t_v1 t_v2
wire t_w t_e1 t_e2
mkplane t_f1 t_w
prism t_s1 t_f1 $aCaveDepth 0 0
box t_s2 0 0 $aBottomLevel $aCaveDepth $aCaveLength $aCaveWidth
bfuse _backcave t_s1 t_s2
bcut _platform _platform _backcave
# Right side cave
set aRCaveRadius 26.2
set aRCaveDistToSection 15.5
set aCurveParam [expr ($my_pi - acos($aRCaveDistToSection/$aRCaveRadius))]
set aRCaveCenterX [expr $aPlatformLength - 162.75]
set aRCaveCenterZ [expr $aPlatformHeight/2]
circle t_circle $aRCaveCenterX 0 $aRCaveCenterZ 0 1 0 1 0 0 $aRCaveRadius
trim t_curve t_circle -$aCurveParam $aCurveParam
mkedge t_e1 t_curve
cvalue t_curve -$aCurveParam t_x t_y t_z
vertex t_v1 t_x t_y t_z
cvalue t_curve $aCurveParam t_x t_y t_z
vertex t_v2 t_x t_y t_z
edge t_e2 t_v1 t_v2
wire t_w t_e1 t_e2
mkplane t_f t_w
prism t_s t_f 0 $aCaveDepth 0
bcut _platform _platform t_s
# Caves on front side
set aFCaveCirclesRadius 4.65
set aFCaveBottomWidth 37.8
set aFCaveHeight 38.75
set aFCaveTopWidth 27
set aFCaveSmallCircleRadius 9.3
circle t_circle1 [expr $aFCaveTopWidth/2] [expr $aFCaveHeight/2] $aFCaveCirclesRadius
circle t_circle2 [expr -$aFCaveTopWidth/2] [expr $aFCaveHeight/2] $aFCaveCirclesRadius
circle t_circle3 [expr -$aFCaveBottomWidth/2] [expr -$aFCaveHeight/2] $aFCaveCirclesRadius
circle t_circle4 [expr $aFCaveBottomWidth/2] [expr -$aFCaveHeight/2] $aFCaveCirclesRadius
lintan t_l t_circle1 t_circle2
trim t_side1 t_l_1 0 $aFCaveTopWidth
lintan t_l t_circle2 t_circle3
trim t_side2 t_l_1 0 39.058577803089555
lintan t_l t_circle3 t_circle4
trim t_side3 t_l_1 0 $aFCaveBottomWidth
lintan t_l t_circle4 t_circle1
trim t_side4 t_l_1 0 39.196587861700415
trim t_circle1 t_circle1 0.15109758878146562 1.5707963267948966
trim t_circle2 t_circle2 1.5707963267948966 3.0158086349284448
trim t_circle3 t_circle3 3.0158086349284448 4.7123889803846897
trim t_circle4 t_circle4 4.7123889803846897 0.15109758878146562
plane t_plane 0 0 0 1 0 0 0 1 0
to3d t_circle1 t_circle1 t_plane
to3d t_circle2 t_circle2 t_plane
to3d t_circle3 t_circle3 t_plane
to3d t_circle4 t_circle4 t_plane
to3d t_side1 t_side1 t_plane
to3d t_side2 t_side2 t_plane
to3d t_side3 t_side3 t_plane
to3d t_side4 t_side4 t_plane
mkedge t_e1 t_circle1
mkedge t_e2 t_side1
mkedge t_e3 t_circle2
mkedge t_e4 t_side2
mkedge t_e5 t_circle3
mkedge t_e6 t_side3
mkedge t_e7 t_circle4
mkedge t_e8 t_side4
wire t_w t_e1 t_e2 t_e3 t_e4 t_e5 t_e6 t_e7 t_e8
mkplane t_f t_w
prism t_s1 t_f -$aCaveDepth 0 0
circle t_circle 0 [expr $aFCaveTopWidth/2 + $aFCaveBottomWidth/2] 0 1 0 0 $aFCaveSmallCircleRadius
mkedge t_e t_circle
wire t_w t_e
mkplane t_f t_w
prism t_s2 t_f [expr -$aCaveDepth/2] 0 0
box t_s3 0 0 -$aFCaveSmallCircleRadius [expr -$aCaveDepth/2] [expr $aFCaveTopWidth/2 + $aFCaveBottomWidth/2] [expr $aFCaveSmallCircleRadius*2]
# Compile elements
bfuse t_s2 t_s2 t_s3
bfuse _frontcave t_s1 t_s2
unifysamedom _frontcave _frontcave
# Cut this cave from the platform
ttranslate _frontcave $aPlatformLength [expr $aPlatformWidth*2/3] [expr $aPlatformHeight/2]
bcut _platform _platform _frontcave
tmirror _frontcave $aPlatformLength [expr $aPlatformWidth/2] [expr $aPlatformHeight/2] 0 1 0
bcut _platform _platform _frontcave
#================================================================================
# A wedge on the platform
box t_box $aPrismXOffset $aPrismYOffset $aPlatformHeight $aPrismLength $aPrismWidth $aPrismHeight
set aCutwedgeLength [expr $aPrismHeight/0.57735]
wedge _cutwedge $aPlatformLength [expr $aPrismYOffset + $aPrismWidth] $aModelHeight 0 -1 0 -1 0 0 $aCutwedgeLength $aPrismHeight $aPrismWidth 0
bcut _prism t_box _cutwedge
# Make 9 small holes on a top side
set aWedgeSmallHolesRadius 7.68
set aWedgeSmallHolesOrbit 67.81
set aWedgeHoleXPos [expr $aPrismXOffset + 77.5]
set aWedgeHoleYPos [expr $aPrismYOffset + 77.5]
plane t_plane $aWedgeHoleXPos $aWedgeHoleYPos [expr $aPlatformHeight + $aPrismHeight/2] 0 0 1 1 0 0
pcylinder t_cyl t_plane $aWedgeSmallHolesRadius [expr $aPrismHeight/2]
set i 2
while {$i <= 10} {ttranslate t_cyl [expr $aWedgeSmallHolesOrbit*cos($i*$my_pi/6)] [expr $aWedgeSmallHolesOrbit*sin($i*$my_pi/6)] 0; bcut _prism _prism t_cyl; reset t_cyl; incr i}
# Make a cylinder on a canted side
set aWedgeCylinderRadius 38.75
set aWedgeCylinderHeight 38.75
set aWedgeCantedHeight [expr tan($my_pi/6)*($aCutwedgeLength - 69.75)]
set aWedgeCylinderZPos [expr $aModelHeight - $aWedgeCantedHeight/2]
plane t_plane [expr $aPrismXOffset + $aPrismLength*3/4] [expr $aPrismYOffset + $aPrismWidth/2] $aWedgeCylinderZPos cos($my_pi/3) 0 sin($my_pi/3) 0 1 0
pcylinder t_cyl t_plane $aWedgeCylinderRadius $aWedgeCylinderHeight
explode t_cyl e
blend t_cyl t_cyl 3 t_cyl_1
bfuse _prism _prism t_cyl
unifysamedom _prism _prism
# Make a hole in the cylinder on the wedge
pcylinder t_cyl t_plane [expr $aWedgeCylinderRadius/2] 100
ttranslate t_cyl [expr -60*cos($my_pi/3)] 0 [expr -60*sin($my_pi/3)]
bcut _prism _prism t_cyl
# Make a hole on a right side of the wedge
plane t_plane [expr $aPlatformLength - 162.75] $aPrismYOffset [expr $aModelHeight - $aWedgeCantedHeight] 0 1 0 1 0 0
pcylinder t_cyl t_plane 13.1 [expr $aPrismWidth/2]
bcut _prism _prism t_cyl
# Fuse the platform and the prism
bfuse _model _platform _prism
# Make a pass-through hole
set aWedgeHoleInnerRadius 38.77
set aWedgeHoleOuterRadius 58.13
set aWedgeHoleBottomInnerRadius 50.38
# Cylinders from bottom to top
plane t_plane $aWedgeHoleXPos $aWedgeHoleYPos 0
pcylinder t_cyl1 t_plane $aWedgeHoleOuterRadius 10
pcylinder t_cyl2 t_plane $aWedgeHoleBottomInnerRadius 10
pcylinder t_cyl3 t_plane $aWedgeHoleInnerRadius [expr $aModelHeight - 30]
pcylinder t_cyl4 t_plane $aWedgeHoleOuterRadius 10
ttranslate t_cyl2 0 0 10
ttranslate t_cyl3 0 0 20
ttranslate t_cyl4 0 0 [expr $aModelHeight - 10]
bfuse _cutCylindricShape t_cyl1 t_cyl2
bfuse _cutCylindricShape _cutCylindricShape t_cyl3
bfuse _cutCylindricShape _cutCylindricShape t_cyl4
bcut _model _model _cutCylindricShape
# Add a block on left side
circle t_circle1 0 0 38.75
circle t_circle2 [expr 38.75 + 9.3] [expr -57.35 + 9.3] 9.3
circle t_circle3 [expr -38.75 - 9.3] [expr -57.35 + 9.3] 9.3
lintan t_l t_circle1 t_circle2
trim t_line12 t_l_2 0 48.05
lintan t_l t_circle2 t_circle3
trim t_line23 t_l_3 0 96.1
lintan t_l t_circle3 t_circle1
trim t_line31 t_l_4 0 48.05
trim t_circle1 t_circle1 0 $my_pi
trim t_circle2 t_circle2 $my_pi 4.7123889803846897
trim t_circle3 t_circle3 4.7123889803846897 6.2831853071795862
reverse t_circle1
plane t_plane [expr $aPrismXOffset + 77.5] [expr $aPrismYOffset + $aPrismWidth] [expr $aPlatformHeight + 57.35] 0 1 0 -1 0 0
to3d t_circle1 t_circle1 t_plane
to3d t_circle2 t_circle2 t_plane
to3d t_circle3 t_circle3 t_plane
to3d t_line12 t_line12 t_plane
to3d t_line23 t_line23 t_plane
to3d t_line31 t_line31 t_plane
mkedge t_e1 t_circle1
mkedge t_e2 t_line31
mkedge t_e3 t_circle3
mkedge t_e4 t_line23
mkedge t_e5 t_circle2
mkedge t_e6 t_line12
wire t_w t_e1 t_e2 t_e3 t_e4 t_e5 t_e6
mkplane t_f t_w
prism t_s t_f 0 $aCaveDepth 0
bfuse _model _model t_s
# Make fillets
explode _model e
# Make a weld at joint edges of platform and wedge
blend _model _model 2 _model_28
blend _model _model 2 _model_29
blend _model _model 2 _model_30
blend _model _model 2 _model_31
blend _model _model 2 _model_33
# Cylinder on wedge
blend result _model 2 _model_161
# Show result
pload VISUALIZATION
vinit Driver1/Viewer1/View1
vsetcolorbg 200 200 255
vdisplay result
vfit
vsetdispmode 1
vshowfaceboundary result 1

View File

@@ -1,269 +0,0 @@
# The following example constructs (however, not trying to follow the drawings
# precisely) an airplane part called Gehause Rohteil from MBB Deutsche Aerospace.
# In this example the planar geometry is combined together with cylindrical parts.
# There are many ways to create a single mechanical workpiece like the following
# one. Here we choose Booleans as a main tool for material cutting. Fillets
# (presented in the original model) are not employed herein as we are focused
# on BOPs only. However, Gehause Rohteil is a good model to test blendings as well.
#
# This model was used as a test part for comparing modeling systems in 1979 and
# again in 1983. The tests were organized by Computer Aided Manufacturing
# International (CAM-I).
#
#Category: Modeling
#Title: MBB Gehause Rohteil (classic test for CAD modelling by CAM-I)
pload MODELING XSDRAW
# -----------------------------------------------------------------------------
# Prepare base contour
# -----------------------------------------------------------------------------
point p1 0 0
point p2 35 0
point p3 39 4
point p4 39 10
point p5 35 13
point p6 27 13
point p7 27 10
point p8 22 10
point p9 20 8
point p10 20 4
point p11 11 4
point p12 11 3
point p13 5 3
point p14 5 13
point p15 0 13
point p16 0 9
point p17 4 9
point p18 4 4
point p19 0 4
line l1 0 0 1 0; trim l1 l1 0 35
line l2 39 4 0 1; trim l2 l2 0 6
line l3 35 13 -1 0; trim l3 l3 0 8
line l4 27 13 0 -1; trim l4 l4 0 3
line l5 27 10 -1 0; trim l5 l5 0 5
line l6 20 8 0 -1; trim l6 l6 0 4
line l7 20 4 -1 0; trim l7 l7 0 9
line l8 11 4 0 -1; trim l8 l8 0 1
line l9 11 3 -1 0; trim l9 l9 0 6
line l10 5 3 0 1; trim l10 l10 0 10
line l11 5 13 -1 0; trim l11 l11 0 5
line l12 0 13 0 -1; trim l12 l12 0 4
line l13 0 9 1 0; trim l13 l13 0 4
line l14 4 9 0 -1; trim l14 l14 0 5
line l15 4 4 -1 0; trim l15 l15 0 4
line l16 0 4 0 -1; trim l16 l16 0 4
# We use Bezier curves here instead of circles. This does not make
# a great sense since we are focused on a principle rather than
# trying to follow the drawing precisely
2dbeziercurve c1 3 35 0 1 39 0 1 39 4 1
2dbeziercurve c2 3 39 10 1 39 13 1 35 13 1
2dbeziercurve c3 3 22 10 1 20 10 1 20 8 1
# Circle for a big hole
circle cbig 33 6.5 4.0
# Create topology
mkedge e1 l1
mkedge e2 c1
mkedge e3 l2
mkedge e4 c2
mkedge e5 l3
mkedge e6 l4
mkedge e7 l5
mkedge e8 c3
mkedge e9 l6
mkedge e10 l7
mkedge e11 l8
mkedge e12 l9
mkedge e13 l10
mkedge e14 l11
mkedge e15 l12
mkedge e16 l13
mkedge e17 l14
mkedge e18 l15
mkedge e19 l16
wire wout e1 e2 e3 e4 e5 e6 e7 e8 e9 e10 e11 e12 e13 e14 e15 e16 e17 e18 e19
mkedge ein1 cbig
wire win1 ein1
mkplane f wout
mkplane f1 win1
fixshape f f
fixshape f1 f1
bcut f f f1
# -----------------------------------------------------------------------------
# Make extrusion
# -----------------------------------------------------------------------------
prism p f 0 0 3
# -----------------------------------------------------------------------------
# Prepare a contour on top face
# -----------------------------------------------------------------------------
point p1 0 0
point p2 28 0
point p3 28 13
point p4 27 13
point p5 27 10
point p6 22 10
point p7 20 8
point p8 20 4
point p9 11 4
point p10 11 3
point p11 5 3
point p12 5 13
point p13 0 13
line l1 0 0 1 0; trim l1 l1 0 28
line l2 28 0 0 1; trim l2 l2 0 13
line l3 28 13 -1 0; trim l3 l3 0 1
line l4 27 13 0 -1; trim l4 l4 0 3
line l5 27 10 -1 0; trim l5 l5 0 5
line l6 20 8 0 -1; trim l6 l6 0 4
line l7 20 4 -1 0; trim l7 l7 0 9
line l8 11 4 0 -1; trim l8 l8 0 1
line l9 11 3 -1 0; trim l9 l9 0 6
line l10 5 3 0 1; trim l10 l10 0 10
line l11 5 13 -1 0; trim l11 l11 0 5
line l12 0 13 0 -1; trim l12 l12 0 13
2dbeziercurve c3 3 22 10 1 20 10 1 20 8 1
# Create topology on top face
plane top_pln 0 0 3
to3d l1 l1 top_pln
to3d l2 l2 top_pln
to3d l3 l3 top_pln
to3d l4 l4 top_pln
to3d l5 l5 top_pln
to3d c3 c3 top_pln
to3d l6 l6 top_pln
to3d l7 l7 top_pln
to3d l8 l8 top_pln
to3d l9 l9 top_pln
to3d l10 l10 top_pln
to3d l11 l11 top_pln
to3d l12 l12 top_pln
mkedge e1 l1
mkedge e2 l2
mkedge e3 l3
mkedge e4 l4
mkedge e5 l5
mkedge e6 c3
mkedge e7 l6
mkedge e8 l7
mkedge e9 l8
mkedge e10 l9
mkedge e11 l10
mkedge e12 l11
mkedge e13 l12
wire wout e1 e2 e3 e4 e5 e6 e7 e8 e9 e10 e11 e12 e13
mkface ftop top_pln wout
fixshape ftop ftop
# -----------------------------------------------------------------------------
# Make top extrusion
# -----------------------------------------------------------------------------
prism ptop ftop 0 0 1.5
# -----------------------------------------------------------------------------
# Fuse top and bottom parts and make features
# -----------------------------------------------------------------------------
# Fuse top and bottom
bfuse p p ptop
# Create a hole
plane top_pln 0 0 10
circle csmall 23 6.5 2.0
to3d hole_top csmall top_pln
plane bot_pln 0 0 -10
to3d hole_bot csmall bot_pln
mkedge ehole_top hole_top
mkedge ehole_bot hole_bot
wire whole_top ehole_top
wire whole_bot ehole_bot
thrusections tool 1 1 whole_top whole_bot
bcut p p tool
# Add extrusion around the hole
plane top_pln 0 0 4.5
circle csmall_outer 23 6.5 3.0
circle csmall_inner 23 6.5 2.0
to3d hole_top_outer csmall_outer top_pln
to3d hole_top_inner csmall_inner top_pln
mkedge e_hole_top_outer hole_top_outer
mkedge e_hole_top_inner hole_top_inner
wire w_hole_top_outer e_hole_top_outer
wire w_hole_top_inner e_hole_top_inner
mkface ftube_outer top_pln w_hole_top_outer
mkface ftube_inner top_pln w_hole_top_inner
fixshape ftube_outer ftube_outer
fixshape ftube_inner ftube_inner
prism ptube_outer ftube_outer 0 0 3
prism ptube_inner ftube_inner 0 0 3
bcut ptube ptube_outer ptube_inner
bfuse p p ptube
# Build elevation "teeths" near the big hole
box t1 26 0 0 3 2.5 7
box t2 26 13 0 3 -3 7
bfuse p p t1
bfuse p p t2
# Build elevation "teeths" near the tail
box t1 0 0 0 5 3 8
box t2 0 13 0 5 -3 8
bfuse p p t1
bfuse p p t2
# Remove some material from tail "teeths"
box blend_box 0 -5 0 5 25 5
trotate blend_box blend_box 0 0 0 0 1 0 -10
ttranslate blend_box blend_box 2.5 0 2.25
bcut p p blend_box
# Remove some material from "teeths" near big hole
box blend_box 0 -5 0 5 25 5
trotate blend_box blend_box 0 0 0 0 1 0 -9
ttranslate blend_box blend_box 14.5 0 1.5
bcut p p blend_box
# Hole at the tail
ellipse tail_hole1 0 0 0.75 0.5
plane base_pln 2 6.5 0
to3d tail_hole_3d1 tail_hole1 base_pln
mkedge e_tail_hole1 tail_hole_3d1
wire w_tail_hole1 e_tail_hole1
plane base_pln 2 6.5 20
to3d tail_hole_3d2 tail_hole1 base_pln
mkedge e_tail_hole2 tail_hole_3d2
wire w_tail_hole2 e_tail_hole2
thrusections tail_tube 1 1 w_tail_hole1 w_tail_hole2
bcut p p tail_tube
# Chamfer at tail
box blend_box 0 3 0 5 7 5
trotate blend_box blend_box 0 0 0 0 1 0 -5
ttranslate blend_box blend_box 2 0 1.5
bcut p p blend_box
# -----------------------------------------------------------------------------
# Extract final solid and simplify it
# -----------------------------------------------------------------------------
explode p So
unifysamedom result p_1
# Show result
pload VISUALIZATION
vinit Driver1/Viewer1/View1
vsetcolorbg 200 200 255
vdisplay result
vfit
vsetdispmode 1
vshowfaceboundary result 1

View File

@@ -70,38 +70,6 @@
static Standard_Boolean Affich = 0;
#endif
// ---------------------------------------------------------------------------------
// static function: UpdateMap
// purpose:
// ---------------------------------------------------------------------------------
static Standard_Boolean UpdateMap(const TopoDS_Shape& theKey,
const TopoDS_Shape& theValue,
TopTools_DataMapOfShapeListOfShape& theMap)
{
if(!theMap.IsBound(theKey))
{
TopTools_ListOfShape thelist;
theMap.Bind(theKey, thelist);
}
TopTools_ListOfShape& aList = theMap.ChangeFind(theKey);
TopTools_ListIteratorOfListOfShape anIt(aList);
Standard_Boolean found = Standard_False;
for(; anIt.More(); anIt.Next())
{
if(theValue.IsSame(anIt.Value()))
{
found = Standard_True;
break;
}
}
if(!found)
aList.Append(theValue);
return !found;
}
static void ReverseModifiedEdges(TopoDS_Shape& aShape,
TopTools_MapOfShape& Emap)
{
@@ -407,47 +375,6 @@ const TopoDS_Shape& BRepFill_Pipe::LastShape() const
return myLast;
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
void BRepFill_Pipe::Generated(const TopoDS_Shape& theShape,
TopTools_ListOfShape& theList)
{
theList.Clear();
if (theShape.IsSame(myProfile))
theList.Append(myShape);
else
{
if (theShape.ShapeType() == TopAbs_FACE ||
theShape.ShapeType() == TopAbs_WIRE)
{
if(myGenMap.IsBound(theShape))
theList = myGenMap.Find(theShape);
}
else if (theShape.ShapeType() == TopAbs_EDGE)
{
TopoDS_Iterator itw(mySpine);
for (; itw.More(); itw.Next())
{
const TopoDS_Edge& aSpineEdge = TopoDS::Edge(itw.Value());
const TopoDS_Shape& aFace = Face(aSpineEdge, TopoDS::Edge(theShape));
theList.Append(aFace);
}
}
else if (theShape.ShapeType() == TopAbs_VERTEX)
{
TopoDS_Iterator itw(mySpine);
for (; itw.More(); itw.Next())
{
const TopoDS_Edge& aSpineEdge = TopoDS::Edge(itw.Value());
const TopoDS_Shape& anEdge = Edge(aSpineEdge, TopoDS::Vertex(theShape));
theList.Append(anEdge);
}
}
}
}
//=======================================================================
//function : Face
@@ -714,7 +641,6 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
MkSw.Build( myReversedEdges, myTapes, myRails,
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
result = MkSw.Shape();
UpdateMap(TheS.Located(myProfile.Location()), result, myGenMap);
myErrorOnSurf = MkSw.ErrorOnSurface();
Handle(TopTools_HArray2OfShape) aSections = MkSw.Sections();
@@ -737,7 +663,6 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
MkSw.Build( myReversedEdges, myTapes, myRails,
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
result = MkSw.Shape();
UpdateMap(TheS.Located(myProfile.Location()), result, myGenMap);
myErrorOnSurf = MkSw.ErrorOnSurface();
//Correct <myFirst> and <myLast>
ReverseModifiedEdges(myFirst, myReversedEdges);
@@ -845,7 +770,6 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
BS.Add(solid,TopoDS::Shell(aLocalShape));
// BS.Add(solid,TopoDS::Shell(result.Reversed()));
}
UpdateMap(TheS.Located(myProfile.Location()), solid, myGenMap);
return solid;
}
else {

View File

@@ -27,7 +27,6 @@
#include <TopTools_HArray2OfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <BRepFill_DataMapOfShapeHArray2OfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <Standard_Integer.hxx>
#include <GeomAbs_Shape.hxx>
#include <GeomFill_Trihedron.hxx>
@@ -75,10 +74,6 @@ public:
Standard_EXPORT const TopoDS_Shape& LastShape() const;
//! Returns the list of shapes generated from the
//! shape <S>.
Standard_EXPORT void Generated (const TopoDS_Shape& S, TopTools_ListOfShape& L);
//! Returns the face created from an edge of the spine
//! and an edge of the profile.
//! if the edges are not in the spine or the profile
@@ -145,7 +140,6 @@ private:
Standard_Integer myCurIndexOfSectionEdge;
TopoDS_Shape myFirst;
TopoDS_Shape myLast;
TopTools_DataMapOfShapeListOfShape myGenMap;
Standard_Integer myDegmax;
Standard_Integer mySegmax;
GeomAbs_Shape myContinuity;

View File

@@ -152,7 +152,7 @@ Standard_Boolean BRepMesh_CircleTool::MakeCircle(const gp_XY& thePoint1,
theRadius = Sqrt(Max(Max((thePoint1 - aIntPnt).SquareModulus(),
(thePoint2 - aIntPnt).SquareModulus()),
(thePoint3 - aIntPnt).SquareModulus())) + 2 * RealEpsilon();
(thePoint3 - aIntPnt).SquareModulus())) + aPrecision;
return Standard_True;
}

View File

@@ -2667,7 +2667,7 @@ void BRepOffset_MakeOffset::CorrectConicalFaces()
break;
}
}
NewEdges.Append(FirstEdge.Oriented(TopAbs_FORWARD));
NewEdges.Append(FirstEdge);
TopoDS_Vertex Vf1, CurVertex;
TopExp::Vertices(FirstEdge, Vf1, CurVertex);
itl.Initialize(EdgesOfWire);
@@ -2678,7 +2678,7 @@ void BRepOffset_MakeOffset::CorrectConicalFaces()
TopExp::Vertices(anEdge, V1, V2);
if (V1.IsSame(CurVertex) || V2.IsSame(CurVertex))
{
NewEdges.Append(anEdge.Oriented(TopAbs_FORWARD));
NewEdges.Append(anEdge);
CurVertex = (V1.IsSame(CurVertex))? V2 : V1;
EdgesOfWire.Remove(itl);
}
@@ -2696,32 +2696,30 @@ void BRepOffset_MakeOffset::CorrectConicalFaces()
Vfirst = -M_PI/2.; Vlast = p2d1.Y();
}
TopoDS_Face NewSphericalFace = BRepLib_MakeFace(aSphSurf, Ufirst, Ulast, Vfirst, Vlast, Precision::Confusion());
TopoDS_Edge OldEdge, DegEdge;
for (Explo.Init(NewSphericalFace, TopAbs_EDGE); Explo.More(); Explo.Next())
{
DegEdge = TopoDS::Edge(Explo.Current());
if (BRep_Tool::Degenerated(DegEdge))
break;
}
TopoDS_Vertex DegVertex = TopExp::FirstVertex(DegEdge);
TopoDS_Edge OldEdge;
for (Explo.Init(NewSphericalFace, TopAbs_EDGE); Explo.More(); Explo.Next())
{
OldEdge = TopoDS::Edge(Explo.Current());
TopoDS_Vertex V1, V2;
TopExp::Vertices(OldEdge, V1, V2);
if (!V1.IsSame(DegVertex) && !V2.IsSame(DegVertex))
break;
if (!BRep_Tool::Degenerated(OldEdge))
{
BRepAdaptor_Curve2d BAc2d(OldEdge, NewSphericalFace);
p2d1 = BAc2d.Value(BAc2d.FirstParameter());
p2d2 = BAc2d.Value(BAc2d.LastParameter());
if (Abs(p2d1.X() - Ufirst) <= Precision::Confusion() &&
Abs(p2d2.X() - Ulast) <= Precision::Confusion())
break;
}
}
TopoDS_Vertex V1, V2;
TopExp::Vertices(OldEdge, V1, V2);
TopTools_ListOfShape LV1, LV2;
LV1.Append(Vf1.Oriented(TopAbs_FORWARD));
LV2.Append(CurVertex.Oriented(TopAbs_FORWARD));
LV1.Append(Vf1);
LV2.Append(CurVertex);
BRepTools_Substitution theSubstitutor;
theSubstitutor.Substitute(V1.Oriented(TopAbs_FORWARD), LV1);
theSubstitutor.Substitute(V1, LV1);
if (!V1.IsSame(V2))
theSubstitutor.Substitute(V2.Oriented(TopAbs_FORWARD), LV2);
theSubstitutor.Substitute(OldEdge.Oriented(TopAbs_FORWARD), NewEdges);
theSubstitutor.Substitute(V2, LV2);
theSubstitutor.Substitute(OldEdge, NewEdges);
theSubstitutor.Build(NewSphericalFace);
if (theSubstitutor.IsCopied(NewSphericalFace))
{

View File

@@ -111,23 +111,14 @@ TopoDS_Shape BRepOffsetAPI_MakePipe::LastShape()
return myPipe.LastShape();
}
//=======================================================================
//function : Generated
//purpose : standard method
//=======================================================================
const TopTools_ListOfShape& BRepOffsetAPI_MakePipe::Generated(const TopoDS_Shape& S)
{
myPipe.Generated(S, myGenerated);
return myGenerated;
}
//=======================================================================
//function : Generated
//purpose : returns generated elementary subshape
//purpose :
//=======================================================================
TopoDS_Shape BRepOffsetAPI_MakePipe::Generated(const TopoDS_Shape& SSpine,
const TopoDS_Shape& SProfile)
TopoDS_Shape BRepOffsetAPI_MakePipe::Generated (const TopoDS_Shape& SSpine,
const TopoDS_Shape& SProfile)
{
if (SProfile.ShapeType () == TopAbs_EDGE) {
return myPipe.Face (TopoDS::Edge (SSpine), TopoDS::Edge (SProfile));

View File

@@ -79,9 +79,7 @@ public:
//! Returns the TopoDS Shape of the top of the prism.
Standard_EXPORT TopoDS_Shape LastShape() Standard_OVERRIDE;
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
Standard_EXPORT TopoDS_Shape Generated(const TopoDS_Shape& SSpine, const TopoDS_Shape& SProfile);
Standard_EXPORT TopoDS_Shape Generated (const TopoDS_Shape& SSpine, const TopoDS_Shape& SProfile);
Standard_EXPORT Standard_Real ErrorOnSurface() const;

View File

@@ -44,10 +44,6 @@
#include <TColStd_Array1OfInteger.hxx>
#include <TopTrans_CurveTransition.hxx>
#include <BRepAdaptor_HCurve2d.hxx>
#include <Geom_Curve.hxx>
#include <BRep_Tool.hxx>
#define Tolpetit 1.e-10 // pour dist au carre
#define tole 5.e-6
@@ -539,23 +535,6 @@ static void ComputeTangency (const Contap_TheSearch& solrst,
const Handle(Adaptor2d_HCurve2d)& thearc = PStart.Arc();
theparam = PStart.Parameter();
gp_Pnt2d Ptoproj=Contap_HCurve2dTool::Value(thearc,theparam);
//jgv: for the issue 24103 to exclude points that are not same parameter:
//these points can be out of the surface's domain and lead to failure of Walking algorithm.
gp_Pnt PointFromSurf = Surf->Value(Ptoproj.X(), Ptoproj.Y());
Handle(BRepAdaptor_HCurve2d) brhc = Handle(BRepAdaptor_HCurve2d)::DownCast(thearc);
TopoDS_Edge theedge = brhc->ChangeCurve2d().Edge();
Standard_Real fpar, lpar;
Handle(Geom_Curve) thecurve = BRep_Tool::Curve(theedge, fpar, lpar);
if (!thecurve.IsNull())
{
gp_Pnt PointFromEdge = thecurve->Value(theparam);
Standard_Real TolEdge = BRep_Tool::Tolerance(theedge);
if (PointFromSurf.Distance(PointFromEdge) > 2.*TolEdge)
continue;
}
//////////////////////////////////////////////////////////
//-- lbr le 15 mai 97
//-- On elimine les points qui sont egalement present sur une restriction solution
Standard_Boolean SurUneRestrictionSolution = Standard_False;

View File

@@ -41,6 +41,8 @@ Geom_Geometry.hxx
Geom_HSequenceOfBSplineSurface.hxx
Geom_Hyperbola.cxx
Geom_Hyperbola.hxx
Geom_Interpolate.cxx
Geom_Interpolate.hxx
Geom_Line.cxx
Geom_Line.hxx
Geom_OffsetCurve.cxx

View File

@@ -0,0 +1,73 @@
// Copyright (c) 1994-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Geom_Interpolate.hxx>
//=======================================================================
//function : computeLagrangeTangent2d
//purpose : compute tangent of 3-point template in middle point
// using Lagrange polynomial.
//=======================================================================
gp_Vec2d Geom_Interpolate::ComputeLagrangeTangent2d(const TColgp_Array1OfPnt2d& thePointsArray,
const TColStd_Array1OfReal& theParametersArray,
const Standard_Integer theIdx)
{
gp_Vec2d aCurTangent(0.0, 0.0);
if (theIdx == thePointsArray.Lower() ||
theIdx == thePointsArray.Upper())
return aCurTangent;
// Compute tangent in the second point.
Standard_Real t0 = theParametersArray(theIdx - 1);
Standard_Real t1 = theParametersArray(theIdx);
Standard_Real t2 = theParametersArray(theIdx + 1);
gp_Pnt2d p0 = thePointsArray(theIdx - 1);
gp_Pnt2d p1 = thePointsArray(theIdx);
gp_Pnt2d p2 = thePointsArray(theIdx + 1);
aCurTangent.SetXY(p0.XY() * (t1-t2)/((t0-t1)*(t0-t2))
+ p1.XY() * (2*t1-t0-t2)/((t1-t0)*(t1-t2))
+ p2.XY() * (t1-t0)/((t2-t0)*(t2-t1)));
return aCurTangent;
}
//=======================================================================
//function : computeLagrangeTangent
//purpose : compute tangent of 3-point template in middle point
// using Lagrange polynomial.
//=======================================================================
gp_Vec Geom_Interpolate::ComputeLagrangeTangent(const TColgp_Array1OfPnt& thePointsArray,
const TColStd_Array1OfReal& theParametersArray,
const Standard_Integer theIdx)
{
gp_Vec aCurTangent(0.0, 0.0, 0.0);
if (theIdx == thePointsArray.Lower() ||
theIdx == thePointsArray.Upper())
return aCurTangent;
// Compute tangent in the second point.
Standard_Real t0 = theParametersArray(theIdx - 1);
Standard_Real t1 = theParametersArray(theIdx);
Standard_Real t2 = theParametersArray(theIdx + 1);
gp_Pnt p0 = thePointsArray(theIdx - 1);
gp_Pnt p1 = thePointsArray(theIdx);
gp_Pnt p2 = thePointsArray(theIdx + 1);
aCurTangent.SetXYZ(p0.XYZ() * (t1-t2)/((t0-t1)*(t0-t2))
+ p1.XYZ() * (2*t1-t0-t2)/((t1-t0)*(t1-t2))
+ p2.XYZ() * (t1-t0)/((t2-t0)*(t2-t1)));
return aCurTangent;
}

View File

@@ -0,0 +1,48 @@
// Copyright (c) 1994-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Geom_Interpolate_HeaderFile
#define _Geom_Interpolate_HeaderFile
#include <gp_Vec2d.hxx>
#include <gp_Vec.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_Array1OfReal.hxx>
//! This enumeration represent boundary condition type for interpolation algorithm.
enum GeomInterpolate_BCType
{
GeomInterpolate_CLAMPED,
GeomInterpolate_NATURAL
};
//! This class contains static method which are used in interpolation algorithms:
//! GeomAPI_Interpolate
//! Geom2dAPI_Interpolate
class Geom_Interpolate
{
public:
Standard_EXPORT static gp_Vec2d ComputeLagrangeTangent2d(const TColgp_Array1OfPnt2d &thePointsArray,
const TColStd_Array1OfReal &theParametersArray,
const Standard_Integer theIdx);
Standard_EXPORT static gp_Vec ComputeLagrangeTangent(const TColgp_Array1OfPnt &thePointsArray,
const TColStd_Array1OfReal &theParametersArray,
const Standard_Integer theIdx);
};
#endif

View File

@@ -127,114 +127,150 @@ static void BuildParameters(const Standard_Boolean PeriodicFlag,
ParametersPtr->Value(ii) + distance) ;
}
}
//=======================================================================
//function : BuildPeriodicTangents
//purpose :
//=======================================================================
static void BuildPeriodicTangent(
const TColgp_Array1OfPnt2d& PointsArray,
TColgp_Array1OfVec2d& TangentsArray,
TColStd_Array1OfBoolean& TangentFlags,
const TColStd_Array1OfReal& ParametersArray)
static void BuildPeriodicTangent(const TColgp_Array1OfPnt2d& PointsArray,
TColgp_Array1OfVec2d& TangentsArray,
TColStd_Array1OfBoolean& TangentFlags,
const TColStd_Array1OfReal& ParametersArray,
const GeomInterpolate_BCType theBCType)
{
Standard_Integer
ii,
degree ;
Standard_Real *point_array,
*parameter_array,
eval_result[2][2] ;
gp_Vec2d a_vector ;
if (PointsArray.Length() < 3) {
Standard_ConstructionError::Raise();
}
if (!TangentFlags.Value(1)) {
degree = 3 ;
if (PointsArray.Length() == 3) {
degree = 2 ;
}
point_array = (Standard_Real *) &PointsArray.Value(PointsArray.Lower()) ;
parameter_array =
(Standard_Real *) &ParametersArray.Value(1) ;
TangentFlags.SetValue(1,Standard_True) ;
PLib::EvalLagrange(ParametersArray.Value(1),
1,
degree,
2,
point_array[0],
parameter_array[0],
eval_result[0][0]) ;
for (ii = 1 ; ii <= 2 ; ii++) {
a_vector.SetCoord(ii,eval_result[1][ii-1]) ;
}
TangentsArray.SetValue(1,a_vector) ;
gp_Vec2d aCurTangent;
Standard_Integer degree = 3;
if (PointsArray.Length() < 3)
Standard_ConstructionError::Raise();
if (TangentFlags.Value(1))
return; // yet computed.
else
TangentFlags.SetValue(1,Standard_True);
if (theBCType == GeomInterpolate_NATURAL)
{
// Compute tangent in second point.
aCurTangent = Geom_Interpolate::
ComputeLagrangeTangent2d(PointsArray, ParametersArray, PointsArray.Lower() + 1);
// Compute tangent in the first point to satisfy
// f''(0) = 0 condition approximation:
// This is approximation due to usage of the tangent approximation in the second point
// instead of the equation below directly in solver.
//
// Formula from the Golovanov book "Geometrical modeling", 2011, pp. 18:
//
// q0 = 1.5 * (p1 - p0) / (t1 - t0) - 0.5 q1
//
// q1=p0*(t1-t2)/((t0-t1)(t0-t2)) + p1 (2t1-t0-t2)/((t1-t0)(t1-t2))+ p2(t1-t0)/((t2-t0)(t2-t1))
//
// Where:
// t - parameter
// p - point
// q - tangent vectors
gp_Vec2d aVec(PointsArray(1), PointsArray(2));
aCurTangent = 1.5 * aVec / (ParametersArray(2) - ParametersArray(1)) - 0.5 * aCurTangent;
}
else if (theBCType == GeomInterpolate_CLAMPED)
{
Standard_Real *point_array, *parameter_array, eval_result[2][2];
if (PointsArray.Length() < 3)
Standard_ConstructionError::Raise();
point_array = (Standard_Real *) &PointsArray.Value(PointsArray.Lower());
parameter_array = (Standard_Real *) &ParametersArray.Value(1);
PLib::EvalLagrange(ParametersArray.Value(1), 1, degree, 2, point_array[0],
parameter_array[0], eval_result[0][0]);
for (Standard_Integer ii = 1 ; ii <= 2 ; ii++)
aCurTangent.SetCoord(ii,eval_result[1][ii-1]);
}
TangentsArray.SetValue(1,aCurTangent);
}
//=======================================================================
//function : BuildTangents
//purpose :
//=======================================================================
static void BuildTangents(const TColgp_Array1OfPnt2d& PointsArray,
TColgp_Array1OfVec2d& TangentsArray,
TColStd_Array1OfBoolean& TangentFlags,
const TColStd_Array1OfReal& ParametersArray)
TColgp_Array1OfVec2d& TangentsArray,
TColStd_Array1OfBoolean& TangentFlags,
const TColStd_Array1OfReal& ParametersArray,
const GeomInterpolate_BCType theBCType)
{
Standard_Integer ii,
degree ;
Standard_Real *point_array,
*parameter_array,
eval_result[2][2] ;
gp_Vec2d a_vector ;
degree = 3 ;
gp_Vec2d aCurTangent,
aFirstTangent, // Resulting tangents.
aLastTangent; // Resulting tangents.
Standard_Integer ii, degree = 3;
if (PointsArray.Length() == 3)
degree = 2;
if ( PointsArray.Length() < 3) {
Standard_ConstructionError::Raise();
}
if (PointsArray.Length() == 3) {
degree = 2 ;
}
if (!TangentFlags.Value(1)) {
point_array = (Standard_Real *) &PointsArray.Value(PointsArray.Lower()) ;
parameter_array =
(Standard_Real *) &ParametersArray.Value(1) ;
TangentFlags.SetValue(1,Standard_True) ;
PLib::EvalLagrange(ParametersArray.Value(1),
1,
degree,
2,
point_array[0],
parameter_array[0],
eval_result[0][0]) ;
for (ii = 1 ; ii <= 2 ; ii++) {
a_vector.SetCoord(ii,eval_result[1][ii-1]) ;
}
TangentsArray.SetValue(1,a_vector) ;
}
if (! TangentFlags.Value(TangentFlags.Upper())) {
point_array =
(Standard_Real *) &PointsArray.Value(PointsArray.Upper() - degree) ;
TangentFlags.SetValue(TangentFlags.Upper(),Standard_True) ;
parameter_array =
(Standard_Real *)&ParametersArray.Value(ParametersArray.Upper() - degree) ;
PLib::EvalLagrange(ParametersArray.Value(ParametersArray.Upper()),
1,
degree,
2,
point_array[0],
parameter_array[0],
eval_result[0][0]) ;
for (ii = 1 ; ii <= 2 ; ii++) {
a_vector.SetCoord(ii,eval_result[1][ii-1]) ;
}
TangentsArray.SetValue(TangentsArray.Upper(),a_vector) ;
}
}
if (TangentFlags.Value(1) &&
TangentFlags.Value(TangentFlags.Upper()))
{
return;
}
if (theBCType == GeomInterpolate_NATURAL)
{
// The formulas for tangent computation is stored in BuildPeriodicTangent.
if (!TangentFlags.Value(1))
{
// Compute tangent in second point.
aCurTangent = Geom_Interpolate::
ComputeLagrangeTangent2d(PointsArray, ParametersArray, PointsArray.Lower() + 1);
gp_Vec2d aVec(PointsArray(1), PointsArray(2));
aFirstTangent = 1.5 * aVec / (ParametersArray(2) - ParametersArray(1)) - 0.5 * aCurTangent;
} // if (!TangentFlags.Value(1))
if (!TangentFlags.Value(TangentFlags.Upper()))
{
// Compute tangent in last but one point.
aCurTangent = Geom_Interpolate::
ComputeLagrangeTangent2d(PointsArray, ParametersArray, PointsArray.Upper() - 1);
Standard_Integer aLastIdx = PointsArray.Upper();
gp_Vec2d aVec(PointsArray(aLastIdx - 1), PointsArray(aLastIdx));
aLastTangent = 1.5 * aVec / (ParametersArray(aLastIdx) - ParametersArray(aLastIdx - 1)) - 0.5 * aCurTangent;
}
}
else if (theBCType == GeomInterpolate_CLAMPED)
{
Standard_Real *point_array, *parameter_array, eval_result[2][2];
if (!TangentFlags.Value(1))
{
point_array = (Standard_Real *) &PointsArray.Value(PointsArray.Lower());
parameter_array = (Standard_Real *) &ParametersArray.Value(1);
TangentFlags.SetValue(1,Standard_True);
PLib::EvalLagrange(ParametersArray.Value(1), 1, degree, 3, point_array[0], parameter_array[0], eval_result[0][0]) ;
for (ii = 1 ; ii <= 3 ; ii++)
aFirstTangent.SetCoord(ii,eval_result[1][ii-1]);
} // if (!TangentFlags.Value(1))
if (!TangentFlags.Value(TangentFlags.Upper()))
{
point_array = (Standard_Real *) &PointsArray.Value(PointsArray.Upper() - degree);
TangentFlags.SetValue(TangentFlags.Upper(),Standard_True);
parameter_array = (Standard_Real *) &ParametersArray.Value(ParametersArray.Upper() - degree);
PLib::EvalLagrange(ParametersArray.Value(ParametersArray.Upper()), 1, degree, 3,point_array[0], parameter_array[0], eval_result[0][0]);
for (ii = 1 ; ii <= 3 ; ii++)
aLastTangent.SetCoord(ii,eval_result[1][ii-1]);
}
}
if (!TangentFlags.Value(1))
{
TangentFlags.SetValue(1, Standard_True);
TangentsArray.SetValue(1, aFirstTangent);
}
if (!TangentFlags.Value(TangentFlags.Upper()))
{
TangentFlags.SetValue(TangentFlags.Upper(), Standard_True);
TangentsArray.SetValue(TangentsArray.Upper(), aLastTangent);
}
}
//=======================================================================
//function : BuildTangents
//purpose : scale the given tangent so that they have the length of
@@ -310,41 +346,28 @@ static void ScaleTangents(const TColgp_Array1OfPnt2d& PointsArray,
//purpose :
//=======================================================================
Geom2dAPI_Interpolate::Geom2dAPI_Interpolate
(const Handle(TColgp_HArray1OfPnt2d)& PointsPtr,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance) :
myTolerance(Tolerance),
myPoints(PointsPtr),
myIsDone(Standard_False),
myPeriodic(PeriodicFlag),
myTangentRequest(Standard_False)
Geom2dAPI_Interpolate::Geom2dAPI_Interpolate(const Handle(TColgp_HArray1OfPnt2d)& PointsPtr,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance,
const GeomInterpolate_BCType theBCType)
: myTolerance(Tolerance),
myPoints(PointsPtr),
myIsDone(Standard_False),
myPeriodic(PeriodicFlag),
myTangentRequest(Standard_False),
myBCType(theBCType)
{
Standard_Integer ii ;
Standard_Boolean result =
CheckPoints(PointsPtr->Array1(),
Tolerance) ;
myTangents =
new TColgp_HArray1OfVec2d(myPoints->Lower(),
myPoints->Upper()) ;
myTangentFlags =
new TColStd_HArray1OfBoolean(myPoints->Lower(),
myPoints->Upper()) ;
Standard_Boolean result = CheckPoints(PointsPtr->Array1(), Tolerance);
myTangents = new TColgp_HArray1OfVec2d(myPoints->Lower(), myPoints->Upper());
myTangentFlags = new TColStd_HArray1OfBoolean(myPoints->Lower(), myPoints->Upper());
if (!result) {
Standard_ConstructionError::Raise();
}
BuildParameters(PeriodicFlag,
PointsPtr->Array1(),
myParameters) ;
if (!result)
Standard_ConstructionError::Raise();
for (ii = myPoints->Lower() ; ii <= myPoints->Upper() ; ii++) {
myTangentFlags->SetValue(ii,Standard_False) ;
}
BuildParameters(PeriodicFlag, PointsPtr->Array1(), myParameters);
for (Standard_Integer ii = myPoints->Lower() ; ii <= myPoints->Upper() ; ii++)
myTangentFlags->SetValue(ii,Standard_False);
}
//=======================================================================
@@ -352,51 +375,40 @@ myTangentRequest(Standard_False)
//purpose :
//=======================================================================
Geom2dAPI_Interpolate::Geom2dAPI_Interpolate
(const Handle(TColgp_HArray1OfPnt2d)& PointsPtr,
const Handle(TColStd_HArray1OfReal)& ParametersPtr,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance) :
myTolerance(Tolerance),
myPoints(PointsPtr),
myIsDone(Standard_False),
myParameters(ParametersPtr),
myPeriodic(PeriodicFlag),
myTangentRequest(Standard_False)
Geom2dAPI_Interpolate::Geom2dAPI_Interpolate(const Handle(TColgp_HArray1OfPnt2d) &PointsPtr,
const Handle(TColStd_HArray1OfReal) &ParametersPtr,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance,
const GeomInterpolate_BCType theBCType)
: myTolerance(Tolerance),
myPoints(PointsPtr),
myIsDone(Standard_False),
myParameters(ParametersPtr),
myPeriodic(PeriodicFlag),
myTangentRequest(Standard_False),
myBCType(theBCType)
{
Standard_Integer ii ;
Standard_Boolean result =
CheckPoints(PointsPtr->Array1(),
Tolerance) ;
Standard_Boolean result = CheckPoints(PointsPtr->Array1(), Tolerance);
if (PeriodicFlag) {
if ((PointsPtr->Length()) + 1 != ParametersPtr->Length()) {
Standard_ConstructionError::Raise();
}
}
myTangents =
new TColgp_HArray1OfVec2d(myPoints->Lower(),
myPoints->Upper()) ;
myTangentFlags =
new TColStd_HArray1OfBoolean(myPoints->Lower(),
myPoints->Upper()) ;
if (!result) {
Standard_ConstructionError::Raise();
}
result =
CheckParameters(ParametersPtr->Array1()) ;
if (!result) {
Standard_ConstructionError::Raise();
}
for (ii = myPoints->Lower() ; ii <= myPoints->Upper() ; ii++) {
myTangentFlags->SetValue(ii,Standard_False) ;
}
if (PeriodicFlag)
{
if ((PointsPtr->Length()) + 1 != ParametersPtr->Length())
{
Standard_ConstructionError::Raise();
}
}
myTangents = new TColgp_HArray1OfVec2d(myPoints->Lower(), myPoints->Upper());
myTangentFlags = new TColStd_HArray1OfBoolean(myPoints->Lower(), myPoints->Upper());
if (!result)
Standard_ConstructionError::Raise();
result = CheckParameters(ParametersPtr->Array1());
if (!result)
Standard_ConstructionError::Raise();
for (Standard_Integer ii = myPoints->Lower() ; ii <= myPoints->Upper() ; ii++)
myTangentFlags->SetValue(ii,Standard_False);
}
//=======================================================================
//function : Load
@@ -566,14 +578,15 @@ void Geom2dAPI_Interpolate::PerformPeriodic()
mults.SetValue(num_distinct_knots ,half_order) ;
if (num_points >= 3) {
//
// only enter here if there are more than 3 points otherwise
// it means we have already the tangent
//
//
// only enter here if there are more than 3 points otherwise
// it means we have already the tangent
//
BuildPeriodicTangent(myPoints->Array1(),
myTangents->ChangeArray1(),
myTangentFlags->ChangeArray1(),
myParameters->Array1()) ;
myTangents->ChangeArray1(),
myTangentFlags->ChangeArray1(),
myParameters->Array1(),
myBCType);
}
contact_order_array.SetValue(2,1) ;
parameters.SetValue(1,myParameters->Value(1)) ;
@@ -787,9 +800,10 @@ void Geom2dAPI_Interpolate::PerformNonPeriodic()
// if those where not given in advance
//
BuildTangents(myPoints->Array1(),
myTangents->ChangeArray1(),
myTangentFlags->ChangeArray1(),
myParameters->Array1()) ;
myTangents->ChangeArray1(),
myTangentFlags->ChangeArray1(),
myParameters->Array1(),
myBCType);
}
contact_order_array.SetValue(2,1) ;
parameters.SetValue(1,myParameters->Value(1)) ;

View File

@@ -17,6 +17,8 @@
#ifndef _Geom2dAPI_Interpolate_HeaderFile
#define _Geom2dAPI_Interpolate_HeaderFile
#include <Geom_Interpolate.hxx>
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
@@ -31,8 +33,6 @@
class Geom2d_BSplineCurve;
class StdFail_NotDone;
class Standard_ConstructionError;
class gp_Vec2d;
//! This class is used to interpolate a BsplineCurve
//! passing through an array of points, with a C2
@@ -54,16 +54,25 @@ public:
//! Tolerance is to check if the points are not too close to one an other
//! It is also used to check if the tangent vector is not too small.
//! There should be at least 2 points
//! There should be at least 2 points.
//! if PeriodicFlag is True then the curve will be periodic.
Standard_EXPORT Geom2dAPI_Interpolate(const Handle(TColgp_HArray1OfPnt2d)& Points, const Standard_Boolean PeriodicFlag, const Standard_Real Tolerance);
//! Last parameter sets the boundary condition type.
Standard_EXPORT Geom2dAPI_Interpolate(const Handle(TColgp_HArray1OfPnt2d)& Points,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance,
const GeomInterpolate_BCType theBCType = GeomInterpolate_CLAMPED);
//! if PeriodicFlag is True then the curve will be periodic
//! Warning:
//! There should be as many parameters as there are points
//! except if PeriodicFlag is True : then there should be one more
//! parameter to close the curve
Standard_EXPORT Geom2dAPI_Interpolate(const Handle(TColgp_HArray1OfPnt2d)& Points, const Handle(TColStd_HArray1OfReal)& Parameters, const Standard_Boolean PeriodicFlag, const Standard_Real Tolerance);
//! There should be as many parameters as there are points.
//! except if PeriodicFlag is True : then there should be one more.
//! parameter to close the curve.
//! Last parameter sets the boundary condition type.
Standard_EXPORT Geom2dAPI_Interpolate(const Handle(TColgp_HArray1OfPnt2d)& Points,
const Handle(TColStd_HArray1OfReal)& Parameters,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance,
const GeomInterpolate_BCType theBCType = GeomInterpolate_CLAMPED);
//! Assigns this constrained BSpline curve to be
//! tangential to vectors InitialTangent and FinalTangent
@@ -100,14 +109,17 @@ Standard_EXPORT operator Handle(Geom2d_BSplineCurve)() const;
//! Note: in this case, the result is given by the function Curve.
Standard_EXPORT Standard_Boolean IsDone() const;
//! Get boundary condition type.
GeomInterpolate_BCType GetBoundaryCondition()
{
return myBCType;
}
protected:
//! Set boundary condition type.
void GetBoundaryCondition(const GeomInterpolate_BCType theBCType)
{
myBCType = theBCType;
}
private:
@@ -128,6 +140,7 @@ private:
Handle(TColStd_HArray1OfReal) myParameters;
Standard_Boolean myPeriodic;
Standard_Boolean myTangentRequest;
GeomInterpolate_BCType myBCType;
};

View File

@@ -94,147 +94,178 @@ static Standard_Boolean CheckParameters(const
//=======================================================================
//function : BuildParameters
//purpose :
//=======================================================================
//=======================================================================
static void BuildParameters(const Standard_Boolean PeriodicFlag,
const TColgp_Array1OfPnt& PointsArray,
Handle(TColStd_HArray1OfReal)& ParametersPtr)
const TColgp_Array1OfPnt& PointsArray,
Handle(TColStd_HArray1OfReal)& ParametersPtr)
{
Standard_Integer ii,
index ;
Standard_Real distance ;
Standard_Integer
num_parameters = PointsArray.Length() ;
if (PeriodicFlag) {
num_parameters += 1 ;
Standard_Integer ii, index;
Standard_Real distance;
Standard_Integer num_parameters = PointsArray.Length();
if (PeriodicFlag)
num_parameters += 1;
ParametersPtr = new TColStd_HArray1OfReal(1, num_parameters);
ParametersPtr->SetValue(1, 0.0);
index = 2;
for (ii = PointsArray.Lower() ; ii < PointsArray.Upper() ; ii++)
{
distance = PointsArray.Value(ii).Distance(PointsArray.Value(ii+1));
ParametersPtr->SetValue(index, ParametersPtr->Value(ii) + distance);
index += 1;
}
ParametersPtr =
new TColStd_HArray1OfReal(1,
num_parameters) ;
ParametersPtr->SetValue(1,0.0e0) ;
index = 2 ;
for (ii = PointsArray.Lower() ; ii < PointsArray.Upper() ; ii++) {
distance =
PointsArray.Value(ii).Distance(PointsArray.Value(ii+1)) ;
ParametersPtr->SetValue(index,
ParametersPtr->Value(ii) + distance) ;
index += 1 ;
}
if (PeriodicFlag) {
distance =
PointsArray.Value(PointsArray.Upper()).
Distance(PointsArray.Value(PointsArray.Lower())) ;
ParametersPtr->SetValue(index,
ParametersPtr->Value(ii) + distance) ;
if (PeriodicFlag)
{
distance = PointsArray.Value(PointsArray.Upper()).Distance(PointsArray.Value(PointsArray.Lower()));
ParametersPtr->SetValue(index, ParametersPtr->Value(ii) + distance);
}
}
//=======================================================================
//function : BuildPeriodicTangents
//purpose :
//purpose : Compute initial condition in periodic case
//=======================================================================
static void BuildPeriodicTangent(
const TColgp_Array1OfPnt& PointsArray,
TColgp_Array1OfVec& TangentsArray,
TColStd_Array1OfBoolean& TangentFlags,
const TColStd_Array1OfReal& ParametersArray)
static void BuildPeriodicTangent(const TColgp_Array1OfPnt& PointsArray,
TColgp_Array1OfVec& TangentsArray,
TColStd_Array1OfBoolean& TangentFlags,
const TColStd_Array1OfReal& ParametersArray,
GeomInterpolate_BCType theBCType)
{
Standard_Integer
ii,
degree ;
Standard_Real *point_array,
*parameter_array,
eval_result[2][3] ;
gp_Vec a_vector ;
if (PointsArray.Length() < 3) {
Standard_ConstructionError::Raise();
}
if (!TangentFlags.Value(1)) {
degree = 3 ;
if (PointsArray.Length() == 3) {
degree = 2 ;
}
point_array = (Standard_Real *) &PointsArray.Value(PointsArray.Lower()) ;
parameter_array =
(Standard_Real *) &ParametersArray.Value(1) ;
TangentFlags.SetValue(1,Standard_True) ;
PLib::EvalLagrange(ParametersArray.Value(1),
1,
degree,
3,
point_array[0],
parameter_array[0],
eval_result[0][0]) ;
for (ii = 1 ; ii <= 3 ; ii++) {
a_vector.SetCoord(ii,eval_result[1][ii-1]) ;
}
TangentsArray.SetValue(1,a_vector) ;
gp_Vec aCurTangent;
Standard_Integer degree = 3;
if (PointsArray.Length() == 3)
degree = 2;
if (TangentFlags.Value(1))
return; // yet computed.
else
TangentFlags.SetValue(1,Standard_True);
if (theBCType == GeomInterpolate_NATURAL)
{
// Compute tangent in second point.
aCurTangent = Geom_Interpolate::
ComputeLagrangeTangent(PointsArray, ParametersArray, PointsArray.Lower() + 1);
// Compute tangent approximation in the first point to satisfy
// f''(0) = 0 condition approximation:
// This is approximation due to usage of the tangent approximation in the second point
// instead of the equation below directly in solver.
//
// Formula from the Golovanov book "Geometrical modeling", 2011, pp. 18:
//
// q0 = 1.5 * (p1 - p0) / (t1 - t0) - 0.5 q1
//
// q1=p0*(t1-t2)/((t0-t1)(t0-t2)) + p1 (2t1-t0-t2)/((t1-t0)(t1-t2))+ p2(t1-t0)/((t2-t0)(t2-t1))
//
// Where:
// t - parameter
// p - point
// q - tangent vector
gp_Vec aVec(PointsArray(1), PointsArray(2));
aCurTangent = 1.5 * aVec / (ParametersArray(2) - ParametersArray(1)) - 0.5 * aCurTangent;
}
}
else if (theBCType == GeomInterpolate_CLAMPED)
{
Standard_Real *point_array, *parameter_array, eval_result[2][3];
if (PointsArray.Length() < 3)
Standard_ConstructionError::Raise();
point_array = (Standard_Real *) &PointsArray.Value(PointsArray.Lower());
parameter_array = (Standard_Real *) &ParametersArray.Value(1);
PLib::EvalLagrange(ParametersArray.Value(1), 1, degree, 3, point_array[0],
parameter_array[0], eval_result[0][0]);
for (Standard_Integer ii = 1 ; ii <= 3 ; ii++)
aCurTangent.SetCoord(ii,eval_result[1][ii-1]);
}
TangentsArray.SetValue(1,aCurTangent);
}
//=======================================================================
//function : BuildTangents
//purpose :
//=======================================================================
static void BuildTangents(const TColgp_Array1OfPnt& PointsArray,
TColgp_Array1OfVec& TangentsArray,
TColStd_Array1OfBoolean& TangentFlags,
const TColStd_Array1OfReal& ParametersArray)
{
Standard_Integer ii,
degree ;
Standard_Real *point_array,
*parameter_array,
eval_result[2][3] ;
gp_Vec a_vector ;
degree = 3 ;
if ( PointsArray.Length() < 3) {
Standard_ConstructionError::Raise();
}
if (PointsArray.Length() == 3) {
degree = 2 ;
}
if (!TangentFlags.Value(1)) {
point_array = (Standard_Real *) &PointsArray.Value(PointsArray.Lower()) ;
parameter_array =
(Standard_Real *) &ParametersArray.Value(1) ;
TangentFlags.SetValue(1,Standard_True) ;
PLib::EvalLagrange(ParametersArray.Value(1),
1,
degree,
3,
point_array[0],
parameter_array[0],
eval_result[0][0]) ;
for (ii = 1 ; ii <= 3 ; ii++) {
a_vector.SetCoord(ii,eval_result[1][ii-1]) ;
}
TangentsArray.SetValue(1,a_vector) ;
}
if (! TangentFlags.Value(TangentFlags.Upper())) {
point_array =
(Standard_Real *) &PointsArray.Value(PointsArray.Upper() - degree) ;
TangentFlags.SetValue(TangentFlags.Upper(),Standard_True) ;
parameter_array =
(Standard_Real *) &ParametersArray.Value(ParametersArray.Upper() - degree) ;
PLib::EvalLagrange(ParametersArray.Value(ParametersArray.Upper()),
1,
degree,
3,
point_array[0],
parameter_array[0],
eval_result[0][0]) ;
for (ii = 1 ; ii <= 3 ; ii++) {
a_vector.SetCoord(ii,eval_result[1][ii-1]) ;
}
TangentsArray.SetValue(TangentsArray.Upper(),a_vector) ;
}
}
static void BuildTangents(const TColgp_Array1OfPnt& PointsArray,
TColgp_Array1OfVec& TangentsArray,
TColStd_Array1OfBoolean& TangentFlags,
const TColStd_Array1OfReal& ParametersArray,
const GeomInterpolate_BCType theBCType)
{
gp_Vec aFirstTangent, // Resulting tangents.
aLastTangent; // Resulting tangents.
Standard_Integer ii, degree = 3;
if (PointsArray.Length() == 3)
degree = 2;
gp_Vec aCurTangent;
if (TangentFlags.Value(1) &&
TangentFlags.Value(TangentFlags.Upper()))
{
return;
}
if (theBCType == GeomInterpolate_NATURAL)
{
// The formulas for tangent computation is stored in BuildPeriodicTangent.
if (!TangentFlags.Value(1))
{
// Compute tangent in second point.
aCurTangent = Geom_Interpolate::
ComputeLagrangeTangent(PointsArray, ParametersArray, PointsArray.Lower() + 1);
gp_Vec aVec(PointsArray(1), PointsArray(2));
aFirstTangent = 1.5 * aVec / (ParametersArray(2) - ParametersArray(1)) - 0.5 * aCurTangent;
} // if (!TangentFlags.Value(1))
if (!TangentFlags.Value(TangentFlags.Upper()))
{
// Compute tangent in last but one point.
aCurTangent = Geom_Interpolate::
ComputeLagrangeTangent(PointsArray, ParametersArray, PointsArray.Upper() - 1);
Standard_Integer aLastIdx = PointsArray.Upper();
gp_Vec aVec(PointsArray(aLastIdx - 1), PointsArray(aLastIdx));
aLastTangent = 1.5 * aVec / (ParametersArray(aLastIdx) - ParametersArray(aLastIdx - 1)) - 0.5 * aCurTangent;
}
}
else if (theBCType == GeomInterpolate_CLAMPED)
{
Standard_Real *point_array, *parameter_array, eval_result[2][3];
if (!TangentFlags.Value(1))
{
point_array = (Standard_Real *) &PointsArray.Value(PointsArray.Lower());
parameter_array = (Standard_Real *) &ParametersArray.Value(1);
PLib::EvalLagrange(ParametersArray.Value(1), 1, degree, 3, point_array[0], parameter_array[0], eval_result[0][0]) ;
for (ii = 1 ; ii <= 3 ; ii++)
aFirstTangent.SetCoord(ii,eval_result[1][ii-1]);
} // if (!TangentFlags.Value(1))
if (!TangentFlags.Value(TangentFlags.Upper()))
{
point_array = (Standard_Real *) &PointsArray.Value(PointsArray.Upper() - degree);
parameter_array = (Standard_Real *) &ParametersArray.Value(ParametersArray.Upper() - degree);
PLib::EvalLagrange(ParametersArray.Value(ParametersArray.Upper()), 1, degree, 3,point_array[0], parameter_array[0], eval_result[0][0]);
for (ii = 1 ; ii <= 3 ; ii++)
aLastTangent.SetCoord(ii,eval_result[1][ii-1]);
}
}
if (!TangentFlags.Value(1))
{
TangentFlags.SetValue(1, Standard_True);
TangentsArray.SetValue(1, aFirstTangent);
}
if (!TangentFlags.Value(TangentFlags.Upper()))
{
TangentFlags.SetValue(TangentFlags.Upper(), Standard_True);
TangentsArray.SetValue(TangentsArray.Upper(), aLastTangent);
}
}
//=======================================================================
//function : BuildTangents
//purpose : scale the given tangent so that they have the length of
@@ -310,40 +341,28 @@ static void ScaleTangents(const TColgp_Array1OfPnt& PointsArray,
//purpose :
//=======================================================================
GeomAPI_Interpolate::GeomAPI_Interpolate
(const Handle(TColgp_HArray1OfPnt)& PointsPtr,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance) :
myTolerance(Tolerance),
myPoints(PointsPtr),
myIsDone(Standard_False),
myPeriodic(PeriodicFlag),
myTangentRequest(Standard_False)
GeomAPI_Interpolate::GeomAPI_Interpolate(const Handle(TColgp_HArray1OfPnt)& PointsPtr,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance,
const GeomInterpolate_BCType theBCType)
: myTolerance(Tolerance),
myPoints(PointsPtr),
myIsDone(Standard_False),
myPeriodic(PeriodicFlag),
myTangentRequest(Standard_False),
myBCType(theBCType)
{
Standard_Integer ii ;
Standard_Boolean result =
CheckPoints(PointsPtr->Array1(),
Tolerance) ;
myTangents =
new TColgp_HArray1OfVec(myPoints->Lower(),
myPoints->Upper()) ;
myTangentFlags =
new TColStd_HArray1OfBoolean(myPoints->Lower(),
myPoints->Upper()) ;
Standard_Boolean result = CheckPoints(PointsPtr->Array1(), Tolerance);
myTangents = new TColgp_HArray1OfVec(myPoints->Lower(), myPoints->Upper());
myTangentFlags = new TColStd_HArray1OfBoolean(myPoints->Lower(), myPoints->Upper());
if (!result) {
Standard_ConstructionError::Raise();
}
BuildParameters(PeriodicFlag,
PointsPtr->Array1(),
myParameters) ;
if (!result)
Standard_ConstructionError::Raise();
for (ii = myPoints->Lower() ; ii <= myPoints->Upper() ; ii++) {
myTangentFlags->SetValue(ii,Standard_False) ;
}
BuildParameters(PeriodicFlag, PointsPtr->Array1(), myParameters);
for ( Standard_Integer ii = myPoints->Lower(); ii <= myPoints->Upper(); ii++)
myTangentFlags->SetValue(ii,Standard_False);
}
//=======================================================================
@@ -351,51 +370,39 @@ myTangentRequest(Standard_False)
//purpose :
//=======================================================================
GeomAPI_Interpolate::GeomAPI_Interpolate
(const Handle(TColgp_HArray1OfPnt)& PointsPtr,
const Handle(TColStd_HArray1OfReal)& ParametersPtr,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance) :
myTolerance(Tolerance),
myPoints(PointsPtr),
myIsDone(Standard_False),
myParameters(ParametersPtr),
myPeriodic(PeriodicFlag),
myTangentRequest(Standard_False)
GeomAPI_Interpolate::GeomAPI_Interpolate(const Handle(TColgp_HArray1OfPnt)& PointsPtr,
const Handle(TColStd_HArray1OfReal)& ParametersPtr,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance,
const GeomInterpolate_BCType theBCType)
: myTolerance(Tolerance),
myPoints(PointsPtr),
myIsDone(Standard_False),
myParameters(ParametersPtr),
myPeriodic(PeriodicFlag),
myTangentRequest(Standard_False),
myBCType(theBCType)
{
Standard_Integer ii ;
Standard_Boolean result =
CheckPoints(PointsPtr->Array1(),
Tolerance) ;
Standard_Boolean result = CheckPoints(PointsPtr->Array1(), Tolerance);
if (PeriodicFlag)
{
if ((PointsPtr->Length()) + 1 != ParametersPtr->Length())
{
Standard_ConstructionError::Raise();
}
}
myTangents = new TColgp_HArray1OfVec(myPoints->Lower(), myPoints->Upper());
myTangentFlags = new TColStd_HArray1OfBoolean(myPoints->Lower(), myPoints->Upper());
if (PeriodicFlag) {
if ((PointsPtr->Length()) + 1 != ParametersPtr->Length()) {
Standard_ConstructionError::Raise();
}
}
myTangents =
new TColgp_HArray1OfVec(myPoints->Lower(),
myPoints->Upper()) ;
myTangentFlags =
new TColStd_HArray1OfBoolean(myPoints->Lower(),
myPoints->Upper()) ;
if (!result) {
Standard_ConstructionError::Raise();
}
result =
CheckParameters(ParametersPtr->Array1()) ;
if (!result) {
Standard_ConstructionError::Raise();
}
for (ii = myPoints->Lower() ; ii <= myPoints->Upper() ; ii++) {
myTangentFlags->SetValue(ii,Standard_False) ;
}
if (!result)
Standard_ConstructionError::Raise();
result = CheckParameters(ParametersPtr->Array1());
if (!result)
Standard_ConstructionError::Raise();
for (Standard_Integer ii = myPoints->Lower(); ii <= myPoints->Upper(); ii++)
myTangentFlags->SetValue(ii,Standard_False);
}
//=======================================================================
//function : Load
@@ -573,14 +580,14 @@ void GeomAPI_Interpolate::PerformPeriodic()
mults.SetValue(num_distinct_knots ,half_order) ;
if (num_points >= 3) {
//
// only enter here if there are more than 3 points otherwise
// it means we have already the tangent
//
// only enter here if there are more than 3 points otherwise
// it means we have already the tangent
BuildPeriodicTangent(myPoints->Array1(),
myTangents->ChangeArray1(),
myTangentFlags->ChangeArray1(),
myParameters->Array1()) ;
myTangents->ChangeArray1(),
myTangentFlags->ChangeArray1(),
myParameters->Array1(),
myBCType);
}
contact_order_array.SetValue(2,1) ;
parameters.SetValue(1,myParameters->Value(1)) ;
@@ -789,14 +796,15 @@ void GeomAPI_Interpolate::PerformNonPeriodic()
// check if the boundary conditions are set
//
if (num_points >= 3) {
//
// cannot build the tangents with degree 3 with only 2 points
// if those where not given in advance
//
//
// cannot build the tangents with degree 3 with only 2 points
// if those where not given in advance
//
BuildTangents(myPoints->Array1(),
myTangents->ChangeArray1(),
myTangentFlags->ChangeArray1(),
myParameters->Array1()) ;
myTangents->ChangeArray1(),
myTangentFlags->ChangeArray1(),
myParameters->Array1(),
myBCType);
}
contact_order_array.SetValue(2,1) ;
parameters.SetValue(1,myParameters->Value(1)) ;

View File

@@ -17,6 +17,8 @@
#ifndef _GeomAPI_Interpolate_HeaderFile
#define _GeomAPI_Interpolate_HeaderFile
#include <Geom_Interpolate.hxx>
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
@@ -30,8 +32,6 @@
#include <TColgp_Array1OfVec.hxx>
#include <Geom_BSplineCurve.hxx>
class gp_Vec;
//! This class is used to interpolate a BsplineCurve
//! passing through an array of points, with a C2
@@ -94,7 +94,11 @@ public:
//! - conditions relating to the respective
//! number of elements in the parallel tables
//! Points and Parameters are not respected.
Standard_EXPORT GeomAPI_Interpolate(const Handle(TColgp_HArray1OfPnt)& Points, const Standard_Boolean PeriodicFlag, const Standard_Real Tolerance);
//! Last parameter sets the boundary condition type.
Standard_EXPORT GeomAPI_Interpolate(const Handle(TColgp_HArray1OfPnt)& Points,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance,
const GeomInterpolate_BCType theBCType = GeomInterpolate_CLAMPED);
//! Initializes an algorithm for constructing a
//! constrained BSpline curve passing through the points of the table
@@ -134,7 +138,12 @@ public:
//! - conditions relating to the respective
//! number of elements in the parallel tables
//! Points and Parameters are not respected.
Standard_EXPORT GeomAPI_Interpolate(const Handle(TColgp_HArray1OfPnt)& Points, const Handle(TColStd_HArray1OfReal)& Parameters, const Standard_Boolean PeriodicFlag, const Standard_Real Tolerance);
//! Last parameter sets the boundary condition type.
Standard_EXPORT GeomAPI_Interpolate(const Handle(TColgp_HArray1OfPnt)& Points,
const Handle(TColStd_HArray1OfReal)& Parameters,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance,
const GeomInterpolate_BCType theBCType = GeomInterpolate_CLAMPED);
//! Assigns this constrained BSpline curve to be
//! tangential to vectors InitialTangent and FinalTangent
@@ -173,14 +182,17 @@ Standard_EXPORT operator Handle(Geom_BSplineCurve)() const;
//! Note: in this case, the result is given by the function Curve.
Standard_EXPORT Standard_Boolean IsDone() const;
//! Get boundary condition type.
GeomInterpolate_BCType GetBoundaryCondition()
{
return myBCType;
}
protected:
//! Set boundary condition type.
void GetBoundaryCondition(const GeomInterpolate_BCType theBCType)
{
myBCType = theBCType;
}
private:
@@ -201,6 +213,7 @@ private:
Handle(TColStd_HArray1OfReal) myParameters;
Standard_Boolean myPeriodic;
Standard_Boolean myTangentRequest;
GeomInterpolate_BCType myBCType; // type of boundary conditions
};

View File

@@ -448,11 +448,22 @@ static Standard_Integer lintang (Draw_Interpretor& di,Standard_Integer n, const
static Standard_Integer interpol (Draw_Interpretor& di,Standard_Integer n, const char** a)
//==================================================================================
{
if (n == 1) {
di <<"give a name to your curve !\n";
if (n == 1)
{
di <<"Interpolate: \n"
<< "interpol resCurveName \n"
<< "interpolation via getting points from the axonometric view \n"
<< "\n"
<< "interpol resCurveName fileWithPoints.txt \n"
<< "interpolate curve using data from file \n"
<< "\n"
<< "interpol [3d/2d] [Natural/Clamped] [x y [z]] \n"
<< "interpolate dataset from input \n";
return 0;
}
if (n == 2) {
if (n == 2)
{
// Read points from axonometric viewer.
Standard_Integer id,XX,YY,b, i, j;
di << "Pick points \n";
dout.Select(id, XX, YY, b);
@@ -463,7 +474,7 @@ static Standard_Integer interpol (Draw_Interpretor& di,Standard_Integer n, const
gp_Pnt2d P2d;
Standard_Boolean newcurve;
if (dout.Is3D(id)) {
if (dout.Is3D(id)){
Handle(Draw_Marker3D) mark;
Handle(TColgp_HArray1OfPnt) Points = new TColgp_HArray1OfPnt(1, 1);
P.SetCoord((Standard_Real)XX/zoom,(Standard_Real)YY/zoom, 0.0);
@@ -584,51 +595,171 @@ static Standard_Integer interpol (Draw_Interpretor& di,Standard_Integer n, const
}
}
else if (n == 3) {
// lecture du fichier.
// nbpoints, 2d ou 3d, puis valeurs.
else if (n == 3)
{
// Read data set from file
const char* nomfic = a[2];
ifstream iFile(nomfic, ios::in);
if (!iFile) return 1;
Standard_Integer nbp, i;
if (!iFile)
return 1;
Standard_Integer nbp;
Standard_Real x, y, z;
iFile >> nbp;
char dimen[3];
iFile >> dimen;
if (!strcmp(dimen,"3d")) {
Handle(TColgp_HArray1OfPnt) Point =
new TColgp_HArray1OfPnt(1, nbp);
for (i = 1; i <= nbp; i++) {
std::string aBC; // boundary condition type.
iFile >> dimen >> aBC;
GeomInterpolate_BCType aBCType = GeomInterpolate_CLAMPED;
if (!aBC.compare("Natural"))
aBCType = GeomInterpolate_NATURAL;
else if (!aBC.compare("Clamped"))
aBCType = GeomInterpolate_CLAMPED;
else
{
di << "Incorrect boundary type, \n"
<< "supported boundary conditions are: \"Natural\" or \"Clamped\" \n";
return 1;
}
if (!strcmp(dimen,"3d"))
{
// 3D case.
Handle(TColgp_HArray1OfPnt) Point = new TColgp_HArray1OfPnt(1, nbp);
for (Standard_Integer i = 1; i <= nbp; i++)
{
iFile >> x >> y >> z;
Point->SetValue(i, gp_Pnt(x, y, z));
}
GeomAPI_Interpolate anInterpolator(Point,
Standard_False,
1.0e-5) ;
anInterpolator.Perform() ;
if (anInterpolator.IsDone()) {
Handle(Geom_BSplineCurve) C =
anInterpolator.Curve();
GeomAPI_Interpolate anInterpolator(Point, Standard_False, 1.0e-5, aBCType);
anInterpolator.Perform();
if (anInterpolator.IsDone())
{
Handle(Geom_BSplineCurve) C = anInterpolator.Curve();
DrawTrSurf::Set(a[1], C);
}
}
else if (!strcmp(dimen,"2d")) {
Handle(TColgp_HArray1OfPnt2d) PointPtr =
new TColgp_HArray1OfPnt2d(1, nbp);
for (i = 1; i <= nbp; i++) {
else if (!strcmp(dimen,"2d"))
{
// 2D case.
Handle(TColgp_HArray1OfPnt2d) PointPtr = new TColgp_HArray1OfPnt2d(1, nbp);
for (Standard_Integer i = 1; i <= nbp; i++)
{
iFile >> x >> y;
PointPtr->SetValue(i, gp_Pnt2d(x, y));
}
Geom2dAPI_Interpolate a2dInterpolator(PointPtr,
Standard_False,
1.0e-5);
a2dInterpolator.Perform() ;
if (a2dInterpolator.IsDone()) {
Handle(Geom2d_BSplineCurve) C = a2dInterpolator.Curve() ;
Geom2dAPI_Interpolate a2dInterpolator(PointPtr, Standard_False, 1.0e-5, aBCType);
a2dInterpolator.Perform();
if (a2dInterpolator.IsDone())
{
Handle(Geom2d_BSplineCurve) C = a2dInterpolator.Curve();
DrawTrSurf::Set(a[1], C);
}
}
else
{
di << "Incorrect dimension type, \n"
<< "supported dimensions are: \"3d\" or \"2d\" \n";
return 1;
}
}
else if (n > 4)
{
// Read points from draw command.
// a[0] - method name.
// a[1] - result curve.
// a[2] - 3d/2d.
// a[3] - Natural / Clamped.
// a[4...] - points.
std::string aDim(a[2]);
Standard_Integer aDimInt = 0;
if (!aDim.compare("3d"))
aDimInt = 3;
else if (!aDim.compare("2d"))
aDimInt = 2;
else
{
di << "Incorrect dimension type, \n"
<< "supported dimensions are: \"3d\" or \"2d\" \n";
return 1;
}
std::string aBC(a[3]);
GeomInterpolate_BCType aBCType = GeomInterpolate_CLAMPED;
if (!aBC.compare("Natural"))
aBCType = GeomInterpolate_NATURAL;
else if (!aBC.compare("Clamped"))
aBCType = GeomInterpolate_CLAMPED;
else
{
di << "Incorrect boundary type, \n"
<< "supported boundary conditions are: \"Natural\" or \"Clamped\" \n";
return 1;
}
// Check for dimension / consistence.
Standard_Integer aMod = (n - 4) % aDimInt;
if (aMod)
{
di << "Incorrect number of input points \n"
<< "Number of points should correspond to the dimension \n";
return 1;
}
// Perform interpolation.
Standard_Integer aPntNb = (n - 4) / aDimInt,
anIdx = 4;
Standard_Real aCoords[3];
if (aDimInt == 2)
{
// Read points.
Handle(TColgp_HArray1OfPnt2d) PointPtr = new TColgp_HArray1OfPnt2d(1, aPntNb);
for (Standard_Integer aPntIdx = 1; aPntIdx <= aPntNb; ++aPntIdx)
{
for (Standard_Integer aDimIdx = 1; aDimIdx <= aDimInt; ++aDimIdx)
aCoords[aDimIdx - 1] = Atof(a[anIdx++]);
PointPtr->SetValue(aPntIdx, gp_Pnt2d(aCoords[0], aCoords[1]));
}
// Compute result.
Geom2dAPI_Interpolate anInterpolator(PointPtr, Standard_False, 1.0e-5, aBCType);
anInterpolator.Perform();
if (anInterpolator.IsDone())
{
Handle(Geom2d_BSplineCurve) aC2D = anInterpolator.Curve();
DrawTrSurf::Set(a[1], aC2D);
}
} // if (aDimInt == 2)
else // 3d case
{
// Read points.
Handle(TColgp_HArray1OfPnt) PointPtr = new TColgp_HArray1OfPnt(1, aPntNb);
for (Standard_Integer aPntIdx = 1; aPntIdx <= aPntNb; ++aPntIdx)
{
for (Standard_Integer aDimIdx = 1; aDimIdx <= aDimInt; ++aDimIdx)
aCoords[aDimIdx - 1] = Atof(a[anIdx++]);
PointPtr->SetValue(aPntIdx, gp_Pnt(aCoords[0], aCoords[1], aCoords[2]));
}
// Compute result.
GeomAPI_Interpolate anInterpolator(PointPtr, Standard_False, 1.0e-5, aBCType);
anInterpolator.Perform();
if (anInterpolator.IsDone())
{
Handle(Geom_BSplineCurve) aC3D = anInterpolator.Curve();
DrawTrSurf::Set(a[1], aC3D);
}
} // else // 3d case
} // else if (n > 4)
return 0;
}
@@ -816,7 +947,7 @@ void GeometryTest::ConstraintCommands(Draw_Interpretor& theCommands)
theCommands.Add("interpol",
"interpol cname [fic]",
"run \"interpol\" without parameters for help",
__FILE__,
interpol, g);
theCommands.Add("tanginterpol",

View File

@@ -401,8 +401,6 @@ void GeomliteTest::API2dCommands(Draw_Interpretor& theCommands)
theCommands.Add("2dapprox", "2dapprox result nbpoint [curve] [[x] y [x] y...]",__FILE__,
appro,g);
theCommands.Add("2dinterpole", "2dinterpole result nbpoint [curve] [[x] y [x] y ...]",__FILE__,
appro,g);
g = "GEOMETRY curves and surfaces analysis";

View File

@@ -124,7 +124,8 @@ public:
Standard_EXPORT void Remove();
//! Computes axis-aligned bounding box of a structure.
Standard_EXPORT virtual void CalculateBoundBox();
//! Category: Methods to modify the class definition
Standard_EXPORT void CalculateBoundBox();
//! If <theToSet> is Standard_True then <me> is infinite and
//! the MinMaxValues method method return :

View File

@@ -149,7 +149,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
default:
{
IntPatch_PrmPrmIntersection interpp;
interpp.Perform(S1,D1,TolTang,TolArc,myFleche,myUVMaxStep);
interpp.Perform(S1,D1,TolArc,TolTang,myFleche,myUVMaxStep);
if (interpp.IsDone())
{
done = Standard_True;
@@ -1237,10 +1237,10 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
Standard_Boolean ClearFlag = Standard_True;
if(!ListOfPnts.IsEmpty())
{
interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep, ListOfPnts, RestrictLine);
interpp.Perform(theS1,theD1,theS2,theD2,TolArc,TolTang,myFleche,myUVMaxStep, ListOfPnts, RestrictLine);
ClearFlag = Standard_False;
}
interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep,ClearFlag); //double call!!!!!!!
interpp.Perform(theS1,theD1,theS2,theD2,TolArc,TolTang,myFleche,myUVMaxStep,ClearFlag); //double call!!!!!!!
}
else if((theD1->DomainIsInfinite()) ^ (theD2->DomainIsInfinite()))
{
@@ -1253,7 +1253,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
const Standard_Real AP = Max(MU, MV);
Handle(Adaptor3d_HSurface) SS;
FUN_TrimInfSurf(pMinXYZ, pMaxXYZ, theS1, AP, SS);
interpp.Perform(SS,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep);
interpp.Perform(SS,theD1,theS2,theD2,TolArc,TolTang,myFleche,myUVMaxStep);
}
else
{
@@ -1263,7 +1263,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
const Standard_Real AP = Max(MU, MV);
Handle(Adaptor3d_HSurface) SS;
FUN_TrimInfSurf(pMinXYZ, pMaxXYZ, theS2, AP, SS);
interpp.Perform(theS1, theD1, SS, theD2,TolTang, TolArc,myFleche,myUVMaxStep);
interpp.Perform(theS1, theD1, SS, theD2,TolArc,TolTang,myFleche,myUVMaxStep);
}
}//(theD1->DomainIsInfinite()) ^ (theD2->DomainIsInfinite())
else
@@ -1302,7 +1302,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
Handle(Adaptor3d_HSurface) nS1 = theS1;
Handle(Adaptor3d_HSurface) nS2 = theS2;
FUN_TrimBothSurf(theS1,typs1,theS2,typs2,1.e+8,nS1,nS2);
interpp.Perform(nS1,theD1,nS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep);
interpp.Perform(nS1,theD1,nS2,theD2,TolArc,TolTang,myFleche,myUVMaxStep);
}// 'NON - COLLINEAR LINES'
}// both domains are infinite
@@ -1652,7 +1652,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
else
{
IntPatch_PrmPrmIntersection interpp;
interpp.Perform(S1,D1,S2,D2,U1,V1,U2,V2,TolTang,TolArc,myFleche,myUVMaxStep);
interpp.Perform(S1,D1,S2,D2,U1,V1,U2,V2,TolArc,TolTang,myFleche,myUVMaxStep);
if (interpp.IsDone())
{
done = Standard_True;

View File

@@ -77,8 +77,6 @@ static void SeveralWlinesProcessing(const Handle(Adaptor3d_HSurface)& theSurf1,
const IntSurf_TypeTrans theTrans1,
const IntSurf_TypeTrans theTrans2,
const Standard_Real theTol,
const Standard_Real theMaxStepS1,
const Standard_Real theMaxStepS2,
Handle(IntPatch_WLine)& theWLline)
{
if(theSLin.Length() == 0)
@@ -86,6 +84,7 @@ static void SeveralWlinesProcessing(const Handle(Adaptor3d_HSurface)& theSurf1,
Standard_Real aU1 = 0.0, aV1 = 0.0, aU2 = 0.0, aV2 = 0.0;
const Standard_Real aTol2D = 1.e-4;
Standard_Integer cnbV = theWLline->NbVertex();
Standard_Integer ciV;
for( ciV = 1; ciV <= cnbV; ciV++ )
@@ -120,14 +119,11 @@ static void SeveralWlinesProcessing(const Handle(Adaptor3d_HSurface)& theSurf1,
Standard_Real vRs2 = theSurf2->Surface().VResolution(tDistance);
Standard_Real RmaxS1 = Max(uRs1,vRs1);
Standard_Real RmaxS2 = Max(uRs2,vRs2);
if(RmaxS1 < theMaxStepS1 && RmaxS2 < theMaxStepS2)
if((aPCS1.SquareDistance(aPTS1) < RmaxS1*RmaxS1) && (aPCS2.SquareDistance(aPTS2) < RmaxS2*RmaxS2))
{
if( pntDMin > tDistance && tDistance > Precision::PConfusion())
if(RmaxS1 < aTol2D && RmaxS2 < aTol2D)
{
const Standard_Real aSqDist1 = aPCS1.SquareDistance(aPTS1),
aSqDist2 = aPCS2.SquareDistance(aPTS2);
if((aSqDist1 < RmaxS1*RmaxS1) && (aSqDist2 < RmaxS2*RmaxS2))
if( pntDMin > tDistance && tDistance > 1.e-9)
{
pntDMin = tDistance;
VDMin = tiV;
@@ -1794,9 +1790,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
wline->AddVertex(vtx);
}
SeveralWlinesProcessing(Surf1, Surf2, SLin, Periods, trans1, trans2,
TolTang, Max(PW.MaxStep(0), PW.MaxStep(1)),
Max(PW.MaxStep(2), PW.MaxStep(3)), wline);
SeveralWlinesProcessing(Surf1, Surf2, SLin, Periods, trans1, trans2, TolTang, wline);
AddWLine(SLin, wline, Deflection);
empt = Standard_False;
@@ -2476,9 +2470,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
lignetrouvee = Standard_True;
SeveralWlinesProcessing(Surf1, Surf2, SLin, Periods, trans1, trans2,
TolTang, Max(PW.MaxStep(0), PW.MaxStep(1)),
Max(PW.MaxStep(2), PW.MaxStep(3)), wline);
SeveralWlinesProcessing(Surf1, Surf2, SLin, Periods, trans1, trans2, TolTang, wline);
AddWLine(SLin, wline, Deflection);
empt = Standard_False;

View File

@@ -34,63 +34,61 @@
#include <TColStd_Array1OfReal.hxx>
//==================================================================================
// function : ComputePasInit
// purpose : estimate of max step : To avoid abrupt changes during change of isos
// function : IntWalk_PWalking::IntWalk_PWalking
// purpose :
// estimate of max step : To avoid abrupt changes
// during change of isos
//==================================================================================
void IntWalk_PWalking::ComputePasInit(const Standard_Real theDeltaU1,
const Standard_Real theDeltaV1,
const Standard_Real theDeltaU2,
const Standard_Real theDeltaV2)
{
const Standard_Real aRangePart = 0.01;
const Standard_Real Increment = 2.0*pasMax;
const Handle(Adaptor3d_HSurface)&
Caro1 = myIntersectionOn2S.Function().AuxillarSurface1();
const Handle(Adaptor3d_HSurface)&
Caro2 = myIntersectionOn2S.Function().AuxillarSurface2();
void ComputePasInit(Standard_Real *pasuv,
Standard_Real Um1,Standard_Real UM1,
Standard_Real Vm1,Standard_Real VM1,
Standard_Real Um2,Standard_Real UM2,
Standard_Real Vm2,Standard_Real VM2,
Standard_Real _Um1,Standard_Real _UM1,
Standard_Real _Vm1,Standard_Real _VM1,
Standard_Real _Um2,Standard_Real _UM2,
Standard_Real _Vm2,Standard_Real _VM2,
const Handle(Adaptor3d_HSurface)& Caro1,
const Handle(Adaptor3d_HSurface)& Caro2,
const Standard_Real Increment,
const Standard_Real tolconf)
{
Standard_Real du1=Abs(UM1-Um1);
Standard_Real dv1=Abs(VM1-Vm1);
Standard_Real du2=Abs(UM2-Um2);
Standard_Real dv2=Abs(VM2-Vm2);
const Standard_Real aDeltaU1=Abs(UM1-Um1);
const Standard_Real aDeltaV1=Abs(VM1-Vm1);
const Standard_Real aDeltaU2=Abs(UM2-Um2);
const Standard_Real aDeltaV2=Abs(VM2-Vm2);
Standard_Real _du1=Abs(_UM1-_Um1);
Standard_Real _dv1=Abs(_VM1-_Vm1);
Standard_Real _du2=Abs(_UM2-_Um2);
Standard_Real _dv2=Abs(_VM2-_Vm2);
//-- limit the reduction of uv box estimate to 0.01 natural box
//-- theDeltaU1 : On box of Inter
//-- aDeltaU1 : On parametric space
if(!Precision::IsInfinite(aDeltaU1))
pasuv[0]=Max(Increment*Max(theDeltaU1, aRangePart*aDeltaU1), pasuv[0]);
else
pasuv[0]=Max(Increment*theDeltaU1, pasuv[0]);
//-- du1 : On box of Inter
//-- _du1 : On parametric space
if(_du1<1e50 && du1<0.01*_du1) du1=0.01*_du1;
if(_dv1<1e50 && dv1<0.01*_dv1) dv1=0.01*_dv1;
if(_du2<1e50 && du2<0.01*_du2) du2=0.01*_du2;
if(_dv2<1e50 && dv2<0.01*_dv2) dv2=0.01*_dv2;
if(!Precision::IsInfinite(aDeltaV1))
pasuv[1]=Max(Increment*Max(theDeltaV1, aRangePart*aDeltaV1), pasuv[1]);
else
pasuv[1]=Max(Increment*theDeltaV1, pasuv[1]);
pasuv[0]=Increment*du1;
pasuv[1]=Increment*dv1;
pasuv[2]=Increment*du2;
pasuv[3]=Increment*dv2;
if(!Precision::IsInfinite(aDeltaU2))
pasuv[2]=Max(Increment*Max(theDeltaU2, aRangePart*aDeltaU2), pasuv[2]);
else
pasuv[2]=Max(Increment*theDeltaU2, pasuv[2]);
Standard_Real ResoU1tol = Adaptor3d_HSurfaceTool::UResolution(Caro1, tolconf);
Standard_Real ResoV1tol = Adaptor3d_HSurfaceTool::VResolution(Caro1, tolconf);
Standard_Real ResoU2tol = Adaptor3d_HSurfaceTool::UResolution(Caro2, tolconf);
Standard_Real ResoV2tol = Adaptor3d_HSurfaceTool::VResolution(Caro2, tolconf);
if(!Precision::IsInfinite(aDeltaV2))
pasuv[3]=Max(Increment*Max(theDeltaV2, aRangePart*aDeltaV2), pasuv[3]);
else
pasuv[3]=Max(Increment*theDeltaV2, pasuv[3]);
const Standard_Real ResoU1tol = Adaptor3d_HSurfaceTool::UResolution(Caro1, tolconf);
const Standard_Real ResoV1tol = Adaptor3d_HSurfaceTool::VResolution(Caro1, tolconf);
const Standard_Real ResoU2tol = Adaptor3d_HSurfaceTool::UResolution(Caro2, tolconf);
const Standard_Real ResoV2tol = Adaptor3d_HSurfaceTool::VResolution(Caro2, tolconf);
myStepMin[0] = Max(myStepMin[0], 2.0*ResoU1tol);
myStepMin[1] = Max(myStepMin[1], 2.0*ResoV1tol);
myStepMin[2] = Max(myStepMin[2], 2.0*ResoU2tol);
myStepMin[3] = Max(myStepMin[3], 2.0*ResoV2tol);
for(Standard_Integer i = 0; i < 4; i++)
{
pasuv[i]=Max(myStepMin[i], pasuv[i]);
}
if (pasuv[0] < 2*ResoU1tol)
pasuv[0] = 2*ResoU1tol;
if (pasuv[1] < 2*ResoV1tol)
pasuv[1] = 2*ResoV1tol;
if (pasuv[2] < 2*ResoU2tol)
pasuv[2] = 2*ResoU2tol;
if (pasuv[3] < 2*ResoV2tol)
pasuv[3] = 2*ResoV2tol;
}
//=======================================================================
@@ -269,7 +267,6 @@ done(Standard_True),
close(Standard_False),
fleche(Deflection),
tolconf(Epsilon),
myTolTang(TolTangency),
sensCheminement(1),
myIntersectionOn2S(Caro1,Caro2,TolTangency),
STATIC_BLOCAGE_SUR_PAS_TROP_GRAND(0),
@@ -380,11 +377,6 @@ STATIC_PRECEDENT_INFLEXION(0)
}
}
myStepMin[0] = 100.0*ResoU1;
myStepMin[1] = 100.0*ResoV1;
myStepMin[2] = 100.0*ResoU2;
myStepMin[3] = 100.0*ResoV2;
//-- ComputePasInit(pasuv,Um1,UM1,Vm1,VM1,Um2,UM2,Vm2,VM2,Caro1,Caro2);
for (Standard_Integer i = 0; i<=3;i++) {
@@ -415,7 +407,6 @@ done(Standard_True),
close(Standard_False),
fleche(Deflection),
tolconf(Epsilon),
myTolTang(TolTangency),
sensCheminement(1),
myIntersectionOn2S(Caro1,Caro2,TolTangency),
STATIC_BLOCAGE_SUR_PAS_TROP_GRAND(0),
@@ -552,12 +543,6 @@ STATIC_PRECEDENT_INFLEXION(0)
if(ResoV1>0.0001*pasuv[1]) ResoV1=0.00001*pasuv[1];
if(ResoU2>0.0001*pasuv[2]) ResoU2=0.00001*pasuv[2];
if(ResoV2>0.0001*pasuv[3]) ResoV2=0.00001*pasuv[3];
myStepMin[0] = 100.0*ResoU1;
myStepMin[1] = 100.0*ResoV1;
myStepMin[2] = 100.0*ResoU2;
myStepMin[3] = 100.0*ResoV2;
//
TColStd_Array1OfReal Par(1,4);
Par(1) = U1;
@@ -637,7 +622,6 @@ static Standard_Boolean IsTangentExtCheck(const Handle(Adaptor3d_HSurface)& theS
const Standard_Real theV10,
const Standard_Real theU20,
const Standard_Real theV20,
const Standard_Real theToler,
const Standard_Real theArrStep[])
{
{
@@ -661,8 +645,7 @@ static Standard_Boolean IsTangentExtCheck(const Handle(Adaptor3d_HSurface)& theS
}
}
//For two faces (2^2 = 4)
const Standard_Real aSQToler = 4.0*theToler*theToler;
const Standard_Real aSQToler = 4.0e-14;
const Standard_Integer aNbItems = 4;
const Standard_Real aParUS1[aNbItems] = { theU10 + theArrStep[0],
theU10 - theArrStep[0],
@@ -734,8 +717,22 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
const Standard_Real ULast2 = Adaptor3d_HSurfaceTool::LastUParameter (Caro2);
const Standard_Real VLast2 = Adaptor3d_HSurfaceTool::LastVParameter (Caro2);
//
ComputePasInit(u1max - u1min,v1max - v1min,u2max - u2min,v2max - v2min);
ComputePasInit(pasuv,u1min,u1max,v1min,v1max,u2min,u2max,v2min,v2max,
Um1,UM1,Vm1,VM1,Um2,UM2,Vm2,VM2,Caro1,Caro2,pasMax+pasMax,tolconf);
//
if(pasuv[0]<100.0*ResoU1) {
pasuv[0]=100.0*ResoU1;
}
if(pasuv[1]<100.0*ResoV1) {
pasuv[1]=100.0*ResoV1;
}
if(pasuv[2]<100.0*ResoU2) {
pasuv[2]=100.0*ResoU2;
}
if(pasuv[3]<100.0*ResoV2) {
pasuv[3]=100.0*ResoV2;
}
//
for (Standard_Integer i=0; i<4; ++i)
{
if(pasuv[i]>10)
@@ -809,7 +806,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
previousPoint.Parameters(Param(1),Param(2),Param(3),Param(4));
if(IsTangentExtCheck(Caro1, Caro2, Param(1), Param(2), Param(3), Param(4), myTolTang, pasuv))
if(IsTangentExtCheck(Caro1, Caro2, Param(1), Param(2), Param(3), Param(4), pasuv))
return;
AddAPoint(line,previousPoint);
@@ -1168,13 +1165,28 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
{
pastroppetit=Standard_True;
for(Standard_Integer i = 0; i < 4; i++)
if(pasuv[0]<pasInit[0])
{
if(pasuv[i]<pasInit[i])
{
pasuv[i]+=(pasInit[i]-pasuv[i])*0.25;
pastroppetit=Standard_False;
}
pasuv[0]+=(pasInit[0]-pasuv[0])*0.25;
pastroppetit=Standard_False;
}
if(pasuv[1]<pasInit[1])
{
pasuv[1]+=(pasInit[1]-pasuv[1])*0.25;
pastroppetit=Standard_False;
}
if(pasuv[2]<pasInit[2])
{
pasuv[2]+=(pasInit[2]-pasuv[2])*0.25;
pastroppetit=Standard_False;
}
if(pasuv[3]<pasInit[3])
{
pasuv[3]+=(pasInit[3]-pasuv[3])*0.25;
pastroppetit=Standard_False;
}
if(pastroppetit)
@@ -1198,32 +1210,6 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
break;
}
case IntWalk_StepTooSmall:
{
Standard_Boolean hasStepBeenIncreased = Standard_False;
for(Standard_Integer i = 0; i < 4; i++)
{
const Standard_Real aNewStep = Min(1.5*pasuv[i], pasInit[i]);
if(aNewStep > pasuv[i])
{
pasuv[i] = aNewStep;
hasStepBeenIncreased = Standard_True;
}
}
if(hasStepBeenIncreased)
{
Param(1)=SvParam[0];
Param(2)=SvParam[1];
Param(3)=SvParam[2];
Param(4)=SvParam[3];
LevelOfIterWithoutAppend = 0;
break;
}
}
case IntWalk_OK:
case IntWalk_ArretSurPoint://006
{
@@ -1312,7 +1298,6 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
if(RejectIndex >= RejectIndexMAX)
{
Arrive = Standard_True;
break;
}
@@ -1400,7 +1385,6 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
if(RejectIndex >= RejectIndexMAX)
{
Arrive = Standard_True;
break;
}
@@ -1634,7 +1618,6 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
if(RejectIndex >= RejectIndexMAX)
{
Arrive = Standard_True;
break;
}
@@ -2820,7 +2803,7 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection(const IntImp_ConstIso
}
IntWalk_StatusDeflection Status = IntWalk_OK;
Standard_Real FlecheCourante , Ratio = 1.0;
Standard_Real FlecheCourante ,Ratio;
// Caro1 and Caro2
const Handle(Adaptor3d_HSurface)& Caro1 = myIntersectionOn2S.Function().AuxillarSurface1();
@@ -2836,12 +2819,10 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection(const IntImp_ConstIso
const gp_Dir& TgCourante = myIntersectionOn2S.Direction();
const Standard_Real aCosBetweenTangent = TgCourante.Dot(previousd);
//==================================================================================
//========= R i s k o f i n f l e x i o n p o i n t ============
//==================================================================================
if (aCosBetweenTangent < 0) {
if (TgCourante.Dot(previousd)<0) {
//------------------------------------------------------------
//-- Risk of inflexion point : Divide the step by 2
//-- Initialize STATIC_PRECEDENT_INFLEXION so that
@@ -2859,6 +2840,7 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection(const IntImp_ConstIso
else
return IntWalk_PasTropGrand;
}
else {
if(STATIC_PRECEDENT_INFLEXION > 0) {
STATIC_PRECEDENT_INFLEXION -- ;
@@ -2870,20 +2852,15 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection(const IntImp_ConstIso
//========= D e t e c t c o n f u s e d P o in t s ===========
//==================================================================================
const Standard_Real aSqDist = previousPoint.Value().
Standard_Real Dist = previousPoint.Value().
SquareDistance(CurrentPoint.Value());
if (aSqDist < tolconf*tolconf) {
pasInit[0] = Max(pasInit[0], 5.0*ResoU1);
pasInit[1] = Max(pasInit[1], 5.0*ResoV1);
pasInit[2] = Max(pasInit[2], 5.0*ResoU2);
pasInit[3] = Max(pasInit[3], 5.0*ResoV2);
for(Standard_Integer i = 0; i < 4; i++)
{
pasuv[i] = Max(pasuv[i], Min(1.5*pasuv[i], pasInit[i]));
}
if (Dist < tolconf*tolconf ) {
pasuv[0] = Max(5.*ResoU1,Min(1.5*pasuv[0],pasInit[0]));
pasuv[1] = Max(5.*ResoV1,Min(1.5*pasuv[1],pasInit[1]));
pasuv[2] = Max(5.*ResoU2,Min(1.5*pasuv[2],pasInit[2]));
pasuv[3] = Max(5.*ResoV2,Min(1.5*pasuv[3],pasInit[3]));
//Compute local resolution: for OCC26717
if (Abs(pasuv[choixIso] - pasInit[choixIso]) <= Precision::Confusion())
{
@@ -3052,7 +3029,7 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection(const IntImp_ConstIso
//-- Estimate of the vector --
//---------------------------------------
FlecheCourante =
Sqrt(Abs((previousd.XYZ()-TgCourante.XYZ()).SquareModulus()*aSqDist))/8.;
Sqrt(Abs((previousd.XYZ()-TgCourante.XYZ()).SquareModulus()*Dist))/8.;
if ( FlecheCourante<= fleche*0.5) { //-- Current step too small
if(FlecheCourante>1e-16) {
@@ -3119,114 +3096,10 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection(const IntImp_ConstIso
Ratio = 0.75 * (fleche / FlecheCourante);
}
}
if(Status != IntWalk_PointConfondu)
{
//Here, aCosBetweenTangent >= 0.0 definitely.
/*
Brief algorithm description.
We have two (not-coincindent) intersection point (P1 and P2). In every point,
vector of tangent (to the intersection curve) is known (vectors T1 and T2).
Basing on these data, we create osculating circle.
* - arc of osculating circle
* *
P1 x----------x P2
/ \
/ \
Vec(T1) Vec(T2)
Let me draw your attention to the following facts:
1. Vectors T1 and T2 direct FROM (not TO) points P1 and P2. Therefore,
one of previously computed vector should be reversed.
In this case, the absolute (!) value of the deflection between the arc of
the osculating circle and the P1P2 segment can be computed as follows:
e = d*(1-sin(B/2))/(2*cos(B/2)), (1)
where d is the length of P1P2 segment, B is the angle between vectors T1 and T2.
At that,
pi/2 <= B <= pi,
cos(B/2) >= 0,
sin(B/2) > 0,
sin(B) > 0,
cos(B) < 0.
Later, the normal state of algorithm work is (as we apply)
tolconf/2 <= e <= tolconf.
In this case, we keep previous step.
If e < tolconf/2 then the local curvature of the intersection curve is small.
As result, the step should be increased.
If e > tolconf then the step is too big. Therefore, we should decrease one.
Condition (1) is equivalent to
sin(B/2) = 1 - 2/(1+(d/(2*e))^2) = Fs(e),
cos(B) = 1 - 2*Fs(e)^2 = Fd(e),
where Fs(e)and Fd(e) are some function with parameter "deflection".
Let mean that Fs(e) is decreasing function. Fd(e) is increasing function,
in the range, where Fs(e) > 0.0 (i.e. when e < d/2).
Now, let substitute required deflection (tolconf or tolconf/2) to z. Then
it is necessary to check if e < z or if e > z.
In this case, it is enough to comapare Fs(e) and Fs(z).
At that Fs(e) > 0 because sin(B/2) > 0 always.
Therefore, if Fs(z) < 0.0 then Fs(e) > Fs(z) ==> e < z definitely.
If Fs(z) > 0.0 then we can compare Fs(z)^2 and Fs(e)^2 or, in substance,
values Fd(e) and Fd(z). If Fd(e) > Fd(z) then e > z and vice versa.
*/
//Fd(e) is already known (Fd(e) == -aCosBetweenTangent)
const Standard_Real anInvSqAbsArcDeflMax = 0.25*aSqDist/(tolconf*tolconf);
const Standard_Real aSinB2Max = 1.0 - 2.0/(1.0 + anInvSqAbsArcDeflMax);
if(aSinB2Max >= 0.0 && (aCosBetweenTangent <= 2.0 * aSinB2Max * aSinB2Max - 1.0))
{//Real deflection is greater or equal than tolconf
Status = IntWalk_PasTropGrand;
}
else
{//Real deflection is less than tolconf
const Standard_Real anInvSqAbsArcDeflMin = 4.0*anInvSqAbsArcDeflMax;
const Standard_Real aSinB2Min = 1.0 - 2.0/(1.0 + anInvSqAbsArcDeflMin);
if((aSinB2Min < 0.0) || (aCosBetweenTangent >= 2.0 * aSinB2Min * aSinB2Min - 1.0))
{//Real deflection is less than tolconf/2.0
Status = IntWalk_StepTooSmall;
}
}
if(Status == IntWalk_PasTropGrand)
{
pasuv[0]*=0.5; pasuv[1]*=0.5; pasuv[2]*=0.5; pasuv[3]*=0.5;
return Status;
}
if(Status == IntWalk_StepTooSmall)
{
pasuv[0] = Max(pasuv[0], AbsDu1);
pasuv[1] = Max(pasuv[1], AbsDv1);
pasuv[2] = Max(pasuv[2], AbsDu2);
pasuv[3] = Max(pasuv[3], AbsDv2);
pasInit[0] = Max(pasInit[0], AbsDu1);
pasInit[1] = Max(pasInit[1], AbsDv1);
pasInit[2] = Max(pasInit[2], AbsDu2);
pasInit[3] = Max(pasInit[3], AbsDv2);
return Status;
}
}
pasuv[0] = Max(myStepMin[0],Min(Min(Ratio*AbsDu1,pasuv[0]),pasInit[0]));
pasuv[1] = Max(myStepMin[1],Min(Min(Ratio*AbsDv1,pasuv[1]),pasInit[1]));
pasuv[2] = Max(myStepMin[2],Min(Min(Ratio*AbsDu2,pasuv[2]),pasInit[2]));
pasuv[3] = Max(myStepMin[3],Min(Min(Ratio*AbsDv2,pasuv[3]),pasInit[3]));
pasuv[0] = Max(5.*ResoU1,Min(Min(Ratio*AbsDu1,pasuv[0]),pasInit[0]));
pasuv[1] = Max(5.*ResoV1,Min(Min(Ratio*AbsDv1,pasuv[1]),pasInit[1]));
pasuv[2] = Max(5.*ResoU2,Min(Min(Ratio*AbsDu2,pasuv[2]),pasInit[2]));
pasuv[3] = Max(5.*ResoV2,Min(Min(Ratio*AbsDv2,pasuv[3]),pasInit[3]));
if(Status == IntWalk_OK) STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0;
return Status;
}

View File

@@ -138,19 +138,10 @@ public:
Standard_EXPORT Standard_Boolean SeekAdditionalPoints (const Handle(Adaptor3d_HSurface)& theASurf1, const Handle(Adaptor3d_HSurface)& theASurf2, const Standard_Integer theMinNbPoints);
Standard_Real MaxStep(Standard_Integer theIndex)
{
Standard_OutOfRange_Raise_if((theIndex < 0) || (theIndex > 3), "");
return pasInit[theIndex];
}
protected:
Standard_EXPORT void ComputePasInit(const Standard_Real theDeltaU1,
const Standard_Real theDeltaV1,
const Standard_Real theDeltaU2,
const Standard_Real theDeltaV2);
@@ -178,9 +169,7 @@ private:
Standard_Real fleche;
Standard_Real pasMax;
Standard_Real tolconf;
Standard_Real myTolTang;
Standard_Real pasuv[4];
Standard_Real myStepMin[4];
Standard_Real pasSav[4];
Standard_Real pasInit[4];
Standard_Real Um1;

View File

@@ -21,7 +21,6 @@
enum IntWalk_StatusDeflection
{
IntWalk_PasTropGrand,
IntWalk_StepTooSmall,
IntWalk_PointConfondu,
IntWalk_ArretSurPointPrecedent,
IntWalk_ArretSurPoint,

View File

@@ -33,7 +33,6 @@ OpenGl_StructureShadow::OpenGl_StructureShadow (const Handle(Graphic3d_Structure
ContainsFacet = myParent->ContainsFacet;
IsInfinite = myParent->IsInfinite;
Transformation = myParent->Transformation;
myBndBox = myParent->BoundingBox();
UpdateTransformation();
myInstancedStructure = const_cast<OpenGl_Structure*> (myParent->InstancedStructure());

View File

@@ -30,12 +30,3 @@ Prs3d_PresentationShadow::Prs3d_PresentationShadow (const Handle(Graphic3d_Struc
{
//
}
//=======================================================================
//function : CalculateBoundBox
//purpose :
//=======================================================================
void Prs3d_PresentationShadow::CalculateBoundBox()
{
//
}

View File

@@ -34,9 +34,6 @@ public:
//! Returns view affinity of the parent presentation
Standard_EXPORT inline const Handle(Graphic3d_ViewAffinity)& ParentAffinity() const { return myParentAffinity; }
//! Do nothing - axis-aligned bounding box should be initialized from parent structure.
Standard_EXPORT virtual void CalculateBoundBox() Standard_OVERRIDE;
private:
DEFINE_STANDARD_RTTIEXT(Prs3d_PresentationShadow,Prs3d_Presentation)

View File

@@ -5051,95 +5051,6 @@ static Standard_Integer OCC27048(Draw_Interpretor& theDI, Standard_Integer theAr
return 0;
}
//========================================================================
//function : OCC27065
//purpose : Tests overloaded method "Generated" of BRepOffsetAPI_MakePipe
//========================================================================
static Standard_Integer OCC27065(Draw_Interpretor& di,
Standard_Integer n, const char** a)
{
if (n < 3) return 1;
BRep_Builder BB;
TopoDS_Shape SpineShape = DBRep::Get(a[1],TopAbs_WIRE);
if ( SpineShape.IsNull()) return 1;
TopoDS_Wire Spine = TopoDS::Wire(SpineShape);
TopoDS_Shape Profile = DBRep::Get(a[2]);
if ( Profile.IsNull()) return 1;
BRepOffsetAPI_MakePipe aPipeBuilder(Spine, Profile);
if (!aPipeBuilder.IsDone())
{
di << "Error: failed to create pipe\n";
return 1;
}
TopExp_Explorer Explo(Profile, TopAbs_SHELL);
TopoDS_Shape aShape;
TopTools_ListIteratorOfListOfShape itl;
if (Explo.More())
{
aShape = Explo.Current();
TopoDS_Compound res1;
BB.MakeCompound(res1);
itl.Initialize(aPipeBuilder.Generated(aShape));
for (; itl.More(); itl.Next())
BB.Add(res1, itl.Value());
DBRep::Set("res_shell", res1);
}
Explo.Init(Profile, TopAbs_FACE);
if (Explo.More())
{
aShape = Explo.Current();
TopoDS_Compound res2;
BB.MakeCompound(res2);
itl.Initialize(aPipeBuilder.Generated(aShape));
for (; itl.More(); itl.Next())
BB.Add(res2, itl.Value());
DBRep::Set("res_face", res2);
}
Explo.Init(Profile, TopAbs_WIRE);
if (Explo.More())
{
aShape = Explo.Current();
TopoDS_Compound res3;
BB.MakeCompound(res3);
itl.Initialize(aPipeBuilder.Generated(aShape));
for (; itl.More(); itl.Next())
BB.Add(res3, itl.Value());
DBRep::Set("res_wire", res3);
}
Explo.Init(Profile, TopAbs_EDGE);
if (Explo.More())
{
aShape = Explo.Current();
TopoDS_Compound res4;
BB.MakeCompound(res4);
itl.Initialize(aPipeBuilder.Generated(aShape));
for (; itl.More(); itl.Next())
BB.Add(res4, itl.Value());
DBRep::Set("res_edge", res4);
}
Explo.Init(Profile, TopAbs_VERTEX);
if (Explo.More())
{
aShape = Explo.Current();
TopoDS_Compound res5;
BB.MakeCompound(res5);
itl.Initialize(aPipeBuilder.Generated(aShape));
for (; itl.More(); itl.Next())
BB.Add(res5, itl.Value());
DBRep::Set("res_vertex", res5);
}
return 0;
}
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
@@ -5250,9 +5161,5 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
"OCC27048 surf U V N\nCalculate value of surface N times in the point (U, V)",
__FILE__, OCC27048, group);
theCommands.Add ("OCC27065",
"OCC27065 spine profile",
__FILE__, OCC27065, group);
return;
}

View File

@@ -137,10 +137,7 @@ const NCollection_Handle<BVH_Tree<Standard_Real, 3> >&
if (anObject->TransformPersistence().Flags && !(anObject->TransformPersistence().Flags & Graphic3d_TMF_2d))
{
anObject->BoundingBox (aBoundingBox);
if (!aBoundingBox.IsVoid())
{
anObject->TransformPersistence().Apply (theProjectionMatrix, theWorldViewMatrix, 0, 0, aBoundingBox);
}
anObject->TransformPersistence().Apply (theProjectionMatrix, theWorldViewMatrix, 0, 0, aBoundingBox);
}
if (aBoundingBox.IsVoid())

View File

@@ -2190,31 +2190,21 @@ void V3d_View::Gravity (Standard_Real& theX,
{
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
if (!aStruct->IsVisible()
|| aStruct->IsInfinite()
|| (hasSelection && !aStruct->IsHighlighted()))
|| (hasSelection && !aStruct->IsHighlighted())
|| aStruct->IsEmpty())
{
continue;
}
const Graphic3d_BndBox4f& aBox = aStruct->CStructure()->BoundingBox();
if (!aBox.IsValid())
{
continue;
}
// skip transformation-persistent objects
if (aStruct->TransformPersistence().Flags != Graphic3d_TMF_None)
Bnd_Box aBox = aStruct->MinMaxValues();
if (aBox.IsVoid() || aStruct->IsInfinite())
{
continue;
}
// use camera projection to find gravity point
Xmin = (Standard_Real )aBox.CornerMin().x();
Ymin = (Standard_Real )aBox.CornerMin().y();
Zmin = (Standard_Real )aBox.CornerMin().z();
Xmax = (Standard_Real )aBox.CornerMax().x();
Ymax = (Standard_Real )aBox.CornerMax().y();
Zmax = (Standard_Real )aBox.CornerMax().z();
aBox.Get (Xmin, Ymin, Zmin,
Xmax, Ymax, Zmax);
gp_Pnt aPnts[THE_NB_BOUND_POINTS] =
{
gp_Pnt (Xmin, Ymin, Zmin), gp_Pnt (Xmin, Ymin, Zmax),
@@ -2238,10 +2228,21 @@ void V3d_View::Gravity (Standard_Real& theX,
if (aNbPoints == 0)
{
// fallback - just use bounding box of entire scene
Bnd_Box aBox = myView->MinMaxValues (Standard_True);
if (!aBox.IsVoid())
for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (aSetOfStructures);
aStructIter.More(); aStructIter.Next())
{
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
if (aStruct->IsEmpty())
{
continue;
}
Bnd_Box aBox = aStruct->MinMaxValues();
if (aBox.IsVoid() || aStruct->IsInfinite())
{
continue;
}
aBox.Get (Xmin, Ymin, Zmin,
Xmax, Ymax, Zmax);
gp_Pnt aPnts[THE_NB_BOUND_POINTS] =

View File

@@ -184,10 +184,7 @@ void XmlMFunction_GraphNodeDriver::Paste (const Handle(TDF_Attribute)& theSource
aValueStr += TCollection_AsciiString(ID);
aValueStr += ' ';
}
// add more spaces between "previous" and "next" ids to make them easily
// recognizable for human
aValueStr += " ";
aValueStr += "\n";
// Next
// ====

View File

@@ -4,6 +4,8 @@
## Comment : From CV tests serie page 25/26
## ===========================================
puts "TODO #OCC26740 ALL: Faulty shapes in variables faulty_1 to faulty_"
restore [locate_data_file CCV_1_h1_gsk.rle] s
explode s E
blend result s 30 s_14

View File

@@ -8,6 +8,18 @@ set BugNumber OCC15489
# Constructor gp_Lin2d(A, B, C) creates line with origin point in infinity
######################################################
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
pload QAcommands
set A 1e-20
@@ -18,8 +30,33 @@ set OriginList [OCC15489 $A $B $C]
regexp {X_0 += +([-0-9.+eE]+)} $OriginList full X_0
regexp {Y_0 += +([-0-9.+eE]+)} $OriginList full Y_0
set percent_max 0.1
set good_X_0 -1.9999999999999999e-20
set good_Y_0 2
set status 0
checkreal "X_0" ${X_0} ${good_X_0} 0 0.001
checkreal "Y_0" ${Y_0} ${good_Y_0} 0 0.001
set X_0_percent [GetPercent ${X_0} ${good_X_0}]
puts "X_0_percent = ${X_0_percent}"
if { ${X_0_percent} > ${percent_max} } {
puts "X_0: Faulty ${BugNumber}"
set status 1
} else {
puts "X_0: OK ${BugNumber}"
}
set Y_0_percent [GetPercent ${Y_0} ${good_Y_0}]
puts "Y_0_percent = ${Y_0_percent}"
if { ${Y_0_percent} > ${percent_max} } {
puts "Y_0: Faulty ${BugNumber}"
set status 1
} else {
puts "Y_0: OK ${BugNumber}"
}
# Resume
puts ""
if { ${status} != 0 } {
puts "Faulty ${BugNumber}"
} else {
puts "OK ${BugNumber}"
}

View File

@@ -1,44 +0,0 @@
puts "========"
puts "OCC27119"
puts "========"
puts ""
###########################################
## Regression: Draw command "incmesh" hangs on the attacheced face.
###########################################
set BugNumber OCC27119
restore [locate_data_file bug27119_GrossPlatePart3Step2TransformedFace.brep] result
dchrono t reset
dchrono t start
incmesh result 1.e-6
dchrono t stop
set time [dchrono t show]
regexp {CPU user time: ([0-9|.]+) seconds} $time full seconds
set tri 0
set nod 0
set def 0
set tri_info [trinfo result]
regexp { +([-0-9.+eE]+) +triangles} $tri_info full tri
regexp { +([-0-9.+eE]+) +nodes} $tri_info full nod
regexp { deflection +([-0-9.+eE]+)} $tri_info full def
set ref_tri 7855
set ref_nod 7857
set ref_def 9.3791641120333225e-013
set tol_rel 0.01
# Computes deviation of the value from specified one
checkreal "Nb of triangles" $tri $ref_tri 0 $tol_rel
checkreal "Nb of nodes" $nod $ref_nod 0 $tol_rel
checkreal "Deflection" $def $ref_def 1.e-12 0
set eps_time 3
if { $seconds > $eps_time } {
puts "Error: Too slow ($seconds > $eps_time)"
}
set 3dviewer 1

View File

@@ -6,6 +6,18 @@ puts ""
# Wrong calculation of bnd box for edge if edge has polygon of triangulation
#######################################################################################
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
set BugNumber OCC12661
restore [locate_data_file OCC12661.brep] result
@@ -18,12 +30,53 @@ set x2 [lindex ${res} 3]
set y2 [lindex ${res} 4]
set z2 [lindex ${res} 5]
checkreal "x1" ${x1} -6.3659273065258741 0 0.001
checkreal "y1" ${y1} 0.7051405053395956 0 0.001
checkreal "z1" ${z1} -2.5792617865186296 0 0.001
checkreal "x2" ${x2} 6.3659273065258795 0 0.001
checkreal "y2" ${y2} 7.6599592236605769 0 0.001
checkreal "z2" ${z2} 3.0815250146676485 0 0.001
set good_x1 -6.3659273065258741
set good_y1 0.7051405053395956
set good_z1 -2.5792617865186296
set good_x2 6.3659273065258795
set good_y2 7.6599592236605769
set good_z2 3.0815250146676485
set percent_max 0.1
set status 0
set x1_percent [GetPercent ${x1} ${good_x1}]
set y1_percent [GetPercent ${y1} ${good_y1}]
set z1_percent [GetPercent ${z1} ${good_z1}]
set x2_percent [GetPercent ${x2} ${good_x2}]
set y2_percent [GetPercent ${y2} ${good_y2}]
set z2_percent [GetPercent ${z2} ${good_z2}]
if {${x1_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : x1 is wrong"
set status 1
}
if {${y1_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : y1 is wrong"
set status 1
}
if {${z1_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : z1 is wrong"
set status 1
}
if {${x2_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : x2 is wrong"
set status 1
}
if {${y2_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : y2 is wrong"
set status 1
}
if {${z2_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : z2 is wrong"
set status 1
}
if { ${status} == 0 } {
puts "${BugNumber}: OK"
} else {
puts "${BugNumber}: Faulty"
}
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -21,12 +21,38 @@ regexp {FACE[ \t]*: MAX=([-0-9.+eE]+)} $ToleranceList full FaceTolerance
regexp {EDGE[ \t]*: MAX=([-0-9.+eE]+)} $ToleranceList full EdgeTolerance
regexp {VERTEX[ \t]*: MAX=([-0-9.+eE]+)} $ToleranceList full VertexTolerance
set percent_max 0.1
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
set IsOk 1
set minTolerance ${EdgeTolerance}
if { ${minTolerance} > ${VertexTolerance} } {
set minTolerance $(VertexTolerance)
}
checkreal "Min tolerance" ${minTolerance} ${oTolerance} 0 0.001
set minTolerance_percent [GetPercent ${minTolerance} ${oTolerance}]
puts "minTolerance_percent = ${minTolerance_percent} %"
if { ${minTolerance_percent} > ${percent_max} } {
set IsOk 0
}
if { ${IsOk} == 0 } {
puts "${BugNumber}: Faulty"
} else {
puts "${BugNumber}: OK"
}
checkmaxtol result -ref 2279.641703013865
checknbshapes result -shell 1
checkfreebounds result 5

View File

@@ -1,5 +1,4 @@
puts "TODO OCC25597 ALL: Error: Vertex tolerance"
puts "TODO OCC25597 ALL: Error: Edge tolerance"
puts "TODO OCC25597 ALL: OCC22967: Faulty"
puts "============"
puts "OCC22967"
puts "============"
@@ -9,6 +8,7 @@ puts ""
###########################################################################################################
set BugNumber OCC22967
set check_value 8.46459e-006
restore [locate_data_file bug22967_Cylinder_1.brep] b1
restore [locate_data_file bug22967_Scale_1.brep] b2
@@ -19,10 +19,42 @@ set info [ maxtolerance result ]
regexp {Edge[ \t]*:.*Max[ \t]*([-0-9.+eE]+)} $info full last1
regexp {Vertex[ \t]*:.*Max[ \t]*([-0-9.+eE]+)} $info full last
set check_value 8.46459e-006
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
set percent_max 5
set status 0
set Tolerance_percent [expr abs ( [GetPercent ${last} ${check_value}] ) ]
if {${Tolerance_percent} > ${percent_max}} {
set status 1
} else {
set status 0
}
set Tolerance_percent [expr abs ( [GetPercent ${last1} ${check_value}] ) ]
if {${Tolerance_percent} > ${percent_max}} {
set status 1
} else {
set status 0
}
# Resume
if {${status} > 0} {
puts "${BugNumber}: Faulty"
} else {
puts "OK ${BugNumber}"
}
checkreal "Vertex tolerance" ${last} ${check_value} 0 0.05
checkreal "Edge tolerance" ${last1} ${check_value} 0 0.05
checkprops result -s 668843
checkshape result
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,4 +1,4 @@
puts "TODO OCC25597 ALL: Error: Reached tolerance"
puts "TODO OCC25597 ALL: OCC23218: Faulty"
puts "============"
puts "OCC23218"
puts "============"
@@ -23,4 +23,24 @@ puts "Finish project operation ..."
set GoodToleranceReached 6.3315853638232248e-007
regexp {Tolerance Reached=([-0-9.+eE]+)} $result full ToleranceReached
checkreal "Reached tolerance" ${ToleranceReached} ${GoodToleranceReached} 0 0.001
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
set percent_max 0.1
set ToleranceReached_percent [expr abs ( [GetPercent ${ToleranceReached} ${GoodToleranceReached}] ) ]
if {${ToleranceReached_percent} > ${percent_max}} {
puts "${BugNumber}: Faulty"
} else {
puts "OK ${BugNumber}"
}

View File

@@ -1,24 +0,0 @@
puts "============"
puts "OCC24103"
puts "============"
puts ""
######################################################
# Infinite loop in HLR algorithm on the customer's shape
######################################################
pload XDE
smallview
right
stepread [locate_data_file bug24100_REFLECT_CURVE_PART_5_SOL_ohne_Metadaten.stp] a *
explode a_1
donly a_1_1
fit
reflectlines result a_1_1 1 0 0
set length 4217.78
set only_screen_axo 1

View File

@@ -1,24 +0,0 @@
puts "============"
puts "OCC24103"
puts "============"
puts ""
######################################################
# Infinite loop in HLR algorithm on the customer's shape
######################################################
pload XDE
smallview
top
stepread [locate_data_file bug24100_REFLECT_CURVE_PART_5_SOL_ohne_Metadaten.stp] a *
explode a_1
donly a_1_1
fit
reflectlines result a_1_1 0 0 1
set length 6385.96
set only_screen_axo 1

View File

@@ -6,7 +6,7 @@ puts ""
# Wrong pcurve of the section curve
###########################################################
set ExpectedTol 5.6061116035240048e-005
set MaxTol 3.0e-5
set NbCurv_OK 1
restore [locate_data_file bug24585_b1.brep] b1
@@ -23,9 +23,9 @@ if {${NbCurv} != ${NbCurv_OK}} {
puts "Error: ${NbCurv_OK} curve(s) expected, but ${NbCurv} found."
}
set tol_abs 0.0
set tol_rel 0.01
checkreal "Tolerance Reached" ${Toler} ${ExpectedTol} ${tol_abs} ${tol_rel}
if {${Toler} > ${MaxTol}} {
puts "Error: Tolerance is too big!"
}
bounds c2d1_1 U1 U2
2dcvalue c2d1_1 U1 U_begin V_begin

View File

@@ -1,6 +1,3 @@
puts "TODO OCC27116 ALL: Error: Summary length ="
puts "TODO OCC27116 ALL: Error: 1 intersection curve\\(s\\) expected but"
puts "================"
puts "OCC25193"
puts "================"
@@ -9,97 +6,18 @@ puts ""
# Bad Intersection curveobtained by Surface/Surface Intersection Algorithm.
#######################################################################
puts ""
pload QAcommands
set GoodNbCurv 1
set GoodTol 3.6570868343352305e-005
set NbControlPts 10
restore [locate_data_file bug25193_s1t.draw] s1
restore [locate_data_file bug25193_s4t.draw] s4
#Ethalon of intersection curve
bounds s1 us1 us2 vs1 vs2
uiso cc s1 us1
set CurveNumb [intersect i s1 s4 3.6570868343352305e-005]
regexp {is ([-0-9.+eE]+)} [length cc 1.0e-4] full ExpLength
puts "Expected length = $ExpLength"
intersect res s1 s4 $GoodTol
set che [whatis res]
set ind [string first "3d curve" $che]
set AllowRepeate 1
set ic 1
if {${ind} >= 0} {
#Only variable "res" exists
renamevar res res_1
}
set SumLength 0
while { $AllowRepeate != 0 } {
set che [whatis res_$ic]
set ind [string first "3d curve" $che]
if {${ind} < 0} {
set AllowRepeate 0
break
}
for {set jc 1} {$jc < $ic} {incr jc} {
mkedge e1 res_$ic
mkedge e2 res_$jc
set coe [checkoverlapedges e1 e2]
puts "res_$ic <-> res_$jc: $coe"
if { [regexp "Edges is not overlaped" $coe] != 1 } {
puts "Error: Overlapped intersection curves"
}
}
regexp {is ([-0-9.+eE]+)} [length res_$ic 1.0e-4] full ll
set SumLength [ expr $SumLength+$ll ]
bounds res_$ic U1 U2
set step [ dval (U2-U1)/$NbControlPts ]
if { $step < 1.0e-9*$NbControlPts } {
puts "Error: Wrong curve's range!"
}
set DPPrev 0
for {set par [dval U1]} {$par <= [dval U2]} {set par [expr $par+$step]} {
cvalue res_$ic $par xx yy zz dx1 dy1 dz1
regexp " parameter 1 = +(\[-0-9*\.+eE\]+)" [proj cc xx yy zz] full cpar
cvalue cc $cpar xx yy zz dx2 dy2 dz2
set DP [dval dx1*dx2+dy1*dy2+dz1*dz2]
if {$DPPrev*$DP < 0.0} {
puts "Error: Curve res_$ic changes its direction"
}
set DPPrev $DP
}
incr ic
}
if {[expr {$ic - 1}] == $GoodNbCurv} {
puts "OK: Good number of intersection curve(s) obtained by Surface/Surface Intersection Algorithm"
if { [llength ${CurveNumb}] != 6 } {
puts "Error : Bad Intersection curveobtained by Surface/Surface Intersection Algorithm"
} else {
puts "Error: $GoodNbCurv intersection curve(s) expected but [expr {$ic - 1}] found"
puts "OK : Good Intersection curveobtained by Surface/Surface Intersection Algorithm"
}
checkreal "Summary length " ${SumLength} $ExpLength 0.0 1.0e-6
smallview
donly res_* s1 s4
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,16 +0,0 @@
puts "============"
puts "OCC26333"
puts "============"
puts ""
############################################
## Fails on a shape with BSpline boundaries
############################################
restore [locate_data_file bug26333.brep] s
mkoffset result s 1 10.
renamevar result_1 result
checkprops result -l 3820.28
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,62 +0,0 @@
puts "========"
puts "OCC26980"
puts "========"
puts ""
#################################
# Intersection part of Boolean algorithm spends much system time and system memory
#################################
set max_time 120
set mem_max_wsetpeak 500000000
bclearobjects;
bcleartools;
restore [locate_data_file bug26980-cmp.brep] cmp
puts [nbshapes cmp -t]
eval baddobjects [explode cmp]
dchrono cr reset
dchrono cr start
bfillds
bbuild result
dchrono cr stop
set mem_wsetpeak [meminfo wsetpeak]
if { ${mem_wsetpeak} > ${mem_max_wsetpeak}} {
puts "Error : there is memory problem (${mem_wsetpeak} MBytes has been allocated)"
}
set chrono_info [dchrono cr show]
regexp {CPU user time: ([-0-9.+eE]+) seconds} $chrono_info full CPU_time
if { $CPU_time > ${max_time} } {
puts "CPU user time of Boolean operation is more than ${max_time} seconds - Error"
} else {
puts "CPU user time of Boolean operation is less than ${max_time} seconds - OK"
}
set nbshapes_expected "
VERTEX : 365
EDGE : 793
WIRE : 531
FACE : 531
SHELL : 102
SOLID : 101
COMPSOLID : 0
COMPOUND : 1
SHAPE : 2424
"
checknbshapes result -ref ${nbshapes_expected} -t
smallview
donly result
fit
set 2dviewer 1

View File

@@ -1,24 +0,0 @@
puts "============"
puts "OCC27065"
puts "============"
puts ""
###############################
## BRepOffsetAPI_MakePipe misses definition of virtual method Generated()
###############################
pload QAcommands
restore [locate_data_file bug24840_comp.brep] sh
explode sh
OCC27065 sh_1 sh_2
fit
checknbshapes res_shell -vertex 56 -edge 130 -wire 99 -face 99 -shell 24 -solid 24 -compsolid 1 -compound 1 -shape 434
checknbshapes res_face -vertex 8 -edge 12 -wire 6 -face 6 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 35
checknbshapes res_wire -vertex 8 -edge 12 -wire 4 -face 4 -shell 1 -solid 0 -compsolid 0 -compound 1 -shape 30
checknbshapes res_edge -vertex 4 -edge 4 -wire 1 -face 1 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 11
checknbshapes res_vertex -vertex 2 -edge 1 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 4

View File

@@ -1,28 +0,0 @@
puts "============"
puts "OCC27065"
puts "============"
puts ""
###############################
## BRepOffsetAPI_MakePipe misses definition of virtual method Generated()
###############################
pload QAcommands
restore [locate_data_file bug23903_base.brep] base
restore [locate_data_file bug23903_path.brep] sp
explode base
shape pr Sh
add base_1 pr
add base_2 pr
OCC27065 sp pr
fit
checknbshapes res_shell -vertex 2 -edge 5 -wire 3 -face 3 -shell 2 -solid 2 -compsolid 1 -compound 1 -shape 19
checknbshapes res_face -vertex 2 -edge 4 -wire 2 -face 2 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 13
checknbshapes res_wire -vertex 2 -edge 4 -wire 2 -face 2 -shell 1 -solid 0 -compsolid 0 -compound 1 -shape 12
checknbshapes res_edge -vertex 2 -edge 3 -wire 1 -face 1 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 8
checknbshapes res_vertex -vertex 1 -edge 1 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 3

View File

@@ -1,28 +0,0 @@
puts "============"
puts "OCC27134"
puts "============"
puts ""
######################################################
# Offset algorithm produces an invalid shape from a cone
######################################################
smallview
set expected_MaxTolerance 1.02470e-007
set tol_abs_MaxTolerance 1.e-08
set tol_rel_MaxTolerance 1.e-08
restore [locate_data_file bug27134_cone.brep] a
explode a f
donly a_1
offsetshape res a_1 10
fit
checknbshapes res -vertex 5 -edge 7 -wire 2 -face 2 -shell 1 -solid 0 -compsolid 0 -compound 0 -shape 17
checkshape res
regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance res] full MaxTolerance
checkreal "MaxTolerance" ${MaxTolerance} ${expected_MaxTolerance} ${tol_abs_MaxTolerance} ${tol_rel_MaxTolerance}
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -8,6 +8,19 @@ puts ""
set BugNumber OCC14782
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
restore [locate_data_file OCC14782.draw] res
bounds res t1 t2
@@ -50,4 +63,14 @@ if { [llength ${segment_list}] < 7 } {
set ll2 [lindex [length res] end]
puts "length2=${ll2}"
checkreal "length1" ${ll1} ${ll2} 0 0.001
set percent_max 0.1
set length_percent [GetPercent ${ll1} ${ll2}]
puts "length_percent = ${length_percent}"
puts ""
if { ${length_percent} > ${percent_max} } {
puts "3. Faulty ${BugNumber}"
} else {
puts "3. OK ${BugNumber}"
}

View File

@@ -10,6 +10,18 @@ set BugNumber OCC15570
pload XDE
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
igesbrep [locate_data_file OCC15570.igs] a *
tpcompound result
@@ -21,11 +33,76 @@ set xmax [lindex ${BoundList} 3]
set ymax [lindex ${BoundList} 4]
set zmax [lindex ${BoundList} 5]
checkreal "xmin" ${xmin} -22.500000100000001 0 0.001
checkreal "ymin" ${ymin} -88.366946209482094 0 0.001
checkreal "zmin" ${zmin} -1.0000002775557561e-07 0 0.001
checkreal "xmax" ${xmax} 22.500000100000001 0 0.001
checkreal "ymax" ${ymax} 22.776076069021901 0 0.001
checkreal "zmax" ${zmax} 86.12676222997429 0 0.001
set percent_max 0.1
set good_xmin -22.500000100000001
set good_ymin -88.366946209482094
set good_zmin -1.0000002775557561e-07
set good_xmax 22.500000100000001
set good_ymax 22.776076069021901
set good_zmax 86.12676222997429
set status 0
set xmin_percent [GetPercent ${xmin} ${good_xmin}]
puts "xmin_percent = ${xmin_percent}"
if { ${xmin_percent} > ${percent_max} } {
puts "xmin: Faulty ${BugNumber}"
set status 1
} else {
puts "xmin: OK ${BugNumber}"
}
set ymin_percent [GetPercent ${ymin} ${good_ymin}]
puts "ymin_percent = ${ymin_percent}"
if { ${ymin_percent} > ${percent_max} } {
puts "ymin: Faulty ${BugNumber}"
set status 1
} else {
puts "ymin: OK ${BugNumber}"
}
set zmin_percent [GetPercent ${zmin} ${good_zmin}]
puts "zmin_percent = ${zmin_percent}"
if { ${zmin_percent} > ${percent_max} } {
puts "zmin: Faulty ${BugNumber}"
set status 1
} else {
puts "zmin: OK ${BugNumber}"
}
set xmax_percent [GetPercent ${xmax} ${good_xmax}]
puts "xmax_percent = ${xmax_percent}"
if { ${xmax_percent} > ${percent_max} } {
puts "xmax: Faulty ${BugNumber}"
set status 1
} else {
puts "xmax: OK ${BugNumber}"
}
set ymax_percent [GetPercent ${ymax} ${good_ymax}]
puts "ymax_percent = ${ymax_percent}"
if { ${ymax_percent} > ${percent_max} } {
puts "ymax: Faulty ${BugNumber}"
set status 1
} else {
puts "ymax: OK ${BugNumber}"
}
set zmax_percent [GetPercent ${zmax} ${good_zmax}]
puts "zmax_percent = ${zmax_percent}"
if { ${zmax_percent} > ${percent_max} } {
puts "zmax: Faulty ${BugNumber}"
set status 1
} else {
puts "zmax: OK ${BugNumber}"
}
# Resume
puts ""
if { ${status} != 0 } {
puts "Faulty ${BugNumber}"
} else {
puts "OK ${BugNumber}"
}
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -8,6 +8,18 @@ puts ""
set BugNumber OCC16119
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
restore [locate_data_file OCC16119-c1.draw] c1
restore [locate_data_file OCC16119-c2.draw] c2
restore [locate_data_file OCC16119-c31.draw] c31
@@ -26,6 +38,23 @@ set deltaX [dval dvx1-dvx2]
set deltaY [dval dvy1-dvy2]
set deltaZ [dval dvz1-dvz2]
checkreal "deltaX" ${deltaX} -3.5527136788005009e-015 0 0.001
checkreal "deltaY" ${deltaY} -3.5527136788005009e-015 0 0.001
checkreal "deltaZ" ${deltaZ} 8.8817841970012523e-016 0 0.001
set percent_max 0.1
set good_deltaX -3.5527136788005009e-015
set good_deltaY -3.5527136788005009e-015
set good_deltaZ 8.8817841970012523e-016
set deltaX_percent [GetPercent ${deltaX} ${good_deltaX}]
puts "deltaX_percent = ${deltaX_percent}"
set deltaY_percent [GetPercent ${deltaY} ${good_deltaY}]
puts "deltaY_percent = ${deltaY_percent}"
set deltaZ_percent [GetPercent ${deltaZ} ${good_deltaZ}]
puts "deltaZ_percent = ${deltaZ_percent}"
if {${deltaX_percent} > ${percent_max} || ${deltaY_percent} > ${percent_max} || ${deltaZ_percent} > ${percent_max} } {
puts "${BugNumber}: Faulty"
} else {
puts "${BugNumber}: OK"
}

View File

@@ -17,10 +17,35 @@ set extrema_length [llength ${extrema_res} ]
if {${extrema_length} < 8 } {
puts "${BugNumber}: Faulty"
} else {
regexp {Extrema 1 is point : +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} $extrema_res full X Y Z
regexp {Extrema 1 is point : +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} $extrema_res full X Y Z
set good_X 1
set good_Y 3.0891916307971289e-33
set good_Z 0.059999999999999998
set percent_max 0.1
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
set X_percent [GetPercent ${X} ${good_X}]
set Y_percent [GetPercent ${Y} ${good_Y}]
set Z_percent [GetPercent ${Z} ${good_Z}]
if {${X_percent} > ${percent_max} || ${Y_percent} > ${percent_max} || ${Z_percent} > ${percent_max}} {
puts "X = ${X} Y = ${Y} Z = ${Z}"
puts "X_percent = ${X_percent} Y_percent = ${Y_percent} Z_percent = ${Z_percent}"
puts "${BugNumber}: Faulty"
} else {
puts "${BugNumber}: OK"
}
checkreal "X" ${X} 1 0 0.001
checkreal "Y" ${Y} 3.0891916307971289e-33 0 0.001
checkreal "Z" ${Z} 0.059999999999999998 0 0.001
}

View File

@@ -21,7 +21,7 @@ tclean result
set Deflection 0.001
incmesh result ${Deflection}
checktrinfo result -tri 616054 -nod 311758 -defl 0.0032657364637550023 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
checktrinfo result -tri 615414 -nod 311438 -defl 0.0032657364637550075 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
vinit
vdisplay result

View File

@@ -21,6 +21,21 @@ puts ""
set BugNumber OCC22809
#
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
set percent_max 0.1
#
psphere a 100
nurbsconvert r1 a
line l 0 0 -100 0 0 1
@@ -38,6 +53,8 @@ set word2 [string compare $info2 "point"]
set status_point 0
puts "ski $word1"
puts "ski $word2"
if { ${word1} == 0 && ${word2} == 0 } {
set status_point 0
} else {
@@ -67,11 +84,38 @@ set good_z2 1.000000000000000e+02
set dump1 [ dump brics_1 ]
regexp {Point : ([-0-9.+eE]+), ([-0-9.+eE]+), ([-0-9.+eE]+)} $dump1 full x1 y1 z1
checkreal "x1" ${x1} ${good_x1} 0 0.001
checkreal "y1" ${y1} ${good_y1} 0 0.001
set status_xyz1 0
set x1_percent [GetPercent ${x1} ${good_x1}]
puts "x1_percent = ${x1_percent}"
if { ${x1_percent} > ${percent_max} } {
puts "x1: Faulty ${BugNumber}"
set status_xyz1 1
} else {
puts "x1: OK ${BugNumber}"
}
if { abs ($z1 - $good_z1) > 0.001 * abs ($good_z1) } {
checkreal "z1" ${z1} ${good_z2} 0 0.001
set y1_percent [GetPercent ${y1} ${good_y1}]
puts "y1_percent = ${y1_percent}"
if { ${y1_percent} > ${percent_max} } {
puts "y1: Faulty ${BugNumber}"
set status_xyz1 1
} else {
puts "y1: OK ${BugNumber}"
}
set z1_percent [GetPercent ${z1} ${good_z1}]
puts "z1_percent = ${z1_percent}"
if { ${z1_percent} > ${percent_max} } {
set z1_percent [GetPercent ${z1} ${good_z2}]
puts "z1_percent = ${z1_percent}"
if { ${z1_percent} > ${percent_max} } {
puts "z1: Faulty ${BugNumber}"
set status_xyz1 1
} else {
puts "z1: OK ${BugNumber}"
}
} else {
puts "z1: OK ${BugNumber}"
}
set dump2 [ dump brics_2 ]
@@ -79,15 +123,43 @@ set dump2 [ dump brics_2 ]
set dump2 [ dump brics_41 ]
regexp {Point : ([-0-9.+eE]+), ([-0-9.+eE]+), ([-0-9.+eE]+)} $dump2 full x2 y2 z2
checkreal "x2" ${x2} ${good_x2} 0 0.001
checkreal "y2" ${y2} ${good_y2} 0 0.001
if { abs ($z2 - $good_z2) > 0.001 * abs ($good_z2) } {
checkreal "z2" ${z2} ${good_z1} 0 0.001
set status_xyz2 0
set x2_percent [GetPercent ${x2} ${good_x2}]
puts "x2_percent = ${x2_percent}"
if { ${x2_percent} > ${percent_max} } {
puts "x2: Faulty ${BugNumber}"
set status_xyz2 1
} else {
puts "x2: OK ${BugNumber}"
}
if { ${status_point} == 0 && ${status_nb} == 0 } {
set y2_percent [GetPercent ${y2} ${good_y2}]
puts "y2_percent = ${y2_percent}"
if { ${y2_percent} > ${percent_max} } {
puts "y2: Faulty ${BugNumber}"
set status_xyz2 1
} else {
puts "y2: OK ${BugNumber}"
}
set z2_percent [GetPercent ${z2} ${good_z2}]
puts "z2_percent = ${z2_percent}"
if { ${z2_percent} > ${percent_max} } {
set z2_percent [GetPercent ${z2} ${good_z1}]
puts "z2_percent = ${z2_percent}"
if { ${z2_percent} > ${percent_max} } {
puts "z2: Faulty ${BugNumber}"
set status_xyz2 1
} else {
puts "z2: OK ${BugNumber}"
}
} else {
puts "z2: OK ${BugNumber}"
}
if { ${status_point} == 0 && ${status_nb} == 0 && ${status_xyz1} == 0 && ${status_xyz2} == 0 } {
puts "OK ${BugNumber}"
} else {
puts "Faulty ${BugNumber}"
}

View File

@@ -21,6 +21,21 @@ puts ""
set BugNumber OCC22809
#
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
set percent_max 0.1
#
psphere a 100
scalexyz r2 a 2 1 1
line l 0 0 -100 0 0 1
@@ -66,11 +81,38 @@ set dump1 [ dump brics_1 ]
regexp {Point : ([-0-9.+eE]+), ([-0-9.+eE]+), ([-0-9.+eE]+)} $dump1 full x1 y1 z1
checkreal "x1" ${x1} ${good_x1} 0 0.001
checkreal "y1" ${y1} ${good_y1} 0 0.001
set status_xyz1 0
set x1_percent [GetPercent ${x1} ${good_x1}]
puts "x1_percent = ${x1_percent}"
if { ${x1_percent} > ${percent_max} } {
puts "x1: Faulty ${BugNumber}"
set status_xyz1 1
} else {
puts "x1: OK ${BugNumber}"
}
if { abs ($z1 - $good_z1) > 0.001 * abs ($good_z1) } {
checkreal "z1" ${z1} ${good_z2} 0 0.001
set y1_percent [GetPercent ${y1} ${good_y1}]
puts "y1_percent = ${y1_percent}"
if { ${y1_percent} > ${percent_max} } {
puts "y1: Faulty ${BugNumber}"
set status_xyz1 1
} else {
puts "y1: OK ${BugNumber}"
}
set z1_percent [GetPercent ${z1} ${good_z1}]
puts "z1_percent = ${z1_percent}"
if { ${z1_percent} > ${percent_max} } {
set z1_percent [GetPercent ${z1} ${good_z2}]
puts "z1_percent = ${z1_percent}"
if { ${z1_percent} > ${percent_max} } {
puts "z1: Faulty ${BugNumber}"
set status_xyz1 1
} else {
puts "z1: OK ${BugNumber}"
}
} else {
puts "z1: OK ${BugNumber}"
}
set dump2 [ dump brics_2 ]
@@ -78,15 +120,45 @@ set dump2 [ dump brics_2 ]
set dump2 [ dump brics_23 ]
regexp {Point : ([-0-9.+eE]+), ([-0-9.+eE]+), ([-0-9.+eE]+)} $dump2 full x2 y2 z2
checkreal "x2" ${x2} ${good_x2} 0 0.001
checkreal "y2" ${y2} ${good_y2} 0 0.001
if { abs ($z2 - $good_z2) > 0.001 * abs ($good_z2) } {
checkreal "z2" ${z2} ${good_z1} 0 0.001
set status_xyz2 0
set x2_percent [GetPercent ${x2} ${good_x2}]
puts "x2_percent = ${x2_percent}"
if { ${x2_percent} > ${percent_max} } {
puts "x2: Faulty ${BugNumber}"
set status_xyz2 1
} else {
puts "x2: OK ${BugNumber}"
}
if { ${status_point} == 0 && ${status_nb} == 0 } {
set y2_percent [GetPercent ${y2} ${good_y2}]
puts "y2_percent = ${y2_percent}"
if { ${y2_percent} > ${percent_max} } {
puts "y2: Faulty ${BugNumber}"
set status_xyz2 1
} else {
puts "y2: OK ${BugNumber}"
}
set z2_percent [GetPercent ${z2} ${good_z2}]
puts "z2_percent = ${z2_percent}"
if { ${z2_percent} > ${percent_max} } {
set z2_percent [GetPercent ${z2} ${good_z1}]
puts "z2_percent = ${z2_percent}"
if { ${z2_percent} > ${percent_max} } {
puts "z2: Faulty ${BugNumber}"
set status_xyz2 1
} else {
puts "z2: OK ${BugNumber}"
}
} else {
puts "z2: OK ${BugNumber}"
}
# Resume
puts ""
if { ${status_point} == 0 && ${status_nb} == 0 && ${status_xyz1} == 0 && ${status_xyz2} == 0 } {
puts "OK ${BugNumber}"
} else {
puts "Faulty ${BugNumber}"
}

View File

@@ -8,6 +8,22 @@ puts ""
set BugNumber OCC22809
#
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
set percent_max 0.1
#
psphere a 100
nurbsconvert r1 a
line l -0.000001 0.0000000001 -100 0 0 1
@@ -49,9 +65,33 @@ set good_x1 -1.000000000000000e-06
set good_y1 1.000000000000000e-10
set good_z1 -1.000000000000000e+02
checkreal "x1" ${x1} ${good_x1} 0 0.001
checkreal "y1" ${y1} ${good_y1} 0 0.001
checkreal "z1" ${z1} ${good_z1} 0 0.001
set status_xyz1 0
set x1_percent [GetPercent ${x1} ${good_x1}]
puts "x1_percent = ${x1_percent}"
if { ${x1_percent} > ${percent_max} } {
puts "x1: Faulty ${BugNumber}"
set status_xyz1 1
} else {
puts "x1: OK ${BugNumber}"
}
set y1_percent [GetPercent ${y1} ${good_y1}]
puts "y1_percent = ${y1_percent}"
if { ${y1_percent} > ${percent_max} } {
puts "y1: Faulty ${BugNumber}"
set status_xyz1 1
} else {
puts "y1: OK ${BugNumber}"
}
set z1_percent [GetPercent ${z1} ${good_z1}]
puts "z1_percent = ${z1_percent}"
if { ${z1_percent} > ${percent_max} } {
puts "z1: Faulty ${BugNumber}"
set status_xyz1 1
} else {
puts "z1: OK ${BugNumber}"
}
set dump2 [ dump brics_2 ]
# N.B. multiple result points are to be processed by other algorithms
@@ -63,13 +103,37 @@ set good_x2 -1.000000000000000e-06
set good_y2 1.000000000000000e-10
set good_z2 1.000000000000000e+02
checkreal "x2" ${x2} ${good_x2} 0 0.001
checkreal "y2" ${y2} ${good_y2} 0 0.001
checkreal "z2" ${z2} ${good_z2} 0 0.001
set status_xyz2 0
set x2_percent [GetPercent ${x2} ${good_x2}]
puts "x2_percent = ${x2_percent}"
if { ${x2_percent} > ${percent_max} } {
puts "x2: Faulty ${BugNumber}"
set status_xyz2 1
} else {
puts "x2: OK ${BugNumber}"
}
set y2_percent [GetPercent ${y2} ${good_y2}]
puts "y2_percent = ${y2_percent}"
if { ${y2_percent} > ${percent_max} } {
puts "y2: Faulty ${BugNumber}"
set status_xyz2 1
} else {
puts "y2: OK ${BugNumber}"
}
set z2_percent [GetPercent ${z2} ${good_z2}]
puts "z2_percent = ${z2_percent}"
if { ${z2_percent} > ${percent_max} } {
puts "z2: Faulty ${BugNumber}"
set status_xyz2 1
} else {
puts "z2: OK ${BugNumber}"
}
# Resume
puts ""
if { ${status_point} == 0 && ${status_nb} == 0 } {
if { ${status_point} == 0 && ${status_nb} == 0 && ${status_xyz1} == 0 && ${status_xyz2} == 0 } {
puts "OK ${BugNumber}"
} else {
puts "Faulty ${BugNumber}"

View File

@@ -8,6 +8,21 @@ puts ""
set BugNumber OCC22809
#
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
set percent_max 0.1
#
psphere a 100
scalexyz r2 a 2 1 1
line l -0.000001 0.0000000001 -100 0 0 1
@@ -52,9 +67,33 @@ set good_x1 -1.000000000000000e-06
set good_y1 1.000000000000000e-10
set good_z1 -1.000000000000000e+02
checkreal "x1" ${x1} ${good_x1} 0 0.001
checkreal "y1" ${y1} ${good_y1} 0 0.001
checkreal "z1" ${z1} ${good_z1} 0 0.001
set status_xyz1 0
set x1_percent [GetPercent ${x1} ${good_x1}]
puts "x1_percent = ${x1_percent}"
if { ${x1_percent} > ${percent_max} } {
puts "x1: Faulty ${BugNumber}"
set status_xyz1 1
} else {
puts "x1: OK ${BugNumber}"
}
set y1_percent [GetPercent ${y1} ${good_y1}]
puts "y1_percent = ${y1_percent}"
if { ${y1_percent} > ${percent_max} } {
puts "y1: Faulty ${BugNumber}"
set status_xyz1 1
} else {
puts "y1: OK ${BugNumber}"
}
set z1_percent [GetPercent ${z1} ${good_z1}]
puts "z1_percent = ${z1_percent}"
if { ${z1_percent} > ${percent_max} } {
puts "z1: Faulty ${BugNumber}"
set status_xyz1 1
} else {
puts "z1: OK ${BugNumber}"
}
set dump2 [ dump brics_2 ]
# N.B. multiple result points are to be processed by other algorithms
@@ -66,12 +105,39 @@ set good_x2 -1.000000000000000e-06
set good_y2 1.000000000000000e-10
set good_z2 1.000000000000000e+02
checkreal "x2" ${x2} ${good_x2} 0 0.001
checkreal "y2" ${y2} ${good_y2} 0 0.001
checkreal "z2" ${z2} ${good_z2} 0 0.001
set status_xyz2 0
set x2_percent [GetPercent ${x2} ${good_x2}]
puts "x2_percent = ${x2_percent}"
if { ${x2_percent} > ${percent_max} } {
puts "x2: Faulty ${BugNumber}"
set status_xyz2 1
} else {
puts "x2: OK ${BugNumber}"
}
if { ${status_point} == 0 && ${status_nb} == 0 } {
set y2_percent [GetPercent ${y2} ${good_y2}]
puts "y2_percent = ${y2_percent}"
if { ${y2_percent} > ${percent_max} } {
puts "y2: Faulty ${BugNumber}"
set status_xyz2 1
} else {
puts "y2: OK ${BugNumber}"
}
set z2_percent [GetPercent ${z2} ${good_z2}]
puts "z2_percent = ${z2_percent}"
if { ${z2_percent} > ${percent_max} } {
puts "z2: Faulty ${BugNumber}"
set status_xyz2 1
} else {
puts "z2: OK ${BugNumber}"
}
# Resume
puts ""
if { ${status_point} == 0 && ${status_nb} == 0 && ${status_xyz1} == 0 && ${status_xyz2} == 0 } {
puts "OK ${BugNumber}"
} else {
puts "Faulty ${BugNumber}"
}

View File

@@ -14,6 +14,22 @@ smallview
# 1 step
set exception_status 0
set e1_status 0
set status 0
set percent_max 0.1
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
restore [locate_data_file OCC23165-edge1.brep] e1
@@ -41,12 +57,38 @@ if {$index > -1} {
set e1_good_y2 5.700038816113608
set e1_good_z2 -1.6251884728673096
checkreal "e1_x1" ${e1_x1} ${e1_good_x1} 0 0.001
checkreal "e1_y1" ${e1_y1} ${e1_good_y1} 0 0.001
checkreal "e1_z1" ${e1_z1} ${e1_good_z1} 0 0.001
checkreal "e1_x2" ${e1_x2} ${e1_good_x2} 0 0.001
checkreal "e1_y2" ${e1_y2} ${e1_good_y2} 0 0.001
checkreal "e1_z2" ${e1_z2} ${e1_good_z2} 0 0.001
set e1_x1_percent [GetPercent ${e1_x1} ${e1_good_x1}]
set e1_y1_percent [GetPercent ${e1_y1} ${e1_good_y1}]
set e1_z1_percent [GetPercent ${e1_z1} ${e1_good_z1}]
set e1_x2_percent [GetPercent ${e1_x2} ${e1_good_x2}]
set e1_y2_percent [GetPercent ${e1_y2} ${e1_good_y2}]
set e1_z2_percent [GetPercent ${e1_z2} ${e1_good_z2}]
if {${e1_x1_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : x1 for e1 is wrong"
set e1_status 1
}
if {${e1_y1_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : y1 for e1 is wrong"
set e1_status 1
}
if {${e1_z1_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : z1 for e1 is wrong"
set e1_status 1
}
if {${e1_x2_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : x2 for e1 is wrong"
set e1_status 1
}
if {${e1_y2_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : y2 for e1 is wrong"
set e1_status 1
}
if {${e1_z2_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : z2 for e1 is wrong"
set e1_status 1
}
}
# 2 step
@@ -71,14 +113,39 @@ set good_x2 -17.589416490940806
set good_y2 5.7000000802283299
set good_z2 -1.6252272087525899
checkreal "x1" ${x1} ${good_x1} 0 0.001
checkreal "y1" ${y1} ${good_y1} 0 0.001
checkreal "z1" ${z1} ${good_z1} 0 0.001
checkreal "x2" ${x2} ${good_x2} 0 0.001
checkreal "y2" ${y2} ${good_y2} 0 0.001
checkreal "z2" ${z2} ${good_z2} 0 0.001
set x1_percent [GetPercent ${x1} ${good_x1}]
set y1_percent [GetPercent ${y1} ${good_y1}]
set z1_percent [GetPercent ${z1} ${good_z1}]
set x2_percent [GetPercent ${x2} ${good_x2}]
set y2_percent [GetPercent ${y2} ${good_y2}]
set z2_percent [GetPercent ${z2} ${good_z2}]
if { ${exception_status} == 0 } {
if {${x1_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : x1 is wrong"
set status 1
}
if {${y1_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : y1 is wrong"
set status 1
}
if {${z1_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : z1 is wrong"
set status 1
}
if {${x2_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : x2 is wrong"
set status 1
}
if {${y2_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : y2 is wrong"
set status 1
}
if {${z2_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : z2 is wrong"
set status 1
}
if { ${status} == 0 && ${exception_status} == 0&& ${e1_status} == 0 } {
puts "${BugNumber}: OK"
} else {
puts "${BugNumber}: Faulty"
@@ -87,3 +154,4 @@ if { ${exception_status} == 0 } {
checkview -display result -2d -path ${imagedir}/${test_image}.png
checkprops result -l 15.8888
checksection result

View File

@@ -24,15 +24,25 @@ set good_AxisXList [list -0.0300865818651084 -0.941236271764613 0.53430666076168
set good_AxisYList [list 0.999547296325529 -0.337748842654791 -0.845290714645381 0.0533862206328518]
set good_AxisZList [list 0 0 0 0]
proc CalculatePercent {value good_value} {
if {${good_value} == 0. && ${value} == 0.} {
set percent 0.
} else {
set percent [expr abs(${value} - ${good_value}) / double(${good_value}) * 100.]
}
return ${percent}
}
if {[llength ${list}] != ${ll}} {
puts "Faulty OCC2755"
} else {
set percent_max 0.1
set IsGood 1
for {set i 0} {$i < ${ll}} {incr i} {
set dump_list [dump [lindex ${list} $i]]
regexp { *Parameters *: *([-0-9.+eE]+) *([-0-9.+eE]+)} $dump_list full Parameter1 Parameter2
regexp { *Origin *:([-0-9.+eE]+), *([-0-9.+eE]+), *([-0-9.+eE]+)} $dump_list full OriginX OriginY OriginZ
regexp { *Axis *:([-0-9.+eE]+), *([-0-9.+eE]+), *([-0-9.+eE]+)} $dump_list full AxisX AxisY AxisZ
regexp { *Parameters *: *([-0-9.+eE]+) *([-0-9.+eE]+)} $dump_list full Parameter1 Parameter2
regexp { *Origin *:([-0-9.+eE]+), *([-0-9.+eE]+), *([-0-9.+eE]+)} $dump_list full OriginX OriginY OriginZ
regexp { *Axis *:([-0-9.+eE]+), *([-0-9.+eE]+), *([-0-9.+eE]+)} $dump_list full AxisX AxisY AxisZ
set good_Parameter1 [lindex ${good_Parameter1List} $i]
set good_Parameter2 [lindex ${good_Parameter2List} $i]
@@ -43,13 +53,84 @@ if {[llength ${list}] != ${ll}} {
set good_AxisY [lindex ${good_AxisYList} $i]
set good_AxisZ [lindex ${good_AxisZList} $i]
checkreal "Parameter1 / case 3 / $i" ${Parameter1} ${good_Parameter1} 0 0.001
checkreal "Parameter2 / case 3 / $i" ${Parameter2} ${good_Parameter2} 0 0.001
checkreal "OriginX / case 3 / $i" ${OriginX} ${good_OriginX} 0 0.001
checkreal "OriginY / case 3 / $i" ${OriginY} ${good_OriginY} 0 0.001
checkreal "OriginZ / case 3 / $i" ${OriginZ} ${good_OriginZ} 0 0.001
checkreal "AxisX / case 3 / $i" ${AxisX} ${good_AxisX} 0 0.001
checkreal "AxisY / case 3 / $i" ${AxisY} ${good_AxisY} 0 0.001
checkreal "AxisZ / case 3 / $i" ${AxisZ} ${good_AxisZ} 0 0.001
set Parameter1_percent [CalculatePercent ${Parameter1} ${good_Parameter1}]
set Parameter2_percent [CalculatePercent ${Parameter2} ${good_Parameter2}]
set OriginX_percent [CalculatePercent ${OriginX} ${good_OriginX}]
set OriginY_percent [CalculatePercent ${OriginY} ${good_OriginY}]
set OriginZ_percent [CalculatePercent ${OriginZ} ${good_OriginZ}]
set AxisX_percent [CalculatePercent ${AxisX} ${good_AxisX}]
set AxisY_percent [CalculatePercent ${AxisY} ${good_AxisY}]
set AxisZ_percent [CalculatePercent ${AxisZ} ${good_AxisZ}]
puts "good_Parameter1 = ${good_Parameter1}"
puts "Parameter1 = ${Parameter1}"
puts "Parameter1_percent = ${Parameter1_percent}\n"
puts "good_Parameter2 = ${good_Parameter2}"
puts "Parameter2 = ${Parameter2}"
puts "Parameter2_percent = ${Parameter2_percent}\n"
puts "good_OriginX = ${good_OriginX}"
puts "OriginX = ${OriginX}"
puts "OriginX_percent = ${OriginX_percent}\n"
puts "good_OriginY = ${good_OriginY}"
puts "OriginY = ${OriginY}"
puts "OriginY_percent = ${OriginY_percent}\n"
puts "good_OriginZ = ${good_OriginZ}"
puts "OriginZ = ${OriginZ}"
puts "OriginZ_percent = ${OriginZ_percent}\n"
puts "good_AxisX = ${good_AxisX}"
puts "AxisX = ${AxisX}"
puts "AxisX_percent = ${AxisX_percent}\n"
puts "good_AxisY = ${good_AxisY}"
puts "AxisY = ${AxisY}"
puts "AxisY_percent = ${AxisY_percent}\n"
puts "good_AxisZ = ${good_AxisZ}"
puts "AxisZ = ${AxisZ}"
puts "AxisZ_percent = ${AxisZ_percent}\n"
if {${Parameter1_percent} > ${percent_max}} {
puts "OCC2755 Faulty (case 3 / $i)"
set IsGood 0
}
if {${Parameter2_percent} > ${percent_max}} {
puts "OCC2755 Faulty (case 3 / $i)"
set IsGood 0
}
if {${OriginX_percent} > ${percent_max}} {
puts "OCC2755 Faulty (case 3 / $i)"
set IsGood 0
}
if {${OriginY_percent} > ${percent_max}} {
puts "OCC2755 Faulty (case 3 / $i)"
set IsGood 0
}
if {${OriginZ_percent} > ${percent_max}} {
puts "OCC2755 Faulty (case 3 / $i)"
set IsGood 0
}
if {${AxisX_percent} > ${percent_max}} {
puts "OCC2755 Faulty (case 3 / $i)"
set IsGood 0
}
if {${AxisY_percent} > ${percent_max}} {
puts "OCC2755 Faulty (case 3 / $i)"
set IsGood 0
}
if {${AxisZ_percent} > ${percent_max}} {
puts "OCC2755 Faulty (case 3 / $i)"
set IsGood 0
}
}
if {${IsGood} == 1} {
puts "OCC2755 OK"
}
}

View File

@@ -8,6 +8,18 @@ puts ""
set BugNumber OCC6503
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
plane pl 0 0 0 0 0 1
mkface f pl
set info_result [bounding f]
@@ -26,9 +38,43 @@ set good_x2 1e+100
set good_y2 1e+100
set good_z2 9.9999999999999995e-08
checkreal "x1" ${x1} ${good_x1} 0 0.001
checkreal "y1" ${y1} ${good_y1} 0 0.001
checkreal "z1" ${z1} ${good_z1} 0 0.001
checkreal "x2" ${x2} ${good_x2} 0 0.001
checkreal "y2" ${y2} ${good_y2} 0 0.001
checkreal "z2" ${z2} ${good_z2} 0 0.001
set percent_max 0.1
set status 0
set x1_percent [GetPercent ${x1} ${good_x1}]
set y1_percent [GetPercent ${y1} ${good_y1}]
set z1_percent [GetPercent ${z1} ${good_z1}]
set x2_percent [GetPercent ${x2} ${good_x2}]
set y2_percent [GetPercent ${y2} ${good_y2}]
set z2_percent [GetPercent ${z2} ${good_z2}]
if {${x1_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : x1 is wrong"
set status 1
}
if {${y1_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : y1 is wrong"
set status 1
}
if {${z1_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : z1 is wrong"
set status 1
}
if {${x2_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : x2 is wrong"
set status 1
}
if {${y2_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : y2 is wrong"
set status 1
}
if {${z2_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : z2 is wrong"
set status 1
}
if { ${status} == 0 } {
puts "${BugNumber}: OK"
} else {
puts "${BugNumber}: Faulty"
}

View File

@@ -32,7 +32,17 @@ intersect res_2 ll surf2
#set first2 [whatis res_1]
#set second2 [whatis res_2]
proc CalculatePercent {value good_value} {
if {${good_value} == 0. && ${value} == 0.} {
set percent 0.
} else {
set percent [expr abs(${value} - ${good_value}) / double(${good_value}) * 100.]
}
return ${percent}
}
set IsGood 1
set percent_max 0.1
if {[info exists res1] == 0} {
puts "Faulty OCC88 (case 2)"
set IsGood 0
@@ -62,7 +72,38 @@ if {${IsGood} == 1} {
set y2 [lindex ${dump_list2} 12]
set z2 [lindex ${dump_list2} 14]
checkreal "x1 case 6" ${x1} ${x2} 0 0.001
checkreal "y1 case 7" ${y1} ${y2} 0 0.001
checkreal "z1 case 8" ${z1} ${z2} 0 0.001
set x_percent [CalculatePercent ${x1} ${x2}]
set y_percent [CalculatePercent ${y1} ${y2}]
set z_percent [CalculatePercent ${z1} ${z2}]
puts "x1 = ${x1}"
puts "x2 = ${x2}"
puts "x_percent = ${x_percent}\n"
puts "y1 = ${y1}"
puts "y2 = ${y2}"
puts "y_percent = ${y_percent}\n"
puts "z1 = ${z1}"
puts "z2 = ${z2}"
puts "z_percent = ${z_percent}\n"
if {${x_percent} > ${percent_max}} {
puts "OCC88 Faulty (case 6)"
set IsGood 0
}
if {${y_percent} > ${percent_max}} {
puts "OCC88 Faulty (case 7)"
set IsGood 0
}
if {${z_percent} > ${percent_max}} {
puts "OCC88 Faulty (case 8)"
set IsGood 0
}
}
if {${IsGood} == 1} {
puts "OCC88 OK"
}

View File

@@ -8,6 +8,18 @@ puts ""
set BugNumber OCC9303
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}
cone c 0 0 0 30 0
trimv nc c 20 30
@@ -57,6 +69,7 @@ if { $mistake == 0} {
set x2 [string range ${x2} 0 end-1]
set y2 [string range ${y2} 0 end-1]
set percent_max 0.1
set GoodX1 1.154700538379251e+01
set GoodY1 0.000000000000000e+00
set GoodZ1 2.000000000000000e+01
@@ -64,12 +77,30 @@ if { $mistake == 0} {
set GoodY2 0.000000000000000e+00
set GoodZ2 2.000000000000000e+01
checkreal "x1" ${x1} ${GoodX1} 0 0.001
checkreal "y1" ${y1} ${GoodY1} 0 0.001
checkreal "z1" ${z1} ${GoodZ1} 0 0.001
checkreal "x2" ${x2} ${GoodX2} 0 0.001
checkreal "y2" ${y2} ${GoodY2} 0 0.001
checkreal "z2" ${z2} ${GoodZ2} 0 0.001
set Percent_x1 [GetPercent ${x1} ${GoodX1}]
set Percent_y1 [GetPercent ${y1} ${GoodY1}]
set Percent_z1 [GetPercent ${z1} ${GoodZ1}]
set Percent_x2 [GetPercent ${x2} ${GoodX2}]
set Percent_y2 [GetPercent ${y2} ${GoodY2}]
set Percent_z2 [GetPercent ${z2} ${GoodZ2}]
if {${Percent_x1} > ${percent_max}} {
puts "Faulty ${BugNumber}: bad value of x1 = ${x1}"
} elseif {${Percent_y1} > ${percent_max}} {
puts "Faulty ${BugNumber}: bad value of y1 = ${y1}"
} elseif {${Percent_z1} > ${percent_max}} {
puts "Faulty ${BugNumber}: bad value of z1 = ${z1}"
} elseif {${Percent_x2} > ${percent_max}} {
puts "Faulty ${BugNumber}: bad value of x2 = ${x2}"
} elseif {${Percent_y2} > ${percent_max}} {
puts "Faulty ${BugNumber}: bad value of y2 = ${y2}"
} elseif {${Percent_z2} > ${percent_max}} {
puts "Faulty ${BugNumber}: bad value of z2 = ${z2}"
} else {
puts "${BugNumber}: OK"
}
}
} else {
puts "Faulty ${BugNumber} : intersection does not finished"

View File

@@ -0,0 +1,33 @@
puts "========"
puts "OCC27112"
puts "========"
puts ""
##############################################
# GeomAPI_Interpolate produces wrong result
##############################################
interpol result 3d Natural \
0020.2145846565971 0043.0749267405586 -0004.42510603802374 \
0023.9807408024132 0014.6827020376834 -0012.4125287876527 \
0024.3667948231688 0013.8677143193155 -0012.641915904261 \
0024.6513678260243 0013.5109991196997 -0012.7423191658556 \
0024.7858704778464 0013.4143863517737 -0012.7695125913718 \
0024.9455105694487 0013.3596568726249 -0012.7849172391444 \
0025.0753806027073 0013.3631194708948 -0012.7839426245161 \
0025.1971400830829 0013.4054685177828 -0012.7720226826757 \
0025.3773723647216 0013.5376332070131 -0012.7348225311948 \
0025.7223738766752 0014.0220793196683 -0012.5984677382982 \
0026.5185459585299 0016.3036441304239 -0011.9563151411137 \
0028.102183898912 0025.7227430797677 -0009.30579278073889 \
0029.7854153434029 0043.0749267405586 -0004.42510603802373
# Result length check.
mkedge anEdge result
checkprops anEdge -l 63.2944
# Visual check.
donly result
smallview
fit
display result
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,37 @@
puts "========"
puts "OCC27112"
puts "========"
puts ""
##############################################
# GeomAPI_Interpolate produces wrong result
##############################################
interpol result 3d Natural \
1.0 1.0 0.0 \
2.0 0.0 0.0 \
3.0 1.0 0.0 \
3.0 8.0 0.0 \
4.0 10.0 0.0\
5.0 9.0 0.0 \
4.0 7.0 0.0 \
0.0 5.0 0.0 \
0.0 3.0 0.0 \
3.0 2.0 0.0 \
6.0 3.0 0.0 \
6.0 5.0 0.0 \
4.0 6.0 0.0 \
3.0 6.0 0.0 \
2.0 5.0 0.0 \
2.0 4.0 0.0 \
3.0 3.0 0.0
# Result length check.
mkedge anEdge result
checkprops anEdge -l 38.925
# Visual check.
donly result
top
fit
display result
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,26 @@
puts "========"
puts "OCC27112"
puts "========"
puts ""
##############################################
# GeomAPI_Interpolate produces wrong result
##############################################
interpol result 3d Natural \
1.0 1.0 0.0 \
8.0 -2.0 0.0 \
15.0 -6.0 0.0 \
16.0 -8.0 0.0 \
16.5 -7.0 0.0 \
52.0 -1.0 0.0 \
# Result length check.
mkedge anEdge result
checkprops anEdge -l 59.3204
# Visual check.
donly result
top
fit
display result
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,3 +1,15 @@
pload XDE
set subgroup xde
proc GetPercent {Value GoodValue} {
set Percent 0.
if {${GoodValue} != 0.} {
set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
} elseif {${Value} != 0.} {
set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
} else {
set Percent 0.
}
return ${Percent}
}

View File

@@ -10,6 +10,8 @@ set BugNumber OCC6542
set TheFileName OCC6542.igs
set TheFileName2 ${TheFileName}-2.igs
set percent_max 0.1
igesbrep [locate_data_file ${TheFileName}] a *
set comp [tpcompound res1]
@@ -26,8 +28,8 @@ if {$index > -1} {
set index1 [lsearch -exact ${dumpList} Circle]
if {${index1} == -1} {
puts "Faulty ${BugNumber} : there is not a cirle in source file"
incr status
puts "Faulty ${BugNumber} : there is not a cirle in source file"
incr status
} else {
puts "OK ${BugNumber} : there is a cirle in source file"
set Center_X_1 [lindex ${dumpList} [expr ${index1} + 5]]
@@ -62,76 +64,136 @@ if {$index > -1} {
dall
if [catch { igesbrep ${imagedir}/${TheFileName2} b * } res] {
puts "Error ${BugNumber}: there is reading problem"
puts "Error ${BugNumber}: there is reading problem"
} else {
set comp [tpcompound res]
set comp [tpcompound res]
set result [checkshape res]
set index [lsearch $result Faulty]
if {$index > -1} {
puts "Faulty ${BugNumber} : checkshape is wrong for writing file"
incr status
puts "Faulty ${BugNumber} : checkshape is wrong for writing file"
incr status
} else {
puts "OK ${BugNumber} : checkshape is good for writing file"
puts "OK ${BugNumber} : checkshape is good for writing file"
set dumpList2 [split [dump res] "\n\t :,"]
set index2 [lsearch -exact ${dumpList2} Circle]
set dumpList2 [split [dump res] "\n\t :,"]
set index2 [lsearch -exact ${dumpList2} Circle]
if {${index2} == -1} {
puts "Faulty ${BugNumber} : there is not a cirle in writing file"
incr status
} else {
puts "OK ${BugNumber} : there is a cirle in writing file"
set Center_X_2 [lindex ${dumpList2} [expr ${index2} + 5]]
set Center_Y_2 [lindex ${dumpList2} [expr ${index2} + 7]]
set Center_Z_2 [lindex ${dumpList2} [expr ${index2} + 9]]
set Axis_X_2 [lindex ${dumpList2} [expr ${index2} + 17]]
set Axis_Y_2 [lindex ${dumpList2} [expr ${index2} + 19]]
set Axis_Z_2 [lindex ${dumpList2} [expr ${index2} + 21]]
set XAxis_X_2 [lindex ${dumpList2} [expr ${index2} + 28]]
set XAxis_Y_2 [lindex ${dumpList2} [expr ${index2} + 30]]
set XAxis_Z_2 [lindex ${dumpList2} [expr ${index2} + 32]]
set YAxis_X_2 [lindex ${dumpList2} [expr ${index2} + 39]]
set YAxis_Y_2 [lindex ${dumpList2} [expr ${index2} + 41]]
set YAxis_Z_2 [lindex ${dumpList2} [expr ${index2} + 43]]
set Radius_2 [lindex ${dumpList2} [expr ${index2} + 49]]
puts "Center_X_2 = ${Center_X_2}"
puts "Center_Y_2 = ${Center_Y_2}"
puts "Center_Z_2 = ${Center_Z_2}"
puts "Axis_X_2 = ${Axis_X_2}"
puts "Axis_Y_2 = ${Axis_Y_2}"
puts "Axis_Z_2 = ${Axis_Z_2}"
puts "XAxis_X_2 = ${XAxis_X_2}"
puts "XAxis_Y_2 = ${XAxis_Y_2}"
puts "XAxis_Z_2 = ${XAxis_Z_2}"
puts "YAxis_X_2 = ${YAxis_X_2}"
puts "YAxis_Y_2 = ${YAxis_Y_2}"
puts "YAxis_Z_2 = ${YAxis_Z_2}"
puts "Radius_2 = ${Radius_2}"
if {${index2} == -1} {
puts "Faulty ${BugNumber} : there is not a cirle in writing file"
incr status
} else {
puts "OK ${BugNumber} : there is a cirle in writing file"
set Center_X_2 [lindex ${dumpList2} [expr ${index2} + 5]]
set Center_Y_2 [lindex ${dumpList2} [expr ${index2} + 7]]
set Center_Z_2 [lindex ${dumpList2} [expr ${index2} + 9]]
set Axis_X_2 [lindex ${dumpList2} [expr ${index2} + 17]]
set Axis_Y_2 [lindex ${dumpList2} [expr ${index2} + 19]]
set Axis_Z_2 [lindex ${dumpList2} [expr ${index2} + 21]]
set XAxis_X_2 [lindex ${dumpList2} [expr ${index2} + 28]]
set XAxis_Y_2 [lindex ${dumpList2} [expr ${index2} + 30]]
set XAxis_Z_2 [lindex ${dumpList2} [expr ${index2} + 32]]
set YAxis_X_2 [lindex ${dumpList2} [expr ${index2} + 39]]
set YAxis_Y_2 [lindex ${dumpList2} [expr ${index2} + 41]]
set YAxis_Z_2 [lindex ${dumpList2} [expr ${index2} + 43]]
set Radius_2 [lindex ${dumpList2} [expr ${index2} + 49]]
puts "Center_X_2 = ${Center_X_2}"
puts "Center_Y_2 = ${Center_Y_2}"
puts "Center_Z_2 = ${Center_Z_2}"
puts "Axis_X_2 = ${Axis_X_2}"
puts "Axis_Y_2 = ${Axis_Y_2}"
puts "Axis_Z_2 = ${Axis_Z_2}"
puts "XAxis_X_2 = ${XAxis_X_2}"
puts "XAxis_Y_2 = ${XAxis_Y_2}"
puts "XAxis_Z_2 = ${XAxis_Z_2}"
puts "YAxis_X_2 = ${YAxis_X_2}"
puts "YAxis_Y_2 = ${YAxis_Y_2}"
puts "YAxis_Z_2 = ${YAxis_Z_2}"
puts "Radius_2 = ${Radius_2}"
checkreal "Center_X" ${Center_X_2} ${Center_X_1} 0 0.001
checkreal "Center_Y" ${Center_Y_2} ${Center_Y_1} 0 0.001
checkreal "Center_Z" ${Center_Z_2} ${Center_Z_1} 0 0.001
set Center_X_percent [GetPercent ${Center_X_2} ${Center_X_1}]
set Center_Y_percent [GetPercent ${Center_Y_2} ${Center_Y_1}]
set Center_Z_percent [GetPercent ${Center_Z_2} ${Center_Z_1}]
checkreal "Axis_X" ${Axis_X_2} ${Axis_X_1} 0 0.001
checkreal "Axis_Y" ${Axis_Y_2} ${Axis_Y_1} 0 0.001
checkreal "Axis_Z" ${Axis_Z_2} ${Axis_Z_1} 0 0.001
set Axis_X_percent [GetPercent ${Axis_X_2} ${Axis_X_1}]
set Axis_Y_percent [GetPercent ${Axis_Y_2} ${Axis_Y_1}]
set Axis_Z_percent [GetPercent ${Axis_Z_2} ${Axis_Z_1}]
checkreal "XAxis_X" ${XAxis_X_2} ${XAxis_X_1} 0 0.001
checkreal "XAxis_Y" ${XAxis_Y_2} ${XAxis_Y_1} 0 0.001
checkreal "XAxis_Z" ${XAxis_Z_2} ${XAxis_Z_1} 0 0.001
set XAxis_X_percent [GetPercent ${XAxis_X_2} ${XAxis_X_1}]
set XAxis_Y_percent [GetPercent ${XAxis_Y_2} ${XAxis_Y_1}]
set XAxis_Z_percent [GetPercent ${XAxis_Z_2} ${XAxis_Z_1}]
checkreal "YAxis_X" ${YAxis_X_2} ${YAxis_X_1} 0 0.001
checkreal "YAxis_Y" ${YAxis_Y_2} ${YAxis_Y_1} 0 0.001
checkreal "YAxis_Z" ${YAxis_Z_2} ${YAxis_Z_1} 0 0.001
set YAxis_X_percent [GetPercent ${YAxis_X_2} ${YAxis_X_1}]
set YAxis_Y_percent [GetPercent ${YAxis_Y_2} ${YAxis_Y_1}]
set YAxis_Z_percent [GetPercent ${YAxis_Z_2} ${YAxis_Z_1}]
checkreal "Radius" ${Radius_2} ${Radius_1} 0 0.001
}
set Radius_percent [GetPercent ${Radius_2} ${Radius_1}]
if {${Center_X_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : Center_X is wrong"
incr status
}
if {${Center_Y_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : Center_Y is wrong"
incr status
}
if {${Center_Z_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : Center_Z is wrong"
incr status
}
if {${Axis_X_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : Axis_X is wrong"
incr status
}
if {${Axis_Y_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : Axis_Y is wrong"
incr status
}
if {${Axis_Z_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : Axis_Z is wrong"
incr status
}
if {${XAxis_X_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : XAxis_X is wrong"
incr status
}
if {${XAxis_Y_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : XAxis_Y is wrong"
incr status
}
if {${XAxis_Z_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : XAxis_Z is wrong"
incr status
}
if {${YAxis_X_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : YAxis_X is wrong"
incr status
}
if {${YAxis_Y_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : YAxis_Y is wrong"
incr status
}
if {${YAxis_Z_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : YAxis_Z is wrong"
incr status
}
if {${Radius_percent} > ${percent_max}} {
puts "Faulty ${BugNumber} : Radius is wrong"
incr status
}
}
}
}
}
puts ""
if {${status} != 0} {
if {${status} == 0} {
puts "${BugNumber}: OK"
} else {
puts "${BugNumber}: Error"
}

View File

@@ -32,14 +32,24 @@ if { ${IsOk} == 1} {
set aTokList {= }
set Tol1 [lindex [split [tolerance OCC9490a] ${aTokList}] 2]
set Tol2 [lindex [split [tolerance OCC9490b] ${aTokList}] 2]
checkreal "Tolerance" ${Tol1} ${Tol2} 0 0.001
set percent_max 0.1
set Tolerance_percent [GetPercent ${Tol1} ${Tol2}]
puts "Tolerance_percent = ${Tolerance_percent} %"
if { ${Tolerance_percent} > ${percent_max} } {
set IsOk 0
}
checknbshapes OCC9490a -vertex 1770 -edge 1237 -wire 140 -face 123 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 3271
checkprops OCC9490a -s 36259
checknbshapes OCC9490b -vertex 1770 -edge 1237 -wire 140 -face 123 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 3271
checkprops OCC9490b -s 36259
if { ${IsOk} == 0 } {
puts "${BugNumber}: Faulty"
} else {
puts "${BugNumber}: OK"
}
}
renamevar OCC9490b result

View File

@@ -34,12 +34,23 @@ if { ${IsOk} == 1} {
set aTokList {= }
set Tol1 [lindex [split [tolerance OCC9531a] ${aTokList}] 2]
set Tol2 [lindex [split [tolerance OCC9531b] ${aTokList}] 2]
set percent_max 0.1
set Tolerance_percent [GetPercent ${Tol1} ${Tol2}]
puts "Tolerance_percent = ${Tolerance_percent} %"
if { ${Tolerance_percent} > ${percent_max} } {
set IsOk 0
}
checkreal "Tolerance" ${Tol1} ${Tol2} 0 0.001
checknbshapes OCC9531a -vertex 5748 -edge 5680 -wire 915 -face 899 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 13243
checkprops OCC9531a -s 5236.89
checkprops OCC9531b -s 5236.89
checknbshapes OCC9531b -vertex 5748 -edge 5680 -wire 915 -face 899 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 13243
if { ${IsOk} == 0 } {
puts "${BugNumber}: Faulty"
} else {
puts "${BugNumber}: OK"
}
}
renamevar OCC9531b result

View File

@@ -1,8 +0,0 @@
# test for creation of ANC101 shape
source $env(CASROOT)/samples/tcl/ANC101.tcl
# check result for validity and make a snapshot
checkshape result
vdump $imagedir/${test_image}.png
puts "TEST COMPLETED"

View File

@@ -1,8 +0,0 @@
# test for creation of MBBGehauseRohteil shape
source $env(CASROOT)/samples/tcl/MBBGehauseRohteil.tcl
# check result for validity and make a snapshot
checkshape result
vdump $imagedir/${test_image}.png
puts "TEST COMPLETED"

View File

@@ -1,7 +1,7 @@
set TheFileName shading_112.brep
set bug_area "OCC22687"
if { [string compare $command "shading"] == 0 } {
set rel_tol 1.7
set rel_tol 1.71
} else {
set rel_tol 1.55
}

View File

@@ -1,5 +1,5 @@
puts "TODO OCC23068 All: ERROR. offsetperform operation not done."
puts "TODO OCC23068 All: Error : The volume of result shape is"
puts "TODO OCC23068 Linux: ERROR. offsetperform operation not done."
puts "TODO OCC23068 Linux: Error : The volume of result shape is"
# Original bug : hkg60144
# Date : 17Juillet98