1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-18 14:27:39 +03:00

Compare commits

..

3 Commits

Author SHA1 Message Date
drochalo
d9d071e0ce 0021753: Visualization - improve shaded display of conical objects
Removal of apex duplication.
2023-10-20 15:39:46 +01:00
drochalo
e6a11fa375 0021753: Visualization - improve shaded display of conical objects
Update on the method to solve cone apex point issue. Revamped previous solution proposed on CR21753 branch.
2023-10-19 16:35:09 +01:00
drochalo
611ba16d81 0021753: Visualization - improve shaded display of conical objects
Removed bad seams from full cone by averaging top vertex normals. Tuned cone mesh subdivision parameters.
2023-10-18 17:27:27 +01:00
3 changed files with 20 additions and 46 deletions

View File

@@ -398,25 +398,17 @@ void AIS_Manipulator::Attach (const Handle(AIS_ManipulatorObjectSequence)& theOb
const Handle(AIS_InteractiveContext)& aContext = Object()->GetContext();
if (!aContext.IsNull())
{
if (!aCurObject.IsNull())
if (!aContext->IsDisplayed (this))
{
Handle(Graphic3d_TransformPers) aTransPers = aCurObject->TransformPersistence();
if (!aTransPers.IsNull())
{
aCurObject->TransformPersistence()->SetAnchorPoint(myPosition.Location());
}
}
if (!aContext->IsDisplayed(this))
{
aContext->Display(this, Standard_False);
aContext->Display (this, Standard_False);
}
else
{
aContext->Update(this, Standard_False);
aContext->RecomputeSelectionOnly(this);
aContext->Update (this, Standard_False);
aContext->RecomputeSelectionOnly (this);
}
aContext->Load(this);
aContext->Load (this);
}
if (theOptions.EnableModes)
@@ -758,11 +750,6 @@ void AIS_Manipulator::Transform (const gp_Trsf& theTrsf)
{
anObj->SetLocalTransformation (theTrsf * anOldTrsf);
}
Handle(Graphic3d_TransformPers) aTransPers = anObj->TransformPersistence();
if (!aTransPers.IsNull())
{
anObj->TransformPersistence()->SetAnchorPoint(myPosition.Location());
}
}
}
@@ -819,32 +806,15 @@ void AIS_Manipulator::updateTransformation()
{
gp_Trsf aTrsf;
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
Handle(AIS_InteractiveObject) anObj = Object();
for (AIS_ManipulatorObjectSequence::Iterator anObjIter(*anObjects); anObjIter.More(); anObjIter.Next())
if (!myIsZoomPersistentMode)
{
anObj = anObjIter.Value();
aTrsf.SetTransformation (myPosition, gp::XOY());
}
if (!anObj.IsNull())
else
{
Handle(Graphic3d_TransformPers) aTransPers = anObj->TransformPersistence();
if (!aTransPers.IsNull())
{
aTrsf.SetTransformation(myPosition, gp::XOY());
}
else
{
if (!myIsZoomPersistentMode)
{
aTrsf.SetTransformation(myPosition, gp::XOY());
}
else
{
const gp_Dir& aVDir = myPosition.Direction();
const gp_Dir& aXDir = myPosition.XDirection();
aTrsf.SetTransformation(gp_Ax2(gp::Origin(), aVDir, aXDir), gp::XOY());
}
}
const gp_Dir& aVDir = myPosition.Direction();
const gp_Dir& aXDir = myPosition.XDirection();
aTrsf.SetTransformation (gp_Ax2 (gp::Origin(), aVDir, aXDir), gp::XOY());
}
Handle(TopLoc_Datum3D) aGeomTrsf = new TopLoc_Datum3D (aTrsf);

View File

@@ -35,13 +35,17 @@ std::pair<Standard_Real, Standard_Real> BRepMesh_ConeRangeSplitter::GetSplitStep
Standard_Real aRadius = Max(Abs(aRefR + aRangeV.first * Sin(aSAng)),
Abs(aRefR + aRangeV.second * Sin(aSAng)));
//Face deflection used to determine circle subdivisions needs to match the one used previously
Standard_Real Dv, Du = GCPnts_TangentialDeflection::ArcAngularStep(
aRadius, GetDFace()->GetDeflection(),
aRadius, GetDFace()->GetDeflection()*0.5,
theParameters.Angle, theParameters.MinSize);
const Standard_Real aDiffU = aRangeU.second - aRangeU.first;
const Standard_Real aDiffV = aRangeV.second - aRangeV.first;
const Standard_Real aScale = (Du * aRadius);
//compute subdivision factor acounting for the difference between the bottom and top radius of the cone
const Standard_Real aTopRadius = aRefR > Precision::Confusion() ? aRefR : 1.0;
const Standard_Real aSubDivFactor = Max(theParameters.MinSize, Min(1.0, aTopRadius > aRadius ? aRadius / aTopRadius : aTopRadius / aRadius));
const Standard_Real aScale = (Du * aRadius * aSubDivFactor);
const Standard_Real aRatio = Max(1., Log(aDiffV / aScale));
const Standard_Integer nbU = (Standard_Integer)(aDiffU / Du);
const Standard_Integer nbV = (Standard_Integer)(aDiffV / aScale / aRatio);

View File

@@ -210,9 +210,9 @@ namespace
{
const gp_Pnt2d aNode2d = aT->UVNode (aNodeIter);
const gp_Pnt2d aTexel = (dUmax == 0.0 || dVmax == 0.0)
? aNode2d
: gp_Pnt2d ((-theUVOrigin.X() + (theUVRepeat.X() * (aNode2d.X() - aUmin)) / dUmax) / theUVScale.X(),
(-theUVOrigin.Y() + (theUVRepeat.Y() * (aNode2d.Y() - aVmin)) / dVmax) / theUVScale.Y());
? aNode2d
: gp_Pnt2d ((-theUVOrigin.X() + (theUVRepeat.X() * (aNode2d.X() - aUmin)) / dUmax) / theUVScale.X(),
(-theUVOrigin.Y() + (theUVRepeat.Y() * (aNode2d.Y() - aVmin)) / dVmax) / theUVScale.Y());
anArray->AddVertex (aPoint, aNorm, aTexel);
}
else