mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-09-09 06:08:09 +08:00
Coding - Rework of Math global functions to stl (#833)
Majority of functions now simply call same functions from std namespace. Functions that duplicate std namespace functionality are declared deprecated. Calls of deprecated functions are replaced with std functions calls.
This commit is contained in:
@@ -273,7 +273,7 @@ Standard_Boolean MeshVS_Tool::GetNormal(const TColStd_Array1OfReal& Nodes, gp_Ve
|
||||
if (fabs(cur_vec[0]) > conf || fabs(cur_vec[1]) > conf || fabs(cur_vec[2]) > conf)
|
||||
{
|
||||
Standard_Real cur =
|
||||
Sqrt(cur_vec[0] * cur_vec[0] + cur_vec[1] * cur_vec[1] + cur_vec[2] * cur_vec[2]);
|
||||
std::sqrt(cur_vec[0] * cur_vec[0] + cur_vec[1] * cur_vec[1] + cur_vec[2] * cur_vec[2]);
|
||||
for (Standard_Integer k = 0; k < 3; k++)
|
||||
cur_vec[k] /= cur;
|
||||
}
|
||||
@@ -342,7 +342,7 @@ Standard_Boolean MeshVS_Tool::GetAverageNormal(const TColStd_Array1OfReal& Nodes
|
||||
if (fabs(cur_vec[0]) > conf || fabs(cur_vec[1]) > conf || fabs(cur_vec[2]) > conf)
|
||||
{
|
||||
Standard_Real cur =
|
||||
Sqrt(cur_vec[0] * cur_vec[0] + cur_vec[1] * cur_vec[1] + cur_vec[2] * cur_vec[2]);
|
||||
std::sqrt(cur_vec[0] * cur_vec[0] + cur_vec[1] * cur_vec[1] + cur_vec[2] * cur_vec[2]);
|
||||
for (Standard_Integer k = 0; k < 3; k++)
|
||||
cur_vec[k] /= cur;
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ void MeshVS_VectorPrsBuilder::Build(const Handle(Prs3d_Presentation)& Prs,
|
||||
{
|
||||
aValue = aVec.Magnitude();
|
||||
|
||||
if (Abs(aValue) < Precision::Confusion())
|
||||
if (std::abs(aValue) < Precision::Confusion())
|
||||
continue;
|
||||
|
||||
if (aSource->GetGeom(aKey, IsElement, aCoords, NbNodes, aType))
|
||||
@@ -276,7 +276,7 @@ void MeshVS_VectorPrsBuilder::Build(const Handle(Prs3d_Presentation)& Prs,
|
||||
gp_Ax3(gp_Pnt(X, Y, Z), aVec));
|
||||
|
||||
DrawVector(aTrsf,
|
||||
Max(k * fabs(aValue) + b, aMinLength),
|
||||
std::max(k * fabs(aValue) + b, aMinLength),
|
||||
aMaxLen,
|
||||
anArrowPnt,
|
||||
aLineArray,
|
||||
|
||||
@@ -184,7 +184,7 @@ void OpenGl_AspectsSprite::build(const Handle(OpenGl_Context)& theCtx,
|
||||
const OpenGl_PointSprite* aSprite = dynamic_cast<OpenGl_PointSprite*>(mySprite.get());
|
||||
if (!aSprite->IsDisplayList())
|
||||
{
|
||||
theMarkerSize = Standard_ShortReal(Max(aSprite->SizeX(), aSprite->SizeY()));
|
||||
theMarkerSize = Standard_ShortReal(std::max(aSprite->SizeX(), aSprite->SizeY()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ void OpenGl_AspectsSprite::build(const Handle(OpenGl_Context)& theCtx,
|
||||
// reuse shared resource
|
||||
if (!aSprite->IsDisplayList())
|
||||
{
|
||||
theMarkerSize = Standard_ShortReal(Max(aSprite->SizeX(), aSprite->SizeY()));
|
||||
theMarkerSize = Standard_ShortReal(std::max(aSprite->SizeX(), aSprite->SizeY()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ void OpenGl_AspectsSprite::build(const Handle(OpenGl_Context)& theCtx,
|
||||
// Creating texture resource for using it with point sprites
|
||||
Handle(Image_PixMap) anImage = aNewMarkerImage->GetImage();
|
||||
theMarkerSize =
|
||||
Max((Standard_ShortReal)anImage->Width(), (Standard_ShortReal)anImage->Height());
|
||||
std::max((Standard_ShortReal)anImage->Width(), (Standard_ShortReal)anImage->Height());
|
||||
|
||||
if (!hadAlreadyRGBA)
|
||||
{
|
||||
@@ -287,7 +287,7 @@ void OpenGl_AspectsSprite::build(const Handle(OpenGl_Context)& theCtx,
|
||||
Image_PixMap::FlipY(*anImageCopy);
|
||||
anImage = anImageCopy;
|
||||
}
|
||||
const GLint anAligment = Min((GLint)anImage->MaxRowAligmentBytes(), 8);
|
||||
const GLint anAligment = std::min((GLint)anImage->MaxRowAligmentBytes(), 8);
|
||||
theCtx->core11fwd->glPixelStorei(GL_UNPACK_ALIGNMENT, anAligment);
|
||||
|
||||
const GLint anExtraBytes = GLint(anImage->RowExtraBytes());
|
||||
|
||||
@@ -291,8 +291,8 @@ Standard_Boolean OpenGl_BackgroundArray::createGradientArray(
|
||||
for (Standard_Integer anIt = 1; anIt < aSubdiv + 2; ++anIt)
|
||||
{
|
||||
anEllipVerts[anIt] =
|
||||
OpenGl_Vec2(float(Cos(aParam) * M_SQRT2 * myViewWidth / 2.0 + myViewWidth / 2.0f),
|
||||
float(Sin(aParam) * M_SQRT2 * myViewHeight / 2.0 + myViewHeight / 2.0f));
|
||||
OpenGl_Vec2(float(std::cos(aParam) * M_SQRT2 * myViewWidth / 2.0 + myViewWidth / 2.0f),
|
||||
float(std::sin(aParam) * M_SQRT2 * myViewHeight / 2.0 + myViewHeight / 2.0f));
|
||||
|
||||
aParam += aTetta;
|
||||
}
|
||||
|
||||
@@ -1397,12 +1397,12 @@ void OpenGl_Context::init(const Standard_Boolean theIsCoreProfile)
|
||||
|
||||
GLint aMaxVPortSize[2] = {0, 0};
|
||||
core11fwd->glGetIntegerv(GL_MAX_VIEWPORT_DIMS, aMaxVPortSize);
|
||||
myMaxDumpSizeX = Min(aMaxVPortSize[0], myMaxTexDim);
|
||||
myMaxDumpSizeY = Min(aMaxVPortSize[1], myMaxTexDim);
|
||||
myMaxDumpSizeX = std::min(aMaxVPortSize[0], myMaxTexDim);
|
||||
myMaxDumpSizeY = std::min(aMaxVPortSize[1], myMaxTexDim);
|
||||
if (myVendor == "intel")
|
||||
{
|
||||
// Intel drivers have known bug with empty dump for images with width>=5462
|
||||
myMaxDumpSizeX = Min(myMaxDumpSizeX, 4096);
|
||||
myMaxDumpSizeX = std::min(myMaxDumpSizeX, 4096);
|
||||
}
|
||||
|
||||
if (extAnis)
|
||||
@@ -1437,7 +1437,7 @@ void OpenGl_Context::init(const Standard_Boolean theIsCoreProfile)
|
||||
GLint aNbColorSamples = 0, aNbDepthSamples = 0;
|
||||
core11fwd->glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &aNbColorSamples);
|
||||
core11fwd->glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, &aNbDepthSamples);
|
||||
myMaxMsaaSamples = Min(aNbColorSamples, aNbDepthSamples);
|
||||
myMaxMsaaSamples = std::min(aNbColorSamples, aNbDepthSamples);
|
||||
}
|
||||
}
|
||||
if (myMaxMsaaSamples <= 1)
|
||||
|
||||
@@ -958,7 +958,7 @@ public: //! @name methods to alter or retrieve current state
|
||||
Standard_ShortReal RenderScale() const { return myRenderScale; }
|
||||
|
||||
//! Return TRUE if rendering scale factor is not 1.
|
||||
Standard_Boolean HasRenderScale() const { return Abs(myRenderScale - 1.0f) > 0.0001f; }
|
||||
Standard_Boolean HasRenderScale() const { return std::abs(myRenderScale - 1.0f) > 0.0001f; }
|
||||
|
||||
//! Rendering scale factor (inverted value).
|
||||
Standard_ShortReal RenderScaleInv() const { return myRenderScaleInv; }
|
||||
@@ -983,7 +983,7 @@ public: //! @name methods to alter or retrieve current state
|
||||
void SetResolutionRatio(const Standard_ShortReal theRatio)
|
||||
{
|
||||
myResolutionRatio = theRatio;
|
||||
myLineWidthScale = Max(1.0f, std::floor(theRatio + 0.5f));
|
||||
myLineWidthScale = (std::max)(1.0f, std::floor(theRatio + 0.5f));
|
||||
}
|
||||
|
||||
//! Return line feater width in pixels.
|
||||
|
||||
@@ -115,7 +115,7 @@ bool OpenGl_Font::createTexture(const Handle(OpenGl_Context)& theCtx)
|
||||
|
||||
myTileSizeY = myFont->GlyphMaxSizeY(true);
|
||||
const Standard_Integer aGlyphsNb =
|
||||
Min(THE_MAX_GLYPHS_PER_TEXTURE, myFont->GlyphsNumber(true) - myLastTileId + 1);
|
||||
std::min(THE_MAX_GLYPHS_PER_TEXTURE, myFont->GlyphsNumber(true) - myLastTileId + 1);
|
||||
const Standard_Integer aMaxTileSizeX = myFont->GlyphMaxSizeX(true);
|
||||
const Standard_Integer aMaxSize = theCtx->MaxTextureSize();
|
||||
const Standard_Integer aTextureSizeX =
|
||||
|
||||
@@ -1219,7 +1219,7 @@ Standard_Boolean OpenGl_FrameBuffer::BufferDump(const Handle(OpenGl_Context)&
|
||||
|
||||
// setup alignment
|
||||
// clang-format off
|
||||
const GLint anAligment = Min (GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL
|
||||
const GLint anAligment = std::min(GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL
|
||||
// clang-format on
|
||||
theGlCtx->core11fwd->glPixelStorei(GL_PACK_ALIGNMENT, anAligment);
|
||||
bool isBatchCopy = !theImage.IsTopDown();
|
||||
|
||||
@@ -55,11 +55,12 @@ bool OpenGl_FrameStats::IsFrameUpdated(Handle(OpenGl_FrameStats)& thePrev) const
|
||||
}
|
||||
// check just a couple of major counters
|
||||
else if (myLastFrameIndex == thePrev->myLastFrameIndex
|
||||
&& Abs(aFrame.FrameRate() - thePrev->myCountersTmp.FrameRate()) <= 0.001
|
||||
&& Abs(aFrame.FrameRateCpu() - thePrev->myCountersTmp.FrameRateCpu()) <= 0.001
|
||||
&& Abs(aFrame.ImmediateFrameRate() - thePrev->myCountersTmp.ImmediateFrameRate())
|
||||
&& std::abs(aFrame.FrameRate() - thePrev->myCountersTmp.FrameRate()) <= 0.001
|
||||
&& std::abs(aFrame.FrameRateCpu() - thePrev->myCountersTmp.FrameRateCpu()) <= 0.001
|
||||
&& std::abs(aFrame.ImmediateFrameRate() - thePrev->myCountersTmp.ImmediateFrameRate())
|
||||
<= 0.001
|
||||
&& Abs(aFrame.ImmediateFrameRateCpu() - thePrev->myCountersTmp.ImmediateFrameRateCpu())
|
||||
&& std::abs(aFrame.ImmediateFrameRateCpu()
|
||||
- thePrev->myCountersTmp.ImmediateFrameRateCpu())
|
||||
<= 0.001
|
||||
&& aFrame[Graphic3d_FrameStatsCounter_NbLayers]
|
||||
== thePrev->myCountersTmp[Graphic3d_FrameStatsCounter_NbLayers]
|
||||
|
||||
@@ -159,12 +159,13 @@ void OpenGl_FrameStatsPrs::updateChart(const Handle(OpenGl_Workspace)& theWorksp
|
||||
++aFrameIter)
|
||||
{
|
||||
const Graphic3d_FrameStatsData& aFrame = aStats->DataFrames().Value(aFrameIter);
|
||||
aMaxDuration = Max(aMaxDuration, aFrame.TimerValue(Graphic3d_FrameStatsTimer_ElapsedFrame));
|
||||
aMaxDuration =
|
||||
std::max(aMaxDuration, aFrame.TimerValue(Graphic3d_FrameStatsTimer_ElapsedFrame));
|
||||
}
|
||||
aMaxDuration = Ceiling(aMaxDuration * 1000.0 * 0.1) * 0.001 * 10.0; // round number
|
||||
// clang-format off
|
||||
aMaxDuration = Max (Min (aMaxDuration, 0.1), 0.005); // limit by 100 ms (10 FPS) and 5 ms (200 FPS)
|
||||
// clang-format on
|
||||
aMaxDuration = std::ceil(aMaxDuration * 1000.0 * 0.1) * 0.001 * 10.0; // round number
|
||||
// clang-format off
|
||||
aMaxDuration = std::max (std::min (aMaxDuration, 0.1), 0.005); // limit by 100 ms (10 FPS) and 5 ms (200 FPS)
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
const Standard_Integer aNbTimers = 4;
|
||||
@@ -261,7 +262,7 @@ void OpenGl_FrameStatsPrs::updateChart(const Handle(OpenGl_Workspace)& theWorksp
|
||||
|
||||
const Standard_Real aBinX1 = anOffset.x() + Standard_Real(aFrameIter) * aBinSize.x();
|
||||
const Standard_Real aBinX2 = aBinX1 + aBinSize.x();
|
||||
const Standard_Real aCurrSizeY = Min(aTimeElapsed / aMaxDuration, 1.2) * aBinSize.y();
|
||||
const Standard_Real aCurrSizeY = std::min(aTimeElapsed / aMaxDuration, 1.2) * aBinSize.y();
|
||||
const Standard_Real aBinY1 =
|
||||
isTopDown ? (anOffset.y() - aCurrY) : (anOffset.y() - aBinSize.y() + aCurrY);
|
||||
const Standard_Real aBinY2 =
|
||||
|
||||
@@ -251,7 +251,7 @@ void OpenGl_Sampler::applySamplerParams(const Handle(OpenGl_Context)& t
|
||||
|
||||
if (theCtx->HasTextureBaseLevel() && (theSampler == NULL || !theSampler->isValidSampler()))
|
||||
{
|
||||
const Standard_Integer aMaxLevel = Min(theMaxMipLevels, theParams->MaxLevel());
|
||||
const Standard_Integer aMaxLevel = std::min(theMaxMipLevels, theParams->MaxLevel());
|
||||
setParameter(theCtx, theSampler, theTarget, GL_TEXTURE_BASE_LEVEL, theParams->BaseLevel());
|
||||
setParameter(theCtx, theSampler, theTarget, GL_TEXTURE_MAX_LEVEL, aMaxLevel);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,9 @@ Standard_ShortReal OpenGl_TriangleSet::Center(const Standard_Integer theIndex,
|
||||
const Standard_ShortReal aVertex2 =
|
||||
BVH::VecComp<Standard_ShortReal, 3>::Get(Vertices[aTriangle.z()], theAxis);
|
||||
|
||||
return (Min(Min(aVertex0, aVertex1), aVertex2) + Max(Max(aVertex0, aVertex1), aVertex2)) * 0.5f;
|
||||
return (std::min(std::min(aVertex0, aVertex1), aVertex2)
|
||||
+ std::max(std::max(aVertex0, aVertex1), aVertex2))
|
||||
* 0.5f;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -233,7 +235,7 @@ Standard_Boolean OpenGl_RaytraceGeometry::ProcessAcceleration()
|
||||
}
|
||||
}
|
||||
|
||||
myBotLevelTreeDepth = Max(myBotLevelTreeDepth, aTriangleSet->QuadBVH()->Depth());
|
||||
myBotLevelTreeDepth = std::max(myBotLevelTreeDepth, aTriangleSet->QuadBVH()->Depth());
|
||||
}
|
||||
|
||||
#ifdef RAY_TRACE_PRINT_INFO
|
||||
|
||||
@@ -586,7 +586,7 @@ void OpenGl_ShaderManager::pushLightSourceState(
|
||||
/ (float)myLightSourceState.ShadowMaps()->First()->Texture()->SizeX(),
|
||||
myLightSourceState.ShadowMaps()->First()->ShadowMapBias());
|
||||
const Standard_Integer aNbShadows =
|
||||
Min(theProgram->NbShadowMaps(), myLightSourceState.ShadowMaps()->Size());
|
||||
std::min(theProgram->NbShadowMaps(), myLightSourceState.ShadowMaps()->Size());
|
||||
for (Standard_Integer aShadowIter = 0; aShadowIter < aNbShadows; ++aShadowIter)
|
||||
{
|
||||
const Handle(OpenGl_ShadowMap)& aShadow =
|
||||
@@ -835,7 +835,7 @@ void OpenGl_ShaderManager::pushClippingState(const Handle(OpenGl_ShaderProgram)&
|
||||
|
||||
const Standard_Integer aNbClipPlanesMax = theProgram->NbClipPlanesMax();
|
||||
const Standard_Integer aNbPlanes =
|
||||
Min(myContext->Clipping().NbClippingOrCappingOn(), aNbClipPlanesMax);
|
||||
std::min(myContext->Clipping().NbClippingOrCappingOn(), aNbClipPlanesMax);
|
||||
if (aNbPlanes < 1)
|
||||
{
|
||||
theProgram->SetUniform(myContext, theProgram->GetStateLocation(OpenGl_OCC_CLIP_PLANE_COUNT), 0);
|
||||
@@ -1143,7 +1143,7 @@ Standard_Boolean OpenGl_ShaderManager::BindFboBlitProgram(Standard_Integer theNb
|
||||
{
|
||||
NCollection_Array1<Handle(OpenGl_ShaderProgram)>& aList =
|
||||
myBlitPrograms[theIsFallback_sRGB ? 1 : 0];
|
||||
Standard_Integer aNbSamples = Max(theNbSamples, 1);
|
||||
Standard_Integer aNbSamples = std::max(theNbSamples, 1);
|
||||
if (aNbSamples > aList.Upper())
|
||||
{
|
||||
aList.Resize(1, aNbSamples, true);
|
||||
|
||||
@@ -668,7 +668,7 @@ Standard_Boolean OpenGl_ShaderProgram::Initialize(const Handle(OpenGl_Context)&
|
||||
|
||||
const TCollection_AsciiString aSamplerNamePrefix("occSampler");
|
||||
const Standard_Integer aNbUnitsMax =
|
||||
Max(theCtx->MaxCombinedTextureUnits(), Graphic3d_TextureUnit_NB);
|
||||
std::max(theCtx->MaxCombinedTextureUnits(), static_cast<int>(Graphic3d_TextureUnit_NB));
|
||||
for (GLint aUnitIter = 0; aUnitIter < aNbUnitsMax; ++aUnitIter)
|
||||
{
|
||||
const TCollection_AsciiString aName = aSamplerNamePrefix + aUnitIter;
|
||||
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
void Set(Graphic3d_RenderTransparentMethod theMode, const float theDepthFactor)
|
||||
{
|
||||
myOitMode = theMode;
|
||||
myDepthFactor = static_cast<float>(Max(0.f, Min(1.f, theDepthFactor)));
|
||||
myDepthFactor = static_cast<float>((std::max)(0.f, (std::min)(1.f, theDepthFactor)));
|
||||
}
|
||||
|
||||
//! Returns flag indicating whether writing of output for OIT processing
|
||||
|
||||
@@ -115,7 +115,7 @@ bool OpenGl_ShadowMap::UpdateCamera(const Graphic3d_CView& theView, const gp_XYZ
|
||||
if (myShadowCamera->FitMinMax(aMinMaxBox, 10.0 * Precision::Confusion(), false))
|
||||
{
|
||||
// clang-format off
|
||||
myShadowCamera->SetScale (Max (myShadowCamera->ViewDimensions().X() * 1.1, myShadowCamera->ViewDimensions().Y() * 1.1)); // add margin
|
||||
myShadowCamera->SetScale (std::max (myShadowCamera->ViewDimensions().X() * 1.1, myShadowCamera->ViewDimensions().Y() * 1.1)); // add margin
|
||||
// clang-format on
|
||||
}
|
||||
myShadowCamera->ZFitAll(1.0, aMinMaxBox, aGraphicBox);
|
||||
|
||||
@@ -448,7 +448,7 @@ void OpenGl_Structure::Render(const Handle(OpenGl_Workspace)& theWorkspace) cons
|
||||
if (aCtx->core11ffp != NULL && !myTrsf.IsNull())
|
||||
{
|
||||
const Standard_Real aScale = myTrsf->Trsf().ScaleFactor();
|
||||
if (Abs(aScale - 1.0) > Precision::Confusion())
|
||||
if (std::abs(aScale - 1.0) > Precision::Confusion())
|
||||
{
|
||||
aCtx->SetGlNormalizeEnabled(Standard_True);
|
||||
}
|
||||
@@ -702,7 +702,7 @@ void OpenGl_Structure::applyPersistence(const Handle(OpenGl_Context)& t
|
||||
if (!theCtx->IsGlNormalizeEnabled() && theCtx->core11ffp != NULL)
|
||||
{
|
||||
const Standard_Real aScale = Graphic3d_TransformUtils::ScaleFactor(aWorldView);
|
||||
if (Abs(aScale - 1.0) > Precision::Confusion())
|
||||
if (std::abs(aScale - 1.0) > Precision::Confusion())
|
||||
{
|
||||
theCtx->SetGlNormalizeEnabled(true);
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ void OpenGl_Text::StringSize(const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
else if (aCharThis == '\x0A') // LF (line feed, new line)
|
||||
{
|
||||
theWidth = Max(theWidth, aWidth);
|
||||
theWidth = std::max(theWidth, aWidth);
|
||||
aWidth = 0.0f;
|
||||
continue;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ void OpenGl_Text::StringSize(const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
aWidth += aFont->FTFont()->AdvanceX(aCharThis, aCharNext);
|
||||
}
|
||||
theWidth = Max(theWidth, aWidth);
|
||||
theWidth = std::max(theWidth, aWidth);
|
||||
|
||||
const Handle(OpenGl_Context)& aCtx = theCtx;
|
||||
aFont.Nullify();
|
||||
@@ -405,8 +405,8 @@ void OpenGl_Text::setupMatrix(const Handle(OpenGl_Context)& theCtx,
|
||||
// Note that for better readability we could also try aligning freely rotated in 3D text
|
||||
// (myHasPlane), when camera orientation co-aligned with horizontal text orientation, but this
|
||||
// might look awkward while rotating camera.
|
||||
aWinXYZ.x() = Floor(aWinXYZ.x());
|
||||
aWinXYZ.y() = Floor(aWinXYZ.y());
|
||||
aWinXYZ.x() = std::floor(aWinXYZ.x());
|
||||
aWinXYZ.y() = std::floor(aWinXYZ.y());
|
||||
}
|
||||
Graphic3d_TransformUtils::UnProject<Standard_Real>(aWinXYZ.x(),
|
||||
aWinXYZ.y(),
|
||||
|
||||
@@ -353,7 +353,7 @@ bool OpenGl_Texture::Init(const Handle(OpenGl_Context)& theCtx,
|
||||
if (aDataPtr != NULL)
|
||||
{
|
||||
// clang-format off
|
||||
const GLint anAligment = Min ((GLint )theImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes
|
||||
const GLint anAligment = std::min((GLint )theImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes
|
||||
// clang-format on
|
||||
theCtx->core11fwd->glPixelStorei(GL_UNPACK_ALIGNMENT, anAligment);
|
||||
const GLint anExtraBytes = GLint(theImage->RowExtraBytes());
|
||||
@@ -671,7 +671,7 @@ bool OpenGl_Texture::GenerateMipmaps(const Handle(OpenGl_Context)& theCtx)
|
||||
Bind(theCtx);
|
||||
if (theCtx->HasTextureBaseLevel() && !mySampler->isValidSampler())
|
||||
{
|
||||
const Standard_Integer aMaxLevel = Min(myMaxMipLevel, mySampler->Parameters()->MaxLevel());
|
||||
const Standard_Integer aMaxLevel = std::min(myMaxMipLevel, mySampler->Parameters()->MaxLevel());
|
||||
mySampler->SetParameter(theCtx, myTarget, GL_TEXTURE_MAX_LEVEL, aMaxLevel);
|
||||
}
|
||||
theCtx->arbFBO->glGenerateMipmap(myTarget);
|
||||
@@ -847,7 +847,7 @@ bool OpenGl_Texture::InitCompressed(const Handle(OpenGl_Context)& theCtx,
|
||||
mySizedFormat = aFormat.Internal();
|
||||
myIsTopDown = theImage.IsTopDown();
|
||||
mySize.SetValues(theImage.SizeX(), theImage.SizeY(), 1);
|
||||
myMaxMipLevel = Max(theImage.MipMaps().Size() - 1, 0);
|
||||
myMaxMipLevel = std::max(theImage.MipMaps().Size() - 1, 0);
|
||||
if (myMaxMipLevel > 0 && !theImage.IsCompleteMipMapSet())
|
||||
{
|
||||
const Graphic3d_Vec2i aMipSize = computeSmallestMipMapSize(mySize.xy(), myMaxMipLevel);
|
||||
@@ -1026,8 +1026,8 @@ bool OpenGl_Texture::InitRectangle(const Handle(OpenGl_Context)& theCtx,
|
||||
myNbSamples = 1;
|
||||
myMaxMipLevel = 0;
|
||||
|
||||
const GLsizei aSizeX = Min(theCtx->MaxTextureSize(), theSizeX);
|
||||
const GLsizei aSizeY = Min(theCtx->MaxTextureSize(), theSizeY);
|
||||
const GLsizei aSizeX = std::min(theCtx->MaxTextureSize(), theSizeX);
|
||||
const GLsizei aSizeY = std::min(theCtx->MaxTextureSize(), theSizeY);
|
||||
|
||||
Bind(theCtx);
|
||||
applyDefaultSamplerParams(theCtx);
|
||||
@@ -1237,7 +1237,7 @@ bool OpenGl_Texture::InitCubeMap(const Handle(OpenGl_Context)& theCtx,
|
||||
theToGenMipmap = false;
|
||||
theSize = aCompImage->SizeX();
|
||||
theFormat = aCompImage->BaseFormat();
|
||||
myMaxMipLevel = Max(aCompImage->MipMaps().Size() - 1, 0);
|
||||
myMaxMipLevel = std::max(aCompImage->MipMaps().Size() - 1, 0);
|
||||
if (myMaxMipLevel > 0 && !aCompImage->IsCompleteMipMapSet())
|
||||
{
|
||||
const Graphic3d_Vec2i aMipSize =
|
||||
@@ -1413,7 +1413,7 @@ bool OpenGl_Texture::InitCubeMap(const Handle(OpenGl_Context)& theCtx,
|
||||
if (!anImage.IsNull())
|
||||
{
|
||||
// clang-format off
|
||||
const GLint anAligment = Min ((GLint)anImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes
|
||||
const GLint anAligment = std::min((GLint)anImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes
|
||||
// clang-format on
|
||||
const GLint anExtraBytes = GLint(anImage->RowExtraBytes());
|
||||
const GLint aPixelsWidth = GLint(anImage->SizeRowBytes() / anImage->SizePixelBytes());
|
||||
@@ -1435,7 +1435,7 @@ bool OpenGl_Texture::InitCubeMap(const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
anImage = aCopyImage;
|
||||
// clang-format off
|
||||
const GLint anAligment2 = Min((GLint)anImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes
|
||||
const GLint anAligment2 = std::min((GLint)anImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes
|
||||
// clang-format on
|
||||
theCtx->core11fwd->glPixelStorei(GL_UNPACK_ALIGNMENT, anAligment2);
|
||||
}
|
||||
@@ -1654,7 +1654,7 @@ bool OpenGl_Texture::ImageDump(Image_PixMap& theImage,
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
const GLint anAligment = Min (GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL
|
||||
const GLint anAligment = std::min(GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL
|
||||
// clang-format on
|
||||
theCtx->core11fwd->glPixelStorei(GL_PACK_ALIGNMENT, anAligment);
|
||||
if (theCtx->hasPackRowLength)
|
||||
|
||||
@@ -34,13 +34,13 @@ public:
|
||||
{
|
||||
if (!theSet1.IsNull() && !theSet1->IsEmpty())
|
||||
{
|
||||
myUnitLower = Min(myUnitLower, theSet1->FirstUnit());
|
||||
myUnitUpper = Max(myUnitUpper, theSet1->LastUnit());
|
||||
myUnitLower = (std::min)(myUnitLower, static_cast<int>(theSet1->FirstUnit()));
|
||||
myUnitUpper = (std::max)(myUnitUpper, static_cast<int>(theSet1->LastUnit()));
|
||||
}
|
||||
if (!theSet2.IsNull() && !theSet2->IsEmpty())
|
||||
{
|
||||
myUnitLower = Min(myUnitLower, theSet2->FirstUnit());
|
||||
myUnitUpper = Max(myUnitUpper, theSet2->LastUnit());
|
||||
myUnitLower = (std::min)(myUnitLower, static_cast<int>(theSet2->FirstUnit()));
|
||||
myUnitUpper = (std::max)(myUnitUpper, static_cast<int>(theSet2->LastUnit()));
|
||||
}
|
||||
myUnitCurrent = myUnitLower;
|
||||
myTexture1 =
|
||||
|
||||
@@ -158,11 +158,11 @@ void OpenGl_TileSampler::SetSize(const Graphic3d_RenderingParams& theParams,
|
||||
|
||||
myViewSize = theSize;
|
||||
|
||||
const int aTileSize = Max(theParams.RayTracingTileSize, 1);
|
||||
const int aTileSize = std::max(theParams.RayTracingTileSize, 1);
|
||||
const int aNbTilesX =
|
||||
Max(1, static_cast<int>(ceilf(static_cast<float>(theSize.x()) / aTileSize)));
|
||||
std::max(1, static_cast<int>(ceilf(static_cast<float>(theSize.x()) / aTileSize)));
|
||||
const int aNbTilesY =
|
||||
Max(1, static_cast<int>(ceilf(static_cast<float>(theSize.y()) / aTileSize)));
|
||||
std::max(1, static_cast<int>(ceilf(static_cast<float>(theSize.y()) / aTileSize)));
|
||||
if (myTileSize != aTileSize || (int)myTiles.SizeX != aNbTilesX || (int)myTiles.SizeY != aNbTilesY)
|
||||
{
|
||||
myTileSize = aTileSize;
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
{
|
||||
for (Standard_Size aColIter = 0; aColIter < myTiles.SizeX; ++aColIter)
|
||||
{
|
||||
aNbSamples = Max(aNbSamples, myTiles.Value(aRowIter, aColIter));
|
||||
aNbSamples = (std::max)(aNbSamples, static_cast<int>(myTiles.Value(aRowIter, aColIter)));
|
||||
}
|
||||
}
|
||||
return aNbSamples;
|
||||
@@ -125,8 +125,8 @@ protected:
|
||||
//! Returns number of pixels in the given tile.
|
||||
int tileArea(int theX, int theY) const
|
||||
{
|
||||
const int aSizeX = Min(myTileSize, myViewSize.x() - theX * myTileSize);
|
||||
const int aSizeY = Min(myTileSize, myViewSize.y() - theY * myTileSize);
|
||||
const int aSizeX = (std::min)(myTileSize, myViewSize.x() - theX * myTileSize);
|
||||
const int aSizeY = (std::min)(myTileSize, myViewSize.y() - theY * myTileSize);
|
||||
return aSizeX * aSizeY;
|
||||
}
|
||||
|
||||
|
||||
@@ -598,7 +598,7 @@ Standard_Boolean OpenGl_View::ShadowMapDump(Image_PixMap& theIm
|
||||
}
|
||||
// Setup alignment.
|
||||
// clang-format off
|
||||
const GLint anAligment = Min (GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL.
|
||||
const GLint anAligment = std::min(GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL.
|
||||
// clang-format on
|
||||
aGlCtx->core11fwd->glPixelStorei(GL_PACK_ALIGNMENT, anAligment);
|
||||
// Read data.
|
||||
@@ -841,7 +841,7 @@ Standard_Integer OpenGl_View::ZLayerMax() const
|
||||
aLayerIter.More();
|
||||
aLayerIter.Next())
|
||||
{
|
||||
aLayerMax = Max(aLayerMax, aLayerIter.Value()->LayerId());
|
||||
aLayerMax = std::max(aLayerMax, aLayerIter.Value()->LayerId());
|
||||
}
|
||||
return aLayerMax;
|
||||
}
|
||||
@@ -1192,7 +1192,7 @@ bool OpenGl_View::prepareFrameBuffers(Graphic3d_Camera::Projection& theProj)
|
||||
// determine multisampling parameters
|
||||
Standard_Integer aNbSamples =
|
||||
!myToDisableMSAA && aSizeX == aRendSize.x()
|
||||
? Max(Min(myRenderParams.NbMsaaSamples, aCtx->MaxMsaaSamples()), 0)
|
||||
? std::max(std::min(myRenderParams.NbMsaaSamples, aCtx->MaxMsaaSamples()), 0)
|
||||
: 0;
|
||||
if (aNbSamples != 0)
|
||||
{
|
||||
|
||||
@@ -711,10 +711,10 @@ protected: //! @name data types related to ray-tracing
|
||||
};
|
||||
|
||||
//! Default ray-tracing depth.
|
||||
static const Standard_Integer THE_DEFAULT_NB_BOUNCES = 3;
|
||||
static constexpr Standard_Integer THE_DEFAULT_NB_BOUNCES = 3;
|
||||
|
||||
//! Default size of traversal stack.
|
||||
static const Standard_Integer THE_DEFAULT_STACK_SIZE = 10;
|
||||
static constexpr Standard_Integer THE_DEFAULT_STACK_SIZE = 10;
|
||||
|
||||
//! Compile-time ray-tracing parameters.
|
||||
struct RaytracingParams
|
||||
|
||||
@@ -239,7 +239,7 @@ Standard_Boolean OpenGl_View::updateRaytraceGeometry(const RaytraceUpdateMode
|
||||
|
||||
const BVH_Vec3f aSize = myRaytraceGeometry.Box().Size();
|
||||
|
||||
myRaytraceSceneEpsilon = Max(1.0e-6f, 1.0e-4f * aSize.Modulus());
|
||||
myRaytraceSceneEpsilon = std::max(1.0e-6f, 1.0e-4f * aSize.Modulus());
|
||||
|
||||
return uploadRaytraceData(theGlContext);
|
||||
}
|
||||
@@ -392,9 +392,10 @@ OpenGl_RaytraceMaterial OpenGl_View::convertMaterial(const OpenGl_Aspects*
|
||||
{
|
||||
// interior color is always ignored for Specular
|
||||
aResMat.Specular.SetValues(aSrcSpe, aShine);
|
||||
const Standard_ShortReal aMaxRefl = Max(
|
||||
aResMat.Diffuse.x() + aResMat.Specular.x(),
|
||||
Max(aResMat.Diffuse.y() + aResMat.Specular.y(), aResMat.Diffuse.z() + aResMat.Specular.z()));
|
||||
const Standard_ShortReal aMaxRefl =
|
||||
std::max(aResMat.Diffuse.x() + aResMat.Specular.x(),
|
||||
std::max(aResMat.Diffuse.y() + aResMat.Specular.y(),
|
||||
aResMat.Diffuse.z() + aResMat.Specular.z()));
|
||||
const Standard_ShortReal aReflectionScale = 0.75f / aMaxRefl;
|
||||
aResMat.Reflection.SetValues(aSrcSpe * aReflectionScale, 0.0f);
|
||||
}
|
||||
@@ -1409,7 +1410,7 @@ Standard_Boolean OpenGl_View::initRaytraceResources(const Standard_Integer
|
||||
|
||||
if (myRaytraceParameters.StackSize < aRequiredStackSize)
|
||||
{
|
||||
myRaytraceParameters.StackSize = Max(aRequiredStackSize, THE_DEFAULT_STACK_SIZE);
|
||||
myRaytraceParameters.StackSize = std::max(aRequiredStackSize, THE_DEFAULT_STACK_SIZE);
|
||||
|
||||
aToRebuildShaders = Standard_True;
|
||||
}
|
||||
@@ -1419,7 +1420,7 @@ Standard_Boolean OpenGl_View::initRaytraceResources(const Standard_Integer
|
||||
{
|
||||
if (myRaytraceParameters.StackSize > THE_DEFAULT_STACK_SIZE)
|
||||
{
|
||||
myRaytraceParameters.StackSize = Max(aRequiredStackSize, THE_DEFAULT_STACK_SIZE);
|
||||
myRaytraceParameters.StackSize = std::max(aRequiredStackSize, THE_DEFAULT_STACK_SIZE);
|
||||
aToRebuildShaders = Standard_True;
|
||||
}
|
||||
}
|
||||
@@ -1585,8 +1586,8 @@ Standard_Boolean OpenGl_View::initRaytraceResources(const Standard_Integer
|
||||
if (myIsRaytraceDataValid)
|
||||
{
|
||||
myRaytraceParameters.StackSize =
|
||||
Max(THE_DEFAULT_STACK_SIZE,
|
||||
myRaytraceGeometry.TopLevelTreeDepth() + myRaytraceGeometry.BotLevelTreeDepth());
|
||||
std::max(THE_DEFAULT_STACK_SIZE,
|
||||
myRaytraceGeometry.TopLevelTreeDepth() + myRaytraceGeometry.BotLevelTreeDepth());
|
||||
}
|
||||
|
||||
const TCollection_AsciiString aPrefixString = generateShaderPrefix(theGlContext);
|
||||
@@ -2670,13 +2671,13 @@ Standard_Boolean OpenGl_View::updateRaytraceLightSources(const OpenGl_Mat4& theI
|
||||
1.0f);
|
||||
|
||||
// store smoothing radius in W-component
|
||||
aEmission.w() = Max(aLight.Smoothness(), 0.f);
|
||||
aEmission.w() = std::max(aLight.Smoothness(), 0.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// store cosine of smoothing angle in W-component
|
||||
aEmission.w() =
|
||||
cosf(Min(Max(aLight.Smoothness(), 0.f), static_cast<Standard_ShortReal>(M_PI / 2.0)));
|
||||
aEmission.w() = cosf(
|
||||
std::min(std::max(aLight.Smoothness(), 0.f), static_cast<Standard_ShortReal>(M_PI / 2.0)));
|
||||
}
|
||||
|
||||
if (aLight.IsHeadlight())
|
||||
|
||||
@@ -75,15 +75,15 @@ void Aspect_CircularGrid::Compute(const Standard_Real X,
|
||||
|
||||
Standard_Real xo = XOrigin();
|
||||
Standard_Real yo = YOrigin();
|
||||
Standard_Real d = Sqrt((xo - X) * (xo - X) + (yo - Y) * (yo - Y));
|
||||
Standard_Real d = std::sqrt((xo - X) * (xo - X) + (yo - Y) * (yo - Y));
|
||||
Standard_Integer n = (Standard_Integer)(d / myRadiusStep + 0.5);
|
||||
Standard_Real radius = Standard_Real(n) * myRadiusStep;
|
||||
Standard_Real cosinus = (X - xo) / d;
|
||||
Standard_Real a = ACos(cosinus);
|
||||
Standard_Real a = std::acos(cosinus);
|
||||
Standard_Real ra = RotationAngle();
|
||||
if (Y < yo)
|
||||
a = 2 * M_PI - a;
|
||||
n = (Standard_Integer)((a - ra) / myAlpha + Sign(0.5, a - ra));
|
||||
n = (Standard_Integer)((a - ra) / myAlpha + std::copysign(0.5, a - ra));
|
||||
|
||||
Standard_Real cs = 0, sn = 0;
|
||||
Standard_Boolean done = Standard_False;
|
||||
@@ -146,8 +146,8 @@ void Aspect_CircularGrid::Compute(const Standard_Real X,
|
||||
if (!done)
|
||||
{
|
||||
Standard_Real ang = ra + Standard_Real(n) * myAlpha;
|
||||
cs = Cos(ang);
|
||||
sn = Sin(ang);
|
||||
cs = std::cos(ang);
|
||||
sn = std::sin(ang);
|
||||
}
|
||||
gridX = xo + cs * radius;
|
||||
gridY = yo + sn * radius;
|
||||
@@ -166,8 +166,8 @@ Standard_Integer Aspect_CircularGrid::DivisionNumber() const
|
||||
void Aspect_CircularGrid::Init()
|
||||
{
|
||||
myAlpha = M_PI / Standard_Real(myDivisionNumber);
|
||||
myA1 = Cos(myAlpha);
|
||||
myB1 = Sin(myAlpha);
|
||||
myA1 = std::cos(myAlpha);
|
||||
myB1 = std::sin(myAlpha);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
@@ -869,7 +869,7 @@ void Aspect_OpenVRSession::updateProjectionFrustums()
|
||||
NCollection_Vec4<float>(-aFrustL.Left, aFrustL.Right, -aFrustR.Left, aFrustR.Right).maxComp(),
|
||||
NCollection_Vec4<float>(-aFrustL.Top, aFrustL.Bottom, -aFrustR.Top, aFrustR.Bottom).maxComp());
|
||||
myAspect = aTanHalfFov.x() / aTanHalfFov.y();
|
||||
myFieldOfView = 2.0 * ATan(aTanHalfFov.y()) * 180.0 / M_PI;
|
||||
myFieldOfView = 2.0 * std::atan(aTanHalfFov.y()) * 180.0 / M_PI;
|
||||
|
||||
// Intra-ocular Distance can be changed in runtime
|
||||
// const vr::HmdMatrix34_t aLeftToHead = myContext->System->GetEyeToHeadTransform (vr::Eye_Left);
|
||||
|
||||
@@ -95,10 +95,10 @@ void Aspect_RectangularGrid::Compute(const Standard_Real X,
|
||||
{
|
||||
Standard_Real D1 = b1 * X - a1 * Y - c1;
|
||||
Standard_Real D2 = b2 * X - a2 * Y - c2;
|
||||
Standard_Integer n1 = Standard_Integer(Abs(D1) / myXStep + 0.5);
|
||||
Standard_Integer n2 = Standard_Integer(Abs(D2) / myYStep + 0.5);
|
||||
Standard_Real offset1 = c1 + Standard_Real(n1) * Sign(myXStep, D1);
|
||||
Standard_Real offset2 = c2 + Standard_Real(n2) * Sign(myYStep, D2);
|
||||
Standard_Integer n1 = Standard_Integer(std::abs(D1) / myXStep + 0.5);
|
||||
Standard_Integer n2 = Standard_Integer(std::abs(D2) / myYStep + 0.5);
|
||||
Standard_Real offset1 = c1 + Standard_Real(n1) * std::copysign(myXStep, D1);
|
||||
Standard_Real offset2 = c2 + Standard_Real(n2) * std::copysign(myYStep, D2);
|
||||
Standard_Real Delta = a1 * b2 - b1 * a2;
|
||||
gridX = (offset2 * a1 - offset1 * a2) / Delta;
|
||||
gridY = (offset2 * b1 - offset1 * b2) / Delta;
|
||||
@@ -140,8 +140,8 @@ void Aspect_RectangularGrid::Init()
|
||||
Standard_Real angle2 = mySecondAngle + RotationAngle();
|
||||
if (angle1 != 0.)
|
||||
{
|
||||
a1 = -Sin(angle1);
|
||||
b1 = Cos(angle1);
|
||||
a1 = -std::sin(angle1);
|
||||
b1 = std::cos(angle1);
|
||||
c1 = XOrigin() * b1 - YOrigin() * a1;
|
||||
}
|
||||
else
|
||||
@@ -154,8 +154,8 @@ void Aspect_RectangularGrid::Init()
|
||||
if (angle2 != 0.)
|
||||
{
|
||||
angle2 += M_PI / 2.;
|
||||
a2 = -Sin(angle2);
|
||||
b2 = Cos(angle2);
|
||||
a2 = -std::sin(angle2);
|
||||
b2 = std::cos(angle2);
|
||||
c2 = XOrigin() * b2 - YOrigin() * a2;
|
||||
}
|
||||
else
|
||||
@@ -170,7 +170,9 @@ void Aspect_RectangularGrid::Init()
|
||||
Standard_Boolean Aspect_RectangularGrid::CheckAngle(const Standard_Real alpha,
|
||||
const Standard_Real beta) const
|
||||
{
|
||||
return (Abs(Sin(alpha) * Cos(beta + M_PI / 2.) - Cos(alpha) * Sin(beta + M_PI / 2.)) != 0);
|
||||
return (std::abs(std::sin(alpha) * std::cos(beta + M_PI / 2.)
|
||||
- std::cos(alpha) * std::sin(beta + M_PI / 2.))
|
||||
!= 0);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
@@ -97,7 +97,7 @@ void Aspect_VKeySet::KeyFromAxis(Aspect_VKey theNegative,
|
||||
const Aspect_VKey aKeyDown = thePressure > 0 ? thePositive : theNegative;
|
||||
const Aspect_VKey aKeyUp = thePressure < 0 ? thePositive : theNegative;
|
||||
|
||||
KeyDown_Unlocked(aKeyDown, theTime, Abs(thePressure));
|
||||
KeyDown_Unlocked(aKeyDown, theTime, std::abs(thePressure));
|
||||
if (myKeys[aKeyUp].KStatus == KeyStatus_Pressed)
|
||||
{
|
||||
KeyUp_Unlocked(aKeyUp, theTime);
|
||||
|
||||
@@ -174,12 +174,12 @@ bool Font_FTFont::Init(const Handle(NCollection_Buffer)& theData,
|
||||
const double THE_SHEAR_ANGLE = 10.0 * M_PI / 180.0;
|
||||
|
||||
FT_Matrix aMat;
|
||||
aMat.xx = FT_Fixed(Cos(-THE_SHEAR_ANGLE) * (1 << 16));
|
||||
aMat.xx = FT_Fixed(std::cos(-THE_SHEAR_ANGLE) * (1 << 16));
|
||||
aMat.xy = 0;
|
||||
aMat.yx = 0;
|
||||
aMat.yy = aMat.xx;
|
||||
|
||||
FT_Fixed aFactor = FT_Fixed(Tan(THE_SHEAR_ANGLE) * (1 << 16));
|
||||
FT_Fixed aFactor = FT_Fixed(std::tan(THE_SHEAR_ANGLE) * (1 << 16));
|
||||
aMat.xy += FT_MulFix(aFactor, aMat.xx);
|
||||
|
||||
FT_Set_Transform(myFTFace, &aMat, 0);
|
||||
@@ -408,7 +408,7 @@ bool Font_FTFont::RenderGlyph(const Standard_Utf32Char theUChar)
|
||||
aBitmap.buffer,
|
||||
aBitmap.width,
|
||||
aBitmap.rows,
|
||||
Abs(aBitmap.pitch)))
|
||||
std::abs(aBitmap.pitch)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -111,8 +111,8 @@ void Font_TextFormatter::Append(const NCollection_String& theString, Font_FTFont
|
||||
return;
|
||||
}
|
||||
|
||||
myAscender = Max(myAscender, theFont.Ascender());
|
||||
myLineSpacing = Max(myLineSpacing, theFont.LineSpacing());
|
||||
myAscender = std::max(myAscender, theFont.Ascender());
|
||||
myLineSpacing = std::max(myLineSpacing, theFont.LineSpacing());
|
||||
myString += theString;
|
||||
|
||||
int aSymbolsCounter = 0; // special counter to process tabulation symbols
|
||||
@@ -151,7 +151,7 @@ void Font_TextFormatter::Append(const NCollection_String& theString, Font_FTFont
|
||||
++aSymbolsCounter;
|
||||
myCorners.Append(myPen);
|
||||
myPen.x() += anAdvanceX;
|
||||
myMaxSymbolWidth = Max(myMaxSymbolWidth, anAdvanceX);
|
||||
myMaxSymbolWidth = std::max(myMaxSymbolWidth, anAdvanceX);
|
||||
}
|
||||
myLastSymbolWidth = myPen.x() - myCorners.Last().x();
|
||||
}
|
||||
@@ -222,7 +222,7 @@ void Font_TextFormatter::Format()
|
||||
if (HasWrapping())
|
||||
{
|
||||
// it is not possible to wrap less than symbol width
|
||||
aMaxLineWidth = Max(aMaxLineWidth, MaximumSymbolWidth());
|
||||
aMaxLineWidth = std::max(aMaxLineWidth, MaximumSymbolWidth());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -234,10 +234,10 @@ void Font_TextFormatter::Format()
|
||||
{
|
||||
for (int aLineIt = 0; aLineIt < myNewLines.Size(); aLineIt++)
|
||||
{
|
||||
aMaxLineWidth = Max(aMaxLineWidth, LineWidth(aLineIt));
|
||||
aMaxLineWidth = std::max(aMaxLineWidth, LineWidth(aLineIt));
|
||||
}
|
||||
// clang-format off
|
||||
aMaxLineWidth = Max (aMaxLineWidth, LineWidth (myNewLines.Size())); // processing the last line also
|
||||
aMaxLineWidth = std::max(aMaxLineWidth, LineWidth (myNewLines.Size())); // processing the last line also
|
||||
// clang-format on
|
||||
}
|
||||
}
|
||||
@@ -336,7 +336,7 @@ Standard_Boolean Font_TextFormatter::GlyphBoundingBox(const Standard_Integer the
|
||||
}
|
||||
|
||||
const NCollection_Vec2<Standard_ShortReal>& aNextLeftCorner = BottomLeft(theIndex + 1);
|
||||
if (Abs(aLeftCorner.y() - aNextLeftCorner.y()) < Precision::Confusion()) // in the same row
|
||||
if (std::abs(aLeftCorner.y() - aNextLeftCorner.y()) < Precision::Confusion()) // in the same row
|
||||
{
|
||||
theBndBox.Right = aNextLeftCorner.x();
|
||||
}
|
||||
@@ -371,7 +371,7 @@ Standard_Boolean Font_TextFormatter::IsLFSymbol(const Standard_Integer theIndex)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Abs(aBndBox.Right - aBndBox.Left) < Precision::Confusion();
|
||||
return std::abs(aBndBox.Right - aBndBox.Left) < Precision::Confusion();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@@ -417,7 +417,7 @@ Standard_Integer Font_TextFormatter::LineIndex(const Standard_Integer theIndex)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (Standard_Integer)Abs((BottomLeft(theIndex).y() + myAscender) / myLineSpacing);
|
||||
return (Standard_Integer)std::abs((BottomLeft(theIndex).y() + myAscender) / myLineSpacing);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
@@ -192,12 +192,12 @@ TEST(Graphic3d_BndBox3dTest, TransformationRotation)
|
||||
|
||||
Standard_Real aPrecision = Precision::Confusion();
|
||||
|
||||
EXPECT_TRUE(Abs(aCornerMin.x() - -1) < aPrecision) << "Xmin should be rotated";
|
||||
EXPECT_TRUE(Abs(aCornerMin.y() - 1) < aPrecision) << "Ymin should be rotated";
|
||||
EXPECT_TRUE(Abs(aCornerMin.z() - 0) < aPrecision) << "Zmin should remain unchanged";
|
||||
EXPECT_TRUE(Abs(aCornerMax.x() - 0) < aPrecision) << "Xmax should be rotated";
|
||||
EXPECT_TRUE(Abs(aCornerMax.y() - 2) < aPrecision) << "Ymax should be rotated";
|
||||
EXPECT_TRUE(Abs(aCornerMax.z() - 1) < aPrecision) << "Zmax should remain unchanged";
|
||||
EXPECT_TRUE(std::abs(aCornerMin.x() - -1) < aPrecision) << "Xmin should be rotated";
|
||||
EXPECT_TRUE(std::abs(aCornerMin.y() - 1) < aPrecision) << "Ymin should be rotated";
|
||||
EXPECT_TRUE(std::abs(aCornerMin.z() - 0) < aPrecision) << "Zmin should remain unchanged";
|
||||
EXPECT_TRUE(std::abs(aCornerMax.x() - 0) < aPrecision) << "Xmax should be rotated";
|
||||
EXPECT_TRUE(std::abs(aCornerMax.y() - 2) < aPrecision) << "Ymax should be rotated";
|
||||
EXPECT_TRUE(std::abs(aCornerMax.z() - 1) < aPrecision) << "Zmax should remain unchanged";
|
||||
}
|
||||
|
||||
TEST(Graphic3d_BndBox3dTest, TransformationComposed)
|
||||
@@ -226,17 +226,17 @@ TEST(Graphic3d_BndBox3dTest, TransformationComposed)
|
||||
Graphic3d_Vec3d(-45.09248805040103, 87.9443412035472, -20.487612688573407);
|
||||
|
||||
Standard_Real aPrecision = 0.00001; // Acceptable error for this test case
|
||||
EXPECT_TRUE(Abs(aResultCornerMin.x() - anExpectedCornerMin.x()) < aPrecision)
|
||||
EXPECT_TRUE(std::abs(aResultCornerMin.x() - anExpectedCornerMin.x()) < aPrecision)
|
||||
<< "Xmin should match expected after composed transformation";
|
||||
EXPECT_TRUE(Abs(aResultCornerMin.y() - anExpectedCornerMin.y()) < aPrecision)
|
||||
EXPECT_TRUE(std::abs(aResultCornerMin.y() - anExpectedCornerMin.y()) < aPrecision)
|
||||
<< "Ymin should match expected after composed transformation";
|
||||
EXPECT_TRUE(Abs(aResultCornerMin.z() - anExpectedCornerMin.z()) < aPrecision)
|
||||
EXPECT_TRUE(std::abs(aResultCornerMin.z() - anExpectedCornerMin.z()) < aPrecision)
|
||||
<< "Zmin should match expected after composed transformation";
|
||||
EXPECT_TRUE(Abs(aResultCornerMax.x() - anExpectedCornerMax.x()) < aPrecision)
|
||||
EXPECT_TRUE(std::abs(aResultCornerMax.x() - anExpectedCornerMax.x()) < aPrecision)
|
||||
<< "Xmax should match expected after composed transformation";
|
||||
EXPECT_TRUE(Abs(aResultCornerMax.y() - anExpectedCornerMax.y()) < aPrecision)
|
||||
EXPECT_TRUE(std::abs(aResultCornerMax.y() - anExpectedCornerMax.y()) < aPrecision)
|
||||
<< "Ymax should match expected after composed transformation";
|
||||
EXPECT_TRUE(Abs(aResultCornerMax.z() - anExpectedCornerMax.z()) < aPrecision)
|
||||
EXPECT_TRUE(std::abs(aResultCornerMax.z() - anExpectedCornerMax.z()) < aPrecision)
|
||||
<< "Zmax should match expected after composed transformation";
|
||||
}
|
||||
|
||||
|
||||
@@ -426,7 +426,7 @@ public:
|
||||
Standard_Byte(theB * 255.0),
|
||||
255);
|
||||
}
|
||||
myAttribs->NbElements = Max(theIndex, myAttribs->NbElements);
|
||||
myAttribs->NbElements = (std::max)(theIndex, myAttribs->NbElements);
|
||||
}
|
||||
|
||||
//! Change the vertex color in the array.
|
||||
@@ -442,7 +442,7 @@ public:
|
||||
myColData + myColStride * ((Standard_Size)theIndex - 1));
|
||||
(*aColorPtr) = theColor;
|
||||
}
|
||||
myAttribs->NbElements = Max(theIndex, myAttribs->NbElements);
|
||||
myAttribs->NbElements = (std::max)(theIndex, myAttribs->NbElements);
|
||||
}
|
||||
|
||||
//! Change the vertex color in the array.
|
||||
@@ -490,7 +490,7 @@ public:
|
||||
aVec.y() = Standard_ShortReal(theNY);
|
||||
aVec.z() = Standard_ShortReal(theNZ);
|
||||
}
|
||||
myAttribs->NbElements = Max(theIndex, myAttribs->NbElements);
|
||||
myAttribs->NbElements = (std::max)(theIndex, myAttribs->NbElements);
|
||||
}
|
||||
|
||||
//! Change the vertex texel in the array.
|
||||
@@ -518,7 +518,7 @@ public:
|
||||
aVec.x() = Standard_ShortReal(theTX);
|
||||
aVec.y() = Standard_ShortReal(theTY);
|
||||
}
|
||||
myAttribs->NbElements = Max(theIndex, myAttribs->NbElements);
|
||||
myAttribs->NbElements = (std::max)(theIndex, myAttribs->NbElements);
|
||||
}
|
||||
|
||||
//! Returns the vertice from the vertex table if defined.
|
||||
@@ -926,7 +926,7 @@ public: //! @name optional array of Bounds/Subgroups within primitive array (e.g
|
||||
aVec.g() = Standard_ShortReal(theG);
|
||||
aVec.b() = Standard_ShortReal(theB);
|
||||
aVec.a() = 1.0f;
|
||||
myBounds->NbBounds = Max(theIndex, myBounds->NbBounds);
|
||||
myBounds->NbBounds = (std::max)(theIndex, myBounds->NbBounds);
|
||||
}
|
||||
|
||||
protected: //! @name protected constructors
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
//! ....
|
||||
//! myArray->AddVertex (x8, y8, z8);
|
||||
//! @endcode
|
||||
//! The number of quadrangle really drawn is: VertexNumber()/2 - Min(1, BoundNumber()).
|
||||
//! The number of quadrangle really drawn is: VertexNumber()/2 - std::min(1, BoundNumber()).
|
||||
//! @param theMaxVertexs defines the maximum allowed vertex number in the array
|
||||
//! @param theMaxStrips defines the maximum allowed strip number in the array
|
||||
//! @param theArrayFlags array flags
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
//! ....
|
||||
//! myArray->AddVertex (x8, y8, z8);
|
||||
//! @endcode
|
||||
//! The number of triangle really drawn is: VertexNumber() - 2 * Min(1, BoundNumber())
|
||||
//! The number of triangle really drawn is: VertexNumber() - 2 * std::min(1, BoundNumber())
|
||||
//! @param theMaxVertexs defines the maximum allowed vertex number in the array
|
||||
//! @param theMaxFans defines the maximum allowed fan number in the array
|
||||
//! @param theArrayFlags array flags
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
//! @endcode
|
||||
//! @param theMaxVertexs defines the maximum allowed vertex number in the array
|
||||
//! @param theMaxStrips defines the maximum allowed strip number in the array;
|
||||
//! the number of triangle really drawn is: VertexNumber() - 2 * Min(1,
|
||||
//! the number of triangle really drawn is: VertexNumber() - 2 * std::min(1,
|
||||
//! BoundNumber())
|
||||
//! @param theArrayFlags array flags
|
||||
Graphic3d_ArrayOfTriangleStrips(Standard_Integer theMaxVertexs,
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
//! Creates an array of triangle strips (Graphic3d_TOPA_TRIANGLESTRIPS).
|
||||
//! @param theMaxVertexs defines the maximum allowed vertex number in the array
|
||||
//! @param theMaxStrips defines the maximum allowed strip number in the array;
|
||||
//! the number of triangle really drawn is: VertexNumber() - 2 * Min(1,
|
||||
//! the number of triangle really drawn is: VertexNumber() - 2 * std::min(1,
|
||||
//! BoundNumber())
|
||||
//! @param theHasVNormals when TRUE, AddVertex(Point,Normal), AddVertex(Point,Normal,Color) or
|
||||
//! AddVertex(Point,Normal,Texel) should be used to specify vertex normal;
|
||||
|
||||
@@ -63,8 +63,8 @@ struct Graphic3d_BufferRange
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Integer aStart = Min(Start, theRange.Start);
|
||||
const Standard_Integer aLast = Max(Upper(), theRange.Upper());
|
||||
const Standard_Integer aStart = (std::min)(Start, theRange.Start);
|
||||
const Standard_Integer aLast = (std::max)(Upper(), theRange.Upper());
|
||||
Start = aStart;
|
||||
Length = aLast - aStart + 1;
|
||||
}
|
||||
|
||||
@@ -173,9 +173,10 @@ void Graphic3d_CLight::SetDirection(const gp_Dir& theDir)
|
||||
&& myType != Graphic3d_TypeOfLightSource_Directional,
|
||||
"Graphic3d_CLight::SetDirection(), incorrect light type");
|
||||
updateRevisionIf(
|
||||
Abs(myDirection.x() - static_cast<Standard_ShortReal>(theDir.X())) > ShortRealEpsilon()
|
||||
|| Abs(myDirection.y() - static_cast<Standard_ShortReal>(theDir.Y())) > ShortRealEpsilon()
|
||||
|| Abs(myDirection.z() - static_cast<Standard_ShortReal>(theDir.Z())) > ShortRealEpsilon());
|
||||
std::abs(myDirection.x() - static_cast<Standard_ShortReal>(theDir.X())) > ShortRealEpsilon()
|
||||
|| std::abs(myDirection.y() - static_cast<Standard_ShortReal>(theDir.Y())) > ShortRealEpsilon()
|
||||
|| std::abs(myDirection.z() - static_cast<Standard_ShortReal>(theDir.Z()))
|
||||
> ShortRealEpsilon());
|
||||
|
||||
myDirection.x() = static_cast<Standard_ShortReal>(theDir.X());
|
||||
myDirection.y() = static_cast<Standard_ShortReal>(theDir.Y());
|
||||
@@ -209,7 +210,7 @@ void Graphic3d_CLight::SetIntensity(Standard_ShortReal theValue)
|
||||
{
|
||||
Standard_OutOfRange_Raise_if(theValue <= 0.0f,
|
||||
"Graphic3d_CLight::SetIntensity(), Negative value for intensity");
|
||||
updateRevisionIf(Abs(myIntensity - theValue) > ShortRealEpsilon());
|
||||
updateRevisionIf(std::abs(myIntensity - theValue) > ShortRealEpsilon());
|
||||
myIntensity = theValue;
|
||||
}
|
||||
|
||||
@@ -221,7 +222,7 @@ void Graphic3d_CLight::SetAngle(Standard_ShortReal theAngle)
|
||||
"Graphic3d_CLight::SetAngle(), incorrect light type");
|
||||
Standard_OutOfRange_Raise_if(theAngle <= 0.0 || theAngle >= M_PI,
|
||||
"Graphic3d_CLight::SetAngle(), bad angle");
|
||||
updateRevisionIf(Abs(changeAngle() - theAngle) > ShortRealEpsilon());
|
||||
updateRevisionIf(std::abs(changeAngle() - theAngle) > ShortRealEpsilon());
|
||||
changeAngle() = theAngle;
|
||||
}
|
||||
|
||||
@@ -236,8 +237,9 @@ void Graphic3d_CLight::SetAttenuation(Standard_ShortReal theConstAttenuation,
|
||||
Standard_OutOfRange_Raise_if(theConstAttenuation < 0.0f || theLinearAttenuation < 0.0f
|
||||
|| theConstAttenuation + theLinearAttenuation == 0.0f,
|
||||
"Graphic3d_CLight::SetAttenuation(), bad coefficient");
|
||||
updateRevisionIf(Abs(changeConstAttenuation() - theConstAttenuation) > ShortRealEpsilon()
|
||||
|| Abs(changeLinearAttenuation() - theLinearAttenuation) > ShortRealEpsilon());
|
||||
updateRevisionIf(std::abs(changeConstAttenuation() - theConstAttenuation) > ShortRealEpsilon()
|
||||
|| std::abs(changeLinearAttenuation() - theLinearAttenuation)
|
||||
> ShortRealEpsilon());
|
||||
changeConstAttenuation() = theConstAttenuation;
|
||||
changeLinearAttenuation() = theLinearAttenuation;
|
||||
}
|
||||
@@ -250,7 +252,7 @@ void Graphic3d_CLight::SetConcentration(Standard_ShortReal theConcentration)
|
||||
"Graphic3d_CLight::SetConcentration(), incorrect light type");
|
||||
Standard_OutOfRange_Raise_if(theConcentration < 0.0f || theConcentration > 1.0f,
|
||||
"Graphic3d_CLight::SetConcentration(), bad coefficient");
|
||||
updateRevisionIf(Abs(changeConcentration() - theConcentration) > ShortRealEpsilon());
|
||||
updateRevisionIf(std::abs(changeConcentration() - theConcentration) > ShortRealEpsilon());
|
||||
changeConcentration() = theConcentration;
|
||||
}
|
||||
|
||||
@@ -264,7 +266,7 @@ void Graphic3d_CLight::SetSmoothRadius(Standard_ShortReal theValue)
|
||||
Standard_OutOfRange_Raise_if(
|
||||
theValue < 0.0f,
|
||||
"Graphic3d_CLight::SetSmoothRadius(), Bad value for smoothing radius");
|
||||
updateRevisionIf(Abs(mySmoothness - theValue) > ShortRealEpsilon());
|
||||
updateRevisionIf(std::abs(mySmoothness - theValue) > ShortRealEpsilon());
|
||||
mySmoothness = theValue;
|
||||
}
|
||||
|
||||
@@ -276,7 +278,7 @@ void Graphic3d_CLight::SetSmoothAngle(Standard_ShortReal theValue)
|
||||
"Graphic3d_CLight::SetSmoothAngle(), incorrect light type");
|
||||
Standard_OutOfRange_Raise_if(theValue < 0.0f || theValue > Standard_ShortReal(M_PI / 2.0),
|
||||
"Graphic3d_CLight::SetSmoothAngle(), Bad value for smoothing angle");
|
||||
updateRevisionIf(Abs(mySmoothness - theValue) > ShortRealEpsilon());
|
||||
updateRevisionIf(std::abs(mySmoothness - theValue) > ShortRealEpsilon());
|
||||
mySmoothness = theValue;
|
||||
}
|
||||
|
||||
@@ -289,7 +291,7 @@ void Graphic3d_CLight::SetRange(Standard_ShortReal theValue)
|
||||
"Graphic3d_CLight::SetRange(), incorrect light type");
|
||||
Standard_OutOfRange_Raise_if(theValue < 0.0,
|
||||
"Graphic3d_CLight::SetRange(), Bad value for falloff range");
|
||||
updateRevisionIf(Abs(Range() - theValue) > ShortRealEpsilon());
|
||||
updateRevisionIf(std::abs(Range() - theValue) > ShortRealEpsilon());
|
||||
myDirection.w() = theValue;
|
||||
};
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ void Graphic3d_CView::SubviewResized(const Handle(Aspect_NeutralWindow)& theWind
|
||||
}
|
||||
else if ((mySubviewCorner & Aspect_TOTP_RIGHT) != 0)
|
||||
{
|
||||
mySubviewTopLeft.x() = Max(aWinSize.x() - anOffset.x() - aViewSize.x(), 0);
|
||||
mySubviewTopLeft.x() = std::max(aWinSize.x() - anOffset.x() - aViewSize.x(), 0);
|
||||
}
|
||||
|
||||
if ((mySubviewCorner & Aspect_TOTP_TOP) != 0)
|
||||
@@ -280,16 +280,16 @@ void Graphic3d_CView::SubviewResized(const Handle(Aspect_NeutralWindow)& theWind
|
||||
}
|
||||
else if ((mySubviewCorner & Aspect_TOTP_BOTTOM) != 0)
|
||||
{
|
||||
mySubviewTopLeft.y() = Max(aWinSize.y() - anOffset.y() - aViewSize.y(), 0);
|
||||
mySubviewTopLeft.y() = std::max(aWinSize.y() - anOffset.y() - aViewSize.y(), 0);
|
||||
}
|
||||
|
||||
mySubviewTopLeft += mySubviewMargins;
|
||||
aViewSize -= mySubviewMargins * 2;
|
||||
|
||||
const int aRight = Min(mySubviewTopLeft.x() + aViewSize.x(), aWinSize.x());
|
||||
const int aRight = std::min(mySubviewTopLeft.x() + aViewSize.x(), aWinSize.x());
|
||||
aViewSize.x() = aRight - mySubviewTopLeft.x();
|
||||
|
||||
const int aBot = Min(mySubviewTopLeft.y() + aViewSize.y(), aWinSize.y());
|
||||
const int aBot = std::min(mySubviewTopLeft.y() + aViewSize.y(), aWinSize.y());
|
||||
aViewSize.y() = aBot - mySubviewTopLeft.y();
|
||||
|
||||
theWindow->SetSize(aViewSize.x(), aViewSize.y());
|
||||
@@ -577,11 +577,11 @@ Standard_Real Graphic3d_CView::ConsiderZoomPersistenceObjects()
|
||||
aLayerIter.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Layer)& aLayer = aLayerIter.Value();
|
||||
aMaxCoef = Max(aMaxCoef,
|
||||
aLayer->considerZoomPersistenceObjects(Identification(),
|
||||
aCamera,
|
||||
aWinSize.x(),
|
||||
aWinSize.y()));
|
||||
aMaxCoef = std::max(aMaxCoef,
|
||||
aLayer->considerZoomPersistenceObjects(Identification(),
|
||||
aCamera,
|
||||
aWinSize.x(),
|
||||
aWinSize.y()));
|
||||
}
|
||||
|
||||
return aMaxCoef;
|
||||
@@ -641,11 +641,12 @@ Bnd_Box Graphic3d_CView::MinMaxValues(const Graphic3d_MapOfStructure& theSet,
|
||||
// To prevent float overflow at camera parameters calculation and further
|
||||
// rendering, bounding boxes with at least one vertex coordinate out of
|
||||
// float range are skipped by view fit algorithms
|
||||
if (Abs(aBox.CornerMax().X()) >= ShortRealLast() || Abs(aBox.CornerMax().Y()) >= ShortRealLast()
|
||||
|| Abs(aBox.CornerMax().Z()) >= ShortRealLast()
|
||||
|| Abs(aBox.CornerMin().X()) >= ShortRealLast()
|
||||
|| Abs(aBox.CornerMin().Y()) >= ShortRealLast()
|
||||
|| Abs(aBox.CornerMin().Z()) >= ShortRealLast())
|
||||
if (std::abs(aBox.CornerMax().X()) >= ShortRealLast()
|
||||
|| std::abs(aBox.CornerMax().Y()) >= ShortRealLast()
|
||||
|| std::abs(aBox.CornerMax().Z()) >= ShortRealLast()
|
||||
|| std::abs(aBox.CornerMin().X()) >= ShortRealLast()
|
||||
|| std::abs(aBox.CornerMin().Y()) >= ShortRealLast()
|
||||
|| std::abs(aBox.CornerMin().Z()) >= ShortRealLast())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1441,8 +1442,9 @@ void Graphic3d_CView::DiagnosticInformation(TColStd_IndexedDataMapOfStringString
|
||||
myXRSession->GetString(Aspect_XRSession::InfoString_SerialNumber);
|
||||
TCollection_AsciiString aDisplay =
|
||||
TCollection_AsciiString() + myXRSession->RecommendedViewport().x() + "x"
|
||||
+ myXRSession->RecommendedViewport().y() + "@" + (int)Round(myXRSession->DisplayFrequency())
|
||||
+ " [FOVy: " + (int)Round(myXRSession->FieldOfView()) + "]";
|
||||
+ myXRSession->RecommendedViewport().y() + "@"
|
||||
+ (int)std::round(myXRSession->DisplayFrequency())
|
||||
+ " [FOVy: " + (int)std::round(myXRSession->FieldOfView()) + "]";
|
||||
|
||||
theDict.ChangeFromIndex(theDict.Add("VRvendor", aVendor)) = aVendor;
|
||||
theDict.ChangeFromIndex(theDict.Add("VRdevice", aDevice)) = aDevice;
|
||||
|
||||
@@ -49,14 +49,14 @@ static Standard_Real zEpsilon()
|
||||
// relative z-range tolerance compatible with for floating point.
|
||||
static Standard_Real zEpsilon(const Standard_Real theValue)
|
||||
{
|
||||
Standard_Real anAbsValue = Abs(theValue);
|
||||
Standard_Real anAbsValue = std::abs(theValue);
|
||||
if (anAbsValue <= (double)FLT_MIN)
|
||||
{
|
||||
return FLT_MIN;
|
||||
}
|
||||
Standard_Real aLogRadix = Log10(anAbsValue) / Log10(FLT_RADIX);
|
||||
Standard_Real aExp = Floor(aLogRadix);
|
||||
return FLT_EPSILON * Pow(FLT_RADIX, aExp);
|
||||
Standard_Real aLogRadix = std::log10(anAbsValue) / std::log10(FLT_RADIX);
|
||||
Standard_Real aExp = std::floor(aLogRadix);
|
||||
return FLT_EPSILON * std::pow(FLT_RADIX, aExp);
|
||||
}
|
||||
|
||||
//! Convert camera definition to Ax3
|
||||
@@ -82,7 +82,7 @@ Graphic3d_Camera::Graphic3d_Camera()
|
||||
myFOVy(45.0),
|
||||
myFOVx(45.0),
|
||||
myFOV2d(180.0),
|
||||
myFOVyTan(Tan(DTR_HALF * 45.0)),
|
||||
myFOVyTan(std::tan(DTR_HALF * 45.0)),
|
||||
myZNear(DEFAULT_ZNEAR),
|
||||
myZFar(DEFAULT_ZFAR),
|
||||
myAspect(1.0),
|
||||
@@ -111,7 +111,7 @@ Graphic3d_Camera::Graphic3d_Camera(const Handle(Graphic3d_Camera)& theOther)
|
||||
myFOVy(45.0),
|
||||
myFOVx(45.0),
|
||||
myFOV2d(180.0),
|
||||
myFOVyTan(Tan(DTR_HALF * 45.0)),
|
||||
myFOVyTan(std::tan(DTR_HALF * 45.0)),
|
||||
myZNear(DEFAULT_ZNEAR),
|
||||
myZFar(DEFAULT_ZFAR),
|
||||
myAspect(1.0),
|
||||
@@ -421,7 +421,7 @@ void Graphic3d_Camera::SetFOVy(const Standard_Real theFOVy)
|
||||
|
||||
myFOVy = theFOVy;
|
||||
myFOVx = theFOVy * myAspect;
|
||||
myFOVyTan = Tan(DTR_HALF * myFOVy);
|
||||
myFOVyTan = std::tan(DTR_HALF * myFOVy);
|
||||
|
||||
InvalidateProjection();
|
||||
}
|
||||
@@ -561,11 +561,11 @@ static Graphic3d_Vec4d safePointCast(const gp_Pnt& thePnt)
|
||||
// have to deal with values greater then max float
|
||||
gp_Pnt aSafePoint = thePnt;
|
||||
const Standard_Real aBigFloat = aLim * 0.1f;
|
||||
if (Abs(aSafePoint.X()) > aLim)
|
||||
if (std::abs(aSafePoint.X()) > aLim)
|
||||
aSafePoint.SetX(aSafePoint.X() >= 0 ? aBigFloat : -aBigFloat);
|
||||
if (Abs(aSafePoint.Y()) > aLim)
|
||||
if (std::abs(aSafePoint.Y()) > aLim)
|
||||
aSafePoint.SetY(aSafePoint.Y() >= 0 ? aBigFloat : -aBigFloat);
|
||||
if (Abs(aSafePoint.Z()) > aLim)
|
||||
if (std::abs(aSafePoint.Z()) > aLim)
|
||||
aSafePoint.SetZ(aSafePoint.Z() >= 0 ? aBigFloat : -aBigFloat);
|
||||
|
||||
// convert point
|
||||
@@ -762,7 +762,7 @@ void Graphic3d_Camera::Frustum(gp_Pln& theLeft,
|
||||
gp_Vec aDirTop = -anUp;
|
||||
if (!IsOrthographic())
|
||||
{
|
||||
Standard_Real aHFOVHor = ATan(Tan(DTR_HALF * FOVy()) * Aspect());
|
||||
Standard_Real aHFOVHor = std::atan(std::tan(DTR_HALF * FOVy()) * Aspect());
|
||||
Standard_Real aHFOVVer = DTR_HALF * FOVy();
|
||||
aDirLeft.Rotate(gp_Ax1(gp::Origin(), anUp), aHFOVHor);
|
||||
aDirRight.Rotate(gp_Ax1(gp::Origin(), anUp), -aHFOVHor);
|
||||
@@ -1345,10 +1345,10 @@ bool Graphic3d_Camera::FitMinMax(const Bnd_Box& theBox,
|
||||
// 4) Determine new zooming in view space.
|
||||
|
||||
// 1. Determine normalized projection asymmetry (if any).
|
||||
Standard_Real anAssymX = Tan((aCamSide).Angle(aFrustumPlane[1].Axis().Direction()))
|
||||
- Tan((-aCamSide).Angle(aFrustumPlane[2].Axis().Direction()));
|
||||
Standard_Real anAssymY = Tan((aCamUp).Angle(aFrustumPlane[3].Axis().Direction()))
|
||||
- Tan((-aCamUp).Angle(aFrustumPlane[4].Axis().Direction()));
|
||||
Standard_Real anAssymX = std::tan((aCamSide).Angle(aFrustumPlane[1].Axis().Direction()))
|
||||
- std::tan((-aCamSide).Angle(aFrustumPlane[2].Axis().Direction()));
|
||||
Standard_Real anAssymY = std::tan((aCamUp).Angle(aFrustumPlane[3].Axis().Direction()))
|
||||
- std::tan((-aCamUp).Angle(aFrustumPlane[4].Axis().Direction()));
|
||||
|
||||
// 2. Determine how far should be the frustum planes placed from center
|
||||
// of bounding box, in order to match the bounding box closely.
|
||||
@@ -1363,7 +1363,7 @@ bool Graphic3d_Camera::FitMinMax(const Bnd_Box& theBox,
|
||||
Standard_Real& aFitDist = aFitDistance[anI];
|
||||
for (Standard_Integer aJ = aBndCorner.Lower(); aJ <= aBndCorner.Upper(); ++aJ)
|
||||
{
|
||||
aFitDist = Max(aFitDist, gp_Vec(aBndCenter, aBndCorner[aJ]).Dot(aPlaneN));
|
||||
aFitDist = std::max(aFitDist, gp_Vec(aBndCenter, aBndCorner[aJ]).Dot(aPlaneN));
|
||||
}
|
||||
}
|
||||
// The center of camera is placed on the same line with center of bounding box.
|
||||
@@ -1382,13 +1382,18 @@ bool Graphic3d_Camera::FitMinMax(const Bnd_Box& theBox,
|
||||
// \//
|
||||
// //
|
||||
// (frustum plane)
|
||||
aFitDistance[1] *= Sqrt(1 + Pow(Tan(aCamSide.Angle(aFrustumPlane[1].Axis().Direction())), 2.0));
|
||||
aFitDistance[1] *=
|
||||
std::sqrt(1 + std::pow(std::tan(aCamSide.Angle(aFrustumPlane[1].Axis().Direction())), 2.0));
|
||||
aFitDistance[2] *=
|
||||
Sqrt(1 + Pow(Tan((-aCamSide).Angle(aFrustumPlane[2].Axis().Direction())), 2.0));
|
||||
aFitDistance[3] *= Sqrt(1 + Pow(Tan(aCamUp.Angle(aFrustumPlane[3].Axis().Direction())), 2.0));
|
||||
aFitDistance[4] *= Sqrt(1 + Pow(Tan((-aCamUp).Angle(aFrustumPlane[4].Axis().Direction())), 2.0));
|
||||
aFitDistance[5] *= Sqrt(1 + Pow(Tan(aCamDir.Angle(aFrustumPlane[5].Axis().Direction())), 2.0));
|
||||
aFitDistance[6] *= Sqrt(1 + Pow(Tan((-aCamDir).Angle(aFrustumPlane[6].Axis().Direction())), 2.0));
|
||||
std::sqrt(1 + std::pow(std::tan((-aCamSide).Angle(aFrustumPlane[2].Axis().Direction())), 2.0));
|
||||
aFitDistance[3] *=
|
||||
std::sqrt(1 + std::pow(std::tan(aCamUp.Angle(aFrustumPlane[3].Axis().Direction())), 2.0));
|
||||
aFitDistance[4] *=
|
||||
std::sqrt(1 + std::pow(std::tan((-aCamUp).Angle(aFrustumPlane[4].Axis().Direction())), 2.0));
|
||||
aFitDistance[5] *=
|
||||
std::sqrt(1 + std::pow(std::tan(aCamDir.Angle(aFrustumPlane[5].Axis().Direction())), 2.0));
|
||||
aFitDistance[6] *=
|
||||
std::sqrt(1 + std::pow(std::tan((-aCamDir).Angle(aFrustumPlane[6].Axis().Direction())), 2.0));
|
||||
|
||||
Standard_Real aViewSizeXv = aFitDistance[1] + aFitDistance[2];
|
||||
Standard_Real aViewSizeYv = aFitDistance[3] + aFitDistance[4];
|
||||
@@ -1426,11 +1431,11 @@ bool Graphic3d_Camera::FitMinMax(const Bnd_Box& theBox,
|
||||
const Standard_Real anAspect = Aspect();
|
||||
if (anAspect > 1.0)
|
||||
{
|
||||
SetScale(Max(aViewSizeXv / anAspect, aViewSizeYv));
|
||||
SetScale(std::max(aViewSizeXv / anAspect, aViewSizeYv));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetScale(Max(aViewSizeXv, aViewSizeYv * anAspect));
|
||||
SetScale(std::max(aViewSizeXv, aViewSizeYv * anAspect));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1526,8 +1531,8 @@ bool Graphic3d_Camera::ZFitAll(const Standard_Real theScaleFactor,
|
||||
// be absent).
|
||||
Standard_Real& aChangeMinDist = aCounter >= 8 ? aModelMinDist : aGraphMinDist;
|
||||
Standard_Real& aChangeMaxDist = aCounter >= 8 ? aModelMaxDist : aGraphMaxDist;
|
||||
aChangeMinDist = Min(aDistance, aChangeMinDist);
|
||||
aChangeMaxDist = Max(aDistance, aChangeMaxDist);
|
||||
aChangeMinDist = std::min(aDistance, aChangeMinDist);
|
||||
aChangeMaxDist = std::max(aDistance, aChangeMaxDist);
|
||||
aCounter++;
|
||||
}
|
||||
|
||||
@@ -1644,7 +1649,7 @@ void Graphic3d_Camera::Interpolate(const Handle(Graphic3d_Camera)& theStart,
|
||||
const double theT,
|
||||
Handle(Graphic3d_Camera)& theCamera)
|
||||
{
|
||||
if (Abs(theT - 1.0) < Precision::Confusion())
|
||||
if (std::abs(theT - 1.0) < Precision::Confusion())
|
||||
{
|
||||
// just copy end-point transformation
|
||||
theCamera->Copy(theEnd);
|
||||
@@ -1652,7 +1657,7 @@ void Graphic3d_Camera::Interpolate(const Handle(Graphic3d_Camera)& theStart,
|
||||
}
|
||||
|
||||
theCamera->Copy(theStart);
|
||||
if (Abs(theT - 0.0) < Precision::Confusion())
|
||||
if (std::abs(theT - 0.0) < Precision::Confusion())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1713,7 +1718,7 @@ void Graphic3d_Camera::Interpolate(const Handle(Graphic3d_Camera)& theStart,
|
||||
}
|
||||
|
||||
// apply scaling
|
||||
if (Abs(theStart->Scale() - theEnd->Scale()) > Precision::Confusion()
|
||||
if (std::abs(theStart->Scale() - theEnd->Scale()) > Precision::Confusion()
|
||||
&& theStart->IsOrthographic())
|
||||
{
|
||||
const Standard_Real aScale =
|
||||
|
||||
@@ -788,7 +788,7 @@ private:
|
||||
Standard_Real myFOVy; //!< Field Of View in y axis.
|
||||
Standard_Real myFOVx; //!< Field Of View in x axis.
|
||||
Standard_Real myFOV2d; //!< Field Of View limit for 2d on-screen elements
|
||||
Standard_Real myFOVyTan; //!< Field Of View as Tan(DTR_HALF * myFOVy)
|
||||
Standard_Real myFOVyTan; //!< Field Of View as std::tan(DTR_HALF * myFOVy)
|
||||
Standard_Real myZNear; //!< Distance to near clipping plane.
|
||||
Standard_Real myZFar; //!< Distance to far clipping plane.
|
||||
Standard_Real myAspect; //!< Width to height display ratio.
|
||||
|
||||
@@ -60,11 +60,11 @@ public:
|
||||
return aTile;
|
||||
}
|
||||
|
||||
aTile.Offset.x() = Max(Offset.x(), 0);
|
||||
aTile.Offset.y() = Max(Offset.y(), 0);
|
||||
aTile.Offset.x() = (std::max)(Offset.x(), 0);
|
||||
aTile.Offset.y() = (std::max)(Offset.y(), 0);
|
||||
|
||||
const Standard_Integer anX = Min(Offset.x() + TileSize.x(), TotalSize.x());
|
||||
const Standard_Integer anY = Min(Offset.y() + TileSize.y(), TotalSize.y());
|
||||
const Standard_Integer anX = (std::min)(Offset.x() + TileSize.x(), TotalSize.x());
|
||||
const Standard_Integer anY = (std::min)(Offset.y() + TileSize.y(), TotalSize.y());
|
||||
aTile.TileSize.x() = anX - Offset.x();
|
||||
aTile.TileSize.y() = anY - Offset.y();
|
||||
return aTile;
|
||||
|
||||
@@ -60,8 +60,8 @@ void Graphic3d_CullingTool::SetViewVolume(const Handle(Graphic3d_Camera)& theCam
|
||||
myCamScale = theCamera->IsOrthographic()
|
||||
? theCamera->Scale()
|
||||
: 2.0
|
||||
* Tan(theCamera->FOVy() * M_PI
|
||||
/ 360.0); // same as theCamera->Scale()/theCamera->Distance()
|
||||
* std::tan(theCamera->FOVy() * M_PI
|
||||
/ 360.0); // same as theCamera->Scale()/theCamera->Distance()
|
||||
|
||||
// Compute frustum points
|
||||
theCamera->FrustumPoints(myClipVerts, theModelWorld);
|
||||
@@ -106,7 +106,8 @@ void Graphic3d_CullingTool::SetViewportSize(Standard_Integer theViewportWidth,
|
||||
{
|
||||
myViewportHeight = theViewportHeight > 0 ? theViewportHeight : 1;
|
||||
myViewportWidth = theViewportWidth > 0 ? theViewportWidth : 1;
|
||||
myPixelSize = Max(theResolutionRatio / myViewportHeight, theResolutionRatio / myViewportWidth);
|
||||
myPixelSize =
|
||||
std::max(theResolutionRatio / myViewportHeight, theResolutionRatio / myViewportWidth);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@@ -167,8 +168,8 @@ void Graphic3d_CullingTool::CacheClipPtsProjections()
|
||||
++aCornerIter)
|
||||
{
|
||||
Standard_Real aProjection = myClipVerts[aCornerIter].Dot(myClipPlanes[aPlaneIter].Normal);
|
||||
aMaxProj = Max(aProjection, aMaxProj);
|
||||
aMinProj = Min(aProjection, aMinProj);
|
||||
aMaxProj = std::max(aProjection, aMaxProj);
|
||||
aMinProj = std::min(aProjection, aMinProj);
|
||||
}
|
||||
myMaxClipProjectionPts[aPlaneIter] = aMaxProj;
|
||||
myMinClipProjectionPts[aPlaneIter] = aMinProj;
|
||||
@@ -186,8 +187,8 @@ void Graphic3d_CullingTool::CacheClipPtsProjections()
|
||||
++aCornerIter)
|
||||
{
|
||||
Standard_Real aProjection = myClipVerts[aCornerIter].Dot(anAxes[aDim]);
|
||||
aMaxProj = Max(aProjection, aMaxProj);
|
||||
aMinProj = Min(aProjection, aMinProj);
|
||||
aMaxProj = std::max(aProjection, aMaxProj);
|
||||
aMinProj = std::min(aProjection, aMinProj);
|
||||
}
|
||||
myMaxOrthoProjectionPts[aDim] = aMaxProj;
|
||||
myMinOrthoProjectionPts[aDim] = aMinProj;
|
||||
|
||||
@@ -682,7 +682,7 @@ void Graphic3d_FrameStats::FrameStart(const Handle(Graphic3d_CView)& theView,
|
||||
}
|
||||
|
||||
const Standard_Integer aNbFrames =
|
||||
Max(!theView.IsNull() ? theView->RenderingParams().StatsNbFrames : 1, 1);
|
||||
std::max(!theView.IsNull() ? theView->RenderingParams().StatsNbFrames : 1, 1);
|
||||
if (myCounters.Size() != aNbFrames)
|
||||
{
|
||||
myCounters.Resize(0, aNbFrames - 1, false);
|
||||
|
||||
@@ -118,10 +118,10 @@ void Graphic3d_FrameStatsData::Reset()
|
||||
|
||||
void Graphic3d_FrameStatsData::FillMax(const Graphic3d_FrameStatsData& theOther)
|
||||
{
|
||||
myFps = Max(myFps, theOther.myFps);
|
||||
myFpsCpu = Max(myFpsCpu, theOther.myFpsCpu);
|
||||
myFpsImmediate = Max(myFpsImmediate, theOther.myFpsImmediate);
|
||||
myFpsCpuImmediate = Max(myFpsCpuImmediate, theOther.myFpsCpuImmediate);
|
||||
myFps = std::max(myFps, theOther.myFps);
|
||||
myFpsCpu = std::max(myFpsCpu, theOther.myFpsCpu);
|
||||
myFpsImmediate = std::max(myFpsImmediate, theOther.myFpsImmediate);
|
||||
myFpsCpuImmediate = std::max(myFpsCpuImmediate, theOther.myFpsCpuImmediate);
|
||||
for (size_t aCounterIter = 0; aCounterIter < myCounters.size(); ++aCounterIter)
|
||||
{
|
||||
myCounters[aCounterIter] = myCounters[aCounterIter] > theOther.myCounters[aCounterIter]
|
||||
@@ -130,8 +130,8 @@ void Graphic3d_FrameStatsData::FillMax(const Graphic3d_FrameStatsData& theOther)
|
||||
}
|
||||
for (size_t aTimerIter = 0; aTimerIter < myTimers.size(); ++aTimerIter)
|
||||
{
|
||||
myTimersMax[aTimerIter] = Max(myTimersMax[aTimerIter], theOther.myTimersMax[aTimerIter]);
|
||||
myTimersMin[aTimerIter] = Min(myTimersMin[aTimerIter], theOther.myTimersMin[aTimerIter]);
|
||||
myTimersMax[aTimerIter] = std::max(myTimersMax[aTimerIter], theOther.myTimersMax[aTimerIter]);
|
||||
myTimersMin[aTimerIter] = std::min(myTimersMin[aTimerIter], theOther.myTimersMin[aTimerIter]);
|
||||
myTimers[aTimerIter] = myTimersMax[aTimerIter];
|
||||
}
|
||||
}
|
||||
@@ -151,8 +151,8 @@ void Graphic3d_FrameStatsDataTmp::FlushTimers(Standard_Size theNbFrames, bool th
|
||||
for (size_t aTimerIter = 0; aTimerIter < myTimers.size(); ++aTimerIter)
|
||||
{
|
||||
const Standard_Real aFrameTime = myTimers[aTimerIter] - myTimersPrev[aTimerIter];
|
||||
myTimersMax[aTimerIter] = Max(myTimersMax[aTimerIter], aFrameTime);
|
||||
myTimersMin[aTimerIter] = Min(myTimersMin[aTimerIter], aFrameTime);
|
||||
myTimersMax[aTimerIter] = std::max(myTimersMax[aTimerIter], aFrameTime);
|
||||
myTimersMin[aTimerIter] = std::min(myTimersMin[aTimerIter], aFrameTime);
|
||||
myTimersPrev[aTimerIter] = myTimers[aTimerIter];
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ void Graphic3d_Layer::Add(const Graphic3d_CStructure* theStruct,
|
||||
Graphic3d_DisplayPriority thePriority,
|
||||
Standard_Boolean isForChangePriority)
|
||||
{
|
||||
const Standard_Integer anIndex =
|
||||
Min(Max(thePriority, Graphic3d_DisplayPriority_Bottom), Graphic3d_DisplayPriority_Topmost);
|
||||
const Standard_Integer anIndex = std::min(std::max(thePriority, Graphic3d_DisplayPriority_Bottom),
|
||||
Graphic3d_DisplayPriority_Topmost);
|
||||
if (theStruct == NULL)
|
||||
{
|
||||
return;
|
||||
@@ -152,12 +152,12 @@ inline Graphic3d_BndBox3d centerOfinfiniteBndBox(const Graphic3d_BndBox3d& theBn
|
||||
//! Return true if at least one vertex coordinate out of float range.
|
||||
inline bool isInfiniteBndBox(const Graphic3d_BndBox3d& theBndBox)
|
||||
{
|
||||
return Abs(theBndBox.CornerMax().x()) >= ShortRealLast()
|
||||
|| Abs(theBndBox.CornerMax().y()) >= ShortRealLast()
|
||||
|| Abs(theBndBox.CornerMax().z()) >= ShortRealLast()
|
||||
|| Abs(theBndBox.CornerMin().x()) >= ShortRealLast()
|
||||
|| Abs(theBndBox.CornerMin().y()) >= ShortRealLast()
|
||||
|| Abs(theBndBox.CornerMin().z()) >= ShortRealLast();
|
||||
return std::abs(theBndBox.CornerMax().x()) >= ShortRealLast()
|
||||
|| std::abs(theBndBox.CornerMax().y()) >= ShortRealLast()
|
||||
|| std::abs(theBndBox.CornerMax().z()) >= ShortRealLast()
|
||||
|| std::abs(theBndBox.CornerMin().x()) >= ShortRealLast()
|
||||
|| std::abs(theBndBox.CornerMin().y()) >= ShortRealLast()
|
||||
|| std::abs(theBndBox.CornerMin().z()) >= ShortRealLast();
|
||||
}
|
||||
|
||||
//! Extend bounding box with another box.
|
||||
@@ -388,18 +388,18 @@ Standard_Real Graphic3d_Layer::considerZoomPersistenceObjects(
|
||||
{
|
||||
aConvertedPoints[anIdx] = theCamera->Project(aPoints[anIdx]);
|
||||
|
||||
aConvertedMinX = Min(aConvertedMinX, aConvertedPoints[anIdx].X());
|
||||
aConvertedMaxX = Max(aConvertedMaxX, aConvertedPoints[anIdx].X());
|
||||
aConvertedMinX = std::min(aConvertedMinX, aConvertedPoints[anIdx].X());
|
||||
aConvertedMaxX = std::max(aConvertedMaxX, aConvertedPoints[anIdx].X());
|
||||
|
||||
aConvertedMinY = Min(aConvertedMinY, aConvertedPoints[anIdx].Y());
|
||||
aConvertedMaxY = Max(aConvertedMaxY, aConvertedPoints[anIdx].Y());
|
||||
aConvertedMinY = std::min(aConvertedMinY, aConvertedPoints[anIdx].Y());
|
||||
aConvertedMaxY = std::max(aConvertedMaxY, aConvertedPoints[anIdx].Y());
|
||||
}
|
||||
|
||||
const Standard_Boolean isBigObject =
|
||||
(Abs(aConvertedMaxX - aConvertedMinX)
|
||||
(std::abs(aConvertedMaxX - aConvertedMinX)
|
||||
> 2.0) // width of zoom pers. object greater than width of window
|
||||
// clang-format off
|
||||
|| (Abs (aConvertedMaxY - aConvertedMinY) > 2.0); // height of zoom pers. object greater than height of window
|
||||
|| (std::abs (aConvertedMaxY - aConvertedMinY) > 2.0); // height of zoom pers. object greater than height of window
|
||||
// clang-format on
|
||||
const Standard_Boolean isAlreadyInScreen = (aConvertedMinX > -1.0 && aConvertedMinX < 1.0)
|
||||
&& (aConvertedMaxX > -1.0 && aConvertedMaxX < 1.0)
|
||||
@@ -447,15 +447,15 @@ Standard_Real Graphic3d_Layer::considerZoomPersistenceObjects(
|
||||
: (aConvertedMaxY - 1.0));
|
||||
}
|
||||
|
||||
const Standard_Real aDifX = Abs(aConvertedTPPoint.X()) - aShiftX;
|
||||
const Standard_Real aDifY = Abs(aConvertedTPPoint.Y()) - aShiftY;
|
||||
const Standard_Real aDifX = std::abs(aConvertedTPPoint.X()) - aShiftX;
|
||||
const Standard_Real aDifY = std::abs(aConvertedTPPoint.Y()) - aShiftY;
|
||||
if (aDifX > Precision::Confusion())
|
||||
{
|
||||
aMaxCoef = Max(aMaxCoef, Abs(aConvertedTPPoint.X()) / aDifX);
|
||||
aMaxCoef = std::max(aMaxCoef, std::abs(aConvertedTPPoint.X()) / aDifX);
|
||||
}
|
||||
if (aDifY > Precision::Confusion())
|
||||
{
|
||||
aMaxCoef = Max(aMaxCoef, Abs(aConvertedTPPoint.Y()) / aDifY);
|
||||
aMaxCoef = std::max(aMaxCoef, std::abs(aConvertedTPPoint.Y()) / aDifY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,15 +102,15 @@ static Handle(Image_PixMap) mergeImages(const Handle(Image_PixMap)& theImage1,
|
||||
aHeight2 = (Standard_Integer)theImage2->Height();
|
||||
}
|
||||
|
||||
const Standard_Integer aMaxWidth = Max(aWidth1, aWidth2);
|
||||
const Standard_Integer aMaxHeight = Max(aHeight1, aHeight2);
|
||||
const Standard_Integer aSize = Max(aMaxWidth, aMaxHeight);
|
||||
const Standard_Integer aMaxWidth = std::max(aWidth1, aWidth2);
|
||||
const Standard_Integer aMaxHeight = std::max(aHeight1, aHeight2);
|
||||
const Standard_Integer aSize = std::max(aMaxWidth, aMaxHeight);
|
||||
aResultImage->InitZero(Image_Format_Alpha, aSize, aSize);
|
||||
|
||||
if (!theImage1.IsNull())
|
||||
{
|
||||
const Standard_Integer aXOffset1 = Abs(aWidth1 - aMaxWidth) / 2;
|
||||
const Standard_Integer anYOffset1 = Abs(aHeight1 - aMaxHeight) / 2;
|
||||
const Standard_Integer aXOffset1 = std::abs(aWidth1 - aMaxWidth) / 2;
|
||||
const Standard_Integer anYOffset1 = std::abs(aHeight1 - aMaxHeight) / 2;
|
||||
for (Standard_Integer anY = 0; anY < aHeight1; anY++)
|
||||
{
|
||||
Standard_Byte* anImageLine = theImage1->ChangeRow(anY);
|
||||
@@ -124,8 +124,8 @@ static Handle(Image_PixMap) mergeImages(const Handle(Image_PixMap)& theImage1,
|
||||
|
||||
if (!theImage2.IsNull())
|
||||
{
|
||||
const Standard_Integer aXOffset2 = Abs(aWidth2 - aMaxWidth) / 2;
|
||||
const Standard_Integer anYOffset2 = Abs(aHeight2 - aMaxHeight) / 2;
|
||||
const Standard_Integer aXOffset2 = std::abs(aWidth2 - aMaxWidth) / 2;
|
||||
const Standard_Integer anYOffset2 = std::abs(aHeight2 - aMaxHeight) / 2;
|
||||
for (Standard_Integer anY = 0; anY < aHeight2; anY++)
|
||||
{
|
||||
Standard_Byte* anImageLine = theImage2->ChangeRow(anY);
|
||||
@@ -310,7 +310,7 @@ const Handle(Image_PixMap)& Graphic3d_MarkerImage::GetImage()
|
||||
// to store bitmap in a square image, so the image will not be stretched
|
||||
// when rendering with point sprites.
|
||||
const Standard_Integer aNumOfBytesInRow = myWidth / 8 + (myWidth % 8 ? 1 : 0);
|
||||
const Standard_Integer aSize = Max(myWidth, myHeight);
|
||||
const Standard_Integer aSize = std::max(myWidth, myHeight);
|
||||
const Standard_Integer aRowOffset = (aSize - myHeight) / 2 + myMargin;
|
||||
const Standard_Integer aColumnOffset = (aSize - myWidth) / 2 + myMargin;
|
||||
const Standard_Integer aLowerIndex = myBitMap->Lower();
|
||||
@@ -483,7 +483,7 @@ Handle(Graphic3d_MarkerImage) Graphic3d_MarkerImage::StandardMarker(
|
||||
|
||||
NCollection_Vec4<Standard_Real> aColor(theColor);
|
||||
|
||||
const Standard_Integer aSize = Max(aWidth + 2, aHeight + 2); // includes extra margin
|
||||
const Standard_Integer aSize = std::max(aWidth + 2, aHeight + 2); // includes extra margin
|
||||
Handle(Image_PixMap) anImage = new Image_PixMap();
|
||||
Handle(Image_PixMap) anImageA = new Image_PixMap();
|
||||
anImage->InitZero(Image_Format_RGBA, aSize, aSize);
|
||||
|
||||
@@ -131,8 +131,8 @@ Handle(Graphic3d_ShaderObject) Graphic3d_ShaderObject::CreateFromSource(
|
||||
{
|
||||
if ((aVar.Stages & aStageIter) != 0)
|
||||
{
|
||||
aStageLower = Min(aStageLower, aStageIter);
|
||||
aStageUpper = Max(aStageUpper, aStageIter);
|
||||
aStageLower = std::min(aStageLower, aStageIter);
|
||||
aStageUpper = std::max(aStageUpper, aStageIter);
|
||||
}
|
||||
}
|
||||
if ((Standard_Integer)theType < aStageLower || (Standard_Integer)theType > aStageUpper)
|
||||
|
||||
@@ -270,7 +270,7 @@ public:
|
||||
gp_Pnt(myParams.Params3d.PntX, myParams.Params3d.PntY, myParams.Params3d.PntZ));
|
||||
const Standard_Real aFocus = aVecToObj.Dot(aVecToEye);
|
||||
const gp_XYZ aViewDim = theCamera->ViewDimensions(aFocus);
|
||||
return Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
|
||||
return std::abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
|
||||
}
|
||||
|
||||
//! Create orientation matrix based on camera and view dimensions.
|
||||
@@ -400,7 +400,7 @@ public:
|
||||
|
||||
// scale factor to pixels
|
||||
const gp_XYZ aViewDim = aProxyCamera->ViewDimensions(aFocus);
|
||||
const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
|
||||
const Standard_Real aScale = std::abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
|
||||
const gp_Dir aForward = aProxyCamera->Direction();
|
||||
gp_XYZ aCenter =
|
||||
aProxyCamera->Center().XYZ() + aForward.XYZ() * (aFocus - aProxyCamera->Distance());
|
||||
@@ -410,7 +410,7 @@ public:
|
||||
(Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale;
|
||||
const gp_Dir aSide = aForward.Crossed(aProxyCamera->Up());
|
||||
const gp_XYZ aDeltaX =
|
||||
aSide.XYZ() * (Abs(aViewDim.X()) * aProxyCamera->NDC2dOffsetX() - anOffsetX);
|
||||
aSide.XYZ() * (std::abs(aViewDim.X()) * aProxyCamera->NDC2dOffsetX() - anOffsetX);
|
||||
if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
|
||||
{
|
||||
aCenter += aDeltaX;
|
||||
@@ -425,7 +425,8 @@ public:
|
||||
const Standard_Real anOffsetY =
|
||||
(Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale;
|
||||
const gp_XYZ aDeltaY =
|
||||
aProxyCamera->Up().XYZ() * (Abs(aViewDim.Y()) * aProxyCamera->NDC2dOffsetY() - anOffsetY);
|
||||
aProxyCamera->Up().XYZ()
|
||||
* (std::abs(aViewDim.Y()) * aProxyCamera->NDC2dOffsetY() - anOffsetY);
|
||||
if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
|
||||
{
|
||||
aCenter += aDeltaY;
|
||||
@@ -453,7 +454,7 @@ public:
|
||||
|
||||
// scale factor to pixels
|
||||
const gp_XYZ aViewDim = aProxyCamera->ViewDimensions(aFocus);
|
||||
const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
|
||||
const Standard_Real aScale = std::abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
|
||||
gp_XYZ aCenter(0.0, 0.0, -aFocus);
|
||||
if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
|
||||
{
|
||||
|
||||
@@ -127,7 +127,7 @@ static Standard_Real ScaleFactor(const NCollection_Mat4<T>& theMatrix)
|
||||
{
|
||||
// The determinant of the matrix should give the scale factor (cubed).
|
||||
const T aDeterminant = theMatrix.DeterminantMat3();
|
||||
return Pow(static_cast<Standard_Real>(aDeterminant), 1.0 / 3.0);
|
||||
return std::pow(static_cast<Standard_Real>(aDeterminant), 1.0 / 3.0);
|
||||
}
|
||||
} // namespace Graphic3d_TransformUtils
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ Handle(Image_CompressedPixMap) Image_DDSParser::parseHeader(const DDSFileHeader&
|
||||
aDef->SetBaseFormat(aBaseFormat);
|
||||
aDef->SetCompressedFormat(aFormat);
|
||||
|
||||
const Standard_Integer aNbMipMaps = Max((Standard_Integer)theHeader.MipMapCount, 1);
|
||||
const Standard_Integer aNbMipMaps = std::max((Standard_Integer)theHeader.MipMapCount, 1);
|
||||
aDef->ChangeMipMaps().Resize(0, aNbMipMaps - 1, false);
|
||||
{
|
||||
Standard_Size aFaceSize = 0;
|
||||
|
||||
@@ -161,7 +161,7 @@ Standard_Integer Image_Diff::Compare()
|
||||
const Standard_Integer aDiff =
|
||||
Standard_Integer(myImageNew->Value<unsigned char>(aRow, aCol))
|
||||
- Standard_Integer(myImageRef->Value<unsigned char>(aRow, aCol));
|
||||
if (Abs(aDiff) > aDiffThreshold)
|
||||
if (std::abs(aDiff) > aDiffThreshold)
|
||||
{
|
||||
myDiffPixels.Append(PackXY((uint16_t)aCol, (uint16_t)aRow));
|
||||
++aNbDiffColors;
|
||||
@@ -411,8 +411,8 @@ Standard_Integer Image_Diff::ignoreBorderEffect()
|
||||
for (Standard_Integer aPixelId2 = aPixelId1 + 1; aPixelId2 < myDiffPixels.Length(); ++aPixelId2)
|
||||
{
|
||||
Standard_Integer aValue2 = myDiffPixels.Value(aPixelId2);
|
||||
if (Abs(Standard_Integer(UnpackX(aValue1)) - Standard_Integer(UnpackX(aValue2))) <= 1
|
||||
&& Abs(Standard_Integer(UnpackY(aValue1)) - Standard_Integer(UnpackY(aValue2))) <= 1)
|
||||
if (std::abs(Standard_Integer(UnpackX(aValue1)) - Standard_Integer(UnpackX(aValue2))) <= 1
|
||||
&& std::abs(Standard_Integer(UnpackY(aValue1)) - Standard_Integer(UnpackY(aValue2))) <= 1)
|
||||
{
|
||||
// A neighbour is found. Create a new group and add both pixels.
|
||||
if (myGroupsOfDiffPixels.IsEmpty())
|
||||
|
||||
@@ -258,8 +258,8 @@ bool Media_FormatContext::OpenInput(const TCollection_AsciiString& theInput)
|
||||
for (unsigned int aStreamId = 0; aStreamId < myFormatCtx->nb_streams; ++aStreamId)
|
||||
{
|
||||
const AVStream& aStream = *myFormatCtx->streams[aStreamId];
|
||||
myPtsStartBase = Min(myPtsStartBase, StreamUnitsToSeconds(aStream, aStream.start_time));
|
||||
myDuration = Max(myDuration, StreamUnitsToSeconds(aStream, aStream.duration));
|
||||
myPtsStartBase = std::min(myPtsStartBase, StreamUnitsToSeconds(aStream, aStream.start_time));
|
||||
myDuration = std::max(myDuration, StreamUnitsToSeconds(aStream, aStream.duration));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -316,19 +316,19 @@ Aspect_TypeOfResize WNT_Window::DoResize()
|
||||
}
|
||||
|
||||
int aMask = 0;
|
||||
if (Abs((int)aPlace.rcNormalPosition.left - myXLeft) > 2)
|
||||
if (std::abs((int)aPlace.rcNormalPosition.left - myXLeft) > 2)
|
||||
{
|
||||
aMask |= 1;
|
||||
}
|
||||
if (Abs((int)aPlace.rcNormalPosition.right - myXRight) > 2)
|
||||
if (std::abs((int)aPlace.rcNormalPosition.right - myXRight) > 2)
|
||||
{
|
||||
aMask |= 2;
|
||||
}
|
||||
if (Abs((int)aPlace.rcNormalPosition.top - myYTop) > 2)
|
||||
if (std::abs((int)aPlace.rcNormalPosition.top - myYTop) > 2)
|
||||
{
|
||||
aMask |= 4;
|
||||
}
|
||||
if (Abs((int)aPlace.rcNormalPosition.bottom - myYBottom) > 2)
|
||||
if (std::abs((int)aPlace.rcNormalPosition.bottom - myYBottom) > 2)
|
||||
{
|
||||
aMask |= 8;
|
||||
}
|
||||
|
||||
@@ -256,13 +256,13 @@ Aspect_TypeOfResize Xw_Window::DoResize()
|
||||
Standard_Integer aMask = 0;
|
||||
Aspect_TypeOfResize aMode = Aspect_TOR_UNKNOWN;
|
||||
|
||||
if (Abs(aWinAttr.x - myXLeft) > 2)
|
||||
if (std::abs(aWinAttr.x - myXLeft) > 2)
|
||||
aMask |= 1;
|
||||
if (Abs((aWinAttr.x + aWinAttr.width) - myXRight) > 2)
|
||||
if (std::abs((aWinAttr.x + aWinAttr.width) - myXRight) > 2)
|
||||
aMask |= 2;
|
||||
if (Abs(aWinAttr.y - myYTop) > 2)
|
||||
if (std::abs(aWinAttr.y - myYTop) > 2)
|
||||
aMask |= 4;
|
||||
if (Abs((aWinAttr.y + aWinAttr.height) - myYBottom) > 2)
|
||||
if (std::abs((aWinAttr.y + aWinAttr.height) - myYBottom) > 2)
|
||||
aMask |= 8;
|
||||
switch (aMask)
|
||||
{
|
||||
|
||||
@@ -143,7 +143,7 @@ void AIS_Animation::UpdateTotalDuration()
|
||||
anIter.Next())
|
||||
{
|
||||
myChildrenDuration =
|
||||
Max(myChildrenDuration, anIter.Value()->StartPts() + anIter.Value()->Duration());
|
||||
std::max(myChildrenDuration, anIter.Value()->StartPts() + anIter.Value()->Duration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ void AIS_Animation::Stop()
|
||||
{
|
||||
const Standard_Real anElapsedTime = ElapsedTime();
|
||||
myTimer->Stop();
|
||||
myTimer->Seek(Min(Duration(), anElapsedTime));
|
||||
myTimer->Seek(std::min(Duration(), anElapsedTime));
|
||||
}
|
||||
|
||||
for (NCollection_Sequence<Handle(AIS_Animation)>::Iterator anIter(myAnimations); anIter.More();
|
||||
@@ -251,8 +251,8 @@ Standard_Boolean AIS_Animation::Update(const Standard_Real thePts)
|
||||
aPosition.Pts = thePts;
|
||||
aPosition.LocalPts = thePts - myPtsStart;
|
||||
aPosition.LocalNormalized = HasOwnDuration() ? (aPosition.LocalPts / myOwnDuration) : 0.0;
|
||||
aPosition.LocalNormalized = Max(0.0, aPosition.LocalNormalized);
|
||||
aPosition.LocalNormalized = Min(1.0, aPosition.LocalNormalized);
|
||||
aPosition.LocalNormalized = std::max(0.0, aPosition.LocalNormalized);
|
||||
aPosition.LocalNormalized = std::min(1.0, aPosition.LocalNormalized);
|
||||
updateWithChildren(aPosition);
|
||||
return thePts < myPtsStart + Duration();
|
||||
}
|
||||
@@ -274,8 +274,8 @@ void AIS_Animation::updateWithChildren(const AIS_AnimationProgress& thePosition)
|
||||
aPosition.LocalPts = aPosition.LocalPts - anAnim->StartPts();
|
||||
aPosition.LocalNormalized =
|
||||
anAnim->HasOwnDuration() ? (aPosition.LocalPts / anAnim->OwnDuration()) : 0.0;
|
||||
aPosition.LocalNormalized = Max(0.0, aPosition.LocalNormalized);
|
||||
aPosition.LocalNormalized = Min(1.0, aPosition.LocalNormalized);
|
||||
aPosition.LocalNormalized = std::max(0.0, aPosition.LocalNormalized);
|
||||
aPosition.LocalNormalized = std::min(1.0, aPosition.LocalNormalized);
|
||||
anAnim->updateWithChildren(aPosition);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
void SetStartPts(const Standard_Real thePtsStart) { myPtsStart = thePtsStart; }
|
||||
|
||||
//! @return duration of the animation in the timeline
|
||||
Standard_Real Duration() const { return Max(myOwnDuration, myChildrenDuration); }
|
||||
Standard_Real Duration() const { return (std::max)(myOwnDuration, myChildrenDuration); }
|
||||
|
||||
//! Update total duration considering all animations on timeline.
|
||||
Standard_EXPORT void UpdateTotalDuration();
|
||||
|
||||
@@ -57,7 +57,7 @@ AIS_Circle::AIS_Circle(const Handle(Geom_Circle)& theComponent,
|
||||
myComponent(theComponent),
|
||||
myUStart(theUStart),
|
||||
myUEnd(theUEnd),
|
||||
myCircleIsArc(Abs(Abs(theUEnd - theUStart) - 2.0 * M_PI) > gp::Resolution()),
|
||||
myCircleIsArc(std::abs(std::abs(theUEnd - theUStart) - 2.0 * M_PI) > gp::Resolution()),
|
||||
myIsFilledCircleSens(theIsFilledCircleSens)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -93,17 +93,17 @@ static Standard_Integer colorDiscreteInterval(Standard_Real theValue,
|
||||
Standard_Real theMax,
|
||||
Standard_Integer theNbIntervals)
|
||||
{
|
||||
if (Abs(theMax - theMin) <= Precision::Approximation())
|
||||
if (std::abs(theMax - theMin) <= Precision::Approximation())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer anInterval =
|
||||
1
|
||||
+ (Standard_Integer)Floor(Standard_Real(theNbIntervals) * (theValue - theMin)
|
||||
/ (theMax - theMin));
|
||||
+ (Standard_Integer)std::floor(Standard_Real(theNbIntervals) * (theValue - theMin)
|
||||
/ (theMax - theMin));
|
||||
// map the very upper value (theValue==theMax) to the largest color interval
|
||||
anInterval = Min(anInterval, theNbIntervals);
|
||||
anInterval = std::min(anInterval, theNbIntervals);
|
||||
return anInterval;
|
||||
}
|
||||
} // namespace
|
||||
@@ -205,8 +205,8 @@ void AIS_ColorScale::GetColors(Aspect_SequenceOfColor& theColors) const
|
||||
|
||||
void AIS_ColorScale::SetRange(const Standard_Real theMin, const Standard_Real theMax)
|
||||
{
|
||||
myMin = Min(theMin, theMax);
|
||||
myMax = Max(theMin, theMax);
|
||||
myMin = std::min(theMin, theMax);
|
||||
myMax = std::max(theMin, theMax);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@@ -282,7 +282,7 @@ Aspect_SequenceOfColor AIS_ColorScale::MakeUniformColors(Standard_Integer theNbC
|
||||
// adjust range to be within (0, 360], with sign according to theHueFrom and theHueTo
|
||||
Standard_Real aHueRange = std::fmod(theHueTo - theHueFrom, 360.);
|
||||
constexpr Standard_Real aHueEps = Precision::Angular() * 180. / M_PI;
|
||||
if (Abs(aHueRange) <= aHueEps)
|
||||
if (std::abs(aHueRange) <= aHueEps)
|
||||
{
|
||||
aHueRange = (aHueRange < 0 ? -360. : 360.);
|
||||
}
|
||||
@@ -305,7 +305,7 @@ Aspect_SequenceOfColor AIS_ColorScale::MakeUniformColors(Standard_Integer theNbC
|
||||
}
|
||||
|
||||
// discretize the range with 1 degree step
|
||||
const int NBCOLORS = 2 + (int)Abs(aHueRange / 1.);
|
||||
const int NBCOLORS = 2 + (int)std::abs(aHueRange / 1.);
|
||||
Standard_Real aHueStep = aHueRange / (NBCOLORS - 1);
|
||||
NCollection_Array1<Quantity_Color> aGrid(0, NBCOLORS - 1);
|
||||
for (Standard_Integer i = 0; i < NBCOLORS; i++)
|
||||
@@ -375,7 +375,7 @@ void AIS_ColorScale::SizeHint(Standard_Integer& theWidth, Standard_Integer& theH
|
||||
for (Standard_Integer aLabIter = (myIsLabelAtBorder ? 0 : 1); aLabIter <= myNbIntervals;
|
||||
++aLabIter)
|
||||
{
|
||||
aTextWidth = Max(aTextWidth, TextWidth(GetLabel(aLabIter)));
|
||||
aTextWidth = std::max(aTextWidth, TextWidth(GetLabel(aLabIter)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ void AIS_ColorScale::SizeHint(Standard_Integer& theWidth, Standard_Integer& theH
|
||||
aTitleWidth = TextWidth(myTitle) + mySpacing * 2;
|
||||
}
|
||||
|
||||
theWidth = Max(aTitleWidth, aScaleWidth);
|
||||
theWidth = std::max(aTitleWidth, aScaleWidth);
|
||||
theHeight = aScaleHeight + aTitleHeight;
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ Standard_Real AIS_ColorScale::GetIntervalValue(const Standard_Integer theIndex)
|
||||
Standard_Real aNum = 0;
|
||||
if (myNbIntervals > 0)
|
||||
{
|
||||
aNum = GetMin() + theIndex * (Abs(GetMax() - GetMin()) / myNbIntervals);
|
||||
aNum = GetMin() + theIndex * (std::abs(GetMax() - GetMin()) / myNbIntervals);
|
||||
}
|
||||
return aNum;
|
||||
}
|
||||
@@ -489,7 +489,7 @@ Standard_Integer AIS_ColorScale::computeMaxLabelWidth(
|
||||
{
|
||||
if (!aLabIter.Value().IsEmpty())
|
||||
{
|
||||
aWidthMax = Max(aWidthMax, TextWidth(aLabIter.Value()));
|
||||
aWidthMax = std::max(aWidthMax, TextWidth(aLabIter.Value()));
|
||||
}
|
||||
}
|
||||
return aWidthMax;
|
||||
@@ -559,7 +559,8 @@ void AIS_ColorScale::Compute(const Handle(PrsMgr_PresentationManager)&,
|
||||
|
||||
const Standard_Integer aTextWidth =
|
||||
myLabelPos != Aspect_TOCSP_NONE ? computeMaxLabelWidth(aLabels) : 0;
|
||||
Standard_Integer aColorBreadth = Max(5, Min(20, myBreadth - aTextWidth - 3 * mySpacing));
|
||||
Standard_Integer aColorBreadth =
|
||||
std::max(5, std::min(20, myBreadth - aTextWidth - 3 * mySpacing));
|
||||
if (myLabelPos == Aspect_TOCSP_CENTER || myLabelPos == Aspect_TOCSP_NONE)
|
||||
{
|
||||
aColorBreadth += aTextWidth;
|
||||
@@ -750,7 +751,7 @@ void AIS_ColorScale::drawLabels(const Handle(Graphic3d_Group)& theGroup
|
||||
!myTitle.IsEmpty() ? (myTextHeight + 2 * mySpacing) : mySpacing;
|
||||
const Standard_Integer aSpc =
|
||||
myHeight - aTitleHeight
|
||||
- ((Min(aNbLabels, 2) + Abs(aNbLabels - aNbIntervals - 1)) * myTextHeight);
|
||||
- ((std::min(aNbLabels, 2) + std::abs(aNbLabels - aNbIntervals - 1)) * myTextHeight);
|
||||
if (aSpc <= 0)
|
||||
{
|
||||
return;
|
||||
@@ -819,8 +820,8 @@ void AIS_ColorScale::drawLabels(const Handle(Graphic3d_Group)& theGroup
|
||||
Standard_Integer i0 = -1;
|
||||
while (aPos <= i2 && i0 == -1)
|
||||
{
|
||||
if (aFilter && !(aPos % aFilter) && Abs(aPos - aLast1) >= aFilter
|
||||
&& Abs(aPos - aLast2) >= aFilter)
|
||||
if (aFilter && !(aPos % aFilter) && std::abs(aPos - aLast1) >= aFilter
|
||||
&& std::abs(aPos - aLast2) >= aFilter)
|
||||
{
|
||||
i0 = aPos;
|
||||
}
|
||||
|
||||
@@ -1763,7 +1763,7 @@ void AIS_InteractiveContext::ClearGlobal(const Handle(AIS_InteractiveObject)& th
|
||||
myDetectedSeq.Remove(aDetIter);
|
||||
if (myCurDetected == aDetIter)
|
||||
{
|
||||
myCurDetected = Min(myDetectedSeq.Upper(), aDetIter);
|
||||
myCurDetected = std::min(myDetectedSeq.Upper(), aDetIter);
|
||||
}
|
||||
if (myCurHighlighted == aDetIter)
|
||||
{
|
||||
@@ -1984,7 +1984,7 @@ Standard_Boolean AIS_InteractiveContext::PlaneSize(Standard_Real& theX, Standard
|
||||
{
|
||||
theX = myDefaultDrawer->PlaneAspect()->PlaneXLength();
|
||||
theY = myDefaultDrawer->PlaneAspect()->PlaneYLength();
|
||||
return (Abs(theX - theY) <= Precision::Confusion());
|
||||
return (std::abs(theX - theY) <= Precision::Confusion());
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
@@ -808,7 +808,7 @@ void AIS_LightSource::computeSpot(const Handle(Prs3d_Presentation)& thePrs,
|
||||
if (theMode == 0 && myToDisplayRange)
|
||||
{
|
||||
const Standard_ShortReal aHalfAngle = myLightSource->Angle() / 2.0f;
|
||||
const Standard_Real aRadius = aDistance * Tan(aHalfAngle);
|
||||
const Standard_Real aRadius = aDistance * std::tan(aHalfAngle);
|
||||
gp_Ax3 aSystem(aLightPos + aLightDir.XYZ() * aDistance, -aLightDir);
|
||||
gp_Trsf aTrsfCone;
|
||||
aTrsfCone.SetTransformation(aSystem, gp_Ax3());
|
||||
@@ -850,7 +850,7 @@ void AIS_LightSource::ComputeSelection(const Handle(SelectMgr_Selection)& theSel
|
||||
aSensPosition->SetSensitivityFactor(12);
|
||||
if (!myTransformPersistence.IsNull() && myTransformPersistence->IsTrihedronOr2d())
|
||||
{
|
||||
aSensPosition->SetSensitivityFactor(Max(12, Standard_Integer(mySize * 0.5)));
|
||||
aSensPosition->SetSensitivityFactor(std::max(12, Standard_Integer(mySize * 0.5)));
|
||||
}
|
||||
theSel->Add(aSensPosition);
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ void AIS_Manipulator::adjustSize(const Bnd_Box& theBox)
|
||||
Standard_Real aYSize = aYmax - aYmin;
|
||||
Standard_Real aZSize = aZmax - aZmin;
|
||||
|
||||
SetSize((Standard_ShortReal)(Max(aXSize, Max(aYSize, aZSize)) * 0.5));
|
||||
SetSize((Standard_ShortReal)(std::max(aXSize, std::max(aYSize, aZSize)) * 0.5));
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@@ -615,7 +615,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation(const Standard_Integer t
|
||||
gp_Dir aCurrentAxis = gce_MakeDir(aPosLoc, aNewPosition);
|
||||
Standard_Real anAngle = aStartAxis.AngleWithRef(aCurrentAxis, aCurrAxis.Direction());
|
||||
|
||||
if (Abs(anAngle) < Precision::Confusion())
|
||||
if (std::abs(anAngle) < Precision::Confusion())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -643,7 +643,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation(const Standard_Integer t
|
||||
anAspect->SetTransparency(0.5);
|
||||
anAspect->SetColor(myAxes[myCurrentIndex].Color());
|
||||
|
||||
mySector.Init(0.0f, myAxes[myCurrentIndex].InnerRadius(), anAxis, Abs(anAngle));
|
||||
mySector.Init(0.0f, myAxes[myCurrentIndex].InnerRadius(), anAxis, std::abs(anAngle));
|
||||
mySectorGroup->Clear();
|
||||
mySectorGroup->SetPrimitivesAspect(anAspect->Aspect());
|
||||
mySectorGroup->AddPrimitiveArray(mySector.Array());
|
||||
@@ -651,7 +651,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation(const Standard_Integer t
|
||||
}
|
||||
|
||||
// Change value of an angle if it should have different sign.
|
||||
if (anAngle * myPrevState < 0 && Abs(anAngle) < M_PI_2)
|
||||
if (anAngle * myPrevState < 0 && std::abs(anAngle) < M_PI_2)
|
||||
{
|
||||
Standard_Real aSign = myPrevState > 0 ? -1.0 : 1.0;
|
||||
anAngle = aSign * (M_PI * 2 - anAngle);
|
||||
@@ -835,9 +835,10 @@ void AIS_Manipulator::RecomputeTransformation(const Handle(Graphic3d_Camera)& th
|
||||
anAxisDir = myPosition.XDirection().Crossed(myPosition.YDirection());
|
||||
}
|
||||
|
||||
const gp_Dir aCameraProj = Abs(Abs(anAxisDir.Dot(aCameraDir)) - 1.0) <= gp::Resolution()
|
||||
? aCameraDir
|
||||
: anAxisDir.Crossed(aCameraDir).Crossed(anAxisDir);
|
||||
const gp_Dir aCameraProj =
|
||||
std::abs(std::abs(anAxisDir.Dot(aCameraDir)) - 1.0) <= gp::Resolution()
|
||||
? aCameraDir
|
||||
: anAxisDir.Crossed(aCameraDir).Crossed(anAxisDir);
|
||||
const Standard_Boolean isReversed = anAxisDir.Dot(aCameraDir) > 0;
|
||||
Standard_Real anAngle = aNormal.AngleWithRef(aCameraProj, anAxisDir);
|
||||
if (aRefAxis.Direction().X() > 0)
|
||||
@@ -919,16 +920,16 @@ void AIS_Manipulator::RecomputeTransformation(const Handle(Graphic3d_Camera)& th
|
||||
const gp_Dir aZDir = gp::DZ();
|
||||
|
||||
const gp_Dir aCameraProjection =
|
||||
Abs(aXDir.Dot(aCameraDir)) <= gp::Resolution()
|
||||
|| Abs(anYDir.Dot(aCameraDir)) <= gp::Resolution()
|
||||
std::abs(aXDir.Dot(aCameraDir)) <= gp::Resolution()
|
||||
|| std::abs(anYDir.Dot(aCameraDir)) <= gp::Resolution()
|
||||
? aCameraDir
|
||||
: aXDir.XYZ() * (aXDir.Dot(aCameraDir)) + anYDir.XYZ() * (anYDir.Dot(aCameraDir));
|
||||
const Standard_Boolean isReversed = aZDir.Dot(aCameraDir) > 0;
|
||||
|
||||
const Standard_Real anAngle = M_PI_2 - aCameraDir.Angle(aCameraProjection);
|
||||
gp_Dir aRotAxis = Abs(Abs(aCameraProjection.Dot(aZDir)) - 1.0) <= gp::Resolution()
|
||||
? aZDir
|
||||
: aCameraProjection.Crossed(aZDir);
|
||||
const Standard_Real anAngle = M_PI_2 - aCameraDir.Angle(aCameraProjection);
|
||||
gp_Dir aRotAxis = std::abs(std::abs(aCameraProjection.Dot(aZDir)) - 1.0) <= gp::Resolution()
|
||||
? aZDir
|
||||
: aCameraProjection.Crossed(aZDir);
|
||||
if (isReversed)
|
||||
{
|
||||
aRotAxis.Reverse();
|
||||
@@ -1430,8 +1431,8 @@ void AIS_Manipulator::ComputeSelection(const Handle(SelectMgr_Selection)& theSel
|
||||
// Sensitivity is calculated relative to the default size of the manipulator (100.0f).
|
||||
const Standard_ShortReal aSensitivityCoef = myAxes[0].Size() / 100.0f;
|
||||
// clang-format off
|
||||
const Standard_Integer aHighSensitivity = Max (Min (RealToInt (aSensitivityCoef * 15), 15), 3); // clamp sensitivity within range [3, 15]
|
||||
const Standard_Integer aLowSensitivity = Max (Min (RealToInt (aSensitivityCoef * 10), 10), 2); // clamp sensitivity within range [2, 10]
|
||||
const Standard_Integer aHighSensitivity = std::clamp(static_cast<Standard_Integer>(aSensitivityCoef * 15), 3, 15); // clamp sensitivity within range [3, 15]
|
||||
const Standard_Integer aLowSensitivity = std::clamp(static_cast<Standard_Integer>(aSensitivityCoef * 10), 2, 10); // clamp sensitivity within range [2, 10]
|
||||
// clang-format on
|
||||
|
||||
switch (aMode)
|
||||
|
||||
@@ -380,7 +380,7 @@ Standard_Boolean AIS_Plane::Size(Standard_Real& X, Standard_Real& Y) const
|
||||
{
|
||||
X = myDrawer->PlaneAspect()->PlaneXLength();
|
||||
Y = myDrawer->PlaneAspect()->PlaneYLength();
|
||||
return Abs(X - Y) <= Precision::Confusion();
|
||||
return std::abs(X - Y) <= Precision::Confusion();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@@ -395,7 +395,7 @@ void AIS_Plane::SetMinimumSize(const Standard_Real theValue)
|
||||
Standard_Real aX, anY;
|
||||
Size(aX, anY);
|
||||
SetTransformPersistence(
|
||||
new Graphic3d_TransformPersScaledAbove(Min(aX, anY) / theValue, myCenter));
|
||||
new Graphic3d_TransformPersScaledAbove(std::min(aX, anY) / theValue, myCenter));
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@@ -497,8 +497,8 @@ void AIS_Plane::ComputeFrame()
|
||||
Handle(Geom_Plane)::DownCast(pl->Translated(pl->Location(), myCenter)));
|
||||
ElSLib::Parameters(thegoodpl->Pln(), myPmin, U, V);
|
||||
|
||||
U = 2.4 * Abs(U);
|
||||
V = 2.4 * Abs(V);
|
||||
U = 2.4 * std::abs(U);
|
||||
V = 2.4 * std::abs(V);
|
||||
if (U < 10 * Precision::Confusion())
|
||||
U = 0.1;
|
||||
if (V < 10 * Precision::Confusion())
|
||||
|
||||
@@ -373,8 +373,8 @@ Standard_Boolean AIS_TextLabel::calculateLabelParams(const gp_Pnt& thePosition,
|
||||
const NCollection_String aText(myText.ToExtString());
|
||||
Font_Rect aBndBox =
|
||||
aFont->BoundingBox(aText, anAsp->HorizontalJustification(), anAsp->VerticalJustification());
|
||||
theWidth = Abs(aBndBox.Width());
|
||||
theHeight = Abs(aBndBox.Height());
|
||||
theWidth = std::abs(aBndBox.Width());
|
||||
theHeight = std::abs(aBndBox.Height());
|
||||
|
||||
theCenterOfLabel = thePosition;
|
||||
if (anAsp->VerticalJustification() == Graphic3d_VTA_BOTTOM)
|
||||
|
||||
@@ -419,7 +419,7 @@ void AIS_ViewController::flushGestures(const Handle(AIS_InteractiveContext)&,
|
||||
// rotation
|
||||
const Standard_Real aRotTouchTol =
|
||||
!aTouch.IsPreciseDevice ? aTolScale * myTouchRotationThresholdPx : gp::Resolution();
|
||||
if (Abs(aTouch.Delta().x()) + Abs(aTouch.Delta().y()) > aRotTouchTol)
|
||||
if (std::abs(aTouch.Delta().x()) + std::abs(aTouch.Delta().y()) > aRotTouchTol)
|
||||
{
|
||||
const Standard_Real aRotAccel =
|
||||
myNavigationMode == AIS_NavigationMode_FirstPersonWalk ? myMouseAccel : myOrbitAccel;
|
||||
@@ -484,10 +484,10 @@ void AIS_ViewController::flushGestures(const Handle(AIS_InteractiveContext)&,
|
||||
else
|
||||
{
|
||||
Standard_Real aNumerator = A1 * B2 - A2 * B1;
|
||||
aRotAngle = ATan(aNumerator / aDenomenator);
|
||||
aRotAngle = std::atan(aNumerator / aDenomenator);
|
||||
}
|
||||
|
||||
if (Abs(aRotAngle) > Standard_Real(myTouchZRotationThreshold))
|
||||
if (std::abs(aRotAngle) > Standard_Real(myTouchZRotationThreshold))
|
||||
{
|
||||
myGL.ZRotate.ToRotate = true;
|
||||
myGL.ZRotate.Angle = aRotAngle;
|
||||
@@ -495,7 +495,7 @@ void AIS_ViewController::flushGestures(const Handle(AIS_InteractiveContext)&,
|
||||
}
|
||||
}
|
||||
|
||||
if (Abs(aDeltaSize) > aTolScale * myTouchZoomThresholdPx)
|
||||
if (std::abs(aDeltaSize) > aTolScale * myTouchZoomThresholdPx)
|
||||
{
|
||||
// zoom
|
||||
aDeltaSize *= Standard_Real(myTouchZoomRatio);
|
||||
@@ -506,7 +506,7 @@ void AIS_ViewController::flushGestures(const Handle(AIS_InteractiveContext)&,
|
||||
|
||||
const Standard_Real aPanTouchTol =
|
||||
!aFirstTouch.IsPreciseDevice ? aTolScale * myTouchPanThresholdPx : gp::Resolution();
|
||||
if (Abs(aPinchCenterXDev) + Abs(aPinchCenterYDev) > aPanTouchTol)
|
||||
if (std::abs(aPinchCenterXDev) + std::abs(aPinchCenterYDev) > aPanTouchTol)
|
||||
{
|
||||
// pan
|
||||
if (myUpdateStartPointPan)
|
||||
@@ -988,7 +988,7 @@ bool AIS_ViewController::UpdateMousePosition(const Graphic3d_Vec2i& thePoint,
|
||||
const double aRotTol =
|
||||
theIsEmulated ? double(myTouchToleranceScale) * myTouchRotationThresholdPx : 0.0;
|
||||
const Graphic3d_Vec2d aDeltaF(aDelta);
|
||||
if (Abs(aDeltaF.x()) + Abs(aDeltaF.y()) > aRotTol)
|
||||
if (std::abs(aDeltaF.x()) + std::abs(aDeltaF.y()) > aRotTol)
|
||||
{
|
||||
const double aRotAccel =
|
||||
myNavigationMode == AIS_NavigationMode_FirstPersonWalk ? myMouseAccel : myOrbitAccel;
|
||||
@@ -1024,7 +1024,7 @@ bool AIS_ViewController::UpdateMousePosition(const Graphic3d_Vec2i& thePoint,
|
||||
theIsEmulated ? double(myTouchToleranceScale) * myTouchZoomThresholdPx : 0.0;
|
||||
const double aScrollDelta =
|
||||
myMouseActiveGesture == AIS_MouseGesture_Zoom ? aDelta.x() : aDelta.y();
|
||||
if (Abs(aScrollDelta) > aZoomTol)
|
||||
if (std::abs(aScrollDelta) > aZoomTol)
|
||||
{
|
||||
if (UpdateZoom(Aspect_ScrollDelta(aScrollDelta)))
|
||||
{
|
||||
@@ -1046,7 +1046,7 @@ bool AIS_ViewController::UpdateMousePosition(const Graphic3d_Vec2i& thePoint,
|
||||
const double aPanTol =
|
||||
theIsEmulated ? double(myTouchToleranceScale) * myTouchPanThresholdPx : 0.0;
|
||||
const Graphic3d_Vec2d aDeltaF(aDelta);
|
||||
if (Abs(aDeltaF.x()) + Abs(aDeltaF.y()) > aPanTol)
|
||||
if (std::abs(aDeltaF.x()) + std::abs(aDeltaF.y()) > aPanTol)
|
||||
{
|
||||
if (myUpdateStartPointPan)
|
||||
{
|
||||
@@ -1083,7 +1083,7 @@ bool AIS_ViewController::UpdateMousePosition(const Graphic3d_Vec2i& thePoint,
|
||||
|
||||
const double aDragTol =
|
||||
theIsEmulated ? double(myTouchToleranceScale) * myTouchDraggingThresholdPx : 0.0;
|
||||
if (double(Abs(aDelta.x()) + Abs(aDelta.y())) > aDragTol)
|
||||
if (double(std::abs(aDelta.x()) + std::abs(aDelta.y())) > aDragTol)
|
||||
{
|
||||
const double aRotAccel =
|
||||
myNavigationMode == AIS_NavigationMode_FirstPersonWalk ? myMouseAccel : myOrbitAccel;
|
||||
@@ -1281,7 +1281,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
updateEventsTime(aPrevEventTime, aNewEventTime);
|
||||
|
||||
double aDuration = 0.0, aPressure = 1.0;
|
||||
if (Abs(myThrustSpeed) > gp::Resolution())
|
||||
if (std::abs(myThrustSpeed) > gp::Resolution())
|
||||
{
|
||||
if (myHasThrust)
|
||||
{
|
||||
@@ -1316,7 +1316,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
: 1.0;
|
||||
if (myKeys.HoldDuration(Aspect_VKey_NavForward, aNewEventTime, aDuration, aPressure))
|
||||
{
|
||||
double aProgress = Abs(Min(aMaxDuration, aDuration));
|
||||
double aProgress = std::abs(std::min(aMaxDuration, aDuration));
|
||||
aProgress *= aRunRatio;
|
||||
aWalk.SetDefined(true);
|
||||
aWalk[AIS_WalkTranslation_Forward].Value += aProgress;
|
||||
@@ -1325,7 +1325,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
}
|
||||
if (myKeys.HoldDuration(Aspect_VKey_NavBackward, aNewEventTime, aDuration, aPressure))
|
||||
{
|
||||
double aProgress = Abs(Min(aMaxDuration, aDuration));
|
||||
double aProgress = std::abs(std::min(aMaxDuration, aDuration));
|
||||
aProgress *= aRunRatio;
|
||||
aWalk.SetDefined(true);
|
||||
aWalk[AIS_WalkTranslation_Forward].Value += -aProgress;
|
||||
@@ -1334,7 +1334,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
}
|
||||
if (myKeys.HoldDuration(Aspect_VKey_NavSlideLeft, aNewEventTime, aDuration, aPressure))
|
||||
{
|
||||
double aProgress = Abs(Min(aMaxDuration, aDuration));
|
||||
double aProgress = std::abs(std::min(aMaxDuration, aDuration));
|
||||
aProgress *= aRunRatio;
|
||||
aWalk.SetDefined(true);
|
||||
aWalk[AIS_WalkTranslation_Side].Value = -aProgress;
|
||||
@@ -1343,7 +1343,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
}
|
||||
if (myKeys.HoldDuration(Aspect_VKey_NavSlideRight, aNewEventTime, aDuration, aPressure))
|
||||
{
|
||||
double aProgress = Abs(Min(aMaxDuration, aDuration));
|
||||
double aProgress = std::abs(std::min(aMaxDuration, aDuration));
|
||||
aProgress *= aRunRatio;
|
||||
aWalk.SetDefined(true);
|
||||
aWalk[AIS_WalkTranslation_Side].Value = aProgress;
|
||||
@@ -1352,7 +1352,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
}
|
||||
if (myKeys.HoldDuration(Aspect_VKey_NavLookLeft, aNewEventTime, aDuration, aPressure))
|
||||
{
|
||||
double aProgress = Abs(Min(aMaxDuration, aDuration)) * aPressure;
|
||||
double aProgress = std::abs(std::min(aMaxDuration, aDuration)) * aPressure;
|
||||
aWalk.SetDefined(true);
|
||||
aWalk[AIS_WalkRotation_Yaw].Value = aProgress;
|
||||
aWalk[AIS_WalkRotation_Yaw].Pressure = aPressure;
|
||||
@@ -1360,7 +1360,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
}
|
||||
if (myKeys.HoldDuration(Aspect_VKey_NavLookRight, aNewEventTime, aDuration, aPressure))
|
||||
{
|
||||
double aProgress = Abs(Min(aMaxDuration, aDuration)) * aPressure;
|
||||
double aProgress = std::abs(std::min(aMaxDuration, aDuration)) * aPressure;
|
||||
aWalk.SetDefined(true);
|
||||
aWalk[AIS_WalkRotation_Yaw].Value = -aProgress;
|
||||
aWalk[AIS_WalkRotation_Yaw].Pressure = aPressure;
|
||||
@@ -1368,7 +1368,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
}
|
||||
if (myKeys.HoldDuration(Aspect_VKey_NavLookUp, aNewEventTime, aDuration, aPressure))
|
||||
{
|
||||
double aProgress = Abs(Min(aMaxDuration, aDuration)) * aPressure;
|
||||
double aProgress = std::abs(std::min(aMaxDuration, aDuration)) * aPressure;
|
||||
aWalk.SetDefined(true);
|
||||
aWalk[AIS_WalkRotation_Pitch].Value = !myToInvertPitch ? -aProgress : aProgress;
|
||||
aWalk[AIS_WalkRotation_Pitch].Pressure = aPressure;
|
||||
@@ -1376,7 +1376,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
}
|
||||
if (myKeys.HoldDuration(Aspect_VKey_NavLookDown, aNewEventTime, aDuration, aPressure))
|
||||
{
|
||||
double aProgress = Abs(Min(aMaxDuration, aDuration)) * aPressure;
|
||||
double aProgress = std::abs(std::min(aMaxDuration, aDuration)) * aPressure;
|
||||
aWalk.SetDefined(true);
|
||||
aWalk[AIS_WalkRotation_Pitch].Value = !myToInvertPitch ? aProgress : -aProgress;
|
||||
aWalk[AIS_WalkRotation_Pitch].Pressure = aPressure;
|
||||
@@ -1384,7 +1384,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
}
|
||||
if (myKeys.HoldDuration(Aspect_VKey_NavRollCCW, aNewEventTime, aDuration, aPressure))
|
||||
{
|
||||
double aProgress = Abs(Min(aMaxDuration, aDuration)) * aPressure;
|
||||
double aProgress = std::abs(std::min(aMaxDuration, aDuration)) * aPressure;
|
||||
aWalk.SetDefined(true);
|
||||
aWalk[AIS_WalkRotation_Roll].Value = -aProgress;
|
||||
aWalk[AIS_WalkRotation_Roll].Pressure = aPressure;
|
||||
@@ -1392,7 +1392,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
}
|
||||
if (myKeys.HoldDuration(Aspect_VKey_NavRollCW, aNewEventTime, aDuration, aPressure))
|
||||
{
|
||||
double aProgress = Abs(Min(aMaxDuration, aDuration)) * aPressure;
|
||||
double aProgress = std::abs(std::min(aMaxDuration, aDuration)) * aPressure;
|
||||
aWalk.SetDefined(true);
|
||||
aWalk[AIS_WalkRotation_Roll].Value = aProgress;
|
||||
aWalk[AIS_WalkRotation_Roll].Pressure = aPressure;
|
||||
@@ -1400,7 +1400,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
}
|
||||
if (myKeys.HoldDuration(Aspect_VKey_NavSlideUp, aNewEventTime, aDuration, aPressure))
|
||||
{
|
||||
double aProgress = Abs(Min(aMaxDuration, aDuration));
|
||||
double aProgress = std::abs(std::min(aMaxDuration, aDuration));
|
||||
aWalk.SetDefined(true);
|
||||
aWalk[AIS_WalkTranslation_Up].Value = aProgress;
|
||||
aWalk[AIS_WalkTranslation_Up].Pressure = aPressure;
|
||||
@@ -1408,7 +1408,7 @@ AIS_WalkDelta AIS_ViewController::FetchNavigationKeys(Standard_Real theCrouchRat
|
||||
}
|
||||
if (myKeys.HoldDuration(Aspect_VKey_NavSlideDown, aNewEventTime, aDuration, aPressure))
|
||||
{
|
||||
double aProgress = Abs(Min(aMaxDuration, aDuration));
|
||||
double aProgress = std::abs(std::min(aMaxDuration, aDuration));
|
||||
aWalk.SetDefined(true);
|
||||
aWalk[AIS_WalkTranslation_Up].Value = -aProgress;
|
||||
aWalk[AIS_WalkTranslation_Up].Pressure = aPressure;
|
||||
@@ -1507,13 +1507,14 @@ void AIS_ViewController::handleZoom(const Handle(V3d_View)& theView,
|
||||
const Handle(Graphic3d_Camera)& aCam = theView->Camera();
|
||||
if (thePnt != NULL)
|
||||
{
|
||||
const double aViewDist = Max(myMinCamDistance, (thePnt->XYZ() - aCam->Eye().XYZ()).Modulus());
|
||||
const double aViewDist =
|
||||
std::max(myMinCamDistance, (thePnt->XYZ() - aCam->Eye().XYZ()).Modulus());
|
||||
aCam->SetCenter(aCam->Eye().XYZ() + aCam->Direction().XYZ() * aViewDist);
|
||||
}
|
||||
|
||||
if (!theParams.HasPoint())
|
||||
{
|
||||
Standard_Real aCoeff = Abs(theParams.Delta) / 100.0 + 1.0;
|
||||
Standard_Real aCoeff = std::abs(theParams.Delta) / 100.0 + 1.0;
|
||||
aCoeff = theParams.Delta > 0.0 ? aCoeff : 1.0 / aCoeff;
|
||||
theView->SetZoom(aCoeff, true);
|
||||
theView->Invalidate();
|
||||
@@ -1525,7 +1526,7 @@ void AIS_ViewController::handleZoom(const Handle(V3d_View)& theView,
|
||||
// theView->StartZoomAtPoint (theParams.Point.x(), theParams.Point.y());
|
||||
// theView->ZoomAtPoint (0, 0, (int )theParams.Delta, (int )theParams.Delta);
|
||||
|
||||
double aDZoom = Abs(theParams.Delta) / 100.0 + 1.0;
|
||||
double aDZoom = std::abs(theParams.Delta) / 100.0 + 1.0;
|
||||
aDZoom = (theParams.Delta > 0.0) ? aDZoom : 1.0 / aDZoom;
|
||||
if (aDZoom <= 0.0)
|
||||
{
|
||||
@@ -1667,7 +1668,7 @@ void AIS_ViewController::handleOrbitRotation(const Handle(V3d_View)& theView,
|
||||
* (M_PI * 0.5);
|
||||
|
||||
// Z-up locking: clamp pitch to prevent camera flipping at top/bottom
|
||||
if (Abs(aPitchAngleDelta) > gp::Resolution())
|
||||
if (std::abs(aPitchAngleDelta) > gp::Resolution())
|
||||
{
|
||||
// Calculate current pitch angle from camera direction (like original Euler)
|
||||
const double aCurrentPitch = asin(-myCamStartOpDir.Z()); // Negative Z for proper orientation
|
||||
@@ -1680,8 +1681,8 @@ void AIS_ViewController::handleOrbitRotation(const Handle(V3d_View)& theView,
|
||||
}
|
||||
|
||||
// Apply transformations only when needed
|
||||
const bool hasYaw = Abs(aYawAngleDelta) > Precision::Angular();
|
||||
const bool hasPitch = Abs(aPitchAngleDelta) > Precision::Angular();
|
||||
const bool hasYaw = std::abs(aYawAngleDelta) > Precision::Angular();
|
||||
const bool hasPitch = std::abs(aPitchAngleDelta) > Precision::Angular();
|
||||
|
||||
if (hasYaw || hasPitch)
|
||||
{
|
||||
@@ -1801,9 +1802,9 @@ void AIS_ViewController::handleViewRotation(const Handle(V3d_View)& theView,
|
||||
}
|
||||
|
||||
const Handle(Graphic3d_Camera)& aCam = theView->Camera();
|
||||
const bool aRollIsChanged = Abs(theRoll - myCurrentRollAngle) > gp::Resolution();
|
||||
const bool toRotateAnyway =
|
||||
Abs(theYawExtra) > gp::Resolution() || Abs(thePitchExtra) > gp::Resolution() || aRollIsChanged;
|
||||
const bool aRollIsChanged = std::abs(theRoll - myCurrentRollAngle) > gp::Resolution();
|
||||
const bool toRotateAnyway = std::abs(theYawExtra) > gp::Resolution()
|
||||
|| std::abs(thePitchExtra) > gp::Resolution() || aRollIsChanged;
|
||||
|
||||
// Store old and new roll values for later processing
|
||||
const double anOldRollAngle = myCurrentRollAngle;
|
||||
@@ -1859,8 +1860,8 @@ void AIS_ViewController::handleViewRotation(const Handle(V3d_View)& theView,
|
||||
gp_Dir aBaseUp = myCamStartOpUp;
|
||||
gp_Dir aBaseDir = myCamStartOpDir;
|
||||
|
||||
const bool hasYaw = Abs(aYawAngleDelta) > Precision::Angular();
|
||||
const bool hasPitch = Abs(aPitchAngleDelta) > Precision::Angular();
|
||||
const bool hasYaw = std::abs(aYawAngleDelta) > Precision::Angular();
|
||||
const bool hasPitch = std::abs(aPitchAngleDelta) > Precision::Angular();
|
||||
|
||||
if (hasYaw || hasPitch)
|
||||
{
|
||||
@@ -2024,8 +2025,8 @@ void AIS_ViewController::FitAllAuto(const Handle(AIS_InteractiveContext)& theCtx
|
||||
theView->FitMinMax(aCameraSel, aBoxSel, aFitMargin);
|
||||
theView->FitMinMax(aCameraAll, aBoxAll, aFitMargin);
|
||||
if (aCameraSel->Center().IsEqual(aCam->Center(), aFitTol)
|
||||
&& Abs(aCameraSel->Scale() - aCam->Scale()) < aFitTol
|
||||
&& Abs(aCameraSel->Distance() - aCam->Distance()) < aFitTol)
|
||||
&& std::abs(aCameraSel->Scale() - aCam->Scale()) < aFitTol
|
||||
&& std::abs(aCameraSel->Distance() - aCam->Distance()) < aFitTol)
|
||||
{
|
||||
// fit all entire view on second FitALL request
|
||||
aCam->Copy(aCameraAll);
|
||||
@@ -2166,7 +2167,8 @@ AIS_WalkDelta AIS_ViewController::handleNavigationKeys(const Handle(AIS_Interact
|
||||
aMin = aBndBox.CornerMin().XYZ();
|
||||
aMax = aBndBox.CornerMax().XYZ();
|
||||
}
|
||||
double aBndDiam = Max(Max(aMax.X() - aMin.X(), aMax.Y() - aMin.Y()), aMax.Z() - aMin.Z());
|
||||
double aBndDiam =
|
||||
std::max(std::max(aMax.X() - aMin.X(), aMax.Y() - aMin.Y()), aMax.Z() - aMin.Z());
|
||||
if (aBndDiam <= gp::Resolution())
|
||||
{
|
||||
aBndDiam = 0.001;
|
||||
@@ -2412,7 +2414,7 @@ void AIS_ViewController::handleCameraActions(const Handle(AIS_InteractiveContext
|
||||
if (!theWalk[AIS_WalkRotation_Roll].IsEmpty() && !myToLockOrbitZUp)
|
||||
{
|
||||
aRoll = (M_PI / 12.0) * theWalk[AIS_WalkRotation_Roll].Pressure;
|
||||
aRoll *= Min(1000.0 * theWalk[AIS_WalkRotation_Roll].Duration, 100.0) / 100.0;
|
||||
aRoll *= std::min(1000.0 * theWalk[AIS_WalkRotation_Roll].Duration, 100.0) / 100.0;
|
||||
if (theWalk[AIS_WalkRotation_Roll].Value < 0.0)
|
||||
{
|
||||
aRoll = -aRoll;
|
||||
@@ -2516,7 +2518,7 @@ void AIS_ViewController::handleXRTurnPad(const Handle(AIS_InteractiveContext)&,
|
||||
const Aspect_XRAnalogActionData aPadPos =
|
||||
theView->View()->XRSession()->GetAnalogActionData(aPadPosAct);
|
||||
if (aPadClick.IsActive && aPadClick.IsPressed && aPadClick.IsChanged && aPadPos.IsActive
|
||||
&& Abs(aPadPos.VecXYZ.y()) < 0.5f && Abs(aPadPos.VecXYZ.x()) > 0.7f)
|
||||
&& std::abs(aPadPos.VecXYZ.y()) < 0.5f && std::abs(aPadPos.VecXYZ.x()) > 0.7f)
|
||||
{
|
||||
gp_Trsf aTrsfTurn;
|
||||
aTrsfTurn.SetRotation(gp_Ax1(gp::Origin(), theView->View()->BaseXRCamera()->Up()),
|
||||
@@ -2567,7 +2569,7 @@ void AIS_ViewController::handleXRTeleport(const Handle(AIS_InteractiveContext)&
|
||||
const bool isPressed = aPadClick.IsPressed;
|
||||
const bool isClicked = !aPadClick.IsPressed && aPadClick.IsChanged;
|
||||
if (aPadClick.IsActive && (isPressed || isClicked) && aPadPos.IsActive
|
||||
&& aPadPos.VecXYZ.y() > 0.6f && Abs(aPadPos.VecXYZ.x()) < 0.5f)
|
||||
&& aPadPos.VecXYZ.y() > 0.6f && std::abs(aPadPos.VecXYZ.x()) < 0.5f)
|
||||
{
|
||||
const Aspect_TrackedDevicePose& aPose =
|
||||
theView->View()->XRSession()->TrackedPoses()[aDeviceId];
|
||||
@@ -2692,7 +2694,7 @@ void AIS_ViewController::handleXRPicking(const Handle(AIS_InteractiveContext)& t
|
||||
theView->View()->XRSession()->GetDigitalActionData(aTrigClickAct);
|
||||
const Aspect_XRAnalogActionData aTrigPos =
|
||||
theView->View()->XRSession()->GetAnalogActionData(aTrigPullAct);
|
||||
if (aTrigPos.IsActive && Abs(aTrigPos.VecXYZ.x()) > 0.1f)
|
||||
if (aTrigPos.IsActive && std::abs(aTrigPos.VecXYZ.x()) > 0.1f)
|
||||
{
|
||||
myXRLastPickingHand = aRole;
|
||||
handleXRHighlight(theCtx, theView);
|
||||
@@ -3016,10 +3018,11 @@ void AIS_ViewController::handleSelectionPoly(const Handle(AIS_InteractiveContext
|
||||
}
|
||||
else
|
||||
{
|
||||
theCtx->MainSelector()->AllowOverlapDetection(aPnt1.y() != Min(aPnt1.y(), aPnt2.y()));
|
||||
theCtx->MainSelector()->AllowOverlapDetection(aPnt1.y()
|
||||
!= std::min(aPnt1.y(), aPnt2.y()));
|
||||
theCtx->SelectRectangle(
|
||||
Graphic3d_Vec2i(Min(aPnt1.x(), aPnt2.x()), Min(aPnt1.y(), aPnt2.y())),
|
||||
Graphic3d_Vec2i(Max(aPnt1.x(), aPnt2.x()), Max(aPnt1.y(), aPnt2.y())),
|
||||
Graphic3d_Vec2i(std::min(aPnt1.x(), aPnt2.x()), std::min(aPnt1.y(), aPnt2.y())),
|
||||
Graphic3d_Vec2i(std::max(aPnt1.x(), aPnt2.x()), std::max(aPnt1.y(), aPnt2.y())),
|
||||
theView,
|
||||
myGL.Selection.Scheme);
|
||||
theCtx->MainSelector()->AllowOverlapDetection(false);
|
||||
@@ -3443,7 +3446,7 @@ void AIS_ViewController::handleXRPresentations(const Handle(AIS_InteractiveConte
|
||||
const Bnd_Box aViewBox = theView->View()->MinMaxValues(true);
|
||||
if (!aViewBox.IsVoid())
|
||||
{
|
||||
aLaserLen = Sqrt(aViewBox.SquareExtent());
|
||||
aLaserLen = std::sqrt(aViewBox.SquareExtent());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3462,7 +3465,7 @@ void AIS_ViewController::handleXRPresentations(const Handle(AIS_InteractiveConte
|
||||
const Bnd_Box aViewBox = theView->View()->MinMaxValues(true);
|
||||
if (!aViewBox.IsVoid())
|
||||
{
|
||||
aLaserLen = Sqrt(aViewBox.SquareExtent());
|
||||
aLaserLen = std::sqrt(aViewBox.SquareExtent());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ static Standard_Integer nbDirectionComponents(const gp_Dir& theDir)
|
||||
Standard_Integer aNbComps = 0;
|
||||
for (Standard_Integer aCompIter = 1; aCompIter <= 3; ++aCompIter)
|
||||
{
|
||||
if (Abs(theDir.Coord(aCompIter)) > gp::Resolution())
|
||||
if (std::abs(theDir.Coord(aCompIter)) > gp::Resolution())
|
||||
{
|
||||
++aNbComps;
|
||||
}
|
||||
@@ -289,7 +289,7 @@ void AIS_ViewCube::ResetStyles()
|
||||
|
||||
void AIS_ViewCube::SetSize(Standard_Real theValue, Standard_Boolean theToAdaptAnother)
|
||||
{
|
||||
const bool isNewSize = Abs(mySize - theValue) > Precision::Confusion();
|
||||
const bool isNewSize = std::abs(mySize - theValue) > Precision::Confusion();
|
||||
mySize = theValue;
|
||||
if (theToAdaptAnother)
|
||||
{
|
||||
@@ -315,7 +315,7 @@ void AIS_ViewCube::SetRoundRadius(const Standard_Real theValue)
|
||||
{
|
||||
Standard_OutOfRange_Raise_if(theValue < 0.0 || theValue > 0.5,
|
||||
"AIS_ViewCube::SetRoundRadius(): theValue should be in [0; 0.5]");
|
||||
if (Abs(myRoundRadius - theValue) > Precision::Confusion())
|
||||
if (std::abs(myRoundRadius - theValue) > Precision::Confusion())
|
||||
{
|
||||
myRoundRadius = theValue;
|
||||
SetToUpdate();
|
||||
@@ -331,7 +331,7 @@ void AIS_ViewCube::createRoundRectangleTriangles(const Handle(Graphic3d_ArrayOfT
|
||||
Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf)
|
||||
{
|
||||
const Standard_Real aRadius = Min(theRadius, Min(theSize.X(), theSize.Y()) * 0.5);
|
||||
const Standard_Real aRadius = std::min(theRadius, std::min(theSize.X(), theSize.Y()) * 0.5);
|
||||
const gp_XY aHSize(theSize.X() * 0.5 - aRadius, theSize.Y() * 0.5 - aRadius);
|
||||
const gp_Dir aNorm = gp::DZ().Transformed(theTrsf);
|
||||
const Standard_Integer aVertFirst = !theTris.IsNull() ? theTris->VertexNumber() : 0;
|
||||
@@ -352,9 +352,10 @@ void AIS_ViewCube::createRoundRectangleTriangles(const Handle(Graphic3d_ArrayOfT
|
||||
M_PI * 0.5,
|
||||
0.0,
|
||||
Standard_Real(aNodeIter) / Standard_Real(THE_NB_ROUND_SPLITS));
|
||||
theTris->AddVertex(
|
||||
gp_Pnt(aHSize.X() + aRadius * Cos(anAngle), aHSize.Y() + aRadius * Sin(anAngle), 0.0)
|
||||
.Transformed(theTrsf));
|
||||
theTris->AddVertex(gp_Pnt(aHSize.X() + aRadius * std::cos(anAngle),
|
||||
aHSize.Y() + aRadius * std::sin(anAngle),
|
||||
0.0)
|
||||
.Transformed(theTrsf));
|
||||
}
|
||||
for (Standard_Integer aNodeIter = 0; aNodeIter <= THE_NB_ROUND_SPLITS; ++aNodeIter)
|
||||
{
|
||||
@@ -362,9 +363,10 @@ void AIS_ViewCube::createRoundRectangleTriangles(const Handle(Graphic3d_ArrayOfT
|
||||
0.0,
|
||||
-M_PI * 0.5,
|
||||
Standard_Real(aNodeIter) / Standard_Real(THE_NB_ROUND_SPLITS));
|
||||
theTris->AddVertex(
|
||||
gp_Pnt(aHSize.X() + aRadius * Cos(anAngle), -aHSize.Y() + aRadius * Sin(anAngle), 0.0)
|
||||
.Transformed(theTrsf));
|
||||
theTris->AddVertex(gp_Pnt(aHSize.X() + aRadius * std::cos(anAngle),
|
||||
-aHSize.Y() + aRadius * std::sin(anAngle),
|
||||
0.0)
|
||||
.Transformed(theTrsf));
|
||||
}
|
||||
for (Standard_Integer aNodeIter = 0; aNodeIter <= THE_NB_ROUND_SPLITS; ++aNodeIter)
|
||||
{
|
||||
@@ -372,9 +374,10 @@ void AIS_ViewCube::createRoundRectangleTriangles(const Handle(Graphic3d_ArrayOfT
|
||||
-M_PI * 0.5,
|
||||
-M_PI,
|
||||
Standard_Real(aNodeIter) / Standard_Real(THE_NB_ROUND_SPLITS));
|
||||
theTris->AddVertex(
|
||||
gp_Pnt(-aHSize.X() + aRadius * Cos(anAngle), -aHSize.Y() + aRadius * Sin(anAngle), 0.0)
|
||||
.Transformed(theTrsf));
|
||||
theTris->AddVertex(gp_Pnt(-aHSize.X() + aRadius * std::cos(anAngle),
|
||||
-aHSize.Y() + aRadius * std::sin(anAngle),
|
||||
0.0)
|
||||
.Transformed(theTrsf));
|
||||
}
|
||||
for (Standard_Integer aNodeIter = 0; aNodeIter <= THE_NB_ROUND_SPLITS; ++aNodeIter)
|
||||
{
|
||||
@@ -382,9 +385,10 @@ void AIS_ViewCube::createRoundRectangleTriangles(const Handle(Graphic3d_ArrayOfT
|
||||
-M_PI,
|
||||
-M_PI * 1.5,
|
||||
Standard_Real(aNodeIter) / Standard_Real(THE_NB_ROUND_SPLITS));
|
||||
theTris->AddVertex(
|
||||
gp_Pnt(-aHSize.X() + aRadius * Cos(anAngle), aHSize.Y() + aRadius * Sin(anAngle), 0.0)
|
||||
.Transformed(theTrsf));
|
||||
theTris->AddVertex(gp_Pnt(-aHSize.X() + aRadius * std::cos(anAngle),
|
||||
aHSize.Y() + aRadius * std::sin(anAngle),
|
||||
0.0)
|
||||
.Transformed(theTrsf));
|
||||
}
|
||||
|
||||
// split triangle fan
|
||||
@@ -465,11 +469,12 @@ void AIS_ViewCube::createBoxEdgeTriangles(const Handle(Graphic3d_ArrayOfTriangle
|
||||
V3d_TypeOfOrientation theDirection) const
|
||||
{
|
||||
const Standard_Real aThickness =
|
||||
Max(myBoxFacetExtension * gp_XY(1.0, 1.0).Modulus() - myBoxEdgeGap, myBoxEdgeMinSize);
|
||||
std::max(myBoxFacetExtension * gp_XY(1.0, 1.0).Modulus() - myBoxEdgeGap, myBoxEdgeMinSize);
|
||||
|
||||
const gp_Dir aDir = V3d::GetProjAxis(theDirection);
|
||||
const gp_Pnt aPos =
|
||||
aDir.XYZ() * (mySize * 0.5 * gp_XY(1.0, 1.0).Modulus() + myBoxFacetExtension * Cos(M_PI_4));
|
||||
aDir.XYZ()
|
||||
* (mySize * 0.5 * gp_XY(1.0, 1.0).Modulus() + myBoxFacetExtension * std::cos(M_PI_4));
|
||||
const gp_Ax2 aPosition(aPos, aDir.Reversed());
|
||||
|
||||
gp_Ax3 aSystem(aPosition);
|
||||
@@ -505,13 +510,14 @@ void AIS_ViewCube::createBoxCornerTriangles(const Handle(Graphic3d_ArrayOfTriang
|
||||
}
|
||||
|
||||
const Standard_Real anEdgeHWidth = myBoxFacetExtension * gp_XY(1.0, 1.0).Modulus() * 0.5;
|
||||
const Standard_Real aHeight = anEdgeHWidth * Sqrt(2.0 / 3.0); // tetrahedron height
|
||||
const Standard_Real aHeight = anEdgeHWidth * std::sqrt(2.0 / 3.0); // tetrahedron height
|
||||
const gp_Pnt aPos = aDir.XYZ() * (aHSize * gp_Vec(1.0, 1.0, 1.0).Magnitude() + aHeight);
|
||||
const gp_Ax2 aPosition(aPos, aDir.Reversed());
|
||||
gp_Ax3 aSystem(aPosition);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation(aSystem, gp_Ax3());
|
||||
const Standard_Real aRadius = Max(myBoxFacetExtension * 0.5 / Cos(M_PI_4), myCornerMinSize);
|
||||
const Standard_Real aRadius =
|
||||
std::max(myBoxFacetExtension * 0.5 / std::cos(M_PI_4), myCornerMinSize);
|
||||
|
||||
theTris->AddVertex(gp_Pnt(0.0, 0.0, 0.0).Transformed(aTrsf));
|
||||
for (Standard_Integer aNodeIter = 0; aNodeIter < THE_NB_DISK_SLICES; ++aNodeIter)
|
||||
@@ -521,7 +527,7 @@ void AIS_ViewCube::createBoxCornerTriangles(const Handle(Graphic3d_ArrayOfTriang
|
||||
0.0,
|
||||
Standard_Real(aNodeIter) / Standard_Real(THE_NB_DISK_SLICES));
|
||||
theTris->AddVertex(
|
||||
gp_Pnt(aRadius * Cos(anAngle), aRadius * Sin(anAngle), 0.0).Transformed(aTrsf));
|
||||
gp_Pnt(aRadius * std::cos(anAngle), aRadius * std::sin(anAngle), 0.0).Transformed(aTrsf));
|
||||
}
|
||||
theTris->AddTriangleFanEdges(aVertFirst + 1, theTris->VertexNumber(), true);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public: //! @name Geometry management API
|
||||
//! Set new value of box facet extension.
|
||||
void SetBoxFacetExtension(Standard_Real theValue)
|
||||
{
|
||||
if (Abs(myBoxFacetExtension - theValue) > Precision::Confusion())
|
||||
if (std::abs(myBoxFacetExtension - theValue) > Precision::Confusion())
|
||||
{
|
||||
myBoxFacetExtension = theValue;
|
||||
SetToUpdate();
|
||||
@@ -136,7 +136,7 @@ public: //! @name Geometry management API
|
||||
//! Set new value of padding between axes and 3D part (box).
|
||||
void SetAxesPadding(Standard_Real theValue)
|
||||
{
|
||||
if (Abs(myAxesPadding - theValue) > Precision::Confusion())
|
||||
if (std::abs(myAxesPadding - theValue) > Precision::Confusion())
|
||||
{
|
||||
myAxesPadding = theValue;
|
||||
SetToUpdate();
|
||||
@@ -149,7 +149,7 @@ public: //! @name Geometry management API
|
||||
//! Set new value of box edges gap.
|
||||
void SetBoxEdgeGap(Standard_Real theValue)
|
||||
{
|
||||
if (Abs(myBoxEdgeGap - theValue) > Precision::Confusion())
|
||||
if (std::abs(myBoxEdgeGap - theValue) > Precision::Confusion())
|
||||
{
|
||||
myBoxEdgeGap = theValue;
|
||||
SetToUpdate();
|
||||
@@ -162,7 +162,7 @@ public: //! @name Geometry management API
|
||||
//! Set new value of box edge minimal size.
|
||||
void SetBoxEdgeMinSize(Standard_Real theValue)
|
||||
{
|
||||
if (Abs(myBoxEdgeMinSize - theValue) > Precision::Confusion())
|
||||
if (std::abs(myBoxEdgeMinSize - theValue) > Precision::Confusion())
|
||||
{
|
||||
myBoxEdgeMinSize = theValue;
|
||||
SetToUpdate();
|
||||
@@ -175,7 +175,7 @@ public: //! @name Geometry management API
|
||||
//! Set new value of box corner minimal size.
|
||||
void SetBoxCornerMinSize(Standard_Real theValue)
|
||||
{
|
||||
if (Abs(myCornerMinSize - theValue) > Precision::Confusion())
|
||||
if (std::abs(myCornerMinSize - theValue) > Precision::Confusion())
|
||||
{
|
||||
myCornerMinSize = theValue;
|
||||
SetToUpdate();
|
||||
@@ -196,7 +196,7 @@ public: //! @name Geometry management API
|
||||
//! Sets radius of axes of the trihedron.
|
||||
void SetAxesRadius(const Standard_Real theRadius)
|
||||
{
|
||||
if (Abs(myAxesRadius - theRadius) > Precision::Confusion())
|
||||
if (std::abs(myAxesRadius - theRadius) > Precision::Confusion())
|
||||
{
|
||||
myAxesRadius = theRadius;
|
||||
SetToUpdate();
|
||||
@@ -209,7 +209,7 @@ public: //! @name Geometry management API
|
||||
//! Sets radius of cone of axes of the trihedron.
|
||||
void SetAxesConeRadius(Standard_Real theRadius)
|
||||
{
|
||||
if (Abs(myAxesConeRadius - theRadius) > Precision::Confusion())
|
||||
if (std::abs(myAxesConeRadius - theRadius) > Precision::Confusion())
|
||||
{
|
||||
myAxesConeRadius = theRadius;
|
||||
SetToUpdate();
|
||||
@@ -222,7 +222,7 @@ public: //! @name Geometry management API
|
||||
//! Sets radius of sphere (central point) of the trihedron.
|
||||
void SetAxesSphereRadius(Standard_Real theRadius)
|
||||
{
|
||||
if (Abs(myAxesSphereRadius - theRadius) > Precision::Confusion())
|
||||
if (std::abs(myAxesSphereRadius - theRadius) > Precision::Confusion())
|
||||
{
|
||||
myAxesSphereRadius = theRadius;
|
||||
SetToUpdate();
|
||||
@@ -310,9 +310,9 @@ public: //! @name Style management API
|
||||
//! @param[in] theValue input transparency value
|
||||
void SetBoxTransparency(Standard_Real theValue)
|
||||
{
|
||||
if (Abs(myDrawer->ShadingAspect()->Transparency() - theValue) > Precision::Confusion()
|
||||
|| Abs(myBoxEdgeAspect->Transparency() - theValue) > Precision::Confusion()
|
||||
|| Abs(myBoxCornerAspect->Transparency() - theValue) > Precision::Confusion())
|
||||
if (std::abs(myDrawer->ShadingAspect()->Transparency() - theValue) > Precision::Confusion()
|
||||
|| std::abs(myBoxEdgeAspect->Transparency() - theValue) > Precision::Confusion()
|
||||
|| std::abs(myBoxCornerAspect->Transparency() - theValue) > Precision::Confusion())
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetTransparency(theValue);
|
||||
myBoxEdgeAspect->SetTransparency(theValue);
|
||||
@@ -384,7 +384,7 @@ public: //! @name Style management API
|
||||
//! @code Attributes()->TextAspect()->SetHeight() @endcode
|
||||
void SetFontHeight(Standard_Real theValue)
|
||||
{
|
||||
if (Abs(myDrawer->TextAspect()->Height() - theValue) > Precision::Confusion())
|
||||
if (std::abs(myDrawer->TextAspect()->Height() - theValue) > Precision::Confusion())
|
||||
{
|
||||
myDrawer->TextAspect()->SetHeight(theValue);
|
||||
SetToUpdate();
|
||||
|
||||
@@ -40,7 +40,7 @@ struct AIS_WalkPart
|
||||
Standard_Real Duration; //!< duration
|
||||
|
||||
//! Return TRUE if delta is empty.
|
||||
bool IsEmpty() const { return Abs(Value) <= RealSmall(); }
|
||||
bool IsEmpty() const { return std::abs(Value) <= RealSmall(); }
|
||||
|
||||
//! Empty constructor.
|
||||
AIS_WalkPart()
|
||||
|
||||
@@ -245,16 +245,16 @@ void DsgPrs::ComputeCurvilinearFacesLengthPresentation(const Standard_Real First
|
||||
deltaU = LastU - FirstU;
|
||||
deltaV = LastV - FirstV;
|
||||
|
||||
if (VCurve->IsPeriodic() && Abs(deltaU) > VCurve->Period() / 2)
|
||||
if (VCurve->IsPeriodic() && std::abs(deltaU) > VCurve->Period() / 2)
|
||||
{
|
||||
Standard_Real Sign = (deltaU > 0.0) ? -1.0 : 1.0;
|
||||
deltaU = VCurve->Period() - Abs(deltaU);
|
||||
deltaU = VCurve->Period() - std::abs(deltaU);
|
||||
deltaU *= Sign;
|
||||
}
|
||||
if (UCurve->IsPeriodic() && Abs(deltaV) > UCurve->Period() / 2)
|
||||
if (UCurve->IsPeriodic() && std::abs(deltaV) > UCurve->Period() / 2)
|
||||
{
|
||||
Standard_Real Sign = (deltaV > 0.0) ? -1.0 : 1.0;
|
||||
deltaV = UCurve->Period() - Abs(deltaV);
|
||||
deltaV = UCurve->Period() - std::abs(deltaV);
|
||||
deltaV *= Sign;
|
||||
}
|
||||
}
|
||||
@@ -285,7 +285,7 @@ void DsgPrs::ComputeFacesAnglePresentation(const Standard_Real ArrowLength,
|
||||
Standard_Real& FirstParAttachCirc,
|
||||
Standard_Real& LastParAttachCirc)
|
||||
{
|
||||
if (Value > Precision::Angular() && Abs(M_PI - Value) > Precision::Angular())
|
||||
if (Value > Precision::Angular() && std::abs(M_PI - Value) > Precision::Angular())
|
||||
{
|
||||
// Computing presentation of angle's arc
|
||||
gp_Ax2 ax(CenterPoint, axisdir, dir1);
|
||||
|
||||
@@ -139,7 +139,7 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
//-------------------------- Compute angle ------------------------
|
||||
if (txt.Length() == 0)
|
||||
{
|
||||
Standard_Real angle = UnitsAPI::CurrentFromLS(Abs(OppParam), "PLANE ANGLE");
|
||||
Standard_Real angle = UnitsAPI::CurrentFromLS(std::abs(OppParam), "PLANE ANGLE");
|
||||
char res[80];
|
||||
Sprintf(res, "%g", angle);
|
||||
txt = TCollection_ExtendedString(res);
|
||||
@@ -269,7 +269,7 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
|
||||
if (uco > ufin)
|
||||
{
|
||||
if (Abs(theval) < M_PI)
|
||||
if (std::abs(theval) < M_PI)
|
||||
{
|
||||
// test if uco is in the opposite sector
|
||||
if (uco > udeb + M_PI && uco < ufin + M_PI)
|
||||
@@ -294,8 +294,8 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
}
|
||||
}
|
||||
|
||||
const Standard_Real alpha = Abs(ufin - udeb);
|
||||
const Standard_Integer nbp = Max(4, Standard_Integer(50. * alpha / M_PI));
|
||||
const Standard_Real alpha = std::abs(ufin - udeb);
|
||||
const Standard_Integer nbp = std::max(4, Standard_Integer(50. * alpha / M_PI));
|
||||
const Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp + 4, 3);
|
||||
@@ -399,10 +399,10 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
|
||||
// Creating the angle's arc or line if null angle
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims;
|
||||
if (theval > Precision::Angular() && Abs(M_PI - theval) > Precision::Angular())
|
||||
if (theval > Precision::Angular() && std::abs(M_PI - theval) > Precision::Angular())
|
||||
{
|
||||
const Standard_Real Alpha = Abs(LastParAngleCirc - FirstParAngleCirc);
|
||||
const Standard_Integer NodeNumber = Max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Real Alpha = std::abs(LastParAngleCirc - FirstParAngleCirc);
|
||||
const Standard_Integer NodeNumber = std::max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Real delta = Alpha / (Standard_Real)(NodeNumber - 1);
|
||||
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber + 4, 3);
|
||||
@@ -454,8 +454,8 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
else
|
||||
{
|
||||
// Creating the arc from AttachmentPoint2 to its projection
|
||||
const Standard_Real Alpha = Abs(LastParAttachCirc - FirstParAttachCirc);
|
||||
const Standard_Integer NodeNumber = Max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Real Alpha = std::abs(LastParAttachCirc - FirstParAttachCirc);
|
||||
const Standard_Integer NodeNumber = std::max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Real delta = Alpha / (Standard_Real)(NodeNumber - 1);
|
||||
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
@@ -496,7 +496,7 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
Norm = dir1.Crossed(dir2B);
|
||||
}
|
||||
|
||||
if (Abs(theval) > M_PI)
|
||||
if (std::abs(theval) > M_PI)
|
||||
Norm.Reverse();
|
||||
|
||||
gp_Ax2 ax(CenterPoint, Norm, dir1);
|
||||
@@ -516,7 +516,7 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
|
||||
if (uco > ufin)
|
||||
{
|
||||
if (Abs(theval) < M_PI)
|
||||
if (std::abs(theval) < M_PI)
|
||||
{
|
||||
// test if uco is in the opposite sector
|
||||
if (uco > udeb + M_PI && uco < ufin + M_PI)
|
||||
@@ -541,8 +541,8 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
}
|
||||
}
|
||||
|
||||
const Standard_Real alpha = Abs(ufin - udeb);
|
||||
const Standard_Integer nbp = Max(4, Standard_Integer(50. * alpha / M_PI));
|
||||
const Standard_Real alpha = std::abs(ufin - udeb);
|
||||
const Standard_Integer nbp = std::max(4, Standard_Integer(50. * alpha / M_PI));
|
||||
const Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp + 4, 3);
|
||||
@@ -622,7 +622,7 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
gp_Dir Norm = dir1.Crossed(dir2);
|
||||
if (Abs(theval) > M_PI)
|
||||
if (std::abs(theval) > M_PI)
|
||||
Norm.Reverse();
|
||||
|
||||
gp_Ax2 ax(CenterPoint, Norm, dir1);
|
||||
@@ -642,7 +642,7 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
|
||||
if (uco > ufin)
|
||||
{
|
||||
if (Abs(theval) < M_PI)
|
||||
if (std::abs(theval) < M_PI)
|
||||
{
|
||||
// test if uco is in the opposite sector
|
||||
if (uco > udeb + M_PI && uco < ufin + M_PI)
|
||||
@@ -667,8 +667,8 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
}
|
||||
}
|
||||
|
||||
const Standard_Real alpha = Abs(ufin - udeb);
|
||||
const Standard_Integer nbp = Max(4, Standard_Integer(50. * alpha / M_PI));
|
||||
const Standard_Real alpha = std::abs(ufin - udeb);
|
||||
const Standard_Integer nbp = std::max(4, Standard_Integer(50. * alpha / M_PI));
|
||||
const Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp + 4, 3);
|
||||
@@ -741,7 +741,7 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
gp_Dir Norm = dir1.Crossed(dir2);
|
||||
if (Abs(theval) > M_PI)
|
||||
if (std::abs(theval) > M_PI)
|
||||
Norm.Reverse();
|
||||
|
||||
gp_Ax2 ax(CenterPoint, Norm, dir1);
|
||||
@@ -761,7 +761,7 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
|
||||
if (uco > ufin)
|
||||
{
|
||||
if (Abs(theval) < M_PI)
|
||||
if (std::abs(theval) < M_PI)
|
||||
{
|
||||
// test if uco is in the opposite sector
|
||||
if (uco > udeb + M_PI && uco < ufin + M_PI)
|
||||
@@ -786,8 +786,8 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
}
|
||||
}
|
||||
|
||||
const Standard_Real alpha = Abs(ufin - udeb);
|
||||
const Standard_Integer nbp = Max(4, Standard_Integer(50. * alpha / M_PI));
|
||||
const Standard_Real alpha = std::abs(ufin - udeb);
|
||||
const Standard_Integer nbp = std::max(4, Standard_Integer(50. * alpha / M_PI));
|
||||
const Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp + 4, 3);
|
||||
@@ -859,7 +859,7 @@ void DsgPrs_AnglePresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
gp_Ax2 ax(CenterPoint, theAxe.Direction(), dir1);
|
||||
gp_Circ cer(ax, CenterPoint.Distance(AttachmentPoint1));
|
||||
|
||||
const Standard_Integer nbp = Max(4, Standard_Integer(50. * theval / M_PI));
|
||||
const Standard_Integer nbp = std::max(4, Standard_Integer(50. * theval / M_PI));
|
||||
const Standard_Real dteta = theval / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp);
|
||||
|
||||
@@ -99,7 +99,7 @@ void DsgPrs_EllipseRadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPr
|
||||
gp_Dir dir(Vpnt ^ Vapex);
|
||||
Standard_Real parFirst =
|
||||
anEllipse.Position().Direction().IsOpposite(dir, Precision::Angular()) ? uLast : uFirst;
|
||||
const Standard_Integer NodeNumber = Max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Integer NodeNumber = std::max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Real delta = Alpha / (NodeNumber - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
@@ -155,7 +155,7 @@ void DsgPrs_EllipseRadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPr
|
||||
gp_Dir dir(Vpnt ^ Vapex);
|
||||
Standard_Real parFirst =
|
||||
aCurve->Direction().IsOpposite(dir, Precision::Angular()) ? uLast : uFirst;
|
||||
const Standard_Integer NodeNumber = Max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Integer NodeNumber = std::max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Real delta = Alpha / (NodeNumber - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
|
||||
@@ -200,9 +200,9 @@ void DsgPrs_EqualDistancePresentation::AddIntervalBetweenTwoArcs(
|
||||
Standard_Real aDelta, aCurPar;
|
||||
if (aPar12 < aPar11)
|
||||
aPar12 += 2. * M_PI;
|
||||
if (Abs(aPar12 - aPar11) > Precision::Confusion())
|
||||
if (std::abs(aPar12 - aPar11) > Precision::Confusion())
|
||||
{
|
||||
aNodeNb = Standard_Integer(Max(Abs(aPar12 - aPar11) * 50. / M_PI + 0.5, 4.));
|
||||
aNodeNb = Standard_Integer(std::max(std::abs(aPar12 - aPar11) * 50. / M_PI + 0.5, 4.));
|
||||
aDelta = (aPar12 - aPar11) / aNodeNb;
|
||||
aCurPar = aPar11;
|
||||
|
||||
@@ -214,9 +214,9 @@ void DsgPrs_EqualDistancePresentation::AddIntervalBetweenTwoArcs(
|
||||
}
|
||||
if (aPar22 < aPar21)
|
||||
aPar22 += 2. * M_PI;
|
||||
if (Abs(aPar22 - aPar21) > Precision::Confusion())
|
||||
if (std::abs(aPar22 - aPar21) > Precision::Confusion())
|
||||
{
|
||||
aNodeNb = Standard_Integer(Max(Abs(aPar22 - aPar21) * 50. / M_PI + 0.5, 4.));
|
||||
aNodeNb = Standard_Integer(std::max(std::abs(aPar22 - aPar21) * 50. / M_PI + 0.5, 4.));
|
||||
aDelta = (aPar22 - aPar21) / aNodeNb;
|
||||
aCurPar = aPar21;
|
||||
|
||||
|
||||
@@ -89,7 +89,8 @@ void DsgPrs_EqualRadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPres
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real Rad = Max(FirstCenter.Distance(FirstPoint), SecondCenter.Distance(SecondPoint));
|
||||
Standard_Real Rad =
|
||||
std::max(FirstCenter.Distance(FirstPoint), SecondCenter.Distance(SecondPoint));
|
||||
|
||||
SmallDist = Rad * 0.05; // take 1/20 part of length;
|
||||
if (SmallDist <= Precision::Confusion())
|
||||
|
||||
@@ -84,8 +84,8 @@ void DsgPrs_FilletRadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPre
|
||||
// Creating the fillet's arc
|
||||
if (!SpecCase)
|
||||
{
|
||||
const Standard_Real Alpha = Abs(LastParCirc - FirstParCirc);
|
||||
const Standard_Integer NodeNumber = Max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Real Alpha = std::abs(LastParCirc - FirstParCirc);
|
||||
const Standard_Integer NodeNumber = std::max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Real delta = Alpha / (NodeNumber - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
|
||||
@@ -119,13 +119,13 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
|
||||
if (alpha < 0)
|
||||
alpha += 2. * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50. * alpha / M_PI);
|
||||
const Standard_Integer nbp = Max(4, nb);
|
||||
const Standard_Integer nbp = std::max(4, nb);
|
||||
const Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims;
|
||||
|
||||
// trait joignant aPntOffset
|
||||
if (Abs((aPntOffset.Distance(aCenter) - rad)) >= Precision::Confusion())
|
||||
if (std::abs((aPntOffset.Distance(aCenter) - rad)) >= Precision::Confusion())
|
||||
{
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp + 2, 2);
|
||||
aPrims->AddBound(2);
|
||||
@@ -169,7 +169,7 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
|
||||
if (alpha < 0)
|
||||
alpha += 2. * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50. * alpha / M_PI);
|
||||
const Standard_Integer nbp = Max(4, nb);
|
||||
const Standard_Integer nbp = std::max(4, nb);
|
||||
const Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims;
|
||||
@@ -216,7 +216,7 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
|
||||
if (alpha < 0)
|
||||
alpha += 2. * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50.0 * alpha / M_PI);
|
||||
const Standard_Integer nbp = Max(4, nb);
|
||||
const Standard_Integer nbp = std::max(4, nb);
|
||||
const Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims;
|
||||
|
||||
@@ -53,7 +53,7 @@ void DsgPrs_LengthPresentation::Add(const Handle(Prs3d_Presentation)& aPresentat
|
||||
parmin = ElCLib::Parameter(L3, Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, Proj2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
Standard_Real dist = std::abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
@@ -163,7 +163,7 @@ void DsgPrs_LengthPresentation::Add(const Handle(Prs3d_Presentation)& aPresentat
|
||||
if ((Par1 > 0.0 && Par2 > 0.0) || (Par1 < 0.0 && Par2 < 0.0))
|
||||
{
|
||||
FirstPoint = OffsetPoint;
|
||||
LastPoint = (Abs(Par1) > Abs(Par2)) ? EndOfArrow1 : EndOfArrow2;
|
||||
LastPoint = (std::abs(Par1) > std::abs(Par2)) ? EndOfArrow1 : EndOfArrow2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -227,7 +227,7 @@ void DsgPrs_LengthPresentation::Add(const Handle(Prs3d_Presentation)& aPresentat
|
||||
parmin = ElCLib::Parameter(L3, Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, Proj2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
Standard_Real dist = std::abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
@@ -325,7 +325,7 @@ void DsgPrs_LengthPresentation::Add(const Handle(Prs3d_Presentation)& aPresentat
|
||||
if ((Par1 > 0.0 && Par2 > 0.0) || (Par1 < 0.0 && Par2 < 0.0))
|
||||
{
|
||||
FirstPoint = OffsetPoint;
|
||||
LastPoint = (Abs(Par1) > Abs(Par2)) ? AttachmentPoint1 : EndOfArrow2;
|
||||
LastPoint = (std::abs(Par1) > std::abs(Par2)) ? AttachmentPoint1 : EndOfArrow2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -355,20 +355,20 @@ void DsgPrs_LengthPresentation::Add(const Handle(Prs3d_Presentation)& aPresentat
|
||||
Standard_Real Alpha, delta;
|
||||
Standard_Integer NodeNumber;
|
||||
|
||||
Alpha = Abs(deltaU);
|
||||
Alpha = std::abs(deltaU);
|
||||
if (Alpha > Precision::Angular() && Alpha < Precision::Infinite())
|
||||
{
|
||||
NodeNumber = Max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
NodeNumber = std::max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
delta = deltaU / (Standard_Real)(NodeNumber - 1);
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
for (Standard_Integer i = 1; i <= NodeNumber; i++, FirstU += delta)
|
||||
aPrims->AddVertex(VCurve->Value(FirstU));
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
Alpha = Abs(deltaV);
|
||||
Alpha = std::abs(deltaV);
|
||||
if (Alpha > Precision::Angular() && Alpha < Precision::Infinite())
|
||||
{
|
||||
NodeNumber = Max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
NodeNumber = std::max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
delta = deltaV / (Standard_Real)(NodeNumber - 1);
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
for (Standard_Integer i = 1; i <= NodeNumber; i++, FirstV += delta)
|
||||
|
||||
@@ -199,7 +199,7 @@ void DsgPrs_MidPointPresentation::Add(const Handle(Prs3d_Presentation)& aPresent
|
||||
if (alpha < 0)
|
||||
alpha += 2. * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50.0 * alpha / M_PI);
|
||||
Standard_Integer nbp = Max(4, nb);
|
||||
Standard_Integer nbp = std::max(4, nb);
|
||||
Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(nbp);
|
||||
@@ -279,7 +279,7 @@ void DsgPrs_MidPointPresentation::Add(const Handle(Prs3d_Presentation)& aPresent
|
||||
if (alpha < 0)
|
||||
alpha += 2 * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50.0 * alpha / M_PI);
|
||||
Standard_Integer nbp = Max(4, nb);
|
||||
Standard_Integer nbp = std::max(4, nb);
|
||||
Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(nbp);
|
||||
|
||||
@@ -68,7 +68,7 @@ void DsgPrs_OffsetPresentation::Add(const Handle(Prs3d_Presentation)& aPresentat
|
||||
parmin = ElCLib::Parameter(L3, Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, Proj2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
Standard_Real dist = std::abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
|
||||
@@ -48,7 +48,7 @@ void DsgPrs_ParalPresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
parmin = ElCLib::Parameter(L3, Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, Proj2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
Standard_Real dist = std::abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
@@ -145,7 +145,7 @@ void DsgPrs_ParalPresentation::Add(const Handle(Prs3d_Presentation)& aPresentati
|
||||
parmin = ElCLib::Parameter(L3, Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, Proj2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
Standard_Real dist = std::abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
|
||||
@@ -81,8 +81,9 @@ void DsgPrs_RadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPresentat
|
||||
}
|
||||
else
|
||||
{
|
||||
const Standard_Real ecartpar = Min(Abs(fpara - parat), Abs(lpara - parat));
|
||||
const Standard_Real ecartoth = Min(Abs(fpara - otherpar), Abs(lpara - otherpar));
|
||||
const Standard_Real ecartpar = std::min(std::abs(fpara - parat), std::abs(lpara - parat));
|
||||
const Standard_Real ecartoth =
|
||||
std::min(std::abs(fpara - otherpar), std::abs(lpara - otherpar));
|
||||
if (ecartpar <= ecartoth)
|
||||
{
|
||||
parat = (parat < fpara) ? fpara : lpara;
|
||||
@@ -106,7 +107,7 @@ void DsgPrs_RadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPresentat
|
||||
{
|
||||
const Standard_Real uatt = ElCLib::Parameter(L, attpoint);
|
||||
const Standard_Real uptc = ElCLib::Parameter(L, ptoncirc);
|
||||
if (Abs(uatt) > Abs(uptc))
|
||||
if (std::abs(uatt) > std::abs(uptc))
|
||||
drawtopoint = aCircle.Location();
|
||||
else
|
||||
firstpoint = aCircle.Location();
|
||||
|
||||
@@ -115,7 +115,7 @@ static Standard_Boolean FindPointOnFace(const TopoDS_Face& face, gp_Pnt2d& pt2d)
|
||||
}
|
||||
}
|
||||
|
||||
if (Abs(area) < gp::Resolution())
|
||||
if (std::abs(area) < gp::Resolution())
|
||||
{
|
||||
pt2d.SetCoord(points(1).X(), points(1).Y());
|
||||
return Standard_False;
|
||||
|
||||
@@ -92,7 +92,7 @@ void DsgPrs_SymmetricPresentation::Add(const Handle(Prs3d_Presentation)& aPresen
|
||||
parmin = ElCLib::Parameter(L3, P1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, P2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
Standard_Real dist = std::abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
@@ -177,7 +177,7 @@ void DsgPrs_SymmetricPresentation::Add(const Handle(Prs3d_Presentation)& aPresen
|
||||
parmin = ElCLib::Parameter(L3, P1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, P2);
|
||||
dist = Abs(parmin - parcur);
|
||||
dist = std::abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
@@ -261,7 +261,7 @@ void DsgPrs_SymmetricPresentation::Add(const Handle(Prs3d_Presentation)& aPresen
|
||||
parmin = ElCLib::Parameter(L3, P1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, P2);
|
||||
dist = Abs(parmin - parcur);
|
||||
dist = std::abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
@@ -484,7 +484,7 @@ void DsgPrs_SymmetricPresentation::Add(const Handle(Prs3d_Presentation)& aPresen
|
||||
ProjOffsetPoint = ProjCenter1.Translated(Vout.Divided(Vout.Magnitude()).Multiplied(Dt));
|
||||
OffsetPnt = ProjOffsetPoint;
|
||||
}
|
||||
h = Sqrt(R * R - Dt * Dt);
|
||||
h = std::sqrt(R * R - Dt * Dt);
|
||||
gp_Pnt P1 = ProjOffsetPoint.Translated(Vp.Added(Vp.Divided(Vp.Magnitude()).Multiplied(h)));
|
||||
gp_Vec v(P1, ProjOffsetPoint);
|
||||
gp_Pnt P2 = ProjOffsetPoint.Translated(v);
|
||||
@@ -494,7 +494,7 @@ void DsgPrs_SymmetricPresentation::Add(const Handle(Prs3d_Presentation)& aPresen
|
||||
parmin = ElCLib::Parameter(L3, P1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, P2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
Standard_Real dist = std::abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
@@ -533,12 +533,12 @@ void DsgPrs_SymmetricPresentation::Add(const Handle(Prs3d_Presentation)& aPresen
|
||||
if (alpha > M_PI)
|
||||
{
|
||||
alpha = (2. * M_PI) - alpha;
|
||||
nbp = (Standard_Integer)IntegerPart(alpha / (alpha * .02));
|
||||
nbp = (Standard_Integer)std::trunc(alpha / (alpha * .02));
|
||||
Dalpha = alpha / (nbp - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nbp = (Standard_Integer)IntegerPart(alpha / (alpha * .02));
|
||||
nbp = (Standard_Integer)std::trunc(alpha / (alpha * .02));
|
||||
Dalpha = -alpha / (nbp - 1);
|
||||
}
|
||||
}
|
||||
@@ -547,12 +547,12 @@ void DsgPrs_SymmetricPresentation::Add(const Handle(Prs3d_Presentation)& aPresen
|
||||
if (alpha > M_PI)
|
||||
{
|
||||
alpha = (2. * M_PI) - alpha;
|
||||
nbp = (Standard_Integer)IntegerPart(alpha / (alpha * .02));
|
||||
nbp = (Standard_Integer)std::trunc(alpha / (alpha * .02));
|
||||
Dalpha = -alpha / (nbp - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nbp = (Standard_Integer)IntegerPart(alpha / (alpha * .02));
|
||||
nbp = (Standard_Integer)std::trunc(alpha / (alpha * .02));
|
||||
Dalpha = alpha / (nbp - 1);
|
||||
}
|
||||
}
|
||||
@@ -581,12 +581,12 @@ void DsgPrs_SymmetricPresentation::Add(const Handle(Prs3d_Presentation)& aPresen
|
||||
if (alpha > M_PI)
|
||||
{
|
||||
alpha = (2 * M_PI) - alpha;
|
||||
nbp = (Standard_Integer)IntegerPart(alpha / (alpha * .02));
|
||||
nbp = (Standard_Integer)std::trunc(alpha / (alpha * .02));
|
||||
Dalpha = alpha / (nbp - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nbp = (Standard_Integer)IntegerPart(alpha / (alpha * .02));
|
||||
nbp = (Standard_Integer)std::trunc(alpha / (alpha * .02));
|
||||
Dalpha = -alpha / (nbp - 1);
|
||||
}
|
||||
}
|
||||
@@ -595,12 +595,12 @@ void DsgPrs_SymmetricPresentation::Add(const Handle(Prs3d_Presentation)& aPresen
|
||||
if (alpha > M_PI)
|
||||
{
|
||||
alpha = (2 * M_PI) - alpha;
|
||||
nbp = (Standard_Integer)IntegerPart(alpha / (alpha * .02));
|
||||
nbp = (Standard_Integer)std::trunc(alpha / (alpha * .02));
|
||||
Dalpha = -alpha / (nbp - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nbp = (Standard_Integer)IntegerPart(alpha / (alpha * .02));
|
||||
nbp = (Standard_Integer)std::trunc(alpha / (alpha * .02));
|
||||
Dalpha = alpha / (nbp - 1);
|
||||
}
|
||||
}
|
||||
@@ -806,7 +806,7 @@ void DsgPrs_SymmetricPresentation::Add(const Handle(Prs3d_Presentation)& aPresen
|
||||
parmin = ElCLib::Parameter(L3, P1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, P2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
Standard_Real dist = std::abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
|
||||
@@ -111,7 +111,8 @@ Standard_Boolean Prs3d::MatchSegment(const Standard_Real X,
|
||||
Standard_Real Lambda = ((X - X1) * DX + (Y - Y1) * DY + (Z - Z1) * DZ) / Dist;
|
||||
if (Lambda < 0. || Lambda > 1.)
|
||||
return Standard_False;
|
||||
dist = Abs(X - X1 - Lambda * DX) + Abs(Y - Y1 - Lambda * DY) + Abs(Z - Z1 - Lambda * DZ);
|
||||
dist = std::abs(X - X1 - Lambda * DX) + std::abs(Y - Y1 - Lambda * DY)
|
||||
+ std::abs(Z - Z1 - Lambda * DZ);
|
||||
return (dist < aDistance);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
const Standard_Real theDeviationCoefficient)
|
||||
{
|
||||
const Graphic3d_Vec3d aDiag = theBndMax - theBndMin;
|
||||
return Max(aDiag.maxComp() * theDeviationCoefficient * 4.0, Precision::Confusion());
|
||||
return (std::max)(aDiag.maxComp() * theDeviationCoefficient * 4.0, Precision::Confusion());
|
||||
}
|
||||
|
||||
//! Computes the absolute deflection value based on relative deflection
|
||||
|
||||
@@ -54,11 +54,12 @@ Handle(Graphic3d_ArrayOfSegments) Prs3d_Arrow::DrawSegments(const gp_Pnt&
|
||||
|
||||
// construction of i,j mark for the circle
|
||||
gp_Dir aN;
|
||||
if (Abs(theDir.X()) <= Abs(theDir.Y()) && Abs(theDir.X()) <= Abs(theDir.Z()))
|
||||
if (std::abs(theDir.X()) <= std::abs(theDir.Y()) && std::abs(theDir.X()) <= std::abs(theDir.Z()))
|
||||
{
|
||||
aN = gp::DX();
|
||||
}
|
||||
else if (Abs(theDir.Y()) <= Abs(theDir.Z()) && Abs(theDir.Y()) <= Abs(theDir.X()))
|
||||
else if (std::abs(theDir.Y()) <= std::abs(theDir.Z())
|
||||
&& std::abs(theDir.Y()) <= std::abs(theDir.X()))
|
||||
{
|
||||
aN = gp::DY();
|
||||
}
|
||||
@@ -71,11 +72,11 @@ Handle(Graphic3d_ArrayOfSegments) Prs3d_Arrow::DrawSegments(const gp_Pnt&
|
||||
const gp_XYZ anXYZj = theDir.XYZ().Crossed(anXYZi.XYZ());
|
||||
aSegments->AddVertex(theLocation);
|
||||
|
||||
const Standard_Real Tg = Tan(theAngle);
|
||||
const Standard_Real Tg = std::tan(theAngle);
|
||||
for (Standard_Integer aVertIter = 1; aVertIter <= theNbSegments; ++aVertIter)
|
||||
{
|
||||
const Standard_Real aCos = Cos(2.0 * M_PI / theNbSegments * (aVertIter - 1));
|
||||
const Standard_Real aSin = Sin(2.0 * M_PI / theNbSegments * (aVertIter - 1));
|
||||
const Standard_Real aCos = std::cos(2.0 * M_PI / theNbSegments * (aVertIter - 1));
|
||||
const Standard_Real aSin = std::sin(2.0 * M_PI / theNbSegments * (aVertIter - 1));
|
||||
|
||||
const gp_Pnt pp(aC.X() + (aCos * anXYZi.X() + aSin * anXYZj.X()) * theLength * Tg,
|
||||
aC.Y() + (aCos * anXYZi.Y() + aSin * anXYZj.Y()) * theLength * Tg,
|
||||
@@ -111,7 +112,7 @@ Handle(Graphic3d_ArrayOfTriangles) Prs3d_Arrow::DrawShaded(const gp_Ax1&
|
||||
const Standard_Real theConeLength,
|
||||
const Standard_Integer theNbFacettes)
|
||||
{
|
||||
const Standard_Real aTubeLength = Max(0.0, theAxisLength - theConeLength);
|
||||
const Standard_Real aTubeLength = std::max(0.0, theAxisLength - theConeLength);
|
||||
const Standard_Integer aNbTrisTube = (theTubeRadius > 0.0 && aTubeLength > 0.0)
|
||||
? Prs3d_ToolCylinder::TrianglesNb(theNbFacettes, 1)
|
||||
: 0;
|
||||
|
||||
@@ -54,7 +54,8 @@ public:
|
||||
{
|
||||
Standard_Real aX, aY, aZ;
|
||||
PointTool::Coord(thePoint, aX, aY, aZ);
|
||||
return Sqrt((theX - aX) * (theX - aX) + (theY - aY) * (theY - aY) + (theZ - aZ) * (theZ - aZ))
|
||||
return std::sqrt((theX - aX) * (theX - aX) + (theY - aY) * (theY - aY)
|
||||
+ (theZ - aZ) * (theZ - aZ))
|
||||
<= theDistance;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ gp_Pnt Prs3d_ToolCylinder::Vertex(const Standard_Real theU, const Standard_Real
|
||||
{
|
||||
const Standard_Real aU = theU * M_PI * 2.0;
|
||||
const Standard_Real aRadius = myBottomRadius + (myTopRadius - myBottomRadius) * theV;
|
||||
return gp_Pnt(Cos(aU) * aRadius, Sin(aU) * aRadius, theV * myHeight);
|
||||
return gp_Pnt(std::cos(aU) * aRadius, std::sin(aU) * aRadius, theV * myHeight);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@@ -49,7 +49,7 @@ gp_Pnt Prs3d_ToolCylinder::Vertex(const Standard_Real theU, const Standard_Real
|
||||
gp_Dir Prs3d_ToolCylinder::Normal(const Standard_Real theU, const Standard_Real) const
|
||||
{
|
||||
const Standard_Real aU = theU * M_PI * 2.0;
|
||||
return gp_Dir(Cos(aU) * myHeight, Sin(aU) * myHeight, myBottomRadius - myTopRadius);
|
||||
return gp_Dir(std::cos(aU) * myHeight, std::sin(aU) * myHeight, myBottomRadius - myTopRadius);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
@@ -40,7 +40,7 @@ gp_Pnt Prs3d_ToolDisk::Vertex(const Standard_Real theU, const Standard_Real theV
|
||||
{
|
||||
const Standard_Real aU = myStartAngle + theU * (myEndAngle - myStartAngle);
|
||||
const Standard_Real aRadius = myInnerRadius + (myOuterRadius - myInnerRadius) * theV;
|
||||
return gp_Pnt(Cos(aU) * aRadius, Sin(aU) * aRadius, 0.0);
|
||||
return gp_Pnt(std::cos(aU) * aRadius, std::sin(aU) * aRadius, 0.0);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
@@ -36,7 +36,7 @@ gp_Pnt Prs3d_ToolSector::Vertex(const Standard_Real theU, const Standard_Real th
|
||||
{
|
||||
const Standard_Real aU = theU * M_PI / 2.0;
|
||||
const Standard_Real aRadius = myRadius * theV;
|
||||
return gp_Pnt(Cos(aU) * aRadius, Sin(aU) * aRadius, 0.0);
|
||||
return gp_Pnt(std::cos(aU) * aRadius, std::sin(aU) * aRadius, 0.0);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
@@ -36,7 +36,9 @@ gp_Pnt Prs3d_ToolSphere::Vertex(const Standard_Real theU, const Standard_Real th
|
||||
{
|
||||
const Standard_Real aU = theU * M_PI * 2.0;
|
||||
const Standard_Real aV = theV * M_PI;
|
||||
return gp_Pnt(myRadius * Cos(aU) * Sin(aV), -myRadius * Sin(aU) * Sin(aV), myRadius * Cos(aV));
|
||||
return gp_Pnt(myRadius * std::cos(aU) * std::sin(aV),
|
||||
-myRadius * std::sin(aU) * std::sin(aV),
|
||||
myRadius * std::cos(aV));
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@@ -45,7 +47,7 @@ gp_Dir Prs3d_ToolSphere::Normal(const Standard_Real theU, const Standard_Real th
|
||||
{
|
||||
const Standard_Real aU = theU * M_PI * 2.0;
|
||||
const Standard_Real aV = theV * M_PI;
|
||||
return gp_Dir(Cos(aU) * Sin(aV), -Sin(aU) * Sin(aV), Cos(aV));
|
||||
return gp_Dir(std::cos(aU) * std::sin(aV), -std::sin(aU) * std::sin(aV), std::cos(aV));
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
@@ -40,9 +40,9 @@ gp_Pnt Prs3d_ToolTorus::Vertex(const Standard_Real theU, const Standard_Real the
|
||||
{
|
||||
const Standard_Real aU = theU * myAngle;
|
||||
const Standard_Real aV = myVMin + theV * (myVMax - myVMin);
|
||||
return gp_Pnt((myMajorRadius + myMinorRadius * Cos(aV)) * Cos(aU),
|
||||
(myMajorRadius + myMinorRadius * Cos(aV)) * Sin(aU),
|
||||
myMinorRadius * Sin(aV));
|
||||
return gp_Pnt((myMajorRadius + myMinorRadius * std::cos(aV)) * std::cos(aU),
|
||||
(myMajorRadius + myMinorRadius * std::cos(aV)) * std::sin(aU),
|
||||
myMinorRadius * std::sin(aV));
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@@ -51,7 +51,7 @@ gp_Dir Prs3d_ToolTorus::Normal(const Standard_Real theU, const Standard_Real the
|
||||
{
|
||||
const Standard_Real aU = theU * myAngle;
|
||||
const Standard_Real aV = myVMin + theV * (myVMax - myVMin);
|
||||
return gp_Dir(Cos(aU) * Cos(aV), Sin(aU) * Cos(aV), Sin(aV));
|
||||
return gp_Dir(std::cos(aU) * std::cos(aV), std::sin(aU) * std::cos(aV), std::sin(aV));
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
@@ -863,7 +863,7 @@ void PrsDim::InitFaceLength(const TopoDS_Face& theFace,
|
||||
Standard_Real& theOffset)
|
||||
{
|
||||
if (PrsDim::GetPlaneFromFace(theFace, thePlane, theSurface, theSurfaceType, theOffset)
|
||||
&& Abs(theOffset) > Precision::Confusion())
|
||||
&& std::abs(theOffset) > Precision::Confusion())
|
||||
{
|
||||
theSurface = new Geom_OffsetSurface(theSurface, theOffset);
|
||||
theOffset = 0.0e0;
|
||||
@@ -1212,7 +1212,7 @@ gp_Pnt PrsDim::TranslatePointToBound(const gp_Pnt& aPoint,
|
||||
Standard_Boolean IsFound = Standard_False;
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
{
|
||||
if (Abs(Dir(i)) <= gp::Resolution())
|
||||
if (std::abs(Dir(i)) <= gp::Resolution())
|
||||
continue;
|
||||
for (Standard_Integer j = 1; j <= 2; j++)
|
||||
{
|
||||
@@ -1336,9 +1336,9 @@ gp_Pnt PrsDim::NearestApex(const gp_Elips& elips,
|
||||
{
|
||||
IsInDomain = Standard_False;
|
||||
Standard_Real posd =
|
||||
Min(DistanceFromApex(elips, pApex, fpara), DistanceFromApex(elips, pApex, lpara));
|
||||
std::min(DistanceFromApex(elips, pApex, fpara), DistanceFromApex(elips, pApex, lpara));
|
||||
Standard_Real negd =
|
||||
Min(DistanceFromApex(elips, nApex, fpara), DistanceFromApex(elips, nApex, lpara));
|
||||
std::min(DistanceFromApex(elips, nApex, fpara), DistanceFromApex(elips, nApex, lpara));
|
||||
if (posd < negd)
|
||||
EndOfArrow = pApex;
|
||||
else
|
||||
|
||||
@@ -376,7 +376,7 @@ void PrsDim_AngleDimension::DrawArc(const Handle(Prs3d_Presentation)& thePresent
|
||||
if (myType == PrsDim_TypeOfAngle_Exterior)
|
||||
anAngle = 2.0 * M_PI - anAngle;
|
||||
// it sets 50 points on PI, and a part of points if angle is less
|
||||
const Standard_Integer aNbPoints = Max(4, Standard_Integer(50.0 * anAngle / M_PI));
|
||||
const Standard_Integer aNbPoints = std::max(4, Standard_Integer(50.0 * anAngle / M_PI));
|
||||
|
||||
GCPnts_UniformAbscissa aMakePnts(anArcAdaptor, aNbPoints);
|
||||
if (!aMakePnts.IsDone())
|
||||
@@ -701,7 +701,7 @@ void PrsDim_AngleDimension::Compute(const Handle(PrsMgr_PresentationManager)&,
|
||||
? aSecondAttach
|
||||
: aSecondArrowEnd,
|
||||
myCenterPoint,
|
||||
Abs(GetFlyout()),
|
||||
std::abs(GetFlyout()),
|
||||
theMode);
|
||||
}
|
||||
}
|
||||
@@ -750,7 +750,7 @@ void PrsDim_AngleDimension::Compute(const Handle(PrsMgr_PresentationManager)&,
|
||||
? aSecondAttach
|
||||
: aSecondArrowEnd,
|
||||
myCenterPoint,
|
||||
Abs(GetFlyout()),
|
||||
std::abs(GetFlyout()),
|
||||
theMode);
|
||||
}
|
||||
|
||||
@@ -905,12 +905,12 @@ Standard_Boolean PrsDim_AngleDimension::InitTwoEdgesAngle(gp_Pln& theComputedPla
|
||||
const Standard_Real aParam21 = ElCLib::Parameter(aFirstLin, aFirstPoint2);
|
||||
const Standard_Real aParam22 = ElCLib::Parameter(aFirstLin, aLastPoint2);
|
||||
myCenterPoint =
|
||||
ElCLib::Value((Min(aParam11, aParam12) + Max(aParam21, aParam22)) * 0.5, aFirstLin);
|
||||
myFirstPoint = myCenterPoint.Translated(gp_Vec(aFirstLin.Direction()) * Abs(GetFlyout()));
|
||||
ElCLib::Value((std::min(aParam11, aParam12) + std::max(aParam21, aParam22)) * 0.5, aFirstLin);
|
||||
myFirstPoint = myCenterPoint.Translated(gp_Vec(aFirstLin.Direction()) * std::abs(GetFlyout()));
|
||||
mySecondPoint = myCenterPoint.XYZ()
|
||||
+ (aFirstLin.Direction().IsEqual(aSecondLin.Direction(), Precision::Angular())
|
||||
? aFirstLin.Direction().Reversed().XYZ() * Abs(GetFlyout())
|
||||
: aSecondLin.Direction().XYZ() * Abs(GetFlyout()));
|
||||
? aFirstLin.Direction().Reversed().XYZ() * std::abs(GetFlyout())
|
||||
: aSecondLin.Direction().XYZ() * std::abs(GetFlyout()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -930,8 +930,10 @@ Standard_Boolean PrsDim_AngleDimension::InitTwoEdgesAngle(gp_Pln& theComputedPla
|
||||
|
||||
if (isInfinite1 || isInfinite2)
|
||||
{
|
||||
myFirstPoint = myCenterPoint.Translated(gp_Vec(aFirstLin.Direction()) * Abs(GetFlyout()));
|
||||
mySecondPoint = myCenterPoint.Translated(gp_Vec(aSecondLin.Direction()) * Abs(GetFlyout()));
|
||||
myFirstPoint =
|
||||
myCenterPoint.Translated(gp_Vec(aFirstLin.Direction()) * std::abs(GetFlyout()));
|
||||
mySecondPoint =
|
||||
myCenterPoint.Translated(gp_Vec(aSecondLin.Direction()) * std::abs(GetFlyout()));
|
||||
|
||||
return IsValidPoints(myFirstPoint, myCenterPoint, mySecondPoint);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ void PrsDim_Chamf2dDimension::ComputeSelection(const Handle(SelectMgr_Selection)
|
||||
aSelection->Add(seg);
|
||||
|
||||
// Text
|
||||
Standard_Real size(Min(myVal / 100. + 1.e-6, myArrowSize + 1.e-6));
|
||||
Standard_Real size(std::min(myVal / 100. + 1.e-6, myArrowSize + 1.e-6));
|
||||
Handle(Select3D_SensitiveBox) box = new Select3D_SensitiveBox(own,
|
||||
myPosition.X(),
|
||||
myPosition.Y(),
|
||||
|
||||
@@ -169,7 +169,7 @@ void PrsDim_Chamf3dDimension::ComputeSelection(const Handle(SelectMgr_Selection)
|
||||
aSelection->Add(seg);
|
||||
|
||||
// Text
|
||||
Standard_Real size(Min(myVal / 100. + 1.e-6, myArrowSize + 1.e-6));
|
||||
Standard_Real size(std::min(myVal / 100. + 1.e-6, myArrowSize + 1.e-6));
|
||||
Handle(Select3D_SensitiveBox) box = new Select3D_SensitiveBox(own,
|
||||
myPosition.X(),
|
||||
myPosition.Y(),
|
||||
|
||||
@@ -110,7 +110,7 @@ void PrsDim_ConcentricRelation::ComputeEdgeVertexConcentric(
|
||||
|
||||
Handle(Geom_Circle) CIRCLE(Handle(Geom_Circle)::DownCast(C));
|
||||
myCenter = CIRCLE->Location();
|
||||
myRad = Min(CIRCLE->Radius() / 5., 15.);
|
||||
myRad = std::min(CIRCLE->Radius() / 5., 15.);
|
||||
gp_Dir vec(p1.XYZ() - myCenter.XYZ());
|
||||
gp_Vec vectrans(vec);
|
||||
myPnt = myCenter.Translated(vectrans.Multiplied(myRad));
|
||||
|
||||
@@ -304,7 +304,7 @@ Standard_Boolean PrsDim_DiameterDimension::IsValidAnchor(const gp_Circ& theCircl
|
||||
Standard_Real anAnchorDist = theAnchor.Distance(theCircle.Location());
|
||||
Standard_Real aRadius = myCircle.Radius();
|
||||
|
||||
return Abs(anAnchorDist - aRadius) > Precision::Confusion()
|
||||
return std::abs(anAnchorDist - aRadius) > Precision::Confusion()
|
||||
&& aCirclePlane.Contains(theAnchor, Precision::Confusion());
|
||||
}
|
||||
|
||||
|
||||
@@ -1416,7 +1416,7 @@ void PrsDim_Dimension::PointsForArrow(const gp_Pnt& thePeakPnt,
|
||||
gp_Pnt anArrowEnd = ElCLib::Value(theArrowLength, anArrowLin);
|
||||
gp_Lin anEdgeLin(anArrowEnd, theDirection.Crossed(thePlane));
|
||||
|
||||
Standard_Real anEdgeLength = Tan(theArrowAngle) * theArrowLength;
|
||||
Standard_Real anEdgeLength = std::tan(theArrowAngle) * theArrowLength;
|
||||
|
||||
theSidePnt1 = ElCLib::Value(anEdgeLength, anEdgeLin);
|
||||
theSidePnt2 = ElCLib::Value(-anEdgeLength, anEdgeLin);
|
||||
|
||||
@@ -159,7 +159,7 @@ void PrsDim_EllipseRadiusDimension::ComputeCylFaceGeometry(const PrsDim_KindOfSu
|
||||
|
||||
if (surf1.GetType() == GeomAbs_OffsetSurface)
|
||||
{
|
||||
if (Offset < 0.0 && Abs(Offset) > myEllipse.MinorRadius())
|
||||
if (Offset < 0.0 && std::abs(Offset) > myEllipse.MinorRadius())
|
||||
{
|
||||
throw Standard_ConstructionError(
|
||||
"PrsDim:: Absolute value of negative offset is larger than MinorRadius");
|
||||
|
||||
@@ -484,7 +484,7 @@ void PrsDim_EqualDistanceRelation::ComputeTwoEdgesLength(
|
||||
constexpr Standard_Real confusion(Precision::Confusion());
|
||||
if (arrsize < confusion)
|
||||
arrsize = Val * 0.1;
|
||||
if (Abs(Val) <= confusion)
|
||||
if (std::abs(Val) <= confusion)
|
||||
{
|
||||
arrsize = 0.;
|
||||
}
|
||||
@@ -595,7 +595,7 @@ void PrsDim_EqualDistanceRelation::ComputeTwoEdgesLength(
|
||||
|
||||
if (arrsize < Precision::Confusion())
|
||||
arrsize = Val * 0.1;
|
||||
if (Abs(Val) <= Precision::Confusion())
|
||||
if (std::abs(Val) <= Precision::Confusion())
|
||||
{
|
||||
arrsize = 0.;
|
||||
}
|
||||
@@ -770,7 +770,7 @@ void PrsDim_EqualDistanceRelation::ComputeOneEdgeOneVertexLength(
|
||||
gp_Dir DirAttach = l.Direction();
|
||||
// size
|
||||
Standard_Real arrsize = ArrowSize;
|
||||
if (Abs(Val) <= Precision::Confusion())
|
||||
if (std::abs(Val) <= Precision::Confusion())
|
||||
{
|
||||
arrsize = 0.;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user