1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-07-30 13:05:50 +03:00

# Add test for cone

This commit is contained in:
mzernova 2024-07-31 13:51:43 +01:00
parent 603a391e9c
commit cacbe65d83
3 changed files with 45 additions and 7 deletions

View File

@ -637,8 +637,6 @@ Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForFace (const TopoDS_
const gp_Cone aCone = BRepAdaptor_Surface (theFace).Cone(); const gp_Cone aCone = BRepAdaptor_Surface (theFace).Cone();
gp_Trsf aTrsf; gp_Trsf aTrsf;
aTrsf.SetTransformation (aCone.Position(), gp::XOY());
Standard_Real aRad1; Standard_Real aRad1;
Standard_Real aRad2; Standard_Real aRad2;
Standard_Real aHeight; Standard_Real aHeight;
@ -647,14 +645,18 @@ Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForFace (const TopoDS_
aRad1 = 0.0; aRad1 = 0.0;
aRad2 = aCircles.First().Radius(); aRad2 = aCircles.First().Radius();
aHeight = aRad2 * Tan (aCone.SemiAngle()); aHeight = aRad2 * Tan (aCone.SemiAngle());
aTrsf.SetTransformation (aCone.Position(), gp::XOY());
} }
else else
{ {
aRad1 = aCone.RefRadius(); aRad1 = aCircles.First().Radius();
aRad2 = IsEqual (aRad1, aCircles.First().Radius()) aRad2 = aCircles.Last().Radius();
? aCircles.Last().Radius()
: aCircles.First().Radius();
aHeight = aCircles.First().Location().Distance (aCircles.Last().Location()); aHeight = aCircles.First().Location().Distance (aCircles.Last().Location());
const gp_Pnt aPos = aCircles.First().Location();
const gp_Dir aDirection (aCircles.Last().Location().XYZ() - aPos.XYZ());
aTrsf.SetTransformation (gp_Ax3(aPos, aDirection), gp::XOY());
} }
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad1, aRad2, aHeight, aTrsf, true); Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad1, aRad2, aHeight, aTrsf, true);

View File

@ -18,4 +18,4 @@ if {[vnbselected] != "1"} {
} }
vselect 0 0 vselect 0 0
vdump $::imagedir/${::casename}.png vdump $::imagedir/${::casename}_cylinder.png

36
tests/v3d/bugs/bug33664_2 Normal file
View File

@ -0,0 +1,36 @@
puts "============"
puts "0033664: Visualization - Selection does not work for simple shape"
puts "============"
puts ""
pload MODELING VISUALIZATION
vclear
vinit View1
pcone c1 50 100 100
ttranslate c1 100 0 100
explode c1
explode c1_1
pcone c2 100 50 100
ttranslate c2 -100 0 100
explode c2
explode c2_1
pcone c3 0 100 100
ttranslate c3 100 0 -100
explode c3
explode c3_1
pcone c4 100 0 100
ttranslate c4 -100 0 -100
explode c4
explode c4_1
vdisplay c1_1_1 c2_1_1 c3_1_1 c4_1_1 -dispmode 1
vsensdis
vfront
vfit
vdump $::imagedir/${::casename}_cone.png