mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0023200: Visualization - prevent multiple triangulating of a shape that already has been triangulated
Add new flag IsAutoTriangulated to Prs3d_Drawer. It is True by default. If this flag is True automatic re-triangulation with deflection-check logic will be applied. Else this feature will be disable and triangulation is expected to be computed by application itself. Change the syntax of vdefalts command. Add new parameter -autoTriang for check of AutoTriangulated functionality. Adjust camera position in test case bugs/xde/bug23969
This commit is contained in:
parent
5149c3f34b
commit
4c5133866b
@ -307,6 +307,8 @@ void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (theMode == AIS_Shaded)
|
if (theMode == AIS_Shaded)
|
||||||
|
{
|
||||||
|
if (myDrawer->IsAutoTriangulation())
|
||||||
{
|
{
|
||||||
// compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
|
// compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
|
||||||
Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
|
Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
|
||||||
@ -319,6 +321,7 @@ void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
|||||||
}
|
}
|
||||||
StdPrs_ShadedShape::Tessellate (myshape, myDrawer);
|
StdPrs_ShadedShape::Tessellate (myshape, myDrawer);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TopoDS_Compound anOpened, aClosed;
|
TopoDS_Compound anOpened, aClosed;
|
||||||
BRep_Builder aBuilder;
|
BRep_Builder aBuilder;
|
||||||
|
@ -225,7 +225,8 @@ void AIS_ConnectedInteractive::Compute (const Handle(Prs3d_Projector)& theProjec
|
|||||||
// process HLRAngle and HLRDeviationCoefficient()
|
// process HLRAngle and HLRDeviationCoefficient()
|
||||||
Standard_Real aPrevAngle = myDrawer->HLRAngle();
|
Standard_Real aPrevAngle = myDrawer->HLRAngle();
|
||||||
Standard_Real aNewAngle = aDefaultDrawer->HLRAngle();
|
Standard_Real aNewAngle = aDefaultDrawer->HLRAngle();
|
||||||
if (Abs (aNewAngle - aPrevAngle) > Precision::Angular())
|
if (myDrawer->IsAutoTriangulation() &&
|
||||||
|
Abs (aNewAngle - aPrevAngle) > Precision::Angular())
|
||||||
{
|
{
|
||||||
BRepTools::Clean (theShape);
|
BRepTools::Clean (theShape);
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,8 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
|
{
|
||||||
|
if (myDrawer->IsAutoTriangulation())
|
||||||
{
|
{
|
||||||
Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
|
Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
|
||||||
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev);
|
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev);
|
||||||
@ -173,6 +175,7 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
|||||||
{
|
{
|
||||||
BRepTools::Clean (myshape);
|
BRepTools::Clean (myshape);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//shading only on face...
|
//shading only on face...
|
||||||
if ((Standard_Integer) myshape.ShapeType()>4)
|
if ((Standard_Integer) myshape.ShapeType()>4)
|
||||||
@ -259,20 +262,18 @@ void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
|
|||||||
Aspect_TypeOfDeflection prevdef = defdrawer->TypeOfDeflection();
|
Aspect_TypeOfDeflection prevdef = defdrawer->TypeOfDeflection();
|
||||||
defdrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
|
defdrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
|
||||||
|
|
||||||
|
if (myDrawer->IsAutoTriangulation())
|
||||||
|
{
|
||||||
// coefficients for calculation
|
// coefficients for calculation
|
||||||
|
Standard_Real aPrevAngle, aNewAngle, aPrevCoeff, aNewCoeff;
|
||||||
Standard_Real prevangle, newangle ,prevcoeff,newcoeff ;
|
Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle (aNewAngle, aPrevAngle);
|
||||||
Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle(newangle,prevangle);
|
Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient (aNewCoeff, aPrevCoeff);
|
||||||
Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient(newcoeff,prevcoeff);
|
if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnHLRDeviationAngle) ||
|
||||||
if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnHLRDeviationAngle) ||
|
((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient))
|
||||||
((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient)) {
|
{
|
||||||
#ifdef OCCT_DEBUG
|
|
||||||
cout << "AIS_Shape : compute"<<endl;
|
|
||||||
cout << "newangle : " << newangle << " # de " << "prevangl : " << prevangle << " OU "<<endl;
|
|
||||||
cout << "newcoeff : " << newcoeff << " # de " << "prevcoeff : " << prevcoeff << endl;
|
|
||||||
#endif
|
|
||||||
BRepTools::Clean(SH);
|
BRepTools::Clean(SH);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -381,7 +382,6 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
|||||||
// POP protection against crash in low layers
|
// POP protection against crash in low layers
|
||||||
|
|
||||||
Standard_Real aDeflection = Prs3d::GetDeflection(shape, myDrawer);
|
Standard_Real aDeflection = Prs3d::GetDeflection(shape, myDrawer);
|
||||||
Standard_Boolean autoTriangulation = Standard_True;
|
|
||||||
try {
|
try {
|
||||||
OCC_CATCH_SIGNALS
|
OCC_CATCH_SIGNALS
|
||||||
StdSelect_BRepSelectionTool::Load(aSelection,
|
StdSelect_BRepSelectionTool::Load(aSelection,
|
||||||
@ -390,7 +390,7 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
|||||||
TypOfSel,
|
TypOfSel,
|
||||||
aDeflection,
|
aDeflection,
|
||||||
myDrawer->HLRAngle(),
|
myDrawer->HLRAngle(),
|
||||||
autoTriangulation);
|
myDrawer->IsAutoTriangulation());
|
||||||
} catch ( Standard_Failure ) {
|
} catch ( Standard_Failure ) {
|
||||||
// cout << "a Shape should be incorrect : A Selection on the Bnd is activated "<<endl;
|
// cout << "a Shape should be incorrect : A Selection on the Bnd is activated "<<endl;
|
||||||
if ( aMode == 0 ) {
|
if ( aMode == 0 ) {
|
||||||
|
@ -429,17 +429,21 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager3d)& /*t
|
|||||||
case AIS_Shaded:
|
case AIS_Shaded:
|
||||||
case 3: // texture mapping on triangulation
|
case 3: // texture mapping on triangulation
|
||||||
{
|
{
|
||||||
Standard_Real prevangle;
|
if (myDrawer->IsAutoTriangulation())
|
||||||
Standard_Real newangle;
|
{
|
||||||
Standard_Real prevcoeff;
|
Standard_Real aPrevAngle;
|
||||||
Standard_Real newcoeff;
|
Standard_Real aNewAngle;
|
||||||
|
Standard_Real aPrevCoeff;
|
||||||
|
Standard_Real aNewCoeff;
|
||||||
|
|
||||||
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle(newangle,prevangle);
|
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (aNewAngle, aPrevAngle);
|
||||||
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(newcoeff,prevcoeff);
|
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient (aNewCoeff,aPrevCoeff);
|
||||||
if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnDeviationAngle) ||
|
if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnDeviationAngle) ||
|
||||||
((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) {
|
((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnDeviationCoefficient))
|
||||||
|
{
|
||||||
BRepTools::Clean (myshape);
|
BRepTools::Clean (myshape);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (myshape.ShapeType() > TopAbs_FACE)
|
if (myshape.ShapeType() > TopAbs_FACE)
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,8 @@ Prs3d_Drawer::Prs3d_Drawer()
|
|||||||
myHasOwnHLRDeviationAngle (Standard_False),
|
myHasOwnHLRDeviationAngle (Standard_False),
|
||||||
myIsoOnPlane (Standard_False),
|
myIsoOnPlane (Standard_False),
|
||||||
myHasOwnIsoOnPlane (Standard_False),
|
myHasOwnIsoOnPlane (Standard_False),
|
||||||
|
myIsAutoTriangulated (Standard_True),
|
||||||
|
myHasOwnIsAutoTriangulated (Standard_False),
|
||||||
|
|
||||||
myHasOwnUIsoAspect (Standard_False),
|
myHasOwnUIsoAspect (Standard_False),
|
||||||
myHasOwnVIsoAspect (Standard_False),
|
myHasOwnVIsoAspect (Standard_False),
|
||||||
@ -229,6 +231,17 @@ void Prs3d_Drawer::SetHLRAngle (const Standard_Real theAngle)
|
|||||||
myHasOwnHLRDeviationAngle = Standard_True;
|
myHasOwnHLRDeviationAngle = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : SetAutoTriangulation
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
|
||||||
|
void Prs3d_Drawer::SetAutoTriangulation (const Standard_Boolean theIsEnabled)
|
||||||
|
{
|
||||||
|
myHasOwnIsAutoTriangulated = Standard_True;
|
||||||
|
myIsAutoTriangulated = theIsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : FreeBoundaryAspect
|
// function : FreeBoundaryAspect
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -1027,6 +1040,7 @@ void Prs3d_Drawer::ClearLocalAttributes()
|
|||||||
myHasOwnDeviationAngle = Standard_False;
|
myHasOwnDeviationAngle = Standard_False;
|
||||||
myHasOwnHLRDeviationAngle = Standard_False;
|
myHasOwnHLRDeviationAngle = Standard_False;
|
||||||
myHasOwnIsoOnPlane = Standard_False;
|
myHasOwnIsoOnPlane = Standard_False;
|
||||||
|
myHasOwnIsAutoTriangulated = Standard_False;
|
||||||
myHasOwnWireDraw = Standard_False;
|
myHasOwnWireDraw = Standard_False;
|
||||||
myHasOwnShadingAspectGlobal = Standard_False;
|
myHasOwnShadingAspectGlobal = Standard_False;
|
||||||
myHasOwnLineArrowDraw = Standard_False;
|
myHasOwnLineArrowDraw = Standard_False;
|
||||||
|
@ -309,6 +309,23 @@ public:
|
|||||||
: 0.0;
|
: 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Sets IsAutoTriangulated on or off by setting the parameter theIsEnabled to true or false.
|
||||||
|
//! If this flag is True automatic re-triangulation with deflection-check logic will be applied.
|
||||||
|
//! Else this feature will be disable and triangulation is expected to be computed by application itself
|
||||||
|
//! and no shading presentation at all if unavailable.
|
||||||
|
Standard_EXPORT void SetAutoTriangulation (const Standard_Boolean theIsEnabled);
|
||||||
|
|
||||||
|
//! Returns True if automatic triangulation is enabled.
|
||||||
|
Standard_Boolean IsAutoTriangulation() const
|
||||||
|
{
|
||||||
|
return HasOwnIsAutoTriangulation() || myLink.IsNull()
|
||||||
|
? myIsAutoTriangulated
|
||||||
|
: myLink->IsAutoTriangulation();
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns true if the drawer has IsoOnPlane setting active.
|
||||||
|
Standard_Boolean HasOwnIsAutoTriangulation() const { return myHasOwnIsAutoTriangulated; }
|
||||||
|
|
||||||
//! Defines the attributes which are used when drawing an
|
//! Defines the attributes which are used when drawing an
|
||||||
//! U isoparametric curve of a face. Defines the number
|
//! U isoparametric curve of a face. Defines the number
|
||||||
//! of U isoparametric curves to be drawn for a single face.
|
//! of U isoparametric curves to be drawn for a single face.
|
||||||
@ -840,6 +857,8 @@ protected:
|
|||||||
Standard_Real myPreviousHLRDeviationAngle;
|
Standard_Real myPreviousHLRDeviationAngle;
|
||||||
Standard_Boolean myIsoOnPlane;
|
Standard_Boolean myIsoOnPlane;
|
||||||
Standard_Boolean myHasOwnIsoOnPlane;
|
Standard_Boolean myHasOwnIsoOnPlane;
|
||||||
|
Standard_Boolean myIsAutoTriangulated;
|
||||||
|
Standard_Boolean myHasOwnIsAutoTriangulated;
|
||||||
|
|
||||||
Handle(Prs3d_IsoAspect) myUIsoAspect;
|
Handle(Prs3d_IsoAspect) myUIsoAspect;
|
||||||
Standard_Boolean myHasOwnUIsoAspect;
|
Standard_Boolean myHasOwnUIsoAspect;
|
||||||
|
@ -64,9 +64,12 @@ void StdPrs_HLRPolyShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
|
|||||||
TColgp_SequenceOfPnt HiddenPnts;
|
TColgp_SequenceOfPnt HiddenPnts;
|
||||||
TColgp_SequenceOfPnt SeenPnts;
|
TColgp_SequenceOfPnt SeenPnts;
|
||||||
|
|
||||||
const Standard_Boolean rel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE;
|
if (aDrawer->IsAutoTriangulation())
|
||||||
Standard_Real def = rel? aDrawer->HLRDeviationCoefficient() : aDrawer->MaximalChordialDeviation();
|
{
|
||||||
BRepMesh_IncrementalMesh mesh(aShape, def, rel, aDrawer->HLRAngle());
|
const Standard_Boolean aRel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE;
|
||||||
|
Standard_Real aDef = aRel ? aDrawer->HLRDeviationCoefficient() : aDrawer->MaximalChordialDeviation();
|
||||||
|
BRepMesh_IncrementalMesh mesh(aShape, aDef, aRel, aDrawer->HLRAngle());
|
||||||
|
}
|
||||||
|
|
||||||
Handle(HLRBRep_PolyAlgo) hider = new HLRBRep_PolyAlgo(aShape);
|
Handle(HLRBRep_PolyAlgo) hider = new HLRBRep_PolyAlgo(aShape);
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <Precision.hxx>
|
#include <Precision.hxx>
|
||||||
#include <Prs3d.hxx>
|
#include <Prs3d.hxx>
|
||||||
#include <Prs3d_Drawer.hxx>
|
#include <Prs3d_Drawer.hxx>
|
||||||
|
#include <Prs3d_IsoAspect.hxx>
|
||||||
#include <Prs3d_LineAspect.hxx>
|
#include <Prs3d_LineAspect.hxx>
|
||||||
#include <Prs3d_Presentation.hxx>
|
#include <Prs3d_Presentation.hxx>
|
||||||
#include <Prs3d_ShadingAspect.hxx>
|
#include <Prs3d_ShadingAspect.hxx>
|
||||||
@ -40,6 +41,7 @@
|
|||||||
#include <Poly_PolygonOnTriangulation.hxx>
|
#include <Poly_PolygonOnTriangulation.hxx>
|
||||||
#include <Poly_Triangulation.hxx>
|
#include <Poly_Triangulation.hxx>
|
||||||
#include <StdPrs_ToolShadedShape.hxx>
|
#include <StdPrs_ToolShadedShape.hxx>
|
||||||
|
#include <StdPrs_WFDeflectionShape.hxx>
|
||||||
#include <StdPrs_WFShape.hxx>
|
#include <StdPrs_WFShape.hxx>
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
@ -105,6 +107,42 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Computes special wireframe presentation for faces without triangulation.
|
||||||
|
void wireframeNoTriangFacesFromShape (const Handle(Prs3d_Presentation)& thePrs,
|
||||||
|
const TopoDS_Shape& theShape,
|
||||||
|
const Handle(Prs3d_Drawer)& theDrawer)
|
||||||
|
{
|
||||||
|
TopoDS_Compound aCompoundWF;
|
||||||
|
BRep_Builder aBuilder;
|
||||||
|
aBuilder.MakeCompound (aCompoundWF);
|
||||||
|
TopLoc_Location aLoc;
|
||||||
|
Standard_Boolean hasElement = Standard_False;
|
||||||
|
|
||||||
|
for (TopExp_Explorer aShapeIter(theShape, TopAbs_FACE); aShapeIter.More(); aShapeIter.Next())
|
||||||
|
{
|
||||||
|
const TopoDS_Face& aFace = TopoDS::Face (aShapeIter.Current());
|
||||||
|
const Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation (aFace, aLoc);
|
||||||
|
if (aTriang.IsNull())
|
||||||
|
{
|
||||||
|
hasElement = Standard_True;
|
||||||
|
aBuilder.Add (aCompoundWF, aFace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasElement)
|
||||||
|
{
|
||||||
|
Standard_Integer aPrevUIsoNb = theDrawer->UIsoAspect()->Number();
|
||||||
|
Standard_Integer aPrevVIsoNb = theDrawer->VIsoAspect()->Number();
|
||||||
|
theDrawer->UIsoAspect()->SetNumber (5);
|
||||||
|
theDrawer->VIsoAspect()->SetNumber (5);
|
||||||
|
|
||||||
|
StdPrs_WFDeflectionShape::Add (thePrs, aCompoundWF, theDrawer);
|
||||||
|
|
||||||
|
theDrawer->UIsoAspect()->SetNumber (aPrevUIsoNb);
|
||||||
|
theDrawer->VIsoAspect()->SetNumber (aPrevVIsoNb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//! Gets triangulation of every face of shape and fills output array of triangles
|
//! Gets triangulation of every face of shape and fills output array of triangles
|
||||||
static Handle(Graphic3d_ArrayOfTriangles) fillTriangles (const TopoDS_Shape& theShape,
|
static Handle(Graphic3d_ArrayOfTriangles) fillTriangles (const TopoDS_Shape& theShape,
|
||||||
const Standard_Boolean theHasTexels,
|
const Standard_Boolean theHasTexels,
|
||||||
@ -504,8 +542,15 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
|
|||||||
// add wireframe presentation for isolated edges and vertices
|
// add wireframe presentation for isolated edges and vertices
|
||||||
wireframeFromShape (thePrs, theShape, theDrawer);
|
wireframeFromShape (thePrs, theShape, theDrawer);
|
||||||
|
|
||||||
|
// Use automatic re-triangulation with deflection-check logic only if this feature is enable
|
||||||
|
if (theDrawer->IsAutoTriangulation())
|
||||||
|
{
|
||||||
// Triangulation completeness is important for "open-closed" analysis - perform tessellation beforehand
|
// Triangulation completeness is important for "open-closed" analysis - perform tessellation beforehand
|
||||||
Tessellate (theShape, theDrawer);
|
Tessellate (theShape, theDrawer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add special wireframe presentation for faces without triangulation
|
||||||
|
wireframeNoTriangFacesFromShape (thePrs, theShape, theDrawer);
|
||||||
|
|
||||||
// The shape types listed below need advanced analysis as potentially containing
|
// The shape types listed below need advanced analysis as potentially containing
|
||||||
// both closed and open parts. Solids are also included, because they might
|
// both closed and open parts. Solids are also included, because they might
|
||||||
|
@ -6620,44 +6620,74 @@ static int VDefaults (Draw_Interpretor& theDi,
|
|||||||
<< "AbsoluteDeflection: " << aDefParams->MaximalChordialDeviation() << "\n";
|
<< "AbsoluteDeflection: " << aDefParams->MaximalChordialDeviation() << "\n";
|
||||||
}
|
}
|
||||||
theDi << "AngularDeflection: " << (180.0 * aDefParams->HLRAngle() / M_PI) << "\n";
|
theDi << "AngularDeflection: " << (180.0 * aDefParams->HLRAngle() / M_PI) << "\n";
|
||||||
|
theDi << "AutoTriangulation: " << (aDefParams->IsAutoTriangulation() ? "on" : "off") << "\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter)
|
for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString anArg (theArgVec[anArgIter]);
|
TCollection_AsciiString anArg (theArgVec[anArgIter]);
|
||||||
TCollection_AsciiString aKey, aValue;
|
anArg.UpperCase();
|
||||||
if (!ViewerTest::SplitParameter (anArg, aKey, aValue)
|
if (anArg == "-ABSDEFL"
|
||||||
|| aValue.IsEmpty())
|
|| anArg == "-ABSOLUTEDEFLECTION"
|
||||||
|
|| anArg == "-DEFL"
|
||||||
|
|| anArg == "-DEFLECTION")
|
||||||
{
|
{
|
||||||
std::cerr << "Error, wrong syntax at: '" << anArg.ToCString() << "'!\n";
|
if (++anArgIter >= theArgsNb)
|
||||||
|
{
|
||||||
|
std::cout << "Error: wrong syntax at " << anArg << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
aKey.UpperCase();
|
|
||||||
if (aKey == "ABSDEFL"
|
|
||||||
|| aKey == "ABSOLUTEDEFLECTION"
|
|
||||||
|| aKey == "DEFL"
|
|
||||||
|| aKey == "DEFLECTION")
|
|
||||||
{
|
|
||||||
aDefParams->SetTypeOfDeflection (Aspect_TOD_ABSOLUTE);
|
aDefParams->SetTypeOfDeflection (Aspect_TOD_ABSOLUTE);
|
||||||
aDefParams->SetMaximalChordialDeviation (aValue.RealValue());
|
aDefParams->SetMaximalChordialDeviation (Draw::Atof (theArgVec[anArgIter]));
|
||||||
}
|
}
|
||||||
else if (aKey == "RELDEFL"
|
else if (anArg == "-RELDEFL"
|
||||||
|| aKey == "RELATIVEDEFLECTION"
|
|| anArg == "-RELATIVEDEFLECTION"
|
||||||
|| aKey == "DEVCOEFF"
|
|| anArg == "-DEVCOEFF"
|
||||||
|| aKey == "DEVIATIONCOEFF"
|
|| anArg == "-DEVIATIONCOEFF"
|
||||||
|| aKey == "DEVIATIONCOEFFICIENT")
|
|| anArg == "-DEVIATIONCOEFFICIENT")
|
||||||
{
|
{
|
||||||
|
if (++anArgIter >= theArgsNb)
|
||||||
|
{
|
||||||
|
std::cout << "Error: wrong syntax at " << anArg << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
aDefParams->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
|
aDefParams->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
|
||||||
aDefParams->SetDeviationCoefficient (aValue.RealValue());
|
aDefParams->SetDeviationCoefficient (Draw::Atof (theArgVec[anArgIter]));
|
||||||
}
|
}
|
||||||
else if (aKey == "ANGDEFL"
|
else if (anArg == "-ANGDEFL"
|
||||||
|| aKey == "ANGULARDEFL"
|
|| anArg == "-ANGULARDEFL"
|
||||||
|| aKey == "ANGULARDEFLECTION")
|
|| anArg == "-ANGULARDEFLECTION")
|
||||||
{
|
{
|
||||||
|
if (++anArgIter >= theArgsNb)
|
||||||
|
{
|
||||||
|
std::cout << "Error: wrong syntax at " << anArg << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
// currently HLRDeviationAngle is used instead of DeviationAngle in most places
|
// currently HLRDeviationAngle is used instead of DeviationAngle in most places
|
||||||
aDefParams->SetHLRAngle (M_PI * aValue.RealValue() / 180.0);
|
aDefParams->SetHLRAngle (M_PI * Draw::Atof (theArgVec[anArgIter]) / 180.0);
|
||||||
|
}
|
||||||
|
if (anArg == "-AUTOTR"
|
||||||
|
|| anArg == "-AUTOTRIANG"
|
||||||
|
|| anArg == "-AUTOTRIANGULATION")
|
||||||
|
{
|
||||||
|
if (++anArgIter >= theArgsNb)
|
||||||
|
{
|
||||||
|
std::cout << "Error: wrong syntax at " << anArg << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
TCollection_AsciiString aValue (theArgVec[anArgIter]);
|
||||||
|
aValue.LowerCase();
|
||||||
|
if (aValue == "on"
|
||||||
|
|| aValue == "1")
|
||||||
|
{
|
||||||
|
aDefParams->SetAutoTriangulation (Standard_True);
|
||||||
|
}
|
||||||
|
else if (aValue == "off"
|
||||||
|
|| aValue == "0")
|
||||||
|
{
|
||||||
|
aDefParams->SetAutoTriangulation (Standard_False);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -7969,8 +7999,11 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
|||||||
" this command sets texture details mode for the specified view.\n"
|
" this command sets texture details mode for the specified view.\n"
|
||||||
, __FILE__, VSetTextureMode, group);
|
, __FILE__, VSetTextureMode, group);
|
||||||
theCommands.Add("vdefaults",
|
theCommands.Add("vdefaults",
|
||||||
"vdefaults [absDefl=value] [devCoeff=value] [angDefl=value]",
|
"vdefaults [-absDefl value]"
|
||||||
__FILE__, VDefaults, group);
|
"\n\t\t: [-devCoeff value]"
|
||||||
|
"\n\t\t: [-angDefl value]"
|
||||||
|
"\n\t\t: [-autoTriang {off/on | 0/1}]"
|
||||||
|
, __FILE__, VDefaults, group);
|
||||||
theCommands.Add("vlight",
|
theCommands.Add("vlight",
|
||||||
"tool to manage light sources, without arguments shows list of lights."
|
"tool to manage light sources, without arguments shows list of lights."
|
||||||
"\n Main commands: "
|
"\n Main commands: "
|
||||||
|
@ -7,7 +7,7 @@ puts "=================================="
|
|||||||
|
|
||||||
# set rough meshing parameters
|
# set rough meshing parameters
|
||||||
vinit
|
vinit
|
||||||
vdefaults absDefl=10 devCoeff=0.1
|
vdefaults -absDefl 10 -devCoeff 0.1
|
||||||
|
|
||||||
puts "Displaying two equal cones, one with Phong shader"
|
puts "Displaying two equal cones, one with Phong shader"
|
||||||
pcone p_gouraud 10 100 100
|
pcone p_gouraud 10 100 100
|
||||||
|
54
tests/bugs/vis/bug23200
Normal file
54
tests/bugs/vis/bug23200
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "CR23200"
|
||||||
|
puts "Check that the shape is automatic re-triangulated with deflection-check logic"
|
||||||
|
puts "in case of enabled auto triangulation feature (its own triangulation can be lost)."
|
||||||
|
puts "And it keeps its already computed triangulation"
|
||||||
|
puts "in case of disabled auto triangulation feature."
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
set aDefaultShape $imagedir/${casename}_shape.png
|
||||||
|
set aShapeAutoTr $imagedir/${casename}_shape_auto_triangulation.png
|
||||||
|
set aShapeNotAutoTr $imagedir/${casename}_shape_not_auto_triangulation.png
|
||||||
|
|
||||||
|
vinit View1
|
||||||
|
vclear
|
||||||
|
vaxo
|
||||||
|
vsetdispmode 1
|
||||||
|
vdefaults -autoTriang on
|
||||||
|
psphere s 0.5
|
||||||
|
vdisplay s
|
||||||
|
vfit
|
||||||
|
vdump $aDefaultShape
|
||||||
|
|
||||||
|
vclear
|
||||||
|
tclean s
|
||||||
|
incmesh s 0.1 -a 45
|
||||||
|
set tri_info [trinfo s]
|
||||||
|
regexp { +([-0-9.+eE]+) +triangles} $tri_info full triIncmesh1
|
||||||
|
|
||||||
|
vdisplay s
|
||||||
|
set tri_info [trinfo s]
|
||||||
|
regexp { +([-0-9.+eE]+) +triangles} $tri_info full triAutoTrShape
|
||||||
|
vfit
|
||||||
|
vdump $aShapeAutoTr
|
||||||
|
|
||||||
|
vclear
|
||||||
|
vdefaults -autoTriang off
|
||||||
|
tclean s
|
||||||
|
incmesh s 0.1 -a 45
|
||||||
|
set tri_info [trinfo s]
|
||||||
|
regexp { +([-0-9.+eE]+) +triangles} $tri_info full triIncmesh2
|
||||||
|
|
||||||
|
vdisplay s
|
||||||
|
set tri_info [trinfo s]
|
||||||
|
regexp { +([-0-9.+eE]+) +triangles} $tri_info full triNotAutoTrShape
|
||||||
|
vfit
|
||||||
|
vdump $aShapeNotAutoTr
|
||||||
|
|
||||||
|
if {${triIncmesh1} == ${triAutoTrShape}} {
|
||||||
|
puts "ERROR : Test failed. Incorrect triangulation in case of enabled auto triangulation feature."
|
||||||
|
}
|
||||||
|
if {${triIncmesh2} != ${triNotAutoTrShape}} {
|
||||||
|
puts "ERROR : Test failed. Incorrect triangulation in case of disabled auto triangulation feature."
|
||||||
|
}
|
23
tests/bugs/vis/bug23200_1
Normal file
23
tests/bugs/vis/bug23200_1
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "CR23200"
|
||||||
|
puts "Check that the shape doesn't have a shading presentation"
|
||||||
|
puts "due to its triangulation isn't computed in case of disabled auto triangulation feature."
|
||||||
|
puts "But in this case the shape should have special wireframe presentation."
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
vinit View1
|
||||||
|
vclear
|
||||||
|
vaxo
|
||||||
|
vsetdispmode 1
|
||||||
|
vdefaults -autoTriang off
|
||||||
|
pcone c 0 5 10
|
||||||
|
vdisplay c
|
||||||
|
vfit
|
||||||
|
|
||||||
|
set aColor [vreadpixel 200 77 rgb name]
|
||||||
|
vdump $imagedir/${casename}_shape_pres.png
|
||||||
|
|
||||||
|
if {"$aColor" != "GRAY75"} {
|
||||||
|
puts "Error: shading presentation of shape is incorrect"
|
||||||
|
}
|
@ -12,7 +12,7 @@ vinit
|
|||||||
vdisplay s
|
vdisplay s
|
||||||
vfit
|
vfit
|
||||||
|
|
||||||
vdefaults angDefl=1
|
vdefaults -angDefl 1
|
||||||
|
|
||||||
vsetdispmode s 1
|
vsetdispmode s 1
|
||||||
vdump ${imagedir}/${casename}_1.png
|
vdump ${imagedir}/${casename}_1.png
|
||||||
|
@ -12,7 +12,7 @@ vinit
|
|||||||
vdisplay s
|
vdisplay s
|
||||||
vfit
|
vfit
|
||||||
|
|
||||||
vdefaults angDefl=1
|
vdefaults -angDefl 1
|
||||||
|
|
||||||
vsetdispmode s 1
|
vsetdispmode s 1
|
||||||
vdump ${imagedir}/${casename}_1.png
|
vdump ${imagedir}/${casename}_1.png
|
||||||
|
@ -12,7 +12,7 @@ vinit
|
|||||||
vdisplay s
|
vdisplay s
|
||||||
vfit
|
vfit
|
||||||
|
|
||||||
vdefaults angDefl=1
|
vdefaults -angDefl 1
|
||||||
|
|
||||||
vsetdispmode s 1
|
vsetdispmode s 1
|
||||||
vdump ${imagedir}/${casename}_1.png
|
vdump ${imagedir}/${casename}_1.png
|
||||||
|
@ -12,7 +12,11 @@ XGetOneShape res_1 D_First
|
|||||||
vinit
|
vinit
|
||||||
vsetdispmode 1
|
vsetdispmode 1
|
||||||
vdisplay res_1
|
vdisplay res_1
|
||||||
|
|
||||||
vfit
|
vfit
|
||||||
|
vdump $::imagedir/${::casename}_fit.png
|
||||||
|
|
||||||
|
vviewparams -eye 106.849 -177.049 169.775 -at -70.2 -5.456e-015 -7.274 -up -0.408 0.408 0.816 -scale 3.048
|
||||||
|
|
||||||
set ver_color [vreadpixel 157 104]
|
set ver_color [vreadpixel 157 104]
|
||||||
if {$ver_color == "0 0 0 0"} {
|
if {$ver_color == "0 0 0 0"} {
|
||||||
@ -34,5 +38,6 @@ set ver_color [vreadpixel 243 323]
|
|||||||
if {$ver_color == "0 0 0 0"} {
|
if {$ver_color == "0 0 0 0"} {
|
||||||
puts "ERROR: OCC23969 is reproduced"
|
puts "ERROR: OCC23969 is reproduced"
|
||||||
}
|
}
|
||||||
|
vdump $::imagedir/${::casename}_center.png
|
||||||
|
|
||||||
set 3dviewer 1
|
set 3dviewer 1
|
||||||
|
@ -10,7 +10,7 @@ box b 2 0 0 1 0.5 0.25
|
|||||||
# draw box
|
# draw box
|
||||||
vinit View1
|
vinit View1
|
||||||
vclear
|
vclear
|
||||||
vdefaults absDefl=0.5
|
vdefaults -absDefl 0.5
|
||||||
vsetdispmode 1
|
vsetdispmode 1
|
||||||
vaxo
|
vaxo
|
||||||
vdisplay f
|
vdisplay f
|
||||||
|
@ -9,7 +9,7 @@ tclean f
|
|||||||
# draw box
|
# draw box
|
||||||
vinit View1
|
vinit View1
|
||||||
vclear
|
vclear
|
||||||
vdefaults absDefl=0.5
|
vdefaults -absDefl 0.5
|
||||||
vsetdispmode 1
|
vsetdispmode 1
|
||||||
vaxo
|
vaxo
|
||||||
vdisplay f
|
vdisplay f
|
||||||
|
@ -9,7 +9,7 @@ tclean f
|
|||||||
# draw box
|
# draw box
|
||||||
vinit View1
|
vinit View1
|
||||||
vclear
|
vclear
|
||||||
vdefaults absDefl=0.5
|
vdefaults -absDefl 0.5
|
||||||
vsetdispmode 1
|
vsetdispmode 1
|
||||||
vaxo
|
vaxo
|
||||||
vdisplay f
|
vdisplay f
|
||||||
|
Loading…
x
Reference in New Issue
Block a user