1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0033084: Visualization - Cylindrical prism is selectable only by its base when extruded in some directions

Fixed bounding boxes for Select3D_SensitiveCylinder.

Added display of Select3D_SensitiveCylinder presentation using the "vsensdis" command.
Added test vselect/bugs/bug33084.
This commit is contained in:
mzernova
2022-08-03 12:46:53 +03:00
committed by smoskvin
parent 6072d3093c
commit 81d569625e
5 changed files with 100 additions and 14 deletions

View File

@@ -13,6 +13,7 @@
#include <SelectMgr.hxx>
#include <Geom_Circle.hxx>
#include <Graphic3d_ArrayOfPoints.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Poly_Triangulation.hxx>
@@ -22,6 +23,7 @@
#include <TColgp_HArray1OfPnt.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <Select3D_SensitiveBox.hxx>
#include <Select3D_SensitiveCylinder.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <Select3D_SensitiveFace.hxx>
#include <Select3D_SensitivePoint.hxx>
@@ -130,6 +132,43 @@ namespace
theSeqLines.Append (aPoints);
}
}
//! Fill in cylinder polylines.
static void addCylinder (Prs3d_NListOfSequenceOfPnt& theSeqLines,
const Handle(Select3D_SensitiveCylinder)& theSensCyl)
{
Handle(TColgp_HSequenceOfPnt) aVertLines[2];
aVertLines[0] = new TColgp_HSequenceOfPnt();
aVertLines[1] = new TColgp_HSequenceOfPnt();
const gp_Trsf& aTrsf = theSensCyl->Transformation();
const Standard_Real aHeight = theSensCyl->Height();
const Standard_Real anUStep = 0.1;
for (int aCircNum = 0; aCircNum < 3; aCircNum++)
{
Standard_Real aRadius = 0.5 * (2 - aCircNum) * theSensCyl->BottomRadius()
+ 0.5 * aCircNum * theSensCyl->TopRadius();
Geom_Circle aGeom (gp_Ax2(), aRadius);
Handle(TColgp_HSequenceOfPnt) aPoints = new TColgp_HSequenceOfPnt();
gp_XYZ aVec (0, 0, aHeight * 0.5 * aCircNum);
if (aCircNum != 1)
{
aVertLines[0]->Append (gp_Pnt(aGeom.Value (0).Coord() + aVec).Transformed (aTrsf));
aVertLines[1]->Append (gp_Pnt(aGeom.Value (M_PI).Coord() + aVec).Transformed (aTrsf));
}
for (Standard_Real anU = 0.0f; anU < (2.0 * M_PI + anUStep); anU += anUStep)
{
gp_Pnt aCircPnt = aGeom.Value (anU).Coord() + aVec;
aCircPnt.Transform (aTrsf);
aPoints->Append (aCircPnt);
}
theSeqLines.Append (aPoints);
}
theSeqLines.Append (aVertLines[0]);
theSeqLines.Append (aVertLines[1]);
}
}
//=======================================================================
@@ -152,6 +191,10 @@ void SelectMgr::ComputeSensitivePrs (const Handle(Graphic3d_Structure)& thePrs,
{
addBoundingBox (aSeqLines, aSensBox, theLoc);
}
else if (Handle(Select3D_SensitiveCylinder) aSensCyl = Handle(Select3D_SensitiveCylinder)::DownCast (anEnt))
{
addCylinder (aSeqLines, aSensCyl);
}
else if (Handle(Select3D_SensitiveFace) aFace = Handle(Select3D_SensitiveFace)::DownCast(anEnt))
{
Handle(TColgp_HArray1OfPnt) aSensPnts;