mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-18 14:27:39 +03:00
Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2714656ef1 | ||
|
69f86542ba | ||
|
50b994e73f | ||
|
6ddebb77cb | ||
|
b86bb3df20 | ||
|
af99433e4e | ||
|
bd28b2afac | ||
|
7ad63454a5 | ||
|
172f635278 | ||
|
7121535194 | ||
|
696d81d000 | ||
|
0a9b38ef44 | ||
|
40738f9ad7 | ||
|
59f520585b | ||
|
e002f1ce5b | ||
|
7a7e8cf174 | ||
|
19589673b3 | ||
|
859a47c3d1 |
@@ -452,7 +452,7 @@ If the test cannot be implemented using available DRAW commands, consider the fo
|
||||
* Otherwise the new command implementing the actions needed for this particular test should be added in *QABugs* package. The command name should be formed by the Mantis issue ID prefixed by *bug*, e.g. *bug12345*.
|
||||
|
||||
Note that a DRAW command is expected to return 0 in case of a normal completion, and 1 (Tcl exception) if it is incorrectly used (e.g. a wrong number of input arguments). Thus if the new command needs to report a test error, this should be done by outputting an appropriate error message rather than by returning a non-zero value.
|
||||
|
||||
Also file names must not be encoded in DRAW command but in script, and passed to DRAW command as argument.
|
||||
|
||||
@subsection testmanual_3_4 Script Implementation
|
||||
|
||||
|
@@ -1,17 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcxproj", "{7972FDD8-9612-3401-827F-C8DF8E2689B5}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcxproj", "{6B92925F-E981-3FF2-AA6A-B0A00466F30A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7972FDD8-9612-3401-827F-C8DF8E2689B5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7972FDD8-9612-3401-827F-C8DF8E2689B5}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7972FDD8-9612-3401-827F-C8DF8E2689B5}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7972FDD8-9612-3401-827F-C8DF8E2689B5}.Release|Win32.Build.0 = Release|Win32
|
||||
{6B92925F-E981-3FF2-AA6A-B0A00466F30A}.Debug|Win32.ActiveCfg = Debug|x64
|
||||
{6B92925F-E981-3FF2-AA6A-B0A00466F30A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6B92925F-E981-3FF2-AA6A-B0A00466F30A}.Debug|x64.Build.0 = Debug|x64
|
||||
{6B92925F-E981-3FF2-AA6A-B0A00466F30A}.Release|Win32.ActiveCfg = Release|x64
|
||||
{6B92925F-E981-3FF2-AA6A-B0A00466F30A}.Release|x64.ActiveCfg = Release|x64
|
||||
{6B92925F-E981-3FF2-AA6A-B0A00466F30A}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@@ -1,17 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcxproj", "{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcxproj", "{57C7DDA0-7B4D-3B28-867B-CE6F0E30896A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Release|Win32.Build.0 = Release|Win32
|
||||
{57C7DDA0-7B4D-3B28-867B-CE6F0E30896A}.Debug|Win32.ActiveCfg = Debug|x64
|
||||
{57C7DDA0-7B4D-3B28-867B-CE6F0E30896A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{57C7DDA0-7B4D-3B28-867B-CE6F0E30896A}.Debug|x64.Build.0 = Debug|x64
|
||||
{57C7DDA0-7B4D-3B28-867B-CE6F0E30896A}.Release|Win32.ActiveCfg = Release|x64
|
||||
{57C7DDA0-7B4D-3B28-867B-CE6F0E30896A}.Release|x64.ActiveCfg = Release|x64
|
||||
{57C7DDA0-7B4D-3B28-867B-CE6F0E30896A}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@@ -6,13 +6,19 @@ EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EF9DFAE9-E10E-42D4-87D1-52431728AFDF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{EF9DFAE9-E10E-42D4-87D1-52431728AFDF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{EF9DFAE9-E10E-42D4-87D1-52431728AFDF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{EF9DFAE9-E10E-42D4-87D1-52431728AFDF}.Debug|x64.Build.0 = Debug|x64
|
||||
{EF9DFAE9-E10E-42D4-87D1-52431728AFDF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{EF9DFAE9-E10E-42D4-87D1-52431728AFDF}.Release|Win32.Build.0 = Release|Win32
|
||||
{EF9DFAE9-E10E-42D4-87D1-52431728AFDF}.Release|x64.ActiveCfg = Release|x64
|
||||
{EF9DFAE9-E10E-42D4-87D1-52431728AFDF}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@@ -5,13 +5,13 @@ TARGET = VoxelDemo
|
||||
|
||||
SAMPLESROOT = $$(CASROOT)/samples/qt
|
||||
|
||||
HEADERS = $${SAMPLESROOT}/voxeldemo/src/*.h
|
||||
HEADERS = $${SAMPLESROOT}/voxeldemo/inc/*.h
|
||||
|
||||
SOURCES = $${SAMPLESROOT}/voxeldemo/src/*.cxx \
|
||||
$${SAMPLESROOT}/voxeldemo/src/*.cpp
|
||||
|
||||
|
||||
INCLUDEPATH += $$quote($${SAMPLESROOT}/voxeldemo/src)
|
||||
INCLUDEPATH += $$quote($${SAMPLESROOT}/voxeldemo/inc)
|
||||
|
||||
DEFINES = CSFDB
|
||||
|
||||
|
@@ -29,15 +29,15 @@ is
|
||||
|
||||
---Category: Public
|
||||
|
||||
FindColor( me; Value : Real from Standard;
|
||||
Color : in out Color from Quantity ) returns Boolean from Standard;
|
||||
FindColor( me; theValue : Real from Standard;
|
||||
theColor : in out Color from Quantity ) returns Boolean from Standard;
|
||||
---Purpose: Calculate color according passed value; returns true if value is in range or false, if isn't
|
||||
|
||||
|
||||
FindColor( myclass; Value : Real from Standard;
|
||||
Min, Max : Real from Standard;
|
||||
ColorsCount : Integer from Standard;
|
||||
Color : in out Color from Quantity ) returns Boolean from Standard;
|
||||
FindColor( myclass; theValue : Real from Standard;
|
||||
theMin, theMax : Real from Standard;
|
||||
theColorsCount : Integer from Standard;
|
||||
theColor : in out Color from Quantity ) returns Boolean from Standard;
|
||||
|
||||
GetMin(me)
|
||||
returns Real from Standard;
|
||||
@@ -47,8 +47,8 @@ is
|
||||
returns Real from Standard;
|
||||
---Purpose: Returns maximal value of color scale;
|
||||
|
||||
GetRange(me; aMin : in out Real from Standard;
|
||||
aMax : in out Real from Standard);
|
||||
GetRange(me; theMin : in out Real from Standard;
|
||||
theMax : in out Real from Standard);
|
||||
---Purpose: Returns minimal and maximal values of color scale;
|
||||
|
||||
GetLabelType(me)
|
||||
@@ -77,20 +77,20 @@ is
|
||||
-- The same like format for function printf().
|
||||
-- Used if GetLabelType() is TOCSD_AUTO;
|
||||
|
||||
GetLabel(me; anIndex : Integer from Standard)
|
||||
GetLabel(me; theIndex : Integer from Standard)
|
||||
returns ExtendedString from TCollection;
|
||||
---Purpose: Returns the user specified label with index <anIndex>.
|
||||
-- Returns empty string if label not defined.
|
||||
|
||||
GetColor(me; anIndex : Integer from Standard)
|
||||
GetColor(me; theIndex : Integer from Standard)
|
||||
returns Color from Quantity;
|
||||
---Purpose: Returns the user specified color from color map with index <anIndex>.
|
||||
-- Returns default color if index out of range in color map.
|
||||
|
||||
GetLabels(me; aLabels : in out SequenceOfExtendedString from TColStd);
|
||||
GetLabels(me; theLabels : in out SequenceOfExtendedString from TColStd);
|
||||
---Purpose: Returns the user specified labels.
|
||||
|
||||
GetColors(me; aColors : in out SequenceOfColor from Aspect);
|
||||
GetColors(me; theColors : in out SequenceOfColor from Aspect);
|
||||
---Purpose: Returns the user specified colors.
|
||||
|
||||
GetLabelPosition(me)
|
||||
@@ -109,66 +109,66 @@ is
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Returns true if the labels placed at border of color filled rectangles.
|
||||
|
||||
SetMin(me : mutable; aMin : Real from Standard);
|
||||
SetMin(me : mutable; theMin : Real from Standard);
|
||||
---Purpose: Sets the minimal value of color scale.
|
||||
|
||||
SetMax(me : mutable; aMax : Real from Standard);
|
||||
SetMax(me : mutable; theMax : Real from Standard);
|
||||
---Purpose: Sets the maximal value of color scale.
|
||||
|
||||
SetRange(me : mutable; aMin : Real from Standard;
|
||||
aMax : Real from Standard);
|
||||
SetRange(me : mutable; theMin : Real from Standard;
|
||||
theMax : Real from Standard);
|
||||
---Purpose: Sets the minimal and maximal value of color scale.
|
||||
|
||||
SetLabelType(me : mutable; aType : TypeOfColorScaleData from Aspect);
|
||||
SetLabelType(me : mutable; theType : TypeOfColorScaleData from Aspect);
|
||||
---Purpose: Sets the type of labels.
|
||||
-- Aspect_TOCSD_AUTO - labels as boundary values for intervals
|
||||
-- Aspect_TOCSD_USER - user specified label is used
|
||||
|
||||
SetColorType(me : mutable; aType : TypeOfColorScaleData from Aspect);
|
||||
SetColorType(me : mutable; theType : TypeOfColorScaleData from Aspect);
|
||||
---Purpose: Sets the type of colors.
|
||||
-- Aspect_TOCSD_AUTO - value between Red and Blue
|
||||
-- Aspect_TOCSD_USER - user specified color from color map
|
||||
|
||||
SetNumberOfIntervals(me : mutable; aNum : Integer from Standard);
|
||||
SetNumberOfIntervals(me : mutable; theNum : Integer from Standard);
|
||||
---Purpose: Sets the number of color scale intervals.
|
||||
|
||||
SetTitle(me : mutable; aTitle : ExtendedString from TCollection);
|
||||
SetTitle(me : mutable; theTitle : ExtendedString from TCollection);
|
||||
---Purpose: Sets the color scale title string.
|
||||
|
||||
SetFormat(me : mutable; aFormat : AsciiString from TCollection);
|
||||
SetFormat(me : mutable; theFormat : AsciiString from TCollection);
|
||||
---Purpose: Sets the color scale auto label format specification.
|
||||
|
||||
SetLabel(me : mutable; aLabel : ExtendedString from TCollection;
|
||||
SetLabel(me : mutable; theLabel : ExtendedString from TCollection;
|
||||
anIndex : Integer from Standard = -1);
|
||||
---Purpose: Sets the color scale label at index. Index started from 1.
|
||||
|
||||
SetColor(me : mutable; aColor : Color from Quantity;
|
||||
anIndex : Integer from Standard = -1);
|
||||
SetColor(me : mutable; theColor : Color from Quantity;
|
||||
theIndex : Integer from Standard = -1);
|
||||
---Purpose: Sets the color scale color at index. Index started from 1.
|
||||
|
||||
SetLabels(me : mutable; aSeq : SequenceOfExtendedString from TColStd);
|
||||
SetLabels(me : mutable; theSeq : SequenceOfExtendedString from TColStd);
|
||||
---Purpose: Sets the color scale labels.
|
||||
|
||||
SetColors(me : mutable; aSeq : SequenceOfColor from Aspect);
|
||||
SetColors(me : mutable; theSeq : SequenceOfColor from Aspect);
|
||||
---Purpose: Sets the color scale colors.
|
||||
|
||||
SetLabelPosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
|
||||
SetLabelPosition(me : mutable; thePos : TypeOfColorScalePosition from Aspect);
|
||||
---Purpose: Sets the color scale labels position concerning color filled rectangles.
|
||||
|
||||
SetTitlePosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
|
||||
SetTitlePosition(me : mutable; thePos : TypeOfColorScalePosition from Aspect);
|
||||
---Purpose: Sets the color scale title position.
|
||||
|
||||
SetReversed(me : mutable; aReverse : Boolean from Standard);
|
||||
SetReversed(me : mutable; theReverse : Boolean from Standard);
|
||||
---Purpose: Sets true if the labels and colors used in reversed order.
|
||||
|
||||
SetLabelAtBorder(me : mutable; anOn : Boolean from Standard);
|
||||
SetLabelAtBorder(me : mutable; theOn : Boolean from Standard);
|
||||
---Purpose: Sets true if the labels placed at border of color filled rectangles.
|
||||
|
||||
--- Size and position management
|
||||
--- Size and position are values relative to view size (between 0 and 1)
|
||||
|
||||
GetSize(me; aWidth : in out Real from Standard;
|
||||
aHeight : in out Real from Standard);
|
||||
GetSize(me; theWidth : in out Real from Standard;
|
||||
theHeight : in out Real from Standard);
|
||||
---Purpose: Returns the size of color scale.
|
||||
|
||||
GetWidth(me)
|
||||
@@ -179,18 +179,18 @@ is
|
||||
returns Real from Standard;
|
||||
---Purpose: Returns the height of color scale.
|
||||
|
||||
SetSize(me : mutable; aWidth : Real from Standard;
|
||||
aHeight : Real from Standard);
|
||||
SetSize(me : mutable; theWidth : Real from Standard;
|
||||
theHeight : Real from Standard);
|
||||
---Purpose: Sets the size of color scale.
|
||||
|
||||
SetWidth(me : mutable; aWidth : Real from Standard);
|
||||
SetWidth(me : mutable; theWidth : Real from Standard);
|
||||
---Purpose: Sets the width of color scale.
|
||||
|
||||
SetHeight(me : mutable; aHeight : Real from Standard);
|
||||
SetHeight(me : mutable; theHeight : Real from Standard);
|
||||
---Purpose: Sets the height of color scale.
|
||||
|
||||
GetPosition(me; aX : in out Real from Standard;
|
||||
aY : in out Real from Standard);
|
||||
GetPosition(me; theX : in out Real from Standard;
|
||||
theY : in out Real from Standard);
|
||||
---Purpose: Returns the position of color scale.
|
||||
|
||||
GetXPosition(me)
|
||||
@@ -201,21 +201,22 @@ is
|
||||
returns Real from Standard;
|
||||
---Purpose: Returns the height of color scale.
|
||||
|
||||
SetPosition(me : mutable; aX : Real from Standard;
|
||||
aY : Real from Standard);
|
||||
SetPosition(me : mutable; theX : Real from Standard;
|
||||
theY : Real from Standard);
|
||||
---Purpose: Sets the position of color scale.
|
||||
|
||||
SetXPosition(me : mutable; aX : Real from Standard);
|
||||
SetXPosition(me : mutable; theX : Real from Standard);
|
||||
---Purpose: Sets the X position of color scale.
|
||||
|
||||
SetYPosition(me : mutable; aY : Real from Standard);
|
||||
SetYPosition(me : mutable; theY : Real from Standard);
|
||||
---Purpose: Sets the Y position of color scale.
|
||||
|
||||
GetTextHeight(me)
|
||||
returns Integer from Standard;
|
||||
|
||||
SetTextHeight(me: mutable; aHeigh : Integer from Standard);
|
||||
---Purpose: Returns the height of text of color scale.
|
||||
|
||||
SetTextHeight(me: mutable; theHeight : Integer from Standard);
|
||||
---Purpose: Sets the height of text of color scale.
|
||||
|
||||
---Category: Protected
|
||||
|
||||
@@ -223,17 +224,29 @@ is
|
||||
Initialize
|
||||
returns ColorScale from Aspect
|
||||
is protected;
|
||||
---Purpose: Default constructor.
|
||||
|
||||
SizeHint(me; aWidth : in out Integer from Standard;
|
||||
aHeight : in out Integer from Standard)
|
||||
SizeHint(me; theWidth : in out Integer from Standard;
|
||||
theHeight : in out Integer from Standard)
|
||||
is protected;
|
||||
---Purpose: Returns the size of color scale.
|
||||
-- @param theWidth [out] the width of color scale.
|
||||
-- @param theHeight [out] the height of color scale.
|
||||
|
||||
|
||||
UpdateColorScale(me : mutable)
|
||||
is virtual protected;
|
||||
---Purpose: updates color scale parameters.
|
||||
|
||||
DrawScale(me : mutable; aBgColor : Color from Quantity;
|
||||
X, Y, W, H : Integer from Standard)
|
||||
DrawScale(me : mutable; theBgColor : Color from Quantity;
|
||||
theX, theY, theWidth, theHeight : Integer from Standard)
|
||||
is protected;
|
||||
---Purpose: Draws color scale.
|
||||
-- @param theBgColor [in] background color
|
||||
-- @param theX [in] the X coordinate of color scale position.
|
||||
-- @param theY [in] the Y coordinate of color scale position.
|
||||
-- @param theWidth [in] the width of color scale.
|
||||
-- @param theHeight [in] the height of color scale.
|
||||
|
||||
BeginPaint(me : mutable)
|
||||
returns Boolean from Standard
|
||||
@@ -243,47 +256,61 @@ is
|
||||
returns Boolean from Standard
|
||||
is virtual protected;
|
||||
|
||||
PaintRect(me : mutable; X, Y, W, H : Integer from Standard;
|
||||
aColor : Color from Quantity;
|
||||
aFilled : Boolean from Standard = Standard_False)
|
||||
PaintRect(me : mutable; theX, theY, theWidth, theHeight : Integer from Standard;
|
||||
theColor : Color from Quantity;
|
||||
theFilled : Boolean from Standard = Standard_False)
|
||||
is deferred;
|
||||
---Purpose: Draws a rectangle.
|
||||
-- @param theX [in] the X coordinate of rectangle position.
|
||||
-- @param theY [in] the Y coordinate of rectangle position.
|
||||
-- @param theWidth [in] the width of rectangle.
|
||||
-- @param theHeight [in] the height of rectangle.
|
||||
-- @param theColor [in] the color of rectangle.
|
||||
-- @param theFilled [in] defines if rectangle must be filled.
|
||||
|
||||
PaintText(me : mutable; aText : ExtendedString from TCollection;
|
||||
X, Y : Integer from Standard;
|
||||
aColor : Color from Quantity)
|
||||
PaintText(me : mutable; theText : ExtendedString from TCollection;
|
||||
theX, theY : Integer from Standard;
|
||||
theColor : Color from Quantity)
|
||||
is deferred;
|
||||
---Purpose: Draws a text.
|
||||
-- @param theText [in] the text to draw.
|
||||
-- @param theX [in] the X coordinate of text position.
|
||||
-- @param theY [in] the Y coordinate of text position.
|
||||
-- @param theColor [in] the color of text.
|
||||
|
||||
TextWidth(me; aText : ExtendedString from TCollection)
|
||||
TextWidth(me; theText : ExtendedString from TCollection)
|
||||
returns Integer from Standard
|
||||
is deferred;
|
||||
---Purpose: Returns the width of text.
|
||||
-- @param theText [in] the text of which to calculate width.
|
||||
|
||||
TextHeight(me; aText : ExtendedString from TCollection)
|
||||
TextHeight(me; theText : ExtendedString from TCollection)
|
||||
returns Integer from Standard
|
||||
is deferred;
|
||||
---Purpose: Returns the height of text.
|
||||
-- @param theText [in] the text of which to calculate height.
|
||||
|
||||
---Category: Private
|
||||
|
||||
Format(me)
|
||||
returns AsciiString from TCollection
|
||||
is private;
|
||||
---Purpose: Returns the format of text.
|
||||
|
||||
GetCurrentLabel(me; anIndex : Integer from Standard)
|
||||
returns ExtendedString from TCollection
|
||||
is private;
|
||||
|
||||
GetCurrentColor(me; anIndex : Integer from Standard)
|
||||
returns Color from Quantity
|
||||
is private;
|
||||
|
||||
GetNumber(me; anIndex : Integer from Standard)
|
||||
GetNumber(me; theIndex : Integer from Standard)
|
||||
returns Real from Standard
|
||||
is private;
|
||||
---Purpose: Returns the value of given interval.
|
||||
|
||||
HueFromValue(myclass; aValue : Integer from Standard;
|
||||
aMin : Integer from Standard;
|
||||
aMax : Integer from Standard)
|
||||
HueFromValue(myclass; theValue : Integer from Standard;
|
||||
theMin : Integer from Standard;
|
||||
theMax : Integer from Standard)
|
||||
returns Integer from Standard
|
||||
is private;
|
||||
---Purpose: Returns the color's hue for the given value in the given interval.
|
||||
-- @param theValue [in] the current value of interval.
|
||||
-- @param theMin [in] the min value of interval.
|
||||
-- @param theMax [in] the max value of interval.
|
||||
|
||||
fields
|
||||
|
||||
|
@@ -58,10 +58,10 @@ Standard_Real Aspect_ColorScale::GetMax() const
|
||||
return myMax;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::GetRange( Standard_Real& aMin, Standard_Real& aMax ) const
|
||||
void Aspect_ColorScale::GetRange (Standard_Real& theMin, Standard_Real& theMax) const
|
||||
{
|
||||
aMin = myMin;
|
||||
aMax = myMax;
|
||||
theMin = myMin;
|
||||
theMax = myMax;
|
||||
}
|
||||
|
||||
Aspect_TypeOfColorScaleData Aspect_ColorScale::GetLabelType() const
|
||||
@@ -89,34 +89,53 @@ TCollection_AsciiString Aspect_ColorScale::GetFormat() const
|
||||
return myFormat;
|
||||
}
|
||||
|
||||
TCollection_ExtendedString Aspect_ColorScale::GetLabel( const Standard_Integer anIndex ) const
|
||||
TCollection_ExtendedString Aspect_ColorScale::GetLabel (const Standard_Integer theIndex) const
|
||||
{
|
||||
TCollection_ExtendedString aLabel;
|
||||
if ( anIndex >= 0 && anIndex < myLabels.Length() )
|
||||
aLabel = myLabels.Value( anIndex + 1 );
|
||||
return aLabel;
|
||||
if (GetLabelType() == Aspect_TOCSD_USER)
|
||||
{
|
||||
if (theIndex < 0
|
||||
|| theIndex >= myLabels.Length())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return myLabels.Value (theIndex + 1);
|
||||
}
|
||||
|
||||
const Standard_Real aVal = GetNumber (theIndex);
|
||||
const TCollection_AsciiString aFormat = Format();
|
||||
Standard_Character aBuf[1024];
|
||||
sprintf (aBuf, aFormat.ToCString(), aVal);
|
||||
return TCollection_ExtendedString (aBuf);
|
||||
}
|
||||
|
||||
Quantity_Color Aspect_ColorScale::GetColor( const Standard_Integer anIndex ) const
|
||||
Quantity_Color Aspect_ColorScale::GetColor (const Standard_Integer theIndex) const
|
||||
{
|
||||
Quantity_Color aColor;
|
||||
if ( anIndex >= 0 && anIndex < myColors.Length() )
|
||||
aColor = myColors.Value( anIndex + 1 );
|
||||
return aColor;
|
||||
if (GetColorType() == Aspect_TOCSD_USER)
|
||||
{
|
||||
if (theIndex < 0
|
||||
|| theIndex >= myColors.Length())
|
||||
{
|
||||
return Quantity_Color();
|
||||
}
|
||||
|
||||
return myColors.Value (theIndex + 1);
|
||||
}
|
||||
return Quantity_Color (HueFromValue (theIndex, 0, GetNumberOfIntervals() - 1), 1.0, 1.0, Quantity_TOC_HLS);
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::GetLabels( TColStd_SequenceOfExtendedString& aLabels ) const
|
||||
void Aspect_ColorScale::GetLabels (TColStd_SequenceOfExtendedString& theLabels) const
|
||||
{
|
||||
aLabels.Clear();
|
||||
for ( Standard_Integer i = 1; i <= myLabels.Length(); i++ )
|
||||
aLabels.Append( myLabels.Value( i ) );
|
||||
theLabels.Clear();
|
||||
for (Standard_Integer i = 1; i <= myLabels.Length(); i++)
|
||||
theLabels.Append (myLabels.Value (i));
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::GetColors( Aspect_SequenceOfColor& aColors ) const
|
||||
void Aspect_ColorScale::GetColors (Aspect_SequenceOfColor& theColors) const
|
||||
{
|
||||
aColors.Clear();
|
||||
for ( Standard_Integer i = 1; i <= myColors.Length(); i++ )
|
||||
aColors.Append( myColors.Value( i ) );
|
||||
theColors.Clear();
|
||||
for (Standard_Integer i = 1; i <= myColors.Length(); i++)
|
||||
theColors.Append (myColors.Value (i));
|
||||
}
|
||||
|
||||
Aspect_TypeOfColorScalePosition Aspect_ColorScale::GetLabelPosition() const
|
||||
@@ -139,164 +158,164 @@ Standard_Boolean Aspect_ColorScale::IsLabelAtBorder() const
|
||||
return myAtBorder;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetMin( const Standard_Real aMin )
|
||||
void Aspect_ColorScale::SetMin (const Standard_Real theMin)
|
||||
{
|
||||
SetRange( aMin, GetMax() );
|
||||
SetRange (theMin, GetMax());
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetMax( const Standard_Real aMax )
|
||||
void Aspect_ColorScale::SetMax (const Standard_Real theMax)
|
||||
{
|
||||
SetRange( GetMin(), aMax );
|
||||
SetRange (GetMin(), theMax);
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetRange( const Standard_Real aMin, const Standard_Real aMax )
|
||||
void Aspect_ColorScale::SetRange (const Standard_Real theMin, const Standard_Real theMax)
|
||||
{
|
||||
if ( myMin == aMin && myMax == aMax )
|
||||
if (myMin == theMin && myMax == theMax)
|
||||
return;
|
||||
|
||||
myMin = Min( aMin, aMax );
|
||||
myMax = Max( aMin, aMax );
|
||||
myMin = Min( theMin, theMax );
|
||||
myMax = Max( theMin, theMax );
|
||||
|
||||
if ( GetColorType() == Aspect_TOCSD_AUTO )
|
||||
if (GetColorType() == Aspect_TOCSD_AUTO)
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetLabelType( const Aspect_TypeOfColorScaleData aType )
|
||||
void Aspect_ColorScale::SetLabelType (const Aspect_TypeOfColorScaleData theType)
|
||||
{
|
||||
if ( myLabelType == aType )
|
||||
if (myLabelType == theType)
|
||||
return;
|
||||
|
||||
myLabelType = aType;
|
||||
myLabelType = theType;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetColorType( const Aspect_TypeOfColorScaleData aType )
|
||||
void Aspect_ColorScale::SetColorType (const Aspect_TypeOfColorScaleData theType)
|
||||
{
|
||||
if ( myColorType == aType )
|
||||
if (myColorType == theType)
|
||||
return;
|
||||
|
||||
myColorType = aType;
|
||||
myColorType = theType;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetNumberOfIntervals( const Standard_Integer aNum )
|
||||
void Aspect_ColorScale::SetNumberOfIntervals (const Standard_Integer theNum)
|
||||
{
|
||||
if ( myInterval == aNum || aNum < 1 )
|
||||
if (myInterval == theNum || theNum < 1)
|
||||
return;
|
||||
|
||||
myInterval = aNum;
|
||||
myInterval = theNum;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetTitle( const TCollection_ExtendedString& aTitle )
|
||||
void Aspect_ColorScale::SetTitle (const TCollection_ExtendedString& theTitle)
|
||||
{
|
||||
if ( myTitle == aTitle )
|
||||
if (myTitle == theTitle)
|
||||
return;
|
||||
|
||||
myTitle = aTitle;
|
||||
myTitle = theTitle;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetFormat( const TCollection_AsciiString& aFormat )
|
||||
void Aspect_ColorScale::SetFormat (const TCollection_AsciiString& theFormat)
|
||||
{
|
||||
if ( myFormat == aFormat )
|
||||
if (myFormat == theFormat)
|
||||
return;
|
||||
|
||||
myFormat = aFormat;
|
||||
if ( GetLabelType() == Aspect_TOCSD_AUTO )
|
||||
myFormat = theFormat;
|
||||
if (GetLabelType() == Aspect_TOCSD_AUTO)
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetLabel( const TCollection_ExtendedString& aLabel, const Standard_Integer anIndex )
|
||||
void Aspect_ColorScale::SetLabel (const TCollection_ExtendedString& theLabel, const Standard_Integer theIndex)
|
||||
{
|
||||
Standard_Boolean changed = Standard_False;
|
||||
Standard_Integer i = anIndex < 1 ? myLabels.Length() + 1 : anIndex;
|
||||
if ( i <= myLabels.Length() ) {
|
||||
changed = myLabels.Value( i ) != aLabel;
|
||||
myLabels.SetValue( i, aLabel );
|
||||
Standard_Integer i = theIndex < 0 ? myLabels.Length() + 1 : theIndex + 1;
|
||||
if (i <= myLabels.Length()) {
|
||||
changed = myLabels.Value (i) != theLabel;
|
||||
myLabels.SetValue (i, theLabel);
|
||||
}
|
||||
else {
|
||||
changed = Standard_True;
|
||||
while ( i > myLabels.Length() )
|
||||
myLabels.Append( TCollection_ExtendedString() );
|
||||
myLabels.SetValue( i, aLabel );
|
||||
while (i > myLabels.Length())
|
||||
myLabels.Append (TCollection_ExtendedString());
|
||||
myLabels.SetValue (i, theLabel);
|
||||
}
|
||||
if ( changed )
|
||||
if (changed)
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetColor(const Quantity_Color& aColor, const Standard_Integer anIndex )
|
||||
void Aspect_ColorScale::SetColor (const Quantity_Color& theColor, const Standard_Integer theIndex)
|
||||
{
|
||||
Standard_Boolean changed = Standard_False;
|
||||
Standard_Integer i = anIndex < 1 ? myLabels.Length() + 1 : anIndex;
|
||||
if ( i <= myColors.Length() ) {
|
||||
changed = myColors.Value( i ) != aColor;
|
||||
myColors.SetValue( i, aColor );
|
||||
Standard_Integer i = theIndex < 0 ? myColors.Length() + 1 : theIndex + 1;
|
||||
if (i <= myColors.Length()) {
|
||||
changed = myColors.Value (i) != theColor;
|
||||
myColors.SetValue (i, theColor);
|
||||
}
|
||||
else {
|
||||
changed = Standard_True;
|
||||
while ( i > myColors.Length() )
|
||||
myColors.Append( Quantity_Color() );
|
||||
myColors.SetValue( i, aColor );
|
||||
myColors.Append (Quantity_Color());
|
||||
myColors.SetValue (i, theColor);
|
||||
}
|
||||
if ( changed )
|
||||
if (changed)
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetLabels( const TColStd_SequenceOfExtendedString& aSeq )
|
||||
void Aspect_ColorScale::SetLabels (const TColStd_SequenceOfExtendedString& theSeq)
|
||||
{
|
||||
myLabels.Clear();
|
||||
for ( Standard_Integer i = 1; i <= aSeq.Length(); i++ )
|
||||
myLabels.Append( aSeq.Value( i ) );
|
||||
for (Standard_Integer i = 1; i <= theSeq.Length(); i++)
|
||||
myLabels.Append (theSeq.Value (i));
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetColors( const Aspect_SequenceOfColor& aSeq )
|
||||
void Aspect_ColorScale::SetColors (const Aspect_SequenceOfColor& theSeq)
|
||||
{
|
||||
myColors.Clear();
|
||||
for ( Standard_Integer i = 1; i <= aSeq.Length(); i++ )
|
||||
myColors.Append( aSeq.Value( i ) );
|
||||
for (Standard_Integer i = 1; i <= theSeq.Length(); i++)
|
||||
myColors.Append (theSeq.Value (i));
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetLabelPosition( const Aspect_TypeOfColorScalePosition aPos )
|
||||
void Aspect_ColorScale::SetLabelPosition (const Aspect_TypeOfColorScalePosition thePos)
|
||||
{
|
||||
if ( myLabelPos == aPos )
|
||||
if (myLabelPos == thePos)
|
||||
return;
|
||||
|
||||
myLabelPos = aPos;
|
||||
myLabelPos = thePos;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetTitlePosition( const Aspect_TypeOfColorScalePosition aPos )
|
||||
void Aspect_ColorScale::SetTitlePosition (const Aspect_TypeOfColorScalePosition thePos)
|
||||
{
|
||||
if ( myTitlePos == aPos )
|
||||
if (myTitlePos == thePos)
|
||||
return;
|
||||
|
||||
myTitlePos = aPos;
|
||||
myTitlePos = thePos;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetReversed( const Standard_Boolean aReverse )
|
||||
void Aspect_ColorScale::SetReversed (const Standard_Boolean theReverse)
|
||||
{
|
||||
if ( myReversed == aReverse )
|
||||
if (myReversed == theReverse)
|
||||
return;
|
||||
|
||||
myReversed = aReverse;
|
||||
myReversed = theReverse;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetLabelAtBorder( const Standard_Boolean anOn )
|
||||
void Aspect_ColorScale::SetLabelAtBorder (const Standard_Boolean theOn)
|
||||
{
|
||||
if ( myAtBorder == anOn )
|
||||
if (myAtBorder == theOn)
|
||||
return;
|
||||
|
||||
myAtBorder = anOn;
|
||||
myAtBorder = theOn;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::GetPosition( Standard_Real& aX, Standard_Real& aY ) const
|
||||
void Aspect_ColorScale::GetPosition (Standard_Real& theX, Standard_Real& theY) const
|
||||
{
|
||||
aX = myXPos;
|
||||
aY = myYPos;
|
||||
theX = myXPos;
|
||||
theY = myYPos;
|
||||
}
|
||||
|
||||
Standard_Real Aspect_ColorScale::GetXPosition() const
|
||||
@@ -309,31 +328,31 @@ Standard_Real Aspect_ColorScale::GetYPosition() const
|
||||
return myYPos;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetPosition( const Standard_Real aX, const Standard_Real aY )
|
||||
void Aspect_ColorScale::SetPosition (const Standard_Real theX, const Standard_Real theY)
|
||||
{
|
||||
if ( myXPos == aX && myYPos == aY )
|
||||
if (myXPos == theX && myYPos == theY)
|
||||
return;
|
||||
|
||||
myXPos = aX;
|
||||
myYPos = aY;
|
||||
myXPos = theX;
|
||||
myYPos = theY;
|
||||
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetXPosition( const Standard_Real aX )
|
||||
void Aspect_ColorScale::SetXPosition (const Standard_Real theX)
|
||||
{
|
||||
SetPosition( aX, GetYPosition() );
|
||||
SetPosition (theX, GetYPosition());
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetYPosition( const Standard_Real aY )
|
||||
void Aspect_ColorScale::SetYPosition (const Standard_Real theY)
|
||||
{
|
||||
SetPosition( GetXPosition(), aY );
|
||||
SetPosition (GetXPosition(), theY);
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::GetSize( Standard_Real& aWidth, Standard_Real& aHeight ) const
|
||||
void Aspect_ColorScale::GetSize (Standard_Real& theWidth, Standard_Real& theHeight) const
|
||||
{
|
||||
aWidth = myWidth;
|
||||
aHeight = myHeight;
|
||||
theWidth = myWidth;
|
||||
theHeight = myHeight;
|
||||
}
|
||||
|
||||
Standard_Real Aspect_ColorScale::GetWidth() const
|
||||
@@ -346,39 +365,39 @@ Standard_Real Aspect_ColorScale::GetHeight() const
|
||||
return myHeight;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetSize( const Standard_Real aWidth, const Standard_Real aHeight )
|
||||
void Aspect_ColorScale::SetSize (const Standard_Real theWidth, const Standard_Real theHeight)
|
||||
{
|
||||
if ( myWidth == aWidth && myHeight == aHeight )
|
||||
if (myWidth == theWidth && myHeight == theHeight)
|
||||
return;
|
||||
|
||||
myWidth = aWidth;
|
||||
myHeight = aHeight;
|
||||
myWidth = theWidth;
|
||||
myHeight = theHeight;
|
||||
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetWidth( const Standard_Real aWidth )
|
||||
void Aspect_ColorScale::SetWidth (const Standard_Real theWidth)
|
||||
{
|
||||
SetSize( aWidth, GetHeight() );
|
||||
SetSize (theWidth, GetHeight());
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetHeight( const Standard_Real aHeight )
|
||||
void Aspect_ColorScale::SetHeight (const Standard_Real theHeight)
|
||||
{
|
||||
SetSize( GetWidth(), aHeight );
|
||||
SetSize (GetWidth(), theHeight);
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SizeHint( Standard_Integer& aWidth, Standard_Integer& aHeight ) const
|
||||
void Aspect_ColorScale::SizeHint (Standard_Integer& theWidth, Standard_Integer& theHeight) const
|
||||
{
|
||||
Standard_Integer num = GetNumberOfIntervals();
|
||||
|
||||
Standard_Integer spacer = 5;
|
||||
Standard_Integer textWidth = 0;
|
||||
Standard_Integer textHeight = TextHeight( "" );
|
||||
Standard_Integer textHeight = TextHeight ("");
|
||||
Standard_Integer colorWidth = 20;
|
||||
|
||||
if ( GetLabelPosition() != Aspect_TOCSP_NONE )
|
||||
for ( Standard_Integer idx = 0; idx < num; idx++ )
|
||||
textWidth = Max( textWidth, TextWidth( GetCurrentLabel( idx + 1 ) ) );
|
||||
if (GetLabelPosition() != Aspect_TOCSP_NONE)
|
||||
for (Standard_Integer idx = 0; idx < num; idx++)
|
||||
textWidth = Max (textWidth, TextWidth (GetLabel (idx + 1)));
|
||||
|
||||
Standard_Integer scaleWidth = 0;
|
||||
Standard_Integer scaleHeight = 0;
|
||||
@@ -386,29 +405,29 @@ void Aspect_ColorScale::SizeHint( Standard_Integer& aWidth, Standard_Integer& aH
|
||||
Standard_Integer titleWidth = 0;
|
||||
Standard_Integer titleHeight = 0;
|
||||
|
||||
if ( IsLabelAtBorder() ) {
|
||||
if (IsLabelAtBorder()) {
|
||||
num++;
|
||||
if ( GetTitle().Length() )
|
||||
if (GetTitle().Length())
|
||||
titleHeight += 10;
|
||||
}
|
||||
|
||||
scaleWidth = colorWidth + textWidth + ( textWidth ? 3 : 2 ) * spacer;
|
||||
scaleHeight = (Standard_Integer)( 1.5 * ( num + 1 ) * textHeight );
|
||||
|
||||
if ( GetTitle().Length() ) {
|
||||
titleHeight = TextHeight( GetTitle() ) + spacer;
|
||||
titleWidth = TextWidth( GetTitle() ) + 10;
|
||||
if (GetTitle().Length()) {
|
||||
titleHeight = TextHeight (GetTitle()) + spacer;
|
||||
titleWidth = TextWidth (GetTitle()) + 10;
|
||||
}
|
||||
|
||||
aWidth = Max( titleWidth, scaleWidth );
|
||||
aHeight = scaleHeight + titleHeight;
|
||||
theWidth = Max (titleWidth, scaleWidth);
|
||||
theHeight = scaleHeight + titleHeight;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::DrawScale( const Quantity_Color& aBgColor,
|
||||
const Standard_Integer X, const Standard_Integer Y,
|
||||
const Standard_Integer W, const Standard_Integer H )
|
||||
void Aspect_ColorScale::DrawScale ( const Quantity_Color& theBgColor,
|
||||
const Standard_Integer theX, const Standard_Integer theY,
|
||||
const Standard_Integer theWidth, const Standard_Integer theHeight)
|
||||
{
|
||||
if ( !BeginPaint() )
|
||||
if (!BeginPaint())
|
||||
return;
|
||||
|
||||
Standard_Integer num = GetNumberOfIntervals();
|
||||
@@ -416,7 +435,7 @@ void Aspect_ColorScale::DrawScale( const Quantity_Color& aBgColor,
|
||||
|
||||
Standard_Integer spacer = 5;
|
||||
Standard_Integer textWidth = 0;
|
||||
Standard_Integer textHeight = TextHeight( "" );
|
||||
Standard_Integer textHeight = TextHeight ("");
|
||||
|
||||
Standard_Boolean drawLabel = GetLabelPosition() != Aspect_TOCSP_NONE;
|
||||
|
||||
@@ -424,79 +443,79 @@ void Aspect_ColorScale::DrawScale( const Quantity_Color& aBgColor,
|
||||
|
||||
Standard_Integer titleHeight = 0;
|
||||
|
||||
Standard_Integer aGray = (Standard_Integer)(255 * ( aBgColor.Red() * 11 + aBgColor.Green() * 16 + aBgColor.Blue() * 5 ) / 32);
|
||||
Quantity_Color aFgColor( aGray < 128 ? Quantity_NOC_WHITE : Quantity_NOC_BLACK );
|
||||
Standard_Integer aGray = (Standard_Integer)(255 * ( theBgColor.Red() * 11 + theBgColor.Green() * 16 + theBgColor.Blue() * 5 ) / 32);
|
||||
Quantity_Color aFgColor (aGray < 128 ? Quantity_NOC_WHITE : Quantity_NOC_BLACK);
|
||||
|
||||
// Draw title
|
||||
if ( aTitle.Length() ) {
|
||||
titleHeight = TextHeight( aTitle ) + 2 * spacer;
|
||||
PaintText( aTitle, X + spacer, Y + spacer, aFgColor );
|
||||
if (aTitle.Length()) {
|
||||
titleHeight = TextHeight (aTitle) + 2 * spacer;
|
||||
PaintText (aTitle, theX + spacer, theY + spacer, aFgColor);
|
||||
}
|
||||
|
||||
Standard_Boolean reverse = IsReversed();
|
||||
|
||||
Aspect_SequenceOfColor colors;
|
||||
TColStd_SequenceOfExtendedString labels;
|
||||
for ( int idx = 0; idx < num; idx++ ) {
|
||||
if ( reverse ) {
|
||||
colors.Append( GetCurrentColor( idx ) );
|
||||
labels.Append( GetCurrentLabel( idx ) );
|
||||
for (int idx = 0; idx < num; idx++) {
|
||||
if (reverse) {
|
||||
colors.Append (GetColor (idx));
|
||||
labels.Append (GetLabel (idx));
|
||||
}
|
||||
else {
|
||||
colors.Prepend( GetCurrentColor( idx ) );
|
||||
labels.Prepend( GetCurrentLabel( idx ) );
|
||||
colors.Prepend (GetColor (idx));
|
||||
labels.Prepend (GetLabel (idx));
|
||||
}
|
||||
}
|
||||
|
||||
if ( IsLabelAtBorder() ) {
|
||||
if ( reverse )
|
||||
labels.Append( GetCurrentLabel( num ) );
|
||||
if (IsLabelAtBorder()) {
|
||||
if (reverse)
|
||||
labels.Append (GetLabel (num));
|
||||
else
|
||||
labels.Prepend( GetCurrentLabel( num ) );
|
||||
labels.Prepend (GetLabel (num));
|
||||
}
|
||||
|
||||
if ( drawLabel )
|
||||
for ( Standard_Integer i = 1; i <= labels.Length(); i++ )
|
||||
textWidth = Max( textWidth, TextWidth( labels.Value( i ) ) );
|
||||
if (drawLabel)
|
||||
for (Standard_Integer i = 1; i <= labels.Length(); i++)
|
||||
textWidth = Max (textWidth, TextWidth (labels.Value (i)));
|
||||
|
||||
Standard_Integer lab = labels.Length();
|
||||
|
||||
Standard_Real spc = ( H - ( ( Min( lab, 2 ) + Abs( lab - num - 1 ) ) * textHeight ) - titleHeight );
|
||||
Standard_Real val = spc != 0 ? 1.0 * ( lab - Min( lab, 2 ) ) * textHeight / spc : 0;
|
||||
Standard_Real spc = ( theHeight - ( ( Min (lab, 2) + Abs (lab - num - 1) ) * textHeight ) - titleHeight );
|
||||
Standard_Real val = spc != 0 ? 1.0 * ( lab - Min (lab, 1) ) * textHeight / spc : 0;
|
||||
Standard_Real iPart;
|
||||
Standard_Real fPart = modf( val, &iPart );
|
||||
Standard_Real fPart = modf (val, &iPart);
|
||||
Standard_Integer filter = (Standard_Integer)iPart + ( fPart != 0 ? 1 : 0 );
|
||||
|
||||
Standard_Real step = 1.0 * ( H - ( lab - num + Abs( lab - num - 1 ) ) * textHeight - titleHeight ) / num;
|
||||
Standard_Real step = 1.0 * ( theHeight - ( lab - num + Abs (lab - num - 1) ) * textHeight - titleHeight ) / num;
|
||||
|
||||
Standard_Integer ascent = 0;
|
||||
Standard_Integer colorWidth = Max( 5, Min( 20, W - textWidth - 3 * spacer ) );
|
||||
if ( labPos == Aspect_TOCSP_CENTER || !drawLabel )
|
||||
colorWidth = W - 2 * spacer;
|
||||
Standard_Integer colorWidth = Max (5, Min (20, theWidth - textWidth - 3 * spacer));
|
||||
if (labPos == Aspect_TOCSP_CENTER || !drawLabel)
|
||||
colorWidth = theWidth - 2 * spacer;
|
||||
|
||||
// Draw colors
|
||||
Standard_Integer x = X + spacer;
|
||||
if ( labPos == Aspect_TOCSP_LEFT )
|
||||
Standard_Integer x = theX + spacer;
|
||||
if (labPos == Aspect_TOCSP_LEFT)
|
||||
x += textWidth + ( textWidth ? 1 : 0 ) * spacer;
|
||||
|
||||
Standard_Real offset = 1.0 * textHeight / 2 * ( lab - num + Abs( lab - num - 1 ) ) + titleHeight;
|
||||
for ( Standard_Integer ci = 1; ci <= colors.Length() && step > 0; ci++ ) {
|
||||
Standard_Integer y = (Standard_Integer)( Y + ( ci - 1 )* step + offset );
|
||||
Standard_Integer h = (Standard_Integer)( Y + ( ci ) * step + offset ) - y;
|
||||
PaintRect( x, y, colorWidth, h, colors.Value( ci ), Standard_True );
|
||||
Standard_Real offset = 1.0 * textHeight / 2 * ( lab - num + Abs (lab - num - 1) ) + titleHeight;
|
||||
for (Standard_Integer ci = 1; ci <= colors.Length() && step > 0; ci++ ) {
|
||||
Standard_Integer y = (Standard_Integer)( theY + ( ci - 1 )* step + offset);
|
||||
Standard_Integer h = (Standard_Integer)( theY + ( ci ) * step + offset ) - y;
|
||||
PaintRect (x, y, colorWidth, h, colors.Value (ci), Standard_True);
|
||||
}
|
||||
|
||||
if ( step > 0 )
|
||||
PaintRect( x - 1, (Standard_Integer)(Y + offset - 1), colorWidth + 2, (Standard_Integer)(colors.Length() * step + 2), aFgColor );
|
||||
if (step > 0)
|
||||
PaintRect (x - 1, (Standard_Integer)(theY + offset - 1), colorWidth + 2, (Standard_Integer)(colors.Length() * step + 2), aFgColor);
|
||||
|
||||
// Draw labels
|
||||
offset = 1.0 * Abs( lab - num - 1 ) * ( step - textHeight ) / 2 + 1.0 * Abs( lab - num - 1 ) * textHeight / 2;
|
||||
offset = 1.0 * Abs (lab - num - 1) * ( step - textHeight ) / 2 + 1.0 * Abs (lab - num - 1) * textHeight / 2;
|
||||
offset += titleHeight;
|
||||
if ( drawLabel && labels.Length() && filter > 0 ) {
|
||||
if (drawLabel && labels.Length() && filter > 0) {
|
||||
Standard_Integer i1 = 0;
|
||||
Standard_Integer i2 = lab - 1;
|
||||
Standard_Integer last1( i1 ), last2( i2 );
|
||||
x = X + spacer;
|
||||
Standard_Integer last1 (i1), last2 (i2);
|
||||
x = theX + spacer;
|
||||
switch ( labPos ) {
|
||||
case Aspect_TOCSP_NONE:
|
||||
case Aspect_TOCSP_LEFT:
|
||||
@@ -508,30 +527,30 @@ void Aspect_ColorScale::DrawScale( const Quantity_Color& aBgColor,
|
||||
x += colorWidth + spacer;
|
||||
break;
|
||||
}
|
||||
while ( i2 - i1 >= filter || ( i2 == 0 && i1 == 0 ) ) {
|
||||
while (i2 - i1 >= filter || ( i2 == 0 && i1 == 0 )) {
|
||||
Standard_Integer pos1 = i1;
|
||||
Standard_Integer pos2 = lab - 1 - i2;
|
||||
if ( filter && !( pos1 % filter ) ) {
|
||||
PaintText( labels.Value( i1 + 1 ), x, (Standard_Integer)( Y + i1 * step + ascent + offset ), aFgColor );
|
||||
last1 = i1;
|
||||
if (filter && !( pos1 % filter )) {
|
||||
PaintText (labels.Value (i1 + 1), x, (Standard_Integer)( theY + i1 * step + ascent + offset ), aFgColor);
|
||||
last1 = i1;
|
||||
}
|
||||
if ( filter && !( pos2 % filter ) ) {
|
||||
PaintText( labels.Value( i2 + 1 ), x, (Standard_Integer)( Y + i2 * step + ascent + offset ), aFgColor );
|
||||
last2 = i2;
|
||||
if (filter && !( pos2 % filter )) {
|
||||
PaintText (labels.Value (i2 + 1), x, (Standard_Integer)( theY + i2 * step + ascent + offset ), aFgColor);
|
||||
last2 = i2;
|
||||
}
|
||||
i1++;
|
||||
i2--;
|
||||
}
|
||||
Standard_Integer pos = i1;
|
||||
Standard_Integer i0 = -1;
|
||||
while ( pos <= i2 && i0 == -1 ) {
|
||||
if ( filter && !( pos % filter ) && Abs( pos - last1 ) >= filter && Abs( pos - last2 ) >= filter )
|
||||
i0 = pos;
|
||||
while (pos <= i2 && i0 == -1) {
|
||||
if (filter && !( pos % filter ) && Abs (pos - last1) >= filter && Abs (pos - last2) >= filter)
|
||||
i0 = pos;
|
||||
pos++;
|
||||
}
|
||||
|
||||
if ( i0 != -1 )
|
||||
PaintText( labels.Value( i0 + 1 ), x, (Standard_Integer)( Y + i0 * step + ascent + offset ), aFgColor );
|
||||
if (i0 != -1)
|
||||
PaintText (labels.Value (i0 + 1), x, (Standard_Integer)( theY + i0 * step + ascent + offset ), aFgColor);
|
||||
}
|
||||
|
||||
EndPaint();
|
||||
@@ -556,50 +575,24 @@ TCollection_AsciiString Aspect_ColorScale::Format() const
|
||||
return GetFormat();
|
||||
}
|
||||
|
||||
TCollection_ExtendedString Aspect_ColorScale::GetCurrentLabel( const Standard_Integer anIndex ) const
|
||||
{
|
||||
TCollection_ExtendedString aLabel;
|
||||
if ( GetLabelType() == Aspect_TOCSD_USER )
|
||||
aLabel = GetLabel( anIndex );
|
||||
else {
|
||||
Standard_Real val = GetNumber( anIndex );
|
||||
Standard_Character buf[1024];
|
||||
TCollection_AsciiString aFormat = Format();
|
||||
sprintf( buf, aFormat.ToCString(), val );
|
||||
aLabel = TCollection_ExtendedString( buf );
|
||||
}
|
||||
|
||||
return aLabel;
|
||||
}
|
||||
|
||||
Quantity_Color Aspect_ColorScale::GetCurrentColor( const Standard_Integer anIndex ) const
|
||||
{
|
||||
Quantity_Color aColor;
|
||||
if ( GetColorType() == Aspect_TOCSD_USER )
|
||||
aColor = GetColor( anIndex );
|
||||
else
|
||||
aColor = Quantity_Color( HueFromValue( anIndex, 0, GetNumberOfIntervals() - 1 ), 1.0, 1.0, Quantity_TOC_HLS );
|
||||
return aColor;
|
||||
}
|
||||
|
||||
Standard_Real Aspect_ColorScale::GetNumber( const Standard_Integer anIndex ) const
|
||||
Standard_Real Aspect_ColorScale::GetNumber (const Standard_Integer theIndex) const
|
||||
{
|
||||
Standard_Real aNum = 0;
|
||||
if ( GetNumberOfIntervals() > 0 )
|
||||
aNum = GetMin() + anIndex * ( Abs( GetMax() - GetMin() ) / GetNumberOfIntervals() );
|
||||
if (GetNumberOfIntervals() > 0)
|
||||
aNum = GetMin() + theIndex * ( Abs (GetMax() - GetMin()) / GetNumberOfIntervals() );
|
||||
return aNum;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorScale::HueFromValue( const Standard_Integer aValue,
|
||||
const Standard_Integer aMin, const Standard_Integer aMax )
|
||||
Standard_Integer Aspect_ColorScale::HueFromValue (const Standard_Integer theValue,
|
||||
const Standard_Integer theMin, const Standard_Integer theMax)
|
||||
{
|
||||
Standard_Integer minLimit( 0 ), maxLimit( 230 );
|
||||
Standard_Integer minLimit (0), maxLimit (230);
|
||||
|
||||
Standard_Integer aHue = maxLimit;
|
||||
if ( aMin != aMax )
|
||||
aHue = (Standard_Integer)( maxLimit - ( maxLimit - minLimit ) * ( aValue - aMin ) / ( aMax - aMin ) );
|
||||
if (theMin != theMax)
|
||||
aHue = (Standard_Integer)( maxLimit - ( maxLimit - minLimit ) * ( theValue - theMin ) / ( theMax - theMin ) );
|
||||
|
||||
aHue = Min( Max( minLimit, aHue ), maxLimit );
|
||||
aHue = Min (Max (minLimit, aHue), maxLimit);
|
||||
|
||||
return aHue;
|
||||
}
|
||||
@@ -608,41 +601,37 @@ Standard_Integer Aspect_ColorScale::GetTextHeight() const {
|
||||
return myTextHeight;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetTextHeight(const Standard_Integer aHeigh) {
|
||||
myTextHeight = aHeigh;
|
||||
void Aspect_ColorScale::SetTextHeight (const Standard_Integer theHeight) {
|
||||
myTextHeight = theHeight;
|
||||
UpdateColorScale ();
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean Aspect_ColorScale::FindColor( const Standard_Real aValue,
|
||||
Quantity_Color& aColor ) const
|
||||
Standard_Boolean Aspect_ColorScale::FindColor (const Standard_Real theValue,
|
||||
Quantity_Color& theColor) const
|
||||
{
|
||||
return FindColor( aValue, myMin, myMax, myInterval, aColor );
|
||||
return FindColor (theValue, myMin, myMax, myInterval, theColor);
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean Aspect_ColorScale::FindColor( const Standard_Real aValue,
|
||||
const Standard_Real aMin,
|
||||
const Standard_Real aMax,
|
||||
const Standard_Integer ColorsCount,
|
||||
Quantity_Color& aColor )
|
||||
Standard_Boolean Aspect_ColorScale::FindColor (const Standard_Real theValue,
|
||||
const Standard_Real theMin,
|
||||
const Standard_Real theMax,
|
||||
const Standard_Integer theColorsCount,
|
||||
Quantity_Color& theColor)
|
||||
{
|
||||
if( aValue<aMin || aValue>aMax || aMax<aMin )
|
||||
if(theValue<theMin || theValue>theMax || theMax<theMin)
|
||||
return Standard_False;
|
||||
|
||||
else
|
||||
{
|
||||
Standard_Real IntervNumber = 0;
|
||||
if( aValue<aMin )
|
||||
IntervNumber = 0;
|
||||
else if( aValue>aMax )
|
||||
IntervNumber = ColorsCount-1;
|
||||
else if( Abs( aMax-aMin ) > Precision::Approximation() )
|
||||
IntervNumber = Ceiling( Standard_Real( ColorsCount ) * ( aValue - aMin ) / ( aMax - aMin ) );
|
||||
if(Abs (theMax-theMin) > Precision::Approximation())
|
||||
IntervNumber = Floor (Standard_Real( theColorsCount ) * ( theValue - theMin ) / ( theMax - theMin ));
|
||||
|
||||
Standard_Integer Interv = Standard_Integer( IntervNumber );
|
||||
Standard_Integer Interv = Standard_Integer (IntervNumber);
|
||||
|
||||
aColor = Quantity_Color( HueFromValue( Interv, 0, ColorsCount - 1 ), 1.0, 1.0, Quantity_TOC_HLS );
|
||||
theColor = Quantity_Color (HueFromValue (Interv, 0, theColorsCount - 1), 1.0, 1.0, Quantity_TOC_HLS);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -332,13 +332,14 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
}
|
||||
//
|
||||
const gp_Pnt& aPnew = BRep_Tool::Pnt(aVnew);
|
||||
if (!myContext->IsValidPointForFace(aPnew,
|
||||
aF,
|
||||
aTolE+aTolF)) {
|
||||
Standard_Real aTolV = BRep_Tool::Tolerance(aVnew);
|
||||
aTolV = Max(aTolV, Max(aTolE, aTolF));
|
||||
//
|
||||
if (!myContext->IsPointInFace(aPnew, aF, aTolV)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aBB.UpdateVertex(aVnew, aTolE);
|
||||
aBB.UpdateVertex(aVnew, aTolV);
|
||||
//
|
||||
aMIEFC.Add(nF);
|
||||
// 1
|
||||
|
@@ -813,7 +813,7 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Real aT, aT1, aT2, aAngle, aTwoPI, aAngleMin, aDt3D;
|
||||
Standard_Real aUmin, aUsup, aVmin, aVsup;
|
||||
Standard_Real aUmin, aUsup, aVmin, aVsup, aPA;
|
||||
gp_Pnt aPn1, aPn2, aPx;
|
||||
gp_Dir aDN1, aDN2, aDBF, aDBF2, aDTF;
|
||||
gp_Vec aVTgt;
|
||||
@@ -823,6 +823,7 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
|
||||
BOPTools_ListIteratorOfListOfCoupleOfShape aIt;
|
||||
GeomAPI_ProjectPointOnSurf aProjPL;
|
||||
//
|
||||
aPA=Precision::Angular();
|
||||
aAngleMin=100.;
|
||||
aTwoPI=M_PI+M_PI;
|
||||
aC3D =BRep_Tool::Curve(theE1, aT1, aT2);
|
||||
@@ -860,7 +861,7 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
|
||||
aAngle=aTwoPI+aAngle;
|
||||
}
|
||||
//
|
||||
if (aAngle<Precision::Angular()) {
|
||||
if (aAngle<aPA) {
|
||||
if (aF2==theF1) {
|
||||
aAngle=M_PI;
|
||||
}
|
||||
@@ -869,6 +870,11 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
|
||||
}
|
||||
}
|
||||
//
|
||||
if (fabs(aAngle-aAngleMin)<aPA) {
|
||||
// the minimal angle can not be found
|
||||
bRet=Standard_False;
|
||||
}
|
||||
//
|
||||
if (aAngle<aAngleMin){
|
||||
aAngleMin=aAngle;
|
||||
theFOff=aF2;
|
||||
|
@@ -617,7 +617,7 @@ Standard_Real IntersectCurves2d(const gp_Pnt& aPV,
|
||||
gp_Pnt2d aP2D;
|
||||
//
|
||||
aDist = 0.;
|
||||
aTol2d = Precision::Confusion();
|
||||
aTol2d = 1.e-10;//Precision::Confusion();
|
||||
//
|
||||
const Handle(Geom2d_Curve)& aC2D1=
|
||||
BRep_Tool::CurveOnSurface(aE1, aF, aT11, aT12);
|
||||
@@ -637,13 +637,13 @@ Standard_Real IntersectCurves2d(const gp_Pnt& aPV,
|
||||
}
|
||||
aNbPnt = aInter.NbPoints();
|
||||
if (aNbPnt) {
|
||||
aDist = Precision::Infinite();
|
||||
aDist = -Precision::Infinite();
|
||||
for (j = 1; j <= aNbPnt; ++j) {
|
||||
aP2D = aInter.Point(j).Value();
|
||||
aS->D0(aP2D.X(), aP2D.Y(), aP);
|
||||
aD=aPV.SquareDistance(aP);
|
||||
if (aD < aDist) {
|
||||
aDist = aD;
|
||||
if (aD > aDist) {
|
||||
aDist = 1.01 * aD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -385,7 +385,9 @@ void BRepLib_CheckCurveOnSurface::Compute
|
||||
aValue = theMaxDist;
|
||||
aParam = theMaxPar;
|
||||
aBP = theMaxPar - aMinDelta;
|
||||
MinComputing(aFunc, aFirst, aBP, anEpsilonRange, theMaxDist, theMaxPar);
|
||||
|
||||
if((aBP - aFirst) > Precision::PConfusion())
|
||||
MinComputing(aFunc, aFirst, aBP, anEpsilonRange, theMaxDist, theMaxPar);
|
||||
//
|
||||
if(theMaxDist < aValue) {
|
||||
aLast = aBP;
|
||||
@@ -399,7 +401,9 @@ void BRepLib_CheckCurveOnSurface::Compute
|
||||
//
|
||||
if(!aStatus) {
|
||||
aBP = theMaxPar + aMinDelta;
|
||||
MinComputing(aFunc, aBP, aLast, 1.0e-3, theMaxDist, theMaxPar);
|
||||
|
||||
if((aLast - aBP) > Precision::PConfusion())
|
||||
MinComputing(aFunc, aBP, aLast, 1.0e-3, theMaxDist, theMaxPar);
|
||||
//
|
||||
if(theMaxDist < aValue) {
|
||||
aFirst = aBP;
|
||||
|
@@ -127,6 +127,8 @@ namespace BRepMesh
|
||||
typedef NCollection_Handle<DMapOfVertexInteger> HDMapOfVertexInteger;
|
||||
typedef NCollection_Handle<DMapOfIntegerListOfXY> HDMapOfIntegerListOfXY;
|
||||
typedef NCollection_Handle<BRepMesh_VertexTool> HVertexTool;
|
||||
typedef NCollection_Handle<SequenceOfBndB2d> HSequenceOfBndB2d;
|
||||
typedef NCollection_Handle<SequenceOfInteger> HSequenceOfInteger;
|
||||
|
||||
//! Other data structures
|
||||
typedef std::pair<HArray1OfSegments, HBndBox2dTree> SegmentsTree;
|
||||
|
@@ -1701,7 +1701,41 @@ void BRepMesh_Delaun::meshPolygon(BRepMesh::SequenceOfInteger& thePolygon,
|
||||
}
|
||||
}
|
||||
|
||||
meshSimplePolygon( thePolygon, thePolyBoxes );
|
||||
BRepMesh::SequenceOfInteger* aPolygon1 = &thePolygon;
|
||||
BRepMesh::SequenceOfBndB2d* aPolyBoxes1 = &thePolyBoxes;
|
||||
|
||||
BRepMesh::HSequenceOfInteger aPolygon2 = new BRepMesh::SequenceOfInteger;
|
||||
BRepMesh::HSequenceOfBndB2d aPolyBoxes2 = new BRepMesh::SequenceOfBndB2d;
|
||||
|
||||
NCollection_Sequence<BRepMesh::HSequenceOfInteger> aPolyStack;
|
||||
NCollection_Sequence<BRepMesh::HSequenceOfBndB2d> aPolyBoxStack;
|
||||
for (;;)
|
||||
{
|
||||
decomposeSimplePolygon(*aPolygon1, *aPolyBoxes1, *aPolygon2, *aPolyBoxes2);
|
||||
if (!aPolygon2->IsEmpty())
|
||||
{
|
||||
aPolyStack.Append(aPolygon2);
|
||||
aPolyBoxStack.Append(aPolyBoxes2);
|
||||
|
||||
aPolygon2 = new BRepMesh::SequenceOfInteger;
|
||||
aPolyBoxes2 = new BRepMesh::SequenceOfBndB2d;
|
||||
}
|
||||
|
||||
if (aPolygon1->IsEmpty())
|
||||
{
|
||||
if (!aPolyStack.IsEmpty() && aPolygon1 == &(*aPolyStack.First()))
|
||||
{
|
||||
aPolyStack.Remove(1);
|
||||
aPolyBoxStack.Remove(1);
|
||||
}
|
||||
|
||||
if (aPolyStack.IsEmpty())
|
||||
return;
|
||||
|
||||
aPolygon1 = &(*aPolyStack.ChangeFirst());
|
||||
aPolyBoxes1 = &(*aPolyBoxStack.ChangeFirst());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1746,18 +1780,21 @@ inline Standard_Boolean BRepMesh_Delaun::meshElementaryPolygon(
|
||||
|
||||
//=======================================================================
|
||||
//function : meshSimplePolygon
|
||||
//purpose : Triangulatiion of a closed simple polygon (polygon without
|
||||
// glued edges and loops) described by the list of indexes of
|
||||
// its edges in the structure.
|
||||
// (negative index means reversed edge)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::meshSimplePolygon(BRepMesh::SequenceOfInteger& thePolygon,
|
||||
BRepMesh::SequenceOfBndB2d& thePolyBoxes )
|
||||
void BRepMesh_Delaun::decomposeSimplePolygon(
|
||||
BRepMesh::SequenceOfInteger& thePolygon,
|
||||
BRepMesh::SequenceOfBndB2d& thePolyBoxes,
|
||||
BRepMesh::SequenceOfInteger& thePolygonCut,
|
||||
BRepMesh::SequenceOfBndB2d& thePolyBoxesCut)
|
||||
{
|
||||
// Check is the given polygon elementary
|
||||
if ( meshElementaryPolygon( thePolygon ) )
|
||||
{
|
||||
thePolygon.Clear();
|
||||
thePolyBoxes.Clear();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Polygon contains more than 3 links
|
||||
Standard_Integer aFirstEdgeInfo = thePolygon(1);
|
||||
@@ -1774,7 +1811,11 @@ void BRepMesh_Delaun::meshSimplePolygon(BRepMesh::SequenceOfInteger& thePolygon,
|
||||
|
||||
Standard_Real aRefEdgeLen = aRefEdgeDir.Magnitude();
|
||||
if ( aRefEdgeLen < Precision )
|
||||
{
|
||||
thePolygon.Clear();
|
||||
thePolyBoxes.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
aRefEdgeDir /= aRefEdgeLen;
|
||||
|
||||
@@ -1865,7 +1906,11 @@ void BRepMesh_Delaun::meshSimplePolygon(BRepMesh::SequenceOfInteger& thePolygon,
|
||||
}
|
||||
|
||||
if ( aUsedLinkId == 0 )
|
||||
{
|
||||
thePolygon.Clear();
|
||||
thePolyBoxes.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
BRepMesh_Edge aNewEdges[2] = {
|
||||
@@ -1893,19 +1938,14 @@ void BRepMesh_Delaun::meshSimplePolygon(BRepMesh::SequenceOfInteger& thePolygon,
|
||||
// polygon.
|
||||
if ( aUsedLinkId < aPolyLen )
|
||||
{
|
||||
BRepMesh::SequenceOfInteger aRightPolygon;
|
||||
thePolygon.Split( aUsedLinkId, aRightPolygon );
|
||||
aRightPolygon.Prepend( -aNewEdgesInfo[2] );
|
||||
|
||||
BRepMesh::SequenceOfBndB2d aRightPolyBoxes;
|
||||
thePolyBoxes.Split( aUsedLinkId, aRightPolyBoxes );
|
||||
thePolygon.Split(aUsedLinkId, thePolygonCut);
|
||||
thePolygonCut.Prepend( -aNewEdgesInfo[2] );
|
||||
thePolyBoxes.Split(aUsedLinkId, thePolyBoxesCut);
|
||||
|
||||
Bnd_B2d aBox;
|
||||
aBox.Add( aRefVertices[0] );
|
||||
aBox.Add( aRefVertices[2] );
|
||||
aRightPolyBoxes.Prepend( aBox );
|
||||
|
||||
meshSimplePolygon( aRightPolygon, aRightPolyBoxes );
|
||||
thePolyBoxesCut.Prepend( aBox );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1922,8 +1962,6 @@ void BRepMesh_Delaun::meshSimplePolygon(BRepMesh::SequenceOfInteger& thePolygon,
|
||||
aBox.Add( aRefVertices[2] );
|
||||
|
||||
thePolyBoxes.SetValue( 1, aBox );
|
||||
|
||||
meshSimplePolygon( thePolygon, thePolyBoxes );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -196,11 +196,20 @@ private:
|
||||
BRepMesh::SequenceOfBndB2d& thePolyBoxes,
|
||||
BRepMesh::HMapOfInteger theSkipped = NULL);
|
||||
|
||||
//! Triangulatiion of a closed simple polygon (polygon without glued edges and loops)
|
||||
//! described by the list of indexes of its edges in the structure.
|
||||
//! (negative index means reversed edge)
|
||||
void meshSimplePolygon (BRepMesh::SequenceOfInteger& thePolygon,
|
||||
BRepMesh::SequenceOfBndB2d& thePolyBoxes);
|
||||
//! Decomposes the given closed simple polygon (polygon without glued edges
|
||||
//! and loops) on two simpler ones by adding new link at the most thin part
|
||||
//! in respect to end point of the first link.
|
||||
//! In case if source polygon consists of three links, creates new triangle
|
||||
//! and clears source container.
|
||||
//! @param thePolygon source polygon to be decomposed (first part of decomposition).
|
||||
//! @param thePolyBoxes bounding boxes corresponded to source polygon's links.
|
||||
//! @param thePolygonCut product of decomposition of source polygon (second part of decomposition).
|
||||
//! @param thePolyBoxesCut bounding boxes corresponded to resulting polygon's links.
|
||||
void decomposeSimplePolygon (
|
||||
BRepMesh::SequenceOfInteger& thePolygon,
|
||||
BRepMesh::SequenceOfBndB2d& thePolyBoxes,
|
||||
BRepMesh::SequenceOfInteger& thePolygonCut,
|
||||
BRepMesh::SequenceOfBndB2d& thePolyBoxesCut);
|
||||
|
||||
//! Triangulation of closed polygon containing only three edges.
|
||||
inline Standard_Boolean meshElementaryPolygon (const BRepMesh::SequenceOfInteger& thePolygon);
|
||||
|
@@ -101,6 +101,9 @@ is
|
||||
|
||||
CheckCompatibility(me: in out;
|
||||
check : Boolean from Standard = Standard_True);
|
||||
---Purpose: Sets/unsets the option to
|
||||
-- compute origin and orientation on wires to avoid twisted results
|
||||
-- and update wires to have same number of edges.
|
||||
|
||||
SetSmoothing(me: in out; UseSmoothing : Boolean from Standard)
|
||||
---Purpose: Define the approximation algorithm
|
||||
|
@@ -869,6 +869,11 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoD
|
||||
for (Ex.Init(start, TopAbs_WIRE, TopAbs_FACE); Ex.More(); Ex.Next()) {
|
||||
TopoDS_Wire S = TopoDS::Wire(Ex.Current());
|
||||
AddWarning(S," a Wire alone is not an IGESBRep entity : no Transfer");
|
||||
|
||||
BRepToIGES_BRWire BW(*this);
|
||||
BW.SetModel(GetModel());
|
||||
IShape = BW.TransferWire(S);
|
||||
if (!IShape.IsNull()) Seq->Append(IShape);
|
||||
}
|
||||
|
||||
|
||||
@@ -876,6 +881,11 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoD
|
||||
for (Ex.Init(start, TopAbs_EDGE, TopAbs_WIRE); Ex.More(); Ex.Next()) {
|
||||
TopoDS_Edge S = TopoDS::Edge(Ex.Current());
|
||||
AddWarning(S," a Edge alone is not an IGESBRep entity : no Transfer");
|
||||
|
||||
BRepToIGES_BRWire BW(*this);
|
||||
BW.SetModel(GetModel());
|
||||
IShape = BW.TransferEdge(S, Standard_False);
|
||||
if (!IShape.IsNull()) Seq->Append(IShape);
|
||||
}
|
||||
|
||||
|
||||
@@ -883,27 +893,27 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoD
|
||||
for (Ex.Init(start, TopAbs_VERTEX, TopAbs_EDGE); Ex.More(); Ex.Next()) {
|
||||
TopoDS_Vertex S = TopoDS::Vertex(Ex.Current());
|
||||
AddWarning(S," a Vertex alone is not an IGESBRep entity : no Transfer");
|
||||
|
||||
BRepToIGES_BRWire BW(*this);
|
||||
BW.SetModel(GetModel());
|
||||
IShape = BW.TransferVertex(S);
|
||||
if (!IShape.IsNull()) Seq->Append(IShape);
|
||||
}
|
||||
|
||||
// construct the group
|
||||
Standard_Integer nbshapes = Seq->Length();
|
||||
Handle(IGESData_HArray1OfIGESEntity) Tab;
|
||||
if (nbshapes > 1) {
|
||||
Tab = new IGESData_HArray1OfIGESEntity(1,nbshapes);
|
||||
if (nbshapes > 0) {
|
||||
Handle(IGESData_HArray1OfIGESEntity) Tab =
|
||||
new IGESData_HArray1OfIGESEntity(1,nbshapes);
|
||||
for (Standard_Integer itab = 1; itab <= nbshapes; itab++) {
|
||||
Handle(IGESData_IGESEntity) item = GetCasted(IGESData_IGESEntity, Seq->Value(itab));
|
||||
Tab->SetValue(itab,item);
|
||||
}
|
||||
}
|
||||
|
||||
if (nbshapes == 1) {
|
||||
res = IShape;
|
||||
}
|
||||
else if(nbshapes > 1) {
|
||||
|
||||
Handle(IGESBasic_Group) IGroup = new IGESBasic_Group;
|
||||
IGroup->Init(Tab);
|
||||
res = IGroup;
|
||||
}
|
||||
}
|
||||
|
||||
SetShapeResult ( start, res );
|
||||
|
||||
|
@@ -647,17 +647,23 @@ gp_Pnt2d Bisector_BisecCC::ValueAndDist (const Standard_Real U,
|
||||
if (Abs(FInit) < EpsH) {
|
||||
U2 = VInit;
|
||||
}
|
||||
else {
|
||||
math_BissecNewton SolNew (H,VMin - EpsH100,VMax + EpsH100,EpsH,10);
|
||||
if (SolNew.IsDone()) {
|
||||
U2 = SolNew.Root();
|
||||
else
|
||||
{
|
||||
math_BissecNewton aNewSolution(EpsH);
|
||||
aNewSolution.Perform(H, VMin - EpsH100, VMax + EpsH100, 10);
|
||||
|
||||
if (aNewSolution.IsDone())
|
||||
{
|
||||
U2 = aNewSolution.Root();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
math_FunctionRoot SolRoot (H,VInit,EpsH,VMin - EpsH100,VMax + EpsH100);
|
||||
if (SolRoot.IsDone()) {
|
||||
|
||||
if (SolRoot.IsDone())
|
||||
U2 = SolRoot.Root();
|
||||
}
|
||||
else { Valid = Standard_False;}
|
||||
else
|
||||
Valid = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -346,12 +346,14 @@ void Bisector_Inter::NeighbourPerform(const Handle(Bisector_BisecCC)& Bis1,
|
||||
if (UMin - Eps > UMax + Eps) {return;}
|
||||
|
||||
// Solution F = 0 to find the common point.
|
||||
Bisector_FunctionInter Fint (Guide,Bis1,BisTemp);
|
||||
math_BissecNewton Sol (Fint,UMin,UMax,Tol,20);
|
||||
if (Sol.IsDone()) {
|
||||
USol = Sol.Root();
|
||||
}
|
||||
else { return; }
|
||||
Bisector_FunctionInter Fint(Guide,Bis1,BisTemp);
|
||||
|
||||
math_BissecNewton aSolution(Tol);
|
||||
aSolution.Perform(Fint, UMin, UMax, 20);
|
||||
|
||||
if (aSolution.IsDone())
|
||||
USol = aSolution.Root();
|
||||
else return;
|
||||
|
||||
PSol = BisTemp ->ValueAndDist(USol,U1,U2,Dist);
|
||||
|
||||
|
@@ -160,6 +160,11 @@ is
|
||||
PC1,PC2 : Real from Standard);
|
||||
---Purpose: Creates a point on two curves.
|
||||
|
||||
SetParameter(me : in out;
|
||||
Param : Real from Standard);
|
||||
---C++: inline
|
||||
---Purpose: Changes parameter on existing point
|
||||
|
||||
Parameter(me)
|
||||
returns Real from Standard
|
||||
---C++: inline
|
||||
|
@@ -15,6 +15,11 @@
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
|
||||
inline void Blend_Point::SetParameter(const Standard_Real Param)
|
||||
{
|
||||
prm = Param;
|
||||
}
|
||||
|
||||
inline const gp_Pnt& Blend_Point::PointOnS1 () const
|
||||
{
|
||||
return pt1;
|
||||
|
@@ -54,8 +54,9 @@ raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create(Surf1,Surf2: TheSurface; Domain1,Domain2: TheTopolTool)
|
||||
|
||||
Create(Surf1,Surf2: TheSurface;
|
||||
Domain1,Domain2: TheTopolTool;
|
||||
HGuide : HElSpine from ChFiDS)
|
||||
returns Walking from Blend;
|
||||
|
||||
|
||||
@@ -67,7 +68,6 @@ is
|
||||
|
||||
Perform(me: in out; F : in out Function from Blend;
|
||||
FInv : in out FuncInv from Blend;
|
||||
HGuide : HElSpine from ChFiDS;
|
||||
Pdep : Real from Standard;
|
||||
Pmax : Real from Standard;
|
||||
MaxStep : Real from Standard;
|
||||
@@ -166,11 +166,22 @@ is
|
||||
|
||||
InternalPerform (me: in out;F : in out Function from Blend;
|
||||
FInv : in out FuncInv from Blend;
|
||||
HGuide : HElSpine from ChFiDS;
|
||||
Bound : Real from Standard)
|
||||
|
||||
is static private;
|
||||
|
||||
CorrectExtremityOnOneRst (me; IndexOfRst : Integer from Standard;
|
||||
theU : Real from Standard;
|
||||
theV : Real from Standard;
|
||||
theParam : Real from Standard;
|
||||
thePntOnRst : Pnt from gp;
|
||||
NewU : out Real from Standard;
|
||||
NewV : out Real from Standard;
|
||||
NewPoint : out Pnt from gp;
|
||||
NewParam : out Real from Standard)
|
||||
returns Boolean from Standard
|
||||
is static private;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
|
||||
@@ -266,6 +277,10 @@ fields
|
||||
domain2 : TheTopolTool;
|
||||
recdomain1 : TheTopolTool;
|
||||
recdomain2 : TheTopolTool;
|
||||
hguide : HElSpine from ChFiDS;
|
||||
ToCorrectOnRst1 : Boolean from Standard;
|
||||
ToCorrectOnRst2 : Boolean from Standard;
|
||||
CorrectedParam : Real from Standard;
|
||||
|
||||
tolesp : Real from Standard;
|
||||
tolgui : Real from Standard;
|
||||
|
@@ -15,8 +15,10 @@
|
||||
Blend_Walking::Blend_Walking(const TheSurface& Surf1,
|
||||
const TheSurface& Surf2,
|
||||
const Handle(TheTopolTool)& Domain1,
|
||||
const Handle(TheTopolTool)& Domain2):
|
||||
const Handle(TheTopolTool)& Domain2,
|
||||
const Handle(ChFiDS_HElSpine)& HGuide):
|
||||
sol(1,4),surf1(Surf1),surf2(Surf2),
|
||||
ToCorrectOnRst1(Standard_False),ToCorrectOnRst2(Standard_False),
|
||||
done(Standard_False),
|
||||
clasonS1(Standard_True),clasonS2(Standard_True),
|
||||
check2d(Standard_True),check(Standard_True),
|
||||
@@ -26,7 +28,8 @@ Blend_Walking::Blend_Walking(const TheSurface& Surf1,
|
||||
domain1 = Domain1;
|
||||
domain2 = Domain2;
|
||||
recdomain1 = Domain1;
|
||||
recdomain2 = Domain2;
|
||||
recdomain2 = Domain2;
|
||||
hguide = HGuide;
|
||||
}
|
||||
|
||||
void Blend_Walking::SetDomainsToRecadre(const Handle(TheTopolTool)& Domain1,
|
||||
@@ -56,7 +59,6 @@ void Blend_Walking::AddSingularPoint(const Blend_Point& P)
|
||||
|
||||
void Blend_Walking::Perform(Blend_Function& Func,
|
||||
Blend_FuncInv& FuncInv,
|
||||
const Handle(ChFiDS_HElSpine)& HGuide,
|
||||
const Standard_Real Pdep,
|
||||
const Standard_Real Pmax,
|
||||
const Standard_Real MaxStep,
|
||||
@@ -135,6 +137,9 @@ void Blend_Walking::Perform(Blend_Function& Func,
|
||||
nbcomputedsection = 1;
|
||||
#endif
|
||||
// Mettre a jour la ligne.
|
||||
//Correct first parameter if needed
|
||||
if (ToCorrectOnRst1 || ToCorrectOnRst2)
|
||||
previousP.SetParameter(CorrectedParam);
|
||||
line->Append(previousP);
|
||||
|
||||
if(doextremities){
|
||||
@@ -155,7 +160,7 @@ void Blend_Walking::Perform(Blend_Function& Func,
|
||||
}
|
||||
}
|
||||
|
||||
InternalPerform(Func,FuncInv,HGuide,Pmax);
|
||||
InternalPerform(Func,FuncInv,Pmax);
|
||||
|
||||
done = Standard_True;
|
||||
}
|
||||
@@ -255,6 +260,8 @@ Standard_Boolean Blend_Walking::PerformFirstSection (Blend_Function& Func,
|
||||
Standard_Boolean Isvtx1 = Standard_False, Isvtx2 = Standard_False;
|
||||
TheVertex Vtx1, Vtx2;
|
||||
gp_Pnt2d p2d;
|
||||
Standard_Real CorrectedU = 0., CorrectedV = 0.;
|
||||
gp_Pnt CorrectedPnt;
|
||||
|
||||
Func.GetTolerance(tolerance, tolesp);
|
||||
Func.GetBounds(infbound, supbound);
|
||||
@@ -358,6 +365,10 @@ Standard_Boolean Blend_Walking::PerformFirstSection (Blend_Function& Func,
|
||||
ParSol(2) = p2d.Y();
|
||||
ParSol(3) = solrst1(3);
|
||||
ParSol(4) = solrst1(4);
|
||||
gp_Pnt thePntOnRst = TheSurfaceTool::Value(surf1,ParSol(1),ParSol(2));
|
||||
if (CorrectExtremityOnOneRst(1, ParSol(3), ParSol(4), param, thePntOnRst,
|
||||
CorrectedU,CorrectedV,CorrectedPnt,CorrectedParam))
|
||||
ToCorrectOnRst1 = Standard_True;
|
||||
}
|
||||
else
|
||||
{ //if (recad2) {
|
||||
@@ -377,6 +388,10 @@ Standard_Boolean Blend_Walking::PerformFirstSection (Blend_Function& Func,
|
||||
ParSol(2) = solrst2(4);
|
||||
ParSol(3) = p2d.X();
|
||||
ParSol(4) = p2d.Y();
|
||||
gp_Pnt thePntOnRst = TheSurfaceTool::Value(surf2,ParSol(3),ParSol(4));
|
||||
if (CorrectExtremityOnOneRst(2, ParSol(1), ParSol(2), param, thePntOnRst,
|
||||
CorrectedU,CorrectedV,CorrectedPnt,CorrectedParam))
|
||||
ToCorrectOnRst2 = Standard_True;
|
||||
}
|
||||
|
||||
Psol = param;
|
||||
@@ -387,26 +402,32 @@ Standard_Boolean Blend_Walking::PerformFirstSection (Blend_Function& Func,
|
||||
{
|
||||
case Blend_OnRst1:
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Blend_GettraceDRAWSECT())
|
||||
{
|
||||
Drawsect(surf1, surf2, sol, param, Func);
|
||||
}
|
||||
#endif
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Blend_GettraceDRAWSECT())
|
||||
{
|
||||
Drawsect(surf1, surf2, sol, param, Func);
|
||||
}
|
||||
#endif
|
||||
MakeExtremity(Ext1, Standard_True, Index1, solrst1(1), Isvtx1, Vtx1);
|
||||
Ext2.SetValue(previousP.PointOnS2(), sol(3), sol(4), tolesp);
|
||||
if (ToCorrectOnRst1)
|
||||
Ext2.SetValue(CorrectedPnt, CorrectedU, CorrectedV, tolesp);
|
||||
else
|
||||
Ext2.SetValue(previousP.PointOnS2(), sol(3), sol(4), tolesp);
|
||||
}
|
||||
break;
|
||||
|
||||
case Blend_OnRst2:
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Blend_GettraceDRAWSECT())
|
||||
{
|
||||
Drawsect(surf1, surf2, sol, param, Func);
|
||||
}
|
||||
#endif
|
||||
Ext1.SetValue(previousP.PointOnS1(), sol(1), sol(2), tolesp);
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Blend_GettraceDRAWSECT())
|
||||
{
|
||||
Drawsect(surf1, surf2, sol, param, Func);
|
||||
}
|
||||
#endif
|
||||
if (ToCorrectOnRst2)
|
||||
Ext1.SetValue(CorrectedPnt, CorrectedU, CorrectedV, tolesp);
|
||||
else
|
||||
Ext1.SetValue(previousP.PointOnS1(), sol(1), sol(2), tolesp);
|
||||
MakeExtremity(Ext2, Standard_False, Index2, solrst2(1), Isvtx2, Vtx2);
|
||||
}
|
||||
break;
|
||||
@@ -462,8 +483,7 @@ Standard_Boolean Blend_Walking::Continu(Blend_Function& Func,
|
||||
previousP.ParametersOnS1(sol(1),sol(2));
|
||||
previousP.ParametersOnS2(sol(3),sol(4));
|
||||
|
||||
Handle(ChFiDS_HElSpine) anHGuide;
|
||||
InternalPerform(Func,FuncInv,anHGuide,P);
|
||||
InternalPerform(Func,FuncInv,P);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -504,8 +524,7 @@ Standard_Boolean Blend_Walking::Continu(Blend_Function& Func,
|
||||
if(OnS1) clasonS1 = Standard_False;
|
||||
else clasonS2 = Standard_False;
|
||||
|
||||
Handle(ChFiDS_HElSpine) anHGuide;
|
||||
InternalPerform(Func,FuncInv,anHGuide,P);
|
||||
InternalPerform(Func,FuncInv,P);
|
||||
|
||||
clasonS1 = Standard_True;
|
||||
clasonS2 = Standard_True;
|
||||
@@ -551,8 +570,7 @@ Standard_Boolean Blend_Walking::Complete(Blend_Function& Func,
|
||||
previousP.ParametersOnS1(sol(1),sol(2));
|
||||
previousP.ParametersOnS2(sol(3),sol(4));
|
||||
|
||||
Handle(ChFiDS_HElSpine) anHGuide;
|
||||
InternalPerform(Func,FuncInv,anHGuide,Pmin);
|
||||
InternalPerform(Func,FuncInv,Pmin);
|
||||
|
||||
iscomplete = Standard_True;
|
||||
return Standard_True;
|
||||
|
@@ -13,6 +13,29 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <gce_MakePln.hxx>
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
#include <Extrema_ExtPC.hxx>
|
||||
|
||||
static void RecadreIfPeriodic(Standard_Real& NewU,
|
||||
Standard_Real& NewV,
|
||||
const Standard_Real OldU,
|
||||
const Standard_Real OldV,
|
||||
const Standard_Real UPeriod,
|
||||
const Standard_Real VPeriod)
|
||||
{
|
||||
if (UPeriod > 0.)
|
||||
{
|
||||
Standard_Real sign = (NewU < OldU)? 1 : -1;
|
||||
while (Abs(NewU - OldU) > UPeriod/2)
|
||||
NewU += sign * UPeriod;
|
||||
}
|
||||
if (VPeriod > 0.)
|
||||
{
|
||||
Standard_Real sign = (NewV < OldV)? 1 : -1;
|
||||
while (Abs(NewV - OldV) > VPeriod/2)
|
||||
NewV += sign * VPeriod;
|
||||
}
|
||||
}
|
||||
|
||||
static void evalpinit(math_Vector& parinit,
|
||||
const Blend_Point& previousP,
|
||||
@@ -67,7 +90,6 @@ static void evalpinit(math_Vector& parinit,
|
||||
|
||||
void Blend_Walking::InternalPerform(Blend_Function& Func,
|
||||
Blend_FuncInv& FuncInv,
|
||||
const Handle(ChFiDS_HElSpine)& HGuide,
|
||||
const Standard_Real Bound)
|
||||
{
|
||||
|
||||
@@ -263,55 +285,62 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
|
||||
sol(3) = p2d.X();
|
||||
sol(4) = p2d.Y();
|
||||
Pnt2 = TheSurfaceTool::Value(surf2,sol(3),sol(4));
|
||||
if (!HGuide.IsNull())
|
||||
const Standard_Real TolProd = 1.e-5;
|
||||
Standard_Real SavedParams [2];
|
||||
Standard_Boolean SameDirs [2] = {Standard_False, Standard_False};
|
||||
ChFiDS_ElSpine& theElSpine = hguide->ChangeCurve();
|
||||
SavedParams[0] = theElSpine.GetSavedFirstParameter();
|
||||
SavedParams[1] = theElSpine.GetSavedLastParameter();
|
||||
for (Standard_Integer ind = 0; ind < 2; ind++)
|
||||
{
|
||||
const Standard_Real TolProd = 1.e-5;
|
||||
Standard_Real SavedParams [2];
|
||||
Standard_Boolean SameDirs [2] = {Standard_False, Standard_False};
|
||||
ChFiDS_ElSpine& theElSpine = HGuide->ChangeCurve();
|
||||
SavedParams[0] = theElSpine.GetSavedFirstParameter();
|
||||
SavedParams[1] = theElSpine.GetSavedLastParameter();
|
||||
for (Standard_Integer ind = 0; ind < 2; ind++)
|
||||
if (!Precision::IsInfinite(SavedParams[ind]))
|
||||
{
|
||||
if (!Precision::IsInfinite(SavedParams[ind]))
|
||||
{
|
||||
//Check the original first and last parameters of guide curve
|
||||
//for equality to found parameter <param>:
|
||||
//check equality of tangent to guide curve and
|
||||
//normal to plane built on 3 points:
|
||||
//point on guide curve and points on restrictions of adjacent
|
||||
//surfaces.
|
||||
gp_Pnt Pnt0;
|
||||
gp_Vec Dir0;
|
||||
HGuide->D1(SavedParams[ind], Pnt0, Dir0);
|
||||
Standard_Real Length = Dir0.Magnitude();
|
||||
if (Length <= gp::Resolution())
|
||||
continue;
|
||||
Dir0 /= Length;
|
||||
gce_MakePln PlaneBuilder(Pnt0, Pnt1, Pnt2);
|
||||
if (!PlaneBuilder.IsDone())
|
||||
continue;
|
||||
gp_Pln thePlane = PlaneBuilder.Value();
|
||||
gp_Dir DirPlane = thePlane.Axis().Direction();
|
||||
gp_Vec theProd = Dir0 ^ DirPlane;
|
||||
Standard_Real ProdMod = theProd.Magnitude();
|
||||
if (ProdMod <= TolProd)
|
||||
SameDirs[ind] = Standard_True;
|
||||
}
|
||||
//Check the original first and last parameters of guide curve
|
||||
//for equality to found parameter <param>:
|
||||
//check equality of tangent to guide curve and
|
||||
//normal to plane built on 3 points:
|
||||
//point on guide curve and points on restrictions of adjacent
|
||||
//surfaces.
|
||||
gp_Pnt Pnt0;
|
||||
gp_Vec Dir0;
|
||||
hguide->D1(SavedParams[ind], Pnt0, Dir0);
|
||||
Standard_Real Length = Dir0.Magnitude();
|
||||
if (Length <= gp::Resolution())
|
||||
continue;
|
||||
Dir0 /= Length;
|
||||
gce_MakePln PlaneBuilder(Pnt0, Pnt1, Pnt2);
|
||||
if (!PlaneBuilder.IsDone())
|
||||
continue;
|
||||
gp_Pln thePlane = PlaneBuilder.Value();
|
||||
gp_Dir DirPlane = thePlane.Axis().Direction();
|
||||
gp_Vec theProd = Dir0 ^ DirPlane;
|
||||
Standard_Real ProdMod = theProd.Magnitude();
|
||||
if (ProdMod <= TolProd)
|
||||
SameDirs[ind] = Standard_True;
|
||||
}
|
||||
Standard_Real theParam = Precision::Infinite();
|
||||
//Choose the closest parameter
|
||||
if (SameDirs[0] && SameDirs[1])
|
||||
theParam = (Abs(param - SavedParams[0]) < Abs(param - SavedParams[1]))?
|
||||
SavedParams[0] : SavedParams[1];
|
||||
else if (SameDirs[0])
|
||||
theParam = SavedParams[0];
|
||||
else if (SameDirs[1])
|
||||
theParam = SavedParams[1];
|
||||
|
||||
if (!Precision::IsInfinite(theParam))
|
||||
param = theParam;
|
||||
}
|
||||
Standard_Real theParam = Precision::Infinite();
|
||||
//Choose the closest parameter
|
||||
if (SameDirs[0] && SameDirs[1])
|
||||
theParam = (Abs(param - SavedParams[0]) < Abs(param - SavedParams[1]))?
|
||||
SavedParams[0] : SavedParams[1];
|
||||
else if (SameDirs[0])
|
||||
theParam = SavedParams[0];
|
||||
else if (SameDirs[1])
|
||||
theParam = SavedParams[1];
|
||||
|
||||
Standard_Real NewU, NewV, NewParam;
|
||||
gp_Pnt NewPnt;
|
||||
Standard_Boolean Corrected = CorrectExtremityOnOneRst(1, sol(3), sol(4), param, Pnt1,
|
||||
NewU, NewV, NewPnt, NewParam);
|
||||
if (Corrected)
|
||||
{
|
||||
if (Abs(param - NewParam) < Abs(param - theParam))
|
||||
theParam = NewParam;
|
||||
}
|
||||
|
||||
if (!Precision::IsInfinite(theParam))
|
||||
param = theParam;
|
||||
}
|
||||
else if (recad1) {
|
||||
// sol sur 1
|
||||
@@ -328,6 +357,17 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
|
||||
sol(2) = p2d.Y();
|
||||
sol(3) = solrst1(3);
|
||||
sol(4) = solrst1(4);
|
||||
gp_Pnt thePntOnRst = TheSurfaceTool::Value(surf1,sol(1),sol(2));
|
||||
Standard_Real NewU, NewV, NewParam;
|
||||
gp_Pnt NewPnt;
|
||||
Standard_Boolean Corrected = CorrectExtremityOnOneRst(1, sol(3), sol(4), param, thePntOnRst,
|
||||
NewU, NewV, NewPnt, NewParam);
|
||||
if (Corrected)
|
||||
{
|
||||
param = NewParam;
|
||||
sol(3) = NewU;
|
||||
sol(4) = NewV;
|
||||
}
|
||||
}
|
||||
else if (recad2) {
|
||||
//sol sur 2
|
||||
@@ -345,6 +385,17 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
|
||||
sol(2) = solrst2(4);
|
||||
sol(3) = p2d.X();
|
||||
sol(4) = p2d.Y();
|
||||
gp_Pnt thePntOnRst = TheSurfaceTool::Value(surf2,sol(3),sol(4));
|
||||
Standard_Real NewU, NewV, NewParam;
|
||||
gp_Pnt NewPnt;
|
||||
Standard_Boolean Corrected = CorrectExtremityOnOneRst(2, sol(1), sol(2), param, thePntOnRst,
|
||||
NewU, NewV, NewPnt, NewParam);
|
||||
if (Corrected)
|
||||
{
|
||||
param = NewParam;
|
||||
sol(1) = NewU;
|
||||
sol(2) = NewV;
|
||||
}
|
||||
}
|
||||
else {
|
||||
State = Blend_OK;
|
||||
@@ -610,3 +661,146 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Blend_Walking::CorrectExtremityOnOneRst(const Standard_Integer IndexOfRst,
|
||||
const Standard_Real theU,
|
||||
const Standard_Real theV,
|
||||
const Standard_Real theParam,
|
||||
const gp_Pnt& thePntOnRst,
|
||||
Standard_Real& NewU,
|
||||
Standard_Real& NewV,
|
||||
gp_Pnt& NewPoint,
|
||||
Standard_Real& NewParam) const
|
||||
{
|
||||
const Standard_Real TolAng = 0.001; //bug OCC25701
|
||||
|
||||
ChFiDS_ElSpine& theElSpine = hguide->ChangeCurve();
|
||||
if (theElSpine.NbVertices() == 0)
|
||||
return Standard_False;
|
||||
|
||||
Handle(TheTopolTool) DomainOfRst = (IndexOfRst == 1)? recdomain1 : recdomain2;
|
||||
TheSurface SurfOfRst = (IndexOfRst == 1)? surf1 : surf2;
|
||||
TheSurface AnotherSurf = (IndexOfRst == 1)? surf2 : surf1;
|
||||
|
||||
//Correct point on surface 2
|
||||
//First we find right <param>
|
||||
Standard_Real Ends [2];
|
||||
Ends[0] = TheArcTool::FirstParameter(DomainOfRst->Value());
|
||||
Ends[1] = TheArcTool::LastParameter(DomainOfRst->Value());
|
||||
Standard_Real GlobalMinSqDist = Precision::Infinite();
|
||||
Standard_Real ParamOnGuide = 0;
|
||||
gp_Pnt PointOnGuide;
|
||||
for (Standard_Integer k = 0; k < 2; k++)
|
||||
{
|
||||
gp_Pnt2d P2dOnEnd = TheArcTool::Value(DomainOfRst->Value(), Ends[k]);
|
||||
gp_Pnt PntOnEnd = TheSurfaceTool::Value(SurfOfRst, P2dOnEnd.X(), P2dOnEnd.Y());
|
||||
Extrema_ExtPC projoncurv(PntOnEnd, theElSpine);
|
||||
if (!projoncurv.IsDone())
|
||||
continue;
|
||||
Standard_Real MinSqDist = Precision::Infinite();
|
||||
Standard_Integer imin = 0;
|
||||
for (Standard_Integer ind = 1; ind <= projoncurv.NbExt(); ind++)
|
||||
{
|
||||
Standard_Real aSqDist = projoncurv.SquareDistance(ind);
|
||||
if (aSqDist < MinSqDist)
|
||||
{
|
||||
MinSqDist = aSqDist;
|
||||
imin = ind;
|
||||
}
|
||||
}
|
||||
if (MinSqDist < GlobalMinSqDist)
|
||||
{
|
||||
GlobalMinSqDist = MinSqDist;
|
||||
ParamOnGuide = projoncurv.Point(imin).Parameter();
|
||||
PointOnGuide = projoncurv.Point(imin).Value();
|
||||
}
|
||||
}
|
||||
NewParam = ParamOnGuide;
|
||||
if (hguide->IsPeriodic())
|
||||
{
|
||||
Standard_Real Period = hguide->Period();
|
||||
Standard_Real sign = (NewParam < theParam)? 1 : -1;
|
||||
while (Abs(NewParam - theParam) > Period/2)
|
||||
NewParam += sign *Period;
|
||||
}
|
||||
|
||||
//Second we find right point and tangent on guide
|
||||
GlobalMinSqDist = Precision::Infinite();
|
||||
gp_Ax1 theAx1;
|
||||
for (Standard_Integer ind = 1; ind <= theElSpine.NbVertices(); ind++)
|
||||
{
|
||||
const gp_Ax1& anAx1 = theElSpine.VertexWithTangent(ind);
|
||||
gp_Pnt aPnt = anAx1.Location();
|
||||
Standard_Real aSqDist = PointOnGuide.SquareDistance(aPnt);
|
||||
if (aSqDist < GlobalMinSqDist)
|
||||
{
|
||||
GlobalMinSqDist = aSqDist;
|
||||
theAx1 = anAx1;
|
||||
}
|
||||
}
|
||||
const gp_Pnt& Pnt0 = theAx1.Location();
|
||||
const gp_Dir& Dir0 = theAx1.Direction();
|
||||
//Check new point: is it real solution?
|
||||
gp_Pnt OldPonGuide = hguide->Value(theParam);
|
||||
gp_Pnt PntOnSurf2 = TheSurfaceTool::Value(AnotherSurf,theU,theV); //old point
|
||||
gce_MakePln PlaneBuilder(thePntOnRst, OldPonGuide, PntOnSurf2);
|
||||
if (!PlaneBuilder.IsDone())
|
||||
return Standard_False;
|
||||
gp_Pln OldPlane = PlaneBuilder.Value();
|
||||
gp_Dir OldDir = OldPlane.Axis().Direction();
|
||||
Standard_Real Angle = OldDir.Angle(Dir0);
|
||||
if (Angle > M_PI/2)
|
||||
Angle = M_PI - Angle;
|
||||
if (Angle > TolAng)
|
||||
return Standard_False;
|
||||
///////////////////////////////////////
|
||||
//Project the point(theU,theV) on the plane(Pnt0,Dir0)
|
||||
gp_Vec aVec(Pnt0, PntOnSurf2);
|
||||
gp_Vec aTranslation( (aVec.XYZ() * Dir0.XYZ()) * Dir0.XYZ() );
|
||||
gp_Pnt PntOnPlane = PntOnSurf2.Translated(-aTranslation);
|
||||
|
||||
//Check new point again: does point on restriction belong to the plane?
|
||||
PlaneBuilder = gce_MakePln(thePntOnRst, Pnt0, PntOnPlane);
|
||||
if (!PlaneBuilder.IsDone())
|
||||
return Standard_False;
|
||||
gp_Pln NewPlane = PlaneBuilder.Value();
|
||||
const gp_Dir& DirOfNewPlane = NewPlane.Axis().Direction();
|
||||
Angle = Dir0.Angle(DirOfNewPlane);
|
||||
if (Angle > M_PI/2)
|
||||
Angle = M_PI - Angle;
|
||||
if (Angle > TolAng)
|
||||
return Standard_False;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Project the point <PntOnPlane> on the surface 2
|
||||
Extrema_ExtPS projonsurf(PntOnPlane, AnotherSurf->Surface(),
|
||||
Precision::PConfusion(), Precision::PConfusion(),
|
||||
Extrema_ExtFlag_MIN);
|
||||
if (projonsurf.IsDone())
|
||||
{
|
||||
Standard_Real MinSqDist = Precision::Infinite();
|
||||
Standard_Integer imin = 0;
|
||||
for (Standard_Integer ind = 1; ind <= projonsurf.NbExt(); ind++)
|
||||
{
|
||||
Standard_Real aSqDist = projonsurf.SquareDistance(ind);
|
||||
if (aSqDist < MinSqDist)
|
||||
{
|
||||
MinSqDist = aSqDist;
|
||||
imin = ind;
|
||||
}
|
||||
}
|
||||
if (imin)
|
||||
{
|
||||
Extrema_POnSurf NewPOnSurf2 = projonsurf.Point(imin);
|
||||
NewPoint = NewPOnSurf2.Value();
|
||||
NewPOnSurf2.Parameter(NewU, NewV);
|
||||
Standard_Real uperiod = (AnotherSurf->IsUPeriodic())? AnotherSurf->UPeriod() : 0.;
|
||||
Standard_Real vperiod = (AnotherSurf->IsVPeriodic())? AnotherSurf->VPeriod() : 0.;
|
||||
RecadreIfPeriodic(NewU, NewV, theU, theV,
|
||||
uperiod, vperiod);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -3954,6 +3954,16 @@ Standard_EXPORT
|
||||
const BRepAdaptor_Curve& edc = Spine->CurrentElementarySpine(IF);
|
||||
tolpared = edc.Resolution(tol);
|
||||
Cv = BRep_Tool::Curve(E, First, Last);
|
||||
//Add vertex with tangent
|
||||
if (ES.IsPeriodic())
|
||||
{
|
||||
Standard_Real ParForElSpine = (E.Orientation() == TopAbs_FORWARD)? First : Last;
|
||||
gp_Pnt PntForElSpine;
|
||||
gp_Vec DirForElSpine;
|
||||
Cv->D1(ParForElSpine, PntForElSpine, DirForElSpine);
|
||||
ES.AddVertexWithTangent(gp_Ax1(PntForElSpine, DirForElSpine));
|
||||
}
|
||||
/////////////////////////
|
||||
urefdeb = Spine->FirstParameter(IF);
|
||||
checkdeb = (nwf > urefdeb);
|
||||
if(checkdeb) {
|
||||
@@ -4080,6 +4090,13 @@ Standard_EXPORT
|
||||
}
|
||||
//
|
||||
Cv = BRep_Tool::Curve(E, First, Last);
|
||||
//Add vertex with tangent
|
||||
Standard_Real ParForElSpine = (E.Orientation() == TopAbs_FORWARD)? First : Last;
|
||||
gp_Pnt PntForElSpine;
|
||||
gp_Vec DirForElSpine;
|
||||
Cv->D1(ParForElSpine, PntForElSpine, DirForElSpine);
|
||||
ES.AddVertexWithTangent(gp_Ax1(PntForElSpine, DirForElSpine));
|
||||
/////////////////////////
|
||||
if(IEdge == IL) {
|
||||
Standard_Real ureffin = Spine->LastParameter(iloc);
|
||||
Standard_Boolean checkfin = (nwl < ureffin);
|
||||
|
@@ -684,6 +684,24 @@ Standard_Boolean ChFi3d_Builder::StoreData(Handle(ChFiDS_SurfData)& Data,
|
||||
if (length2 > Precision::Confusion())
|
||||
GeomLib::ExtendSurfByLength(Surf,length2,1,Standard_False,Standard_True);
|
||||
|
||||
//Correction of surface on extremities
|
||||
if (length1 <= Precision::Confusion())
|
||||
{
|
||||
gp_Pnt P11, P21;
|
||||
P11 = lin->StartPointOnFirst().Value();
|
||||
P21 = lin->StartPointOnSecond().Value();
|
||||
Surf->SetPole(1, 1, P11);
|
||||
Surf->SetPole(Surf->NbUPoles(), 1, P21);
|
||||
}
|
||||
if (length2 <= Precision::Confusion())
|
||||
{
|
||||
gp_Pnt P12, P22;
|
||||
P12 = lin->EndPointOnFirst().Value();
|
||||
P22 = lin->EndPointOnSecond().Value();
|
||||
Surf->SetPole(1, Surf->NbVPoles(), P12);
|
||||
Surf->SetPole(Surf->NbUPoles(), Surf->NbVPoles(), P22);
|
||||
}
|
||||
|
||||
Data->ChangeSurf(DStr.AddSurface(TopOpeBRepDS_Surface(Surf,tolget3d)));
|
||||
|
||||
#ifdef DRAW
|
||||
@@ -1475,7 +1493,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
|
||||
Standard_Real TolGuide=tolguide, TolEsp = tolesp;
|
||||
Standard_Integer nbptmin = 4;
|
||||
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2);
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
|
||||
|
||||
//Start of removal, 2D path controls
|
||||
//that qui s'accomodent mal des surfaces a parametrages non homogenes
|
||||
@@ -1573,7 +1591,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
|
||||
if (5*TolGuide > MS) TolGuide = MS/5;
|
||||
if (5*TolEsp > MS) TolEsp = MS/5;
|
||||
}
|
||||
TheWalk.Perform(Func,FInv,HGuide,NewFirst,Target,MS,TolGuide,
|
||||
TheWalk.Perform(Func,FInv,NewFirst,Target,MS,TolGuide,
|
||||
ParSol,TolEsp,Fleche,Appro);
|
||||
if (!TheWalk.IsDone()) {
|
||||
#ifdef OCCT_DEBUG
|
||||
@@ -2068,7 +2086,7 @@ Standard_Boolean ChFi3d_Builder::SimulData
|
||||
const Standard_Boolean RecOnS1,
|
||||
const Standard_Boolean RecOnS2)
|
||||
{
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2);
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
|
||||
TheWalk.Check2d(Standard_False);
|
||||
|
||||
Standard_Real MS = MaxStep;
|
||||
@@ -2113,7 +2131,7 @@ Standard_Boolean ChFi3d_Builder::SimulData
|
||||
if (5*TolEsp > MS) TolEsp = MS/5;
|
||||
}
|
||||
|
||||
TheWalk.Perform(Func,FInv,HGuide,NewFirst,Target,MS,TolGuide,
|
||||
TheWalk.Perform(Func,FInv,NewFirst,Target,MS,TolGuide,
|
||||
ParSol,TolEsp,Fleche,Appro);
|
||||
|
||||
if (!TheWalk.IsDone()) {
|
||||
|
@@ -1289,7 +1289,7 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
|
||||
|
||||
BRepBlend_Chamfer Func(S1,S2,HGuide);
|
||||
Func.Set(dis,dis,Choix);
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2);
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
|
||||
|
||||
//calculate an approximate starting solution
|
||||
gp_Vec TgF, TgL, tmp1, tmp2, d1gui;
|
||||
@@ -1346,7 +1346,7 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
|
||||
|
||||
BRepBlend_Chamfer Func(S1,S2,HGuide);
|
||||
Func.Set(dis1,dis2,Choix);
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2);
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
|
||||
|
||||
//calculate an approximate starting solution
|
||||
gp_Vec TgF, TgL, tmp1, tmp2, d1gui;
|
||||
@@ -1407,7 +1407,7 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
|
||||
if (disonF1) {
|
||||
BRepBlend_ChAsym Func(S1,S2,HGuide);
|
||||
Func.Set(dis1, angle, Ch);
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2);
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
|
||||
|
||||
//calculate an approximate starting solution
|
||||
gp_Vec TgF, TgL, tmp1, tmp2, d1gui;
|
||||
@@ -1469,7 +1469,7 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
|
||||
Standard_Real Rtemp;
|
||||
BRepBlend_ChAsym Func(S2,S1,HGuide);
|
||||
Func.Set(dis1, angle, Ch);
|
||||
BRepBlend_Walking TheWalk(S2,S1,I2,I1);
|
||||
BRepBlend_Walking TheWalk(S2,S1,I2,I1,HGuide);
|
||||
|
||||
//calculate an approximate starting solution
|
||||
gp_Vec TgF, TgL, tmp1, tmp2, d1gui;
|
||||
|
@@ -1198,7 +1198,7 @@ Standard_Boolean ChFi3d_FilBuilder::PerformFirstSection
|
||||
BRepBlend_ConstRad Func(S1,S2,HGuide);
|
||||
Func.Set(fsp->Radius(),Choix);
|
||||
Func.Set(myShape);
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2);
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
|
||||
return TheWalk.PerformFirstSection(Func,Par,SolDep,
|
||||
tolesp,TolGuide,Pos1,Pos2);
|
||||
}
|
||||
@@ -1206,7 +1206,7 @@ Standard_Boolean ChFi3d_FilBuilder::PerformFirstSection
|
||||
BRepBlend_EvolRad Func(S1,S2,HGuide,fsp->Law(HGuide));
|
||||
Func.Set(Choix);
|
||||
Func.Set(myShape);
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2);
|
||||
BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
|
||||
return TheWalk.PerformFirstSection(Func,Par,SolDep,
|
||||
tolesp,TolGuide,Pos1,Pos2);
|
||||
}
|
||||
|
@@ -26,9 +26,11 @@ uses
|
||||
Elips from gp,
|
||||
Hypr from gp,
|
||||
Parab from gp,
|
||||
Ax1 from gp,
|
||||
BezierCurve from Geom,
|
||||
BSplineCurve from Geom,
|
||||
Array1OfReal from TColStd,
|
||||
SequenceOfAx1 from TColgp,
|
||||
SurfData from ChFiDS,
|
||||
Shape from GeomAbs,
|
||||
CurveType from GeomAbs,
|
||||
@@ -116,9 +118,17 @@ is
|
||||
|
||||
LastPointAndTgt(me; P : out Pnt from gp; T : out Vec from gp);
|
||||
|
||||
NbVertices(me) returns Integer from Standard;
|
||||
|
||||
VertexWithTangent(me; Index : Integer from Standard)
|
||||
returns Ax1 from gp;
|
||||
---C++: return const &
|
||||
|
||||
SetFirstPointAndTgt(me : in out; P : Pnt from gp; T : Vec from gp);
|
||||
|
||||
SetLastPointAndTgt(me : in out; P : Pnt from gp; T : Vec from gp);
|
||||
|
||||
AddVertexWithTangent(me : in out; anAx1 : Ax1 from gp);
|
||||
|
||||
SetCurve(me : in out; C : Curve from Geom);
|
||||
|
||||
@@ -187,6 +197,7 @@ ptfirst : Pnt from gp;
|
||||
ptlast : Pnt from gp;
|
||||
tgfirst : Vec from gp;
|
||||
tglast : Vec from gp;
|
||||
VerticesWithTangents : SequenceOfAx1 from TColgp;
|
||||
|
||||
previous : SurfData from ChFiDS;
|
||||
next : SurfData from ChFiDS;
|
||||
|
@@ -311,6 +311,16 @@ void ChFiDS_ElSpine::SetLastPointAndTgt(const gp_Pnt& P,
|
||||
tglast = T;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddVertexWithTangent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ChFiDS_ElSpine::AddVertexWithTangent(const gp_Ax1& anAx1)
|
||||
{
|
||||
VerticesWithTangents.Append(anAx1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FirstPointAndTgt
|
||||
//purpose :
|
||||
@@ -335,6 +345,26 @@ void ChFiDS_ElSpine::LastPointAndTgt(gp_Pnt& P,
|
||||
T = tglast;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer ChFiDS_ElSpine::NbVertices() const
|
||||
{
|
||||
return VerticesWithTangents.Length();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : VertexWithTangent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Ax1& ChFiDS_ElSpine::VertexWithTangent(const Standard_Integer Index) const
|
||||
{
|
||||
return VerticesWithTangents(Index);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetCurve
|
||||
//purpose :
|
||||
|
@@ -338,7 +338,8 @@ void Extrema_ExtPExtS::Perform (const gp_Pnt& P)
|
||||
Pe = ProjectPnt (anOrtogSection, myDirection, E),
|
||||
V = gp_Vec(E,Pe) * gp_Vec(myDirection);
|
||||
UV(1) = U; UV(2) = V;
|
||||
math_FunctionSetRoot aFSR (myF,UV,Tol,UVinf,UVsup);
|
||||
math_FunctionSetRoot aFSR (myF, Tol);
|
||||
aFSR.Perform(myF, UV, UVinf, UVsup);
|
||||
// for (Standard_Integer k=1 ; k <= myF.NbExt();
|
||||
Standard_Integer k;
|
||||
for ( k=1 ; k <= myF.NbExt(); k++) {
|
||||
|
@@ -289,7 +289,8 @@ void Extrema_GenExtCS::Perform (const Adaptor3d_Curve& C,
|
||||
math_PSO aPSO(&aFunc, TUVinf, TUVsup, aStep);
|
||||
aPSO.Perform(aParticles, aNbParticles, aValue, TUV);
|
||||
|
||||
math_FunctionSetRoot anA (myF, TUV, Tol, TUVinf, TUVsup, 100, Standard_False);
|
||||
math_FunctionSetRoot anA(myF, Tol);
|
||||
anA.Perform(myF, TUV, TUVinf, TUVsup);
|
||||
|
||||
myDone = Standard_True;
|
||||
}
|
||||
|
@@ -778,8 +778,8 @@ void Extrema_GenExtPS::FindSolution(const gp_Pnt& /*P*/,
|
||||
UVsup(1) = myusup;
|
||||
UVsup(2) = myvsup;
|
||||
|
||||
const Standard_Integer aNbMaxIter = 100;
|
||||
math_FunctionSetRoot S (myF, UV, Tol, UVinf, UVsup, aNbMaxIter);
|
||||
math_FunctionSetRoot S(myF, Tol);
|
||||
S.Perform(myF, UV, UVinf, UVsup);
|
||||
|
||||
myDone = Standard_True;
|
||||
}
|
||||
|
@@ -266,14 +266,16 @@ b- Calcul des minima:
|
||||
UV(3) = U20 + (N2Umin - 1) * PasU2;
|
||||
UV(4) = V20 + (N2Vmin - 1) * PasV2;
|
||||
|
||||
math_FunctionSetRoot SR1 (myF,UV,Tol,UVinf,UVsup);
|
||||
math_FunctionSetRoot SR1(myF, Tol);
|
||||
SR1.Perform(myF, UV, UVinf, UVsup);
|
||||
|
||||
UV(1) = U10 + (N1Umax - 1) * PasU1;
|
||||
UV(2) = V10 + (N1Vmax - 1) * PasV1;
|
||||
UV(3) = U20 + (N2Umax - 1) * PasU2;
|
||||
UV(4) = V20 + (N2Vmax - 1) * PasV2;
|
||||
|
||||
math_FunctionSetRoot SR2 (myF,UV,Tol,UVinf,UVsup);
|
||||
math_FunctionSetRoot SR2(myF, Tol);
|
||||
SR2.Perform(myF, UV, UVinf, UVsup);
|
||||
|
||||
myDone = Standard_True;
|
||||
}
|
||||
|
@@ -82,7 +82,9 @@ Methode:
|
||||
Uusup(1)=Usup;
|
||||
Uusup(2)=Vsup;
|
||||
|
||||
math_FunctionSetRoot S (F,Start,Tol,Uuinf,Uusup);
|
||||
math_FunctionSetRoot S(F, Tol);
|
||||
S.Perform(F, Start, Uuinf, Uusup);
|
||||
|
||||
if (S.IsDone() && F.NbExt() > 0) {
|
||||
mySqDist = F.SquareDistance(1);
|
||||
F.Points(1,myPoint1,myPoint2);
|
||||
|
@@ -89,7 +89,8 @@ void Extrema_GenLocateExtCS::Perform(const Adaptor3d_Curve& C,
|
||||
BSup(2) = Usup;
|
||||
BSup(3) = Vsup;
|
||||
|
||||
math_FunctionSetRoot SR (F, Start,Tol, BInf, BSup);
|
||||
math_FunctionSetRoot SR (F, Tol);
|
||||
SR.Perform(F, Start, BInf, BSup);
|
||||
if (!SR.IsDone())
|
||||
return;
|
||||
|
||||
|
@@ -75,7 +75,8 @@ Method:
|
||||
BSup(1) = Usup;
|
||||
BSup(2) = Vsup;
|
||||
|
||||
math_FunctionSetRoot SR (F, Start,Tol, BInf, BSup);
|
||||
math_FunctionSetRoot SR (F, Tol);
|
||||
SR.Perform(F, Start, BInf, BSup);
|
||||
if (!SR.IsDone())
|
||||
return;
|
||||
|
||||
|
@@ -97,7 +97,8 @@ void Extrema_GenLocateExtSS::Perform(const Adaptor3d_Surface& S1,
|
||||
BSup(3) = Usup2;
|
||||
BSup(4) = Vsup2;
|
||||
|
||||
math_FunctionSetRoot SR (F, Start,Tol, BInf, BSup);
|
||||
math_FunctionSetRoot SR (F, Tol);
|
||||
SR.Perform(F, Start, BInf, BSup);
|
||||
if (!SR.IsDone())
|
||||
return;
|
||||
|
||||
|
@@ -23,50 +23,30 @@ uses
|
||||
MultipleVarFunctionWithHessian from math
|
||||
|
||||
is
|
||||
Create(F: in out MultipleVarFunctionWithHessian;
|
||||
StartingPoint: Vector;
|
||||
SpatialTolerance : Real = 1.0e-7;
|
||||
CriteriumTolerance: Real = 1.0e-2;
|
||||
NbIterations: Integer=40;
|
||||
Convexity: Real=1.0e-6;
|
||||
WithSingularity : Boolean = Standard_True)
|
||||
---Purpose: -- Given the starting point StartingPoint,
|
||||
-- The tolerance required on the solution is given by
|
||||
-- Tolerance.
|
||||
-- Iteration are stopped if
|
||||
-- (!WithSingularity) and H(F(Xi)) is not definite
|
||||
-- positive (if the smaller eigenvalue of H < Convexity)
|
||||
-- or IsConverged() returns True for 2 successives Iterations.
|
||||
-- Warning: Obsolete Constructor (because IsConverged can not be redefined
|
||||
-- with this. )
|
||||
returns Newton;
|
||||
|
||||
Create(F: in out MultipleVarFunctionWithHessian;
|
||||
SpatialTolerance : Real = 1.0e-7;
|
||||
Tolerance: Real=1.0e-7;
|
||||
NbIterations: Integer=40;
|
||||
Convexity: Real=1.0e-6;
|
||||
WithSingularity : Boolean = Standard_True)
|
||||
Create(theFunction: in MultipleVarFunctionWithHessian;
|
||||
theSpatialTolerance: Real = 1.0e-7;
|
||||
theCriteriumTolerance: Real=1.0e-7;
|
||||
theNbIterations: Integer=40;
|
||||
theConvexity: Real=1.0e-6;
|
||||
theWithSingularity: Boolean = Standard_True)
|
||||
---Purpose:
|
||||
-- The tolerance required on the solution is given by
|
||||
-- Tolerance.
|
||||
-- Iteration are stopped if
|
||||
-- (!WithSingularity) and H(F(Xi)) is not definite
|
||||
-- positive (if the smaller eigenvalue of H < Convexity)
|
||||
-- or IsConverged() returns True for 2 successives Iterations.
|
||||
-- Warning: This constructor do not computation
|
||||
-- The tolerance required on the solution is given by Tolerance.
|
||||
-- Iteration are stopped if (!WithSingularity) and H(F(Xi)) is not definite
|
||||
-- positive (if the smaller eigenvalue of H < Convexity)
|
||||
-- or IsConverged() returns True for 2 successives Iterations.
|
||||
-- Warning: This constructor do not computation
|
||||
returns Newton;
|
||||
|
||||
IsConverged(me)
|
||||
---Purpose: This method is called at the end of each
|
||||
-- iteration to check the convergence :
|
||||
-- || Xi+1 - Xi || < SpatialTolerance/100 Or
|
||||
-- || Xi+1 - Xi || < SpatialTolerance and
|
||||
-- |F(Xi+1) - F(Xi)| < CriteriumTolerance * |F(xi)|
|
||||
-- It can be redefined in a sub-class to implement a specific test.
|
||||
|
||||
returns Boolean
|
||||
is redefined;
|
||||
---Purpose:
|
||||
-- This method is called at the end of each
|
||||
-- iteration to check the convergence :
|
||||
-- || Xi+1 - Xi || < SpatialTolerance/100 Or
|
||||
-- || Xi+1 - Xi || < SpatialTolerance and
|
||||
-- |F(Xi+1) - F(Xi)| < CriteriumTolerance * |F(xi)|
|
||||
-- It can be redefined in a sub-class to implement a specific test.
|
||||
|
||||
returns Boolean is redefined;
|
||||
|
||||
fields
|
||||
mySpTol : Real;
|
||||
|
@@ -16,44 +16,37 @@
|
||||
|
||||
#include <FairCurve_Newton.ixx>
|
||||
|
||||
FairCurve_Newton::FairCurve_Newton(math_MultipleVarFunctionWithHessian& F,
|
||||
const math_Vector& StartingPoint,
|
||||
const Standard_Real SpatialTolerance,
|
||||
const Standard_Real CriteriumTolerance,
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Real Convexity,
|
||||
const Standard_Boolean WithSingularity)
|
||||
:math_NewtonMinimum(F, StartingPoint, CriteriumTolerance,
|
||||
NbIterations, Convexity, WithSingularity),
|
||||
mySpTol(SpatialTolerance)
|
||||
|
||||
//=======================================================================
|
||||
//function : FairCurve_Newton
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
FairCurve_Newton::FairCurve_Newton(
|
||||
const math_MultipleVarFunctionWithHessian& theFunction,
|
||||
const Standard_Real theSpatialTolerance,
|
||||
const Standard_Real theCriteriumTolerance,
|
||||
const Standard_Integer theNbIterations,
|
||||
const Standard_Real theConvexity,
|
||||
const Standard_Boolean theWithSingularity
|
||||
)
|
||||
: math_NewtonMinimum(theFunction,
|
||||
theCriteriumTolerance,
|
||||
theNbIterations,
|
||||
theConvexity,
|
||||
theWithSingularity),
|
||||
mySpTol(theSpatialTolerance)
|
||||
{
|
||||
// Attention this writing is wrong as FairCurve_Newton::IsConverged() is not
|
||||
// used in the constructor of NewtonMinimum !!
|
||||
}
|
||||
|
||||
FairCurve_Newton::FairCurve_Newton(math_MultipleVarFunctionWithHessian& F,
|
||||
const Standard_Real SpatialTolerance,
|
||||
const Standard_Real CriteriumTolerance,
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Real Convexity,
|
||||
const Standard_Boolean WithSingularity)
|
||||
:math_NewtonMinimum(F, CriteriumTolerance,
|
||||
NbIterations, Convexity, WithSingularity),
|
||||
mySpTol(SpatialTolerance)
|
||||
|
||||
{
|
||||
// It is much better
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsConverged
|
||||
//purpose : Convert if the steps are too small or if the criterion
|
||||
// progresses little with a reasonable step, this last
|
||||
// requirement allows detecting infinite slidings
|
||||
// (case when the criterion varies troo slowly).
|
||||
//=======================================================================
|
||||
Standard_Boolean FairCurve_Newton::IsConverged() const
|
||||
// Convert if the steps are too small
|
||||
// or if the criterion progresses little with a reasonable step, this last requirement
|
||||
// allows detecting infinite slidings,
|
||||
// (case when the criterion varies troo slowly).
|
||||
{
|
||||
Standard_Real N = TheStep.Norm();
|
||||
return ( (N <= mySpTol/100 ) ||
|
||||
( Abs(TheMinimum-PreviousMinimum) <= XTol*Abs(PreviousMinimum)
|
||||
&& N<=mySpTol) );
|
||||
const Standard_Real N = TheStep.Norm();
|
||||
return ( N <= 0.01 * mySpTol ) || ( N <= mySpTol &&
|
||||
Abs(TheMinimum - PreviousMinimum) <= XTol * Abs(PreviousMinimum));
|
||||
}
|
||||
|
@@ -91,7 +91,8 @@ Geom2dGcc_Circ2d2TanOnIter (const GccEnt_QualifiedLin& Qualified1 ,
|
||||
gp_Pnt2d point3 = ElCLib::Value(Param3,OnLine);
|
||||
Ufirst(4) = (point3.Distance(point2)+point3.Distance(point1))/2.;
|
||||
Geom2dGcc_FunctionTanCuCuOnCu Func(L1,Cu2,OnLine,Ufirst(4));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
Func.Value(Ufirst,Umin);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
@@ -192,7 +193,8 @@ Geom2dGcc_Circ2d2TanOnIter (const Geom2dGcc_QCurve& Qualified1 ,
|
||||
gp_Pnt2d point3 = ElCLib::Value(Param3,OnLine);
|
||||
Ufirst(4) = (point3.Distance(point2)+point3.Distance(point1))/2.;
|
||||
Geom2dGcc_FunctionTanCuCuOnCu Func(Cu1,Cu2,OnLine,Ufirst(4));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
Func.Value(Ufirst,Umin);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
@@ -288,7 +290,8 @@ Geom2dGcc_Circ2d2TanOnIter (const Geom2dGcc_QCurve& Qualified1 ,
|
||||
gp_Pnt2d point3 = ElCLib::Value(Param2,OnLine);
|
||||
Ufirst(3) = (point3.Distance(Point2)+point3.Distance(point1))/2.;
|
||||
Geom2dGcc_FunctionTanCuCuOnCu Func(Cu1,Point2,OnLine,Ufirst(3));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
Func.Value(Ufirst,Umin);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
@@ -381,7 +384,8 @@ Geom2dGcc_Circ2d2TanOnIter (const GccEnt_QualifiedCirc& Qualified1 ,
|
||||
gp_Pnt2d point3 = ElCLib::Value(Param3,OnLine);
|
||||
Ufirst(4) = (point3.Distance(point2)+point3.Distance(point1))/2.;
|
||||
Geom2dGcc_FunctionTanCuCuOnCu Func(C1,Cu2,OnLine,Ufirst(4));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
Func.Value(Ufirst,Umin);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
@@ -488,7 +492,8 @@ Geom2dGcc_Circ2d2TanOnIter (const GccEnt_QualifiedCirc& Qualified1 ,
|
||||
gp_Pnt2d point3 = ElCLib::Value(Param3,OnCirc);
|
||||
Ufirst(4) = (point3.Distance(point2)+point3.Distance(point1))/2.;
|
||||
Geom2dGcc_FunctionTanCuCuOnCu Func(C1,Cu2,OnCirc,Ufirst(4));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
Func.Value(Ufirst,Umin);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
@@ -592,7 +597,8 @@ Geom2dGcc_Circ2d2TanOnIter (const GccEnt_QualifiedLin& Qualified1 ,
|
||||
gp_Pnt2d point3 = ElCLib::Value(Param3,OnCirc);
|
||||
Ufirst(4) = (point3.Distance(point2)+point3.Distance(point1))/2.;
|
||||
Geom2dGcc_FunctionTanCuCuOnCu Func(L1,Cu2,OnCirc,Ufirst(4));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
Func.Value(Ufirst,Umin);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
@@ -696,7 +702,8 @@ Geom2dGcc_Circ2d2TanOnIter (const Geom2dGcc_QCurve& Qualified1 ,
|
||||
gp_Pnt2d point3(OnCirc.Location().XY()+R1*gp_XY(Cos(Param3),Sin(Param3)));
|
||||
Ufirst(4) = (point3.Distance(point2)+point3.Distance(point1))/2.;
|
||||
Geom2dGcc_FunctionTanCuCuOnCu Func(Cu1,Cu2,OnCirc,Ufirst(4));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
Func.Value(Ufirst,Umin);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
@@ -796,7 +803,8 @@ Geom2dGcc_Circ2d2TanOnIter (const Geom2dGcc_QCurve& Qualified1 ,
|
||||
gp_Pnt2d point3 = ElCLib::Value(Param2,OnCirc);
|
||||
Ufirst(3) = (point3.Distance(Point2)+point3.Distance(point1))/2.;
|
||||
Geom2dGcc_FunctionTanCuCuOnCu Func(Cu1,Point2,OnCirc,Ufirst(3));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
Func.Value(Ufirst,Umin);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
@@ -889,7 +897,8 @@ Geom2dGcc_Circ2d2TanOnIter (const Geom2dGcc_QCurve& Qualified1 ,
|
||||
gp_Pnt2d point3 = Geom2dGcc_CurveTool::Value(OnCurv,Param3);
|
||||
Ufirst(4) = (point3.Distance(point2)+point3.Distance(point1))/2.;
|
||||
Geom2dGcc_FunctionTanCuCuOnCu Func(Cu1,Cu2,OnCurv,Ufirst(4));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
Func.Value(Ufirst,Umin);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
@@ -994,7 +1003,8 @@ Geom2dGcc_Circ2d2TanOnIter (const GccEnt_QualifiedCirc& Qualified1 ,
|
||||
gp_Pnt2d point3 = Geom2dGcc_CurveTool::Value(OnCurv,ParamOn);
|
||||
Ufirst(4) = (point3.Distance(point2)+point3.Distance(point1))/2.;
|
||||
Geom2dGcc_FunctionTanCuCuOnCu Func(C1,Cu2,OnCurv,Ufirst(4));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
Func.Value(Ufirst,Umin);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
@@ -1095,7 +1105,8 @@ Geom2dGcc_Circ2d2TanOnIter (const GccEnt_QualifiedLin& Qualified1 ,
|
||||
gp_Pnt2d point3 = Geom2dGcc_CurveTool::Value(OnCurv,ParamOn);
|
||||
Ufirst(4) = (point3.Distance(point2)+point3.Distance(point1))/2.;
|
||||
Geom2dGcc_FunctionTanCuCuOnCu Func(L1,Cu2,OnCurv,Ufirst(4));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
Func.Value(Ufirst,Umin);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
@@ -1186,7 +1197,8 @@ Geom2dGcc_Circ2d2TanOnIter (const Geom2dGcc_QCurve& Qualified1 ,
|
||||
gp_Pnt2d point3 = Geom2dGcc_CurveTool::Value(OnCurv,ParamOn);
|
||||
Ufirst(3) = (point3.Distance(Point2)+point3.Distance(point1))/2.;
|
||||
Geom2dGcc_FunctionTanCuCuOnCu Func(Cu1,Point2,OnCurv,Ufirst(3));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
Func.Value(Ufirst,Umin);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
|
@@ -89,7 +89,8 @@ Geom2dGcc_Circ2d3TanIter (const Geom2dGcc_QCurve& Qualified1 ,
|
||||
tol(1) = Geom2dGcc_CurveTool::EpsX(Cu1,Abs(Tolerance));
|
||||
tol(2) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolerance));
|
||||
tol(3) = Geom2dGcc_CurveTool::EpsX(Cu3,Abs(Tolerance));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
Func.Value(Ufirst,Umin);
|
||||
@@ -212,7 +213,8 @@ Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedCirc& Qualified1 ,
|
||||
tol(1) = 2.e-15*M_PI;
|
||||
tol(2) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolerance));
|
||||
tol(3) = Geom2dGcc_CurveTool::EpsX(Cu3,Abs(Tolerance));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
Func.Value(Ufirst,Umin);
|
||||
@@ -340,7 +342,8 @@ Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedCirc& Qualified1 ,
|
||||
tol(1) = 2.e-15*M_PI;
|
||||
tol(2) = 2.e-15*M_PI;
|
||||
tol(3) = Geom2dGcc_CurveTool::EpsX(Cu3,Abs(Tolerance));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
Func.Value(Ufirst,Umin);
|
||||
@@ -471,7 +474,8 @@ Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedLin& Qualified1 ,
|
||||
tol(1) = 1.e-15;
|
||||
tol(2) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolerance));
|
||||
tol(3) = Geom2dGcc_CurveTool::EpsX(Cu3,Abs(Tolerance));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
Func.Value(Ufirst,Umin);
|
||||
@@ -602,7 +606,8 @@ Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedLin& Qualified1 ,
|
||||
tol(1) = 1.e-15;
|
||||
tol(2) = 1.e-15;
|
||||
tol(3) = Geom2dGcc_CurveTool::EpsX(Cu3,Abs(Tolerance));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
Func.Value(Ufirst,Umin);
|
||||
@@ -726,7 +731,8 @@ Geom2dGcc_Circ2d3TanIter (const Geom2dGcc_QCurve& Qualified1 ,
|
||||
tol(1) = 2.e-15*M_PI;
|
||||
tol(2) = Geom2dGcc_CurveTool::EpsX(Cu1,Abs(Tolerance));
|
||||
tol(3) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolerance));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
Func.Value(Ufirst,Umin);
|
||||
@@ -839,7 +845,8 @@ Geom2dGcc_Circ2d3TanIter (const Geom2dGcc_QCurve& Qualified1 ,
|
||||
tol(1) = 2.e-15*M_PI;
|
||||
tol(2) = 2.e-15*M_PI;
|
||||
tol(3) = Geom2dGcc_CurveTool::EpsX(Cu1,Abs(Tolerance));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
Func.Value(Ufirst,Umin);
|
||||
@@ -949,7 +956,8 @@ Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedLin& Qualified1 ,
|
||||
tol(1) = 2.e-15;
|
||||
tol(2) = 1.e-15;
|
||||
tol(3) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolerance));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
Func.Value(Ufirst,Umin);
|
||||
@@ -1068,7 +1076,8 @@ Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedCirc& Qualified1 ,
|
||||
tol(1) = 2.e-15*M_PI;
|
||||
tol(2) = 1.e-15;
|
||||
tol(3) = Geom2dGcc_CurveTool::EpsX(Cu3,Abs(Tolerance));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
if (Root.IsDone()) {
|
||||
Func.Value(Ufirst,Umin);
|
||||
Root.Root(Ufirst);
|
||||
@@ -1195,7 +1204,8 @@ Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedCirc& Qualified1 ,
|
||||
tol(1) = 2.e-15*M_PI;
|
||||
tol(2) = 2.e-15*M_PI;
|
||||
tol(3) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolerance));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
Func.Value(Ufirst,Umin);
|
||||
|
@@ -144,7 +144,8 @@ Geom2dGcc_Lin2d2TanIter (const Geom2dGcc_QCurve& Qualified1 ,
|
||||
Ufirst(2) = Param2;
|
||||
tol(1) = Geom2dGcc_CurveTool::EpsX(Cu1,Abs(Tolang));
|
||||
tol(2) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolang));
|
||||
math_FunctionSetRoot Root(Func,Ufirst,tol,Umin,Umax);
|
||||
math_FunctionSetRoot Root(Func, tol);
|
||||
Root.Perform(Func, Ufirst, Umin, Umax);
|
||||
if (Root.IsDone()) {
|
||||
Root.Root(Ufirst);
|
||||
// Modified by Sergey KHROMOV - Thu Apr 5 17:45:00 2001 Begin
|
||||
|
@@ -310,30 +310,27 @@ GeomFill_LocationDraft::GeomFill_LocationDraft
|
||||
GeomFill_FunctionDraft E(mySurf , G);
|
||||
|
||||
// resolution
|
||||
math_NewtonFunctionSetRoot Result(E, X, XTol, FTol, Iter);
|
||||
|
||||
math_NewtonFunctionSetRoot Result(E, XTol, FTol, Iter);
|
||||
Result.Perform(E, X);
|
||||
|
||||
if (Result.IsDone())
|
||||
{
|
||||
math_Vector R(1,3);
|
||||
Result.Root(R); // solution
|
||||
|
||||
gp_Pnt2d p (R(2), R(3)); // point sur la surface
|
||||
gp_Pnt2d q (R(1), Param); // point de la courbe
|
||||
Poles2d.SetValue(1,p);
|
||||
Poles2d.SetValue(2,q);
|
||||
|
||||
}
|
||||
else {
|
||||
return Standard_False;
|
||||
{
|
||||
math_Vector R(1,3);
|
||||
Result.Root(R); // solution
|
||||
|
||||
gp_Pnt2d p (R(2), R(3)); // point sur la surface
|
||||
gp_Pnt2d q (R(1), Param); // point de la courbe
|
||||
Poles2d.SetValue(1,p);
|
||||
Poles2d.SetValue(2,q);
|
||||
}
|
||||
|
||||
else {
|
||||
return Standard_False;
|
||||
}
|
||||
}// if_Intersec
|
||||
|
||||
|
||||
}// if_Intersec
|
||||
|
||||
// la generatrice n'intersecte pas la surface d'arret
|
||||
// la generatrice n'intersecte pas la surface d'arret
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
//Function: D1
|
||||
@@ -427,44 +424,44 @@ GeomFill_LocationDraft::GeomFill_LocationDraft
|
||||
|
||||
|
||||
// resolution
|
||||
math_NewtonFunctionSetRoot Result (E, X, XTol, FTol, Iter);
|
||||
math_NewtonFunctionSetRoot Result(E, XTol, FTol, Iter);
|
||||
Result.Perform(E, X);
|
||||
|
||||
if (Result.IsDone())
|
||||
{
|
||||
math_Vector R(1,3);
|
||||
Result.Root(R); // solution
|
||||
|
||||
gp_Pnt2d p (R(2), R(3)); // point sur la surface
|
||||
gp_Pnt2d q (R(1), Param); // point de la courbe
|
||||
Poles2d.SetValue(1,p);
|
||||
Poles2d.SetValue(2,q);
|
||||
{
|
||||
math_Vector R(1,3);
|
||||
Result.Root(R); // solution
|
||||
|
||||
// derivee de la fonction par rapport a Param
|
||||
math_Vector DEDT(1,3,0);
|
||||
E.DerivT(myTrimmed, Param, R(1), DN, myAngle, DEDT); // dE/dt => DEDT
|
||||
gp_Pnt2d p (R(2), R(3)); // point sur la surface
|
||||
gp_Pnt2d q (R(1), Param); // point de la courbe
|
||||
Poles2d.SetValue(1,p);
|
||||
Poles2d.SetValue(2,q);
|
||||
|
||||
math_Vector DSDT (1,3,0);
|
||||
math_Matrix DEDX (1,3,1,3,0);
|
||||
E.Derivatives(R, DEDX); // dE/dx au point R => DEDX
|
||||
// derivee de la fonction par rapport a Param
|
||||
math_Vector DEDT(1,3,0);
|
||||
E.DerivT(myTrimmed, Param, R(1), DN, myAngle, DEDT); // dE/dt => DEDT
|
||||
|
||||
// resolution du syst. lin. : DEDX*DSDT = -DEDT
|
||||
math_Gauss Ga(DEDX);
|
||||
if (Ga.IsDone())
|
||||
{
|
||||
Ga.Solve (DEDT.Opposite(), DSDT); // resolution du syst. lin.
|
||||
gp_Vec2d dp (DSDT(2), DSDT(3)); // surface
|
||||
gp_Vec2d dq (DSDT(1), 1); // courbe
|
||||
DPoles2d.SetValue(1, dp);
|
||||
DPoles2d.SetValue(2, dq);
|
||||
}//if
|
||||
math_Vector DSDT (1,3,0);
|
||||
math_Matrix DEDX (1,3,1,3,0);
|
||||
E.Derivatives(R, DEDX); // dE/dx au point R => DEDX
|
||||
|
||||
|
||||
}//if_Result
|
||||
// resolution du syst. lin. : DEDX*DSDT = -DEDT
|
||||
math_Gauss Ga(DEDX);
|
||||
if (Ga.IsDone())
|
||||
{
|
||||
Ga.Solve (DEDT.Opposite(), DSDT); // resolution du syst. lin.
|
||||
gp_Vec2d dp (DSDT(2), DSDT(3)); // surface
|
||||
gp_Vec2d dq (DSDT(1), 1); // courbe
|
||||
DPoles2d.SetValue(1, dp);
|
||||
DPoles2d.SetValue(2, dq);
|
||||
}//if
|
||||
|
||||
|
||||
}//if_Result
|
||||
else {// la generatrice n'intersecte pas la surface d'arret
|
||||
return Standard_False;
|
||||
return Standard_False;
|
||||
}
|
||||
}// if_Intersec
|
||||
|
||||
}// if_Intersec
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -564,7 +561,8 @@ GeomFill_LocationDraft::GeomFill_LocationDraft
|
||||
|
||||
|
||||
// resolution
|
||||
math_NewtonFunctionSetRoot Result (E, X, XTol, FTol, Iter);
|
||||
math_NewtonFunctionSetRoot Result (E, XTol, FTol, Iter);
|
||||
Result.Perform(E, X);
|
||||
|
||||
if (Result.IsDone())
|
||||
{
|
||||
|
@@ -349,34 +349,34 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
#endif
|
||||
Standard_Boolean SOS=Standard_False;
|
||||
if (ii>1) {
|
||||
// Intersection de secour entre surf revol et guide
|
||||
// equation
|
||||
X(1) = myPoles2d->Value(1,ii-1).Y();
|
||||
X(2) = myPoles2d->Value(2,ii-1).X();
|
||||
X(3) = myPoles2d->Value(2,ii-1).Y();
|
||||
GeomFill_FunctionGuide E (mySec, myGuide, U);
|
||||
E.SetParam(U, P, T.XYZ(), N.XYZ());
|
||||
// resolution => angle
|
||||
math_FunctionSetRoot Result(E, X, TolRes,
|
||||
Inf, Sup);
|
||||
|
||||
if (Result.IsDone() &&
|
||||
(Result.FunctionSetErrors().Norm() < TolRes(1)*TolRes(1)) ) {
|
||||
// Intersection de secour entre surf revol et guide
|
||||
// equation
|
||||
X(1) = myPoles2d->Value(1,ii-1).Y();
|
||||
X(2) = myPoles2d->Value(2,ii-1).X();
|
||||
X(3) = myPoles2d->Value(2,ii-1).Y();
|
||||
GeomFill_FunctionGuide E (mySec, myGuide, U);
|
||||
E.SetParam(U, P, T.XYZ(), N.XYZ());
|
||||
// resolution => angle
|
||||
math_FunctionSetRoot Result(E, TolRes);
|
||||
Result.Perform(E, X, Inf, Sup);
|
||||
|
||||
if (Result.IsDone() &&
|
||||
(Result.FunctionSetErrors().Norm() < TolRes(1)*TolRes(1)) ) {
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Ratrappage Reussi !" << endl;
|
||||
cout << "Ratrappage Reussi !" << endl;
|
||||
#endif
|
||||
SOS = Standard_True;
|
||||
math_Vector RR(1,3);
|
||||
Result.Root(RR);
|
||||
PInt.SetValues(P, RR(2), RR(3), RR(1), IntCurveSurface_Out);
|
||||
theU = PInt.U();
|
||||
theV = PInt.V();
|
||||
}
|
||||
else {
|
||||
SOS = Standard_True;
|
||||
math_Vector RR(1,3);
|
||||
Result.Root(RR);
|
||||
PInt.SetValues(P, RR(2), RR(3), RR(1), IntCurveSurface_Out);
|
||||
theU = PInt.U();
|
||||
theV = PInt.V();
|
||||
}
|
||||
else {
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Echec du Ratrappage !" << endl;
|
||||
cout << "Echec du Ratrappage !" << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!SOS) {
|
||||
myStatus = GeomFill_ImpossibleContact;
|
||||
@@ -614,8 +614,8 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
GeomFill_FunctionGuide E (mySec, myGuide, U);
|
||||
E.SetParam(Param, P, t, n);
|
||||
// resolution => angle
|
||||
math_FunctionSetRoot Result(E, X, TolRes,
|
||||
Inf, Sup, Iter);
|
||||
math_FunctionSetRoot Result(E, TolRes, Iter);
|
||||
Result.Perform(E, X, Inf, Sup);
|
||||
|
||||
if (Result.IsDone()) {
|
||||
// solution
|
||||
@@ -682,11 +682,11 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
GeomFill_FunctionGuide E (mySec, myGuide, myFirstS +
|
||||
(Param-myCurve->FirstParameter())*ratio);
|
||||
E.SetParam(Param, P, t, n);
|
||||
|
||||
|
||||
// resolution
|
||||
math_FunctionSetRoot Result(E, X, TolRes,
|
||||
Inf, Sup, Iter);
|
||||
|
||||
math_FunctionSetRoot Result(E, TolRes, Iter);
|
||||
Result.Perform(E, X, Inf, Sup);
|
||||
|
||||
if (Result.IsDone()) {
|
||||
// solution
|
||||
Result.Root(R);
|
||||
|
@@ -61,6 +61,18 @@ public:
|
||||
//! Returns unique ID used to manage resource in graphic driver.
|
||||
const TCollection_AsciiString& GetId() const { return myID; }
|
||||
|
||||
//! Returns GLSL header (version code and extensions).
|
||||
const TCollection_AsciiString& Header() const { return myHeader; }
|
||||
|
||||
//! Setup GLSL header containing language version code and used extensions.
|
||||
//! Will be prepended to the very beginning of the source code.
|
||||
//! Example:
|
||||
//! @code
|
||||
//! #version 300 es
|
||||
//! #extension GL_ARB_bindless_texture : require
|
||||
//! @endcode
|
||||
void SetHeader (const TCollection_AsciiString& theHeader) { myHeader = theHeader; }
|
||||
|
||||
//! Attaches shader object to the program object.
|
||||
Standard_EXPORT Standard_Boolean AttachShader (const Handle(Graphic3d_ShaderObject)& theShader);
|
||||
|
||||
@@ -96,6 +108,7 @@ private:
|
||||
TCollection_AsciiString myID; //!< The unique identifier of program object.
|
||||
Graphic3d_ShaderObjectList myShaderObjects; //!< the list of attached shader objects.
|
||||
Graphic3d_ShaderVariableList myVariables; //!< the list of custom uniform variables.
|
||||
TCollection_AsciiString myHeader; //!< GLSL header with version code and used extensions
|
||||
|
||||
};
|
||||
|
||||
|
@@ -61,15 +61,18 @@ HLRBRep_Curve::Parameter2d (const Standard_Real P3d) const
|
||||
|
||||
switch (myType)
|
||||
{
|
||||
case GeomAbs_Line:
|
||||
if (((HLRAlgo_Projector*) myProj)->Perspective()) {
|
||||
const Standard_Real FmOZ = myOF - myOZ;
|
||||
return myOF * P3d * (myVX * FmOZ + myOX * myVZ) / (FmOZ * (FmOZ - P3d * myVZ));
|
||||
}
|
||||
return P3d * myVX;
|
||||
|
||||
case GeomAbs_Ellipse:
|
||||
return P3d + myOX;
|
||||
case GeomAbs_Line:
|
||||
if (((HLRAlgo_Projector*) myProj)->Perspective()) {
|
||||
const Standard_Real FmOZ = myOF - myOZ;
|
||||
return myOF * P3d * (myVX * FmOZ + myOX * myVZ) / (FmOZ * (FmOZ - P3d * myVZ));
|
||||
}
|
||||
return P3d * myVX;
|
||||
|
||||
case GeomAbs_Ellipse:
|
||||
return P3d + myOX;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return P3d;
|
||||
}
|
||||
|
@@ -198,12 +198,8 @@ void IntCurve_ExactIntersectionPoint::Roots(Standard_Real& U,Standard_Real& V) {
|
||||
|
||||
void IntCurve_ExactIntersectionPoint::MathPerform(void)
|
||||
{
|
||||
math_FunctionSetRoot Fct( FctDist
|
||||
,StartingPoint
|
||||
,ToleranceVector
|
||||
,BInfVector
|
||||
,BSupVector
|
||||
,60);
|
||||
math_FunctionSetRoot Fct(FctDist, ToleranceVector, 60);
|
||||
Fct.Perform(FctDist, StartingPoint, BInfVector, BSupVector);
|
||||
|
||||
if(Fct.IsDone()) {
|
||||
Fct.Root(Root); nbroots = 1;
|
||||
|
@@ -1019,7 +1019,10 @@ static Standard_Boolean SearchOnVBounds(const SearchBoundType theSBType,
|
||||
|
||||
//=======================================================================
|
||||
//function : InscribePoint
|
||||
//purpose : If theFlForce==TRUE theUGiven will be adjasted forceful.
|
||||
//purpose : If theFlForce==TRUE theUGiven will be changed forcefully
|
||||
// even if theUGiven is already inscibed in the boundary
|
||||
// (if it is possible; i.e. if new theUGiven is inscribed
|
||||
// in the boundary, too).
|
||||
//=======================================================================
|
||||
static Standard_Boolean InscribePoint(const Standard_Real theUfTarget,
|
||||
const Standard_Real theUlTarget,
|
||||
@@ -1960,38 +1963,70 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1,
|
||||
|
||||
if(aNbPntsWL == 0)
|
||||
{//the line has not contained any points yet
|
||||
if(((aUSurf2l - aUSurf2f) >= aPeriod) &&
|
||||
if(((aUSurf2f + aPeriod - aUSurf2l) <= 2.0*theTol2D) &&
|
||||
((Abs(aU2[i] - aUSurf2f) < theTol2D) ||
|
||||
(Abs(aU2[i]-aUSurf2l) < theTol2D)))
|
||||
{
|
||||
const Standard_Real anU1Temp = anU1 + aStepMin;
|
||||
Standard_Real anArgTemp = anEquationCoeffs.mB *
|
||||
cos(anU1Temp - anEquationCoeffs.mFI1) +
|
||||
anEquationCoeffs.mC;
|
||||
//In this case aU2[i] can have two values: current aU2[i] or
|
||||
//aU2[i] +/- aPeriod. It is necessary to choose correct value.
|
||||
|
||||
if(aNulValue > 1.0 - anArgTemp)
|
||||
anArgTemp = 1.0;
|
||||
// U2(U1) = FI2 + anArccosFactor*acos(B*cos(U1 - FI1) + C);
|
||||
//Accordingly,
|
||||
//Func. U2(X1) = FI2 + X1;
|
||||
//Func. X1(X2) = anArccosFactor*X2;
|
||||
//Func. X2(X3) = acos(X3);
|
||||
//Func. X3(X4) = B*X4 + C;
|
||||
//Func. X4(U1) = cos(U1 - FI1).
|
||||
//
|
||||
//Consequently,
|
||||
//U2(X1) is always increasing.
|
||||
//X1(X2) is increasing if anArccosFactor > 0.0 and
|
||||
//is decreasing otherwise.
|
||||
//X2(X3) is always decreasing.
|
||||
//Therefore, U2(X3) is decreasing if anArccosFactor > 0.0 and
|
||||
//is increasing otherwise.
|
||||
//X3(X4) is increasing if B > 0 and is decreasing otherwise.
|
||||
//X4(U1) is increasing if U1 - FI1 in [PI, 2*PI) and
|
||||
//is decreasing U1 - FI1 in [0, PI) or if (U1 - FI1 == 2PI).
|
||||
//After that, we can predict behaviour of U2(U1) function:
|
||||
//if it is increasing or decreasing.
|
||||
Standard_Real aU1Temp = anU1 - anEquationCoeffs.mFI1;
|
||||
InscribePoint(0, aPeriod, aU1Temp, 0.0, aPeriod, Standard_False);
|
||||
|
||||
Standard_Boolean isIncreasing = Standard_True;
|
||||
|
||||
if(anArgTemp + 1.0 < aNulValue)
|
||||
anArgTemp = -1.0;
|
||||
|
||||
Standard_Real aU2Temp = anEquationCoeffs.mFI2 +
|
||||
anArccosFactor[i]*acos(anArgTemp);
|
||||
|
||||
InscribePoint(aUSurf2f, aUSurf2l, aU2Temp, theTol2D, aPeriod, Standard_False);
|
||||
|
||||
if(2.0*Abs(aU2Temp - aU2[i]) > aPeriod)
|
||||
if(((M_PI - aU1Temp) < RealSmall()) && (aU1Temp < aPeriod))
|
||||
{
|
||||
if(aU2Temp > aU2[i])
|
||||
aU2[i] += aPeriod;
|
||||
else
|
||||
aU2[i] -= aPeriod;
|
||||
isIncreasing = Standard_False;
|
||||
}
|
||||
|
||||
if(anEquationCoeffs.mB < 0.0)
|
||||
{
|
||||
isIncreasing = !isIncreasing;
|
||||
}
|
||||
|
||||
if(anArccosFactor[i] < 0.0)
|
||||
{
|
||||
isIncreasing = !isIncreasing;
|
||||
}
|
||||
|
||||
//If U2(U1) is increasing and U2 is considered to be equal aUSurf2l
|
||||
//then after the next step (when U1 will be increased) U2 will be
|
||||
//increased too. And we will go out of surface boundary.
|
||||
//Therefore, If U2(U1) is increasing then U2 must be equal aUSurf2f.
|
||||
//Analogically, if U2(U1) is decreasing.
|
||||
if(isIncreasing)
|
||||
{
|
||||
aU2[i] = aUSurf2f;
|
||||
}
|
||||
else
|
||||
{
|
||||
aU2[i] = aUSurf2l;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(aNbPntsWL > 0)
|
||||
{
|
||||
else
|
||||
{//aNbPntsWL > 0
|
||||
if(((aUSurf2l - aUSurf2f) >= aPeriod) &&
|
||||
((Abs(aU2[i] - aUSurf2f) < theTol2D) ||
|
||||
(Abs(aU2[i]-aUSurf2l) < theTol2D)))
|
||||
@@ -2012,8 +2047,10 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1,
|
||||
}
|
||||
}
|
||||
|
||||
if(aWLFindStatus[i] == WLFStatus_Broken)
|
||||
{
|
||||
if( (aWLFindStatus[i] == WLFStatus_Broken) ||
|
||||
(aWLFindStatus[i] == WLFStatus_Absent))
|
||||
{//Begin and end of WLine must be on boundary point
|
||||
//or on seam-edge strictly (if it is possible).
|
||||
if(Abs(aU2[i]) <= theTol2D)
|
||||
aU2[i] = 0.0;
|
||||
else if(Abs(aU2[i] - aPeriod) <= theTol2D)
|
||||
|
@@ -188,7 +188,17 @@ is
|
||||
--- inside the boundaries of the face aF,
|
||||
--- otherwise returns false
|
||||
---
|
||||
|
||||
|
||||
IsPointInFace(me:mutable;
|
||||
aP3D : Pnt from gp;
|
||||
aF : Face from TopoDS;
|
||||
aTol : Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if the point aP2D is
|
||||
--- inside the boundaries of the face aF,
|
||||
--- otherwise returns false
|
||||
---
|
||||
|
||||
IsPointInOnFace(me:mutable;
|
||||
aF : Face from TopoDS;
|
||||
|
@@ -553,6 +553,35 @@ Standard_Boolean IntTools_Context::IsPointInFace
|
||||
return Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsPointInFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsPointInFace
|
||||
(const gp_Pnt& aP,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aTol)
|
||||
{
|
||||
Standard_Boolean bIn;
|
||||
Standard_Real aDist;
|
||||
//
|
||||
GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(aF);
|
||||
aProjector.Perform(aP);
|
||||
//
|
||||
bIn = aProjector.IsDone();
|
||||
if (bIn) {
|
||||
aDist = aProjector.LowerDistance();
|
||||
if (aDist < aTol) {
|
||||
Standard_Real U, V;
|
||||
//
|
||||
aProjector.LowerDistanceParameters(U, V);
|
||||
gp_Pnt2d aP2D(U, V);
|
||||
bIn = IsPointInFace(aF, aP2D);
|
||||
}
|
||||
}
|
||||
//
|
||||
return bIn;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsPointInOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
@@ -48,11 +48,11 @@ static
|
||||
Standard_Real PointBoxDistance(const Bnd_Box& aB,
|
||||
const gp_Pnt& aP);
|
||||
static
|
||||
void SplitRangeOnSegments(const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
const Standard_Real theResolution,
|
||||
const Standard_Integer theNbSeg,
|
||||
IntTools_SequenceOfRanges& theSegments);
|
||||
Standard_Integer SplitRangeOnSegments(const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
const Standard_Real theResolution,
|
||||
const Standard_Integer theNbSeg,
|
||||
IntTools_SequenceOfRanges& theSegments);
|
||||
static
|
||||
Standard_Integer DistPC(const Standard_Real aT1,
|
||||
const Handle(Geom_Curve)& theC1,
|
||||
@@ -268,11 +268,9 @@ void IntTools_EdgeEdge::FindSolutions(IntTools_SequenceOfRanges& theRanges1,
|
||||
aNb1 = IsClosed(myGeom1, aT11, aT12, myTol1, myRes1) ? 2 : 1;
|
||||
aNb2 = 2;
|
||||
//
|
||||
SplitRangeOnSegments(aT11, aT12, myRes1, aNb1, aSegments1);
|
||||
SplitRangeOnSegments(aT21, aT22, myRes2, aNb2, aSegments2);
|
||||
aNb1 = SplitRangeOnSegments(aT11, aT12, myRes1, aNb1, aSegments1);
|
||||
aNb2 = SplitRangeOnSegments(aT21, aT22, myRes2, aNb2, aSegments2);
|
||||
//
|
||||
aNb1 = aSegments1.Length();
|
||||
aNb2 = aSegments2.Length();
|
||||
for (i = 1; i <= aNb1; ++i) {
|
||||
const IntTools_Range& aR1 = aSegments1(i);
|
||||
for (j = 1; j <= aNb2; ++j) {
|
||||
@@ -433,8 +431,7 @@ void IntTools_EdgeEdge::FindSolutions(const IntTools_Range& theR1,
|
||||
IntTools_Range aR2(aT21, aT22);
|
||||
BndBuildBox(myCurve2, aT21, aT22, myTol2, aB2);
|
||||
//
|
||||
SplitRangeOnSegments(aT11, aT12, myRes1, 3, aSegments1);
|
||||
aNb1 = aSegments1.Length();
|
||||
aNb1 = SplitRangeOnSegments(aT11, aT12, myRes1, 3, aSegments1);
|
||||
for (i = 1; i <= aNb1; ++i) {
|
||||
const IntTools_Range& aR1 = aSegments1(i);
|
||||
FindSolutions(aR1, aR2, aB2, theRanges1, theRanges2);
|
||||
@@ -685,37 +682,64 @@ void IntTools_EdgeEdge::FindBestSolution(const Standard_Real aT11,
|
||||
Standard_Real& aT2)
|
||||
{
|
||||
Standard_Integer i, aNbS, iErr;
|
||||
Standard_Real aDMin, aD, aCrit, aRes1;
|
||||
Standard_Real aT1x, aT2x, aT1p, aT2p;
|
||||
GeomAPI_ProjectPointOnCurve aProj;
|
||||
IntTools_SequenceOfRanges aSeg1;
|
||||
Standard_Real aDMin, aD, aRes1, aSolCriteria, aTouchCriteria;
|
||||
Standard_Real aT1A, aT1B, aT1Min, aT2Min;
|
||||
Standard_Real aT1Im, aT2Im, aT1Touch;
|
||||
GeomAPI_ProjectPointOnCurve aProjPC;
|
||||
IntTools_SequenceOfRanges aRanges;
|
||||
Standard_Boolean bTouch;
|
||||
//
|
||||
aT1 = (aT11 + aT12) * .5;
|
||||
aT2 = (aT21 + aT22) * .5;
|
||||
//
|
||||
aDMin = 100.;
|
||||
aD = 100.;
|
||||
aCrit = 0.;//1.e-16;
|
||||
aDMin = Precision::Infinite();
|
||||
aSolCriteria = 5.e-16;
|
||||
aTouchCriteria = 5.e-13;
|
||||
bTouch = Standard_False;
|
||||
aT1Touch = aT11;
|
||||
//
|
||||
aRes1 = Resolution(myCurve1.Curve().Curve(),
|
||||
myCurve1.GetType(), myResCoeff1, myTol);
|
||||
aNbS = 10;
|
||||
SplitRangeOnSegments(aT11, aT12, 3*aRes1, aNbS, aSeg1);
|
||||
aNbS = aSeg1.Length();
|
||||
aNbS = SplitRangeOnSegments(aT11, aT12, 3*aRes1, aNbS, aRanges);
|
||||
//
|
||||
aProjPC.Init(myGeom2, aT21, aT22);
|
||||
//
|
||||
aT1 = (aT11 + aT12) * 0.5;
|
||||
iErr = DistPC(aT1, myGeom1, aSolCriteria, aProjPC, aD, aT2, -1);
|
||||
if (iErr == 1) {
|
||||
aT2 = (aT21 + aT22) * 0.5;
|
||||
}
|
||||
//
|
||||
aT1Im = aT1;
|
||||
aT2Im = aT2;
|
||||
//
|
||||
aProj.Init(myGeom2, aT21, aT22);
|
||||
for (i = 1; i <= aNbS; ++i) {
|
||||
const IntTools_Range& aR1 = aSeg1(i);
|
||||
aR1.Range(aT1x, aT2x);
|
||||
const IntTools_Range& aR1 = aRanges(i);
|
||||
aR1.Range(aT1A, aT1B);
|
||||
//
|
||||
iErr = FindDistPC(aT1x, aT2x, myGeom1, aCrit, myPTol1,
|
||||
aProj, aD, aT1p, aT2p, Standard_False);
|
||||
if (iErr != 1 && aD < aDMin) {
|
||||
aT1 = aT1p;
|
||||
aT2 = aT2p;
|
||||
aDMin = aD;
|
||||
if (aDMin <= aCrit) {
|
||||
break;
|
||||
aD = myTol;
|
||||
iErr = FindDistPC(aT1A, aT1B, myGeom1, aSolCriteria, myPTol1,
|
||||
aProjPC, aD, aT1Min, aT2Min, Standard_False);
|
||||
if (iErr != 1) {
|
||||
if (aD < aDMin) {
|
||||
aT1 = aT1Min;
|
||||
aT2 = aT2Min;
|
||||
aDMin = aD;
|
||||
}
|
||||
//
|
||||
if (aD < aTouchCriteria) {
|
||||
if (bTouch) {
|
||||
aT1A = (aT1Touch + aT1Min) * 0.5;
|
||||
iErr = DistPC(aT1A, myGeom1, aTouchCriteria,
|
||||
aProjPC, aD, aT2Min, -1);
|
||||
if (aD > aTouchCriteria) {
|
||||
aT1 = aT1Im;
|
||||
aT2 = aT2Im;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
aT1Touch = aT1Min;
|
||||
bTouch = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -920,13 +944,14 @@ Standard_Boolean IntTools_EdgeEdge::IsIntersection(const Standard_Real aT11,
|
||||
//
|
||||
if (((anAngle1 < anAngleCriteria) || ((M_PI - anAngle1) < anAngleCriteria)) ||
|
||||
((anAngle2 < anAngleCriteria) || ((M_PI - anAngle2) < anAngleCriteria))) {
|
||||
GeomAPI_ProjectPointOnCurve aProj;
|
||||
GeomAPI_ProjectPointOnCurve aProjPC;
|
||||
Standard_Integer iErr;
|
||||
Standard_Real aD, aT1p, aT2p;
|
||||
Standard_Real aD, aT1Min, aT2Min;
|
||||
//
|
||||
aD = 100.;
|
||||
aProj.Init(myGeom2, aT21, aT22);
|
||||
iErr = FindDistPC(aT11, aT12, myGeom1, myTol, myRes1, aProj, aD, aT1p, aT2p, Standard_False);
|
||||
aD = Precision::Infinite();
|
||||
aProjPC.Init(myGeom2, aT21, aT22);
|
||||
iErr = FindDistPC(aT11, aT12, myGeom1, myTol, myRes1,
|
||||
aProjPC, aD, aT1Min, aT2Min, Standard_False);
|
||||
bRet = (iErr == 2);
|
||||
}
|
||||
}
|
||||
@@ -947,7 +972,7 @@ Standard_Integer IntTools_EdgeEdge::CheckCoincidence(const Standard_Real aT11,
|
||||
Standard_Integer iErr, aNb, aNb1, i;
|
||||
Standard_Real aT1A, aT1B, aT1max, aT2max, aDmax;
|
||||
GeomAPI_ProjectPointOnCurve aProjPC;
|
||||
IntTools_SequenceOfRanges aSeg1;
|
||||
IntTools_SequenceOfRanges aRanges;
|
||||
//
|
||||
iErr = 0;
|
||||
aDmax = -1.;
|
||||
@@ -955,10 +980,9 @@ Standard_Integer IntTools_EdgeEdge::CheckCoincidence(const Standard_Real aT11,
|
||||
//
|
||||
// 1. Express evaluation
|
||||
aNb = 10; // Number of intervals on the curve #1
|
||||
SplitRangeOnSegments(aT11, aT12, theCurveRes1, aNb, aSeg1);
|
||||
aNb1 = aSeg1.Length();
|
||||
aNb1 = SplitRangeOnSegments(aT11, aT12, theCurveRes1, aNb, aRanges);
|
||||
for (i = 1; i < aNb1; ++i) {
|
||||
const IntTools_Range& aR1 = aSeg1(i);
|
||||
const IntTools_Range& aR1 = aRanges(i);
|
||||
aR1.Range(aT1A, aT1B);
|
||||
//
|
||||
iErr = DistPC(aT1B, myGeom1, theCriteria, aProjPC, aDmax, aT2max);
|
||||
@@ -967,7 +991,7 @@ Standard_Integer IntTools_EdgeEdge::CheckCoincidence(const Standard_Real aT11,
|
||||
}
|
||||
}
|
||||
//
|
||||
// if the ranges in aSeg1 are less than theCurveRes1,
|
||||
// if the ranges in aRanges are less than theCurveRes1,
|
||||
// there is no need to do step 2 (deep evaluation)
|
||||
if (aNb1 < aNb) {
|
||||
return iErr;
|
||||
@@ -975,7 +999,7 @@ Standard_Integer IntTools_EdgeEdge::CheckCoincidence(const Standard_Real aT11,
|
||||
//
|
||||
// 2. Deep evaluation
|
||||
for (i = 2; i < aNb1; ++i) {
|
||||
const IntTools_Range& aR1 = aSeg1(i);
|
||||
const IntTools_Range& aR1 = aRanges(i);
|
||||
aR1.Range(aT1A, aT1B);
|
||||
//
|
||||
iErr = FindDistPC(aT1A, aT1B, myGeom1, theCriteria, theCurveRes1,
|
||||
@@ -1017,12 +1041,14 @@ Standard_Integer FindDistPC(const Standard_Real aT1A,
|
||||
aB = aT1B;
|
||||
//
|
||||
// check bounds
|
||||
iErr = DistPC(aA, theC1, theCriteria, theProjPC, aYP, aT2P, aDmax, aT1max, aT2max, iC);
|
||||
iErr = DistPC(aA, theC1, theCriteria, theProjPC,
|
||||
aYP, aT2P, aDmax, aT1max, aT2max, iC);
|
||||
if (iErr == 2) {
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
iErr = DistPC(aB, theC1, theCriteria, theProjPC, aYL, aT2L, aDmax, aT1max, aT2max, iC);
|
||||
iErr = DistPC(aB, theC1, theCriteria, theProjPC,
|
||||
aYL, aT2L, aDmax, aT1max, aT2max, iC);
|
||||
if (iErr == 2) {
|
||||
return iErr;
|
||||
}
|
||||
@@ -1030,12 +1056,14 @@ Standard_Integer FindDistPC(const Standard_Real aT1A,
|
||||
aXP = aA + (aB - aA)*aGS;
|
||||
aXL = aB - (aB - aA)*aGS;
|
||||
//
|
||||
iErr = DistPC(aXP, theC1, theCriteria, theProjPC, aYP, aT2P, aDmax, aT1max, aT2max, iC);
|
||||
iErr = DistPC(aXP, theC1, theCriteria, theProjPC,
|
||||
aYP, aT2P, aDmax, aT1max, aT2max, iC);
|
||||
if (iErr) {
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
iErr = DistPC(aXL, theC1, theCriteria, theProjPC, aYL, aT2L, aDmax, aT1max, aT2max, iC);
|
||||
iErr = DistPC(aXL, theC1, theCriteria, theProjPC,
|
||||
aYL, aT2L, aDmax, aT1max, aT2max, iC);
|
||||
if (iErr) {
|
||||
return iErr;
|
||||
}
|
||||
@@ -1046,20 +1074,25 @@ Standard_Integer FindDistPC(const Standard_Real aT1A,
|
||||
aXL = aXP;
|
||||
aYL = aYP;
|
||||
aXP = aA + (aB - aA)*aGS;
|
||||
iErr = DistPC(aXP, theC1, theCriteria, theProjPC, aYP, aT2P, aDmax, aT1max, aT2max, iC);
|
||||
if (iErr) {
|
||||
return iErr;
|
||||
}
|
||||
iErr = DistPC(aXP, theC1, theCriteria, theProjPC,
|
||||
aYP, aT2P, aDmax, aT1max, aT2max, iC);
|
||||
}
|
||||
else {
|
||||
aB = aXP;
|
||||
aXP = aXL;
|
||||
aYP = aYL;
|
||||
aXL = aB - (aB - aA)*aGS;
|
||||
iErr = DistPC(aXL, theC1, theCriteria, theProjPC, aYL, aT2L, aDmax, aT1max, aT2max, iC);
|
||||
if (iErr) {
|
||||
return iErr;
|
||||
iErr = DistPC(aXL, theC1, theCriteria, theProjPC,
|
||||
aYL, aT2L, aDmax, aT1max, aT2max, iC);
|
||||
}
|
||||
//
|
||||
if (iErr) {
|
||||
if ((iErr == 2) && !bMaxDist) {
|
||||
aXP = (aA + aB) * 0.5;
|
||||
DistPC(aXP, theC1, theCriteria, theProjPC,
|
||||
aYP, aT2P, aDmax, aT1max, aT2max, iC);
|
||||
}
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
if ((aB - aA) < theEps) {
|
||||
@@ -1087,7 +1120,7 @@ Standard_Integer DistPC(const Standard_Real aT1,
|
||||
Standard_Integer iErr;
|
||||
//
|
||||
iErr = DistPC(aT1, theC1, theCriteria, theProjPC, aD, aT2, iC);
|
||||
if (iErr) {
|
||||
if (iErr == 1) {
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
@@ -1137,16 +1170,16 @@ Standard_Integer DistPC(const Standard_Real aT1,
|
||||
//function : SplitRangeOnSegments
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SplitRangeOnSegments(const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
const Standard_Real theResolution,
|
||||
const Standard_Integer theNbSeg,
|
||||
IntTools_SequenceOfRanges& theSegments)
|
||||
Standard_Integer SplitRangeOnSegments(const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
const Standard_Real theResolution,
|
||||
const Standard_Integer theNbSeg,
|
||||
IntTools_SequenceOfRanges& theSegments)
|
||||
{
|
||||
Standard_Real aDiff = aT2 - aT1;
|
||||
if (aDiff < theResolution || theNbSeg == 1) {
|
||||
theSegments.Append(IntTools_Range(aT1, aT2));
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
Standard_Real aDt, aT1x, aT2x, aSeg;
|
||||
@@ -1172,6 +1205,8 @@ void SplitRangeOnSegments(const Standard_Real aT1,
|
||||
//
|
||||
IntTools_Range aR(aT1x, aT2);
|
||||
theSegments.Append(aR);
|
||||
//
|
||||
return aNbSegments;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -70,14 +70,15 @@
|
||||
|
||||
static
|
||||
Standard_Boolean IsCoplanar (const BRepAdaptor_Curve& ,
|
||||
const BRepAdaptor_Surface& );
|
||||
const BRepAdaptor_Surface& );
|
||||
static
|
||||
Standard_Boolean IsRadius (const BRepAdaptor_Curve& aCurve ,
|
||||
const BRepAdaptor_Surface& aSurface);
|
||||
const BRepAdaptor_Surface& aSurface,
|
||||
const Standard_Real aCriteria);
|
||||
static
|
||||
Standard_Integer AdaptiveDiscret (const Standard_Integer iDiscret,
|
||||
const BRepAdaptor_Curve& aCurve ,
|
||||
const BRepAdaptor_Surface& aSurface);
|
||||
const BRepAdaptor_Curve& aCurve ,
|
||||
const BRepAdaptor_Surface& aSurface);
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_EdgeFace::IntTools_EdgeFace
|
||||
@@ -1309,14 +1310,14 @@ void IntTools_EdgeFace::Perform()
|
||||
if (bIsTouch) {
|
||||
aCP.SetType(TopAbs_VERTEX);
|
||||
aCP.SetVertexParameter1(aTx);
|
||||
aCP.SetRange1 (aTx, aTx);
|
||||
//aCP.SetRange1 (aTx, aTx);
|
||||
}
|
||||
}
|
||||
if (aType==TopAbs_VERTEX) {
|
||||
else if (aType==TopAbs_VERTEX) {
|
||||
bIsTouch=CheckTouchVertex (aCP, aTx);
|
||||
if (bIsTouch) {
|
||||
aCP.SetVertexParameter1(aTx);
|
||||
aCP.SetRange1 (aTx, aTx);
|
||||
//aCP.SetRange1 (aTx, aTx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1327,7 +1328,7 @@ void IntTools_EdgeFace::Perform()
|
||||
if (aCType==GeomAbs_Circle && aSType==GeomAbs_Plane) {
|
||||
Standard_Boolean bIsCoplanar, bIsRadius;
|
||||
bIsCoplanar=IsCoplanar(myC, myS);
|
||||
bIsRadius=IsRadius(myC, myS);
|
||||
bIsRadius=IsRadius(myC, myS, myCriteria);
|
||||
if (!bIsCoplanar && !bIsRadius) {
|
||||
for (i=1; i<=aNb; i++) {
|
||||
IntTools_CommonPrt& aCP=mySeqOfCommonPrts(i);
|
||||
@@ -1337,7 +1338,14 @@ void IntTools_EdgeFace::Perform()
|
||||
if (bIsTouch) {
|
||||
aCP.SetType(TopAbs_VERTEX);
|
||||
aCP.SetVertexParameter1(aTx);
|
||||
aCP.SetRange1 (aTx, aTx);
|
||||
//aCP.SetRange1 (aTx, aTx);
|
||||
}
|
||||
}
|
||||
else if (aType==TopAbs_VERTEX) {
|
||||
bIsTouch=CheckTouchVertex (aCP, aTx);
|
||||
if (bIsTouch) {
|
||||
aCP.SetVertexParameter1(aTx);
|
||||
//aCP.SetRange1 (aTx, aTx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1483,8 +1491,9 @@ Standard_Boolean IsCoplanar (const BRepAdaptor_Curve& aCurve ,
|
||||
//function : IsRadius
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsRadius (const BRepAdaptor_Curve& aCurve ,
|
||||
const BRepAdaptor_Surface& aSurface)
|
||||
Standard_Boolean IsRadius (const BRepAdaptor_Curve& aCurve,
|
||||
const BRepAdaptor_Surface& aSurface,
|
||||
const Standard_Real aCriteria)
|
||||
{
|
||||
Standard_Boolean bFlag=Standard_False;
|
||||
|
||||
@@ -1500,7 +1509,7 @@ Standard_Boolean IsRadius (const BRepAdaptor_Curve& aCurve ,
|
||||
Standard_Real aR=aCirc.Radius();
|
||||
gp_Pln aPln=aSurface.Plane();
|
||||
Standard_Real aD=aPln.Distance(aCenter);
|
||||
if (fabs (aD-aR) < 1.e-7) {
|
||||
if (fabs (aD-aR) < aCriteria) {
|
||||
return !bFlag;
|
||||
}
|
||||
}
|
||||
|
@@ -48,4 +48,13 @@ struct OpenGl_ArbFBO : protected OpenGl_GlFunctions
|
||||
|
||||
};
|
||||
|
||||
//! FBO blit is available in OpenGL 3.0+.
|
||||
//! Moved out from OpenGl_ArbFBO since it is unavailable in OpenGL ES 2.0.
|
||||
struct OpenGl_ArbFBOBlit : protected OpenGl_GlFunctions
|
||||
{
|
||||
|
||||
using OpenGl_GlFunctions::glBlitFramebuffer;
|
||||
|
||||
};
|
||||
|
||||
#endif // _OpenGl_ArbFBO_H__
|
||||
|
@@ -95,6 +95,7 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
||||
arbIns (NULL),
|
||||
arbDbg (NULL),
|
||||
arbFBO (NULL),
|
||||
arbFBOBlit (NULL),
|
||||
extGS (NULL),
|
||||
extBgra(Standard_False),
|
||||
extAnis(Standard_False),
|
||||
@@ -877,6 +878,7 @@ void OpenGl_Context::init()
|
||||
arbIns = NULL;
|
||||
arbDbg = NULL;
|
||||
arbFBO = NULL;
|
||||
arbFBOBlit = NULL;
|
||||
extGS = NULL;
|
||||
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
@@ -902,7 +904,12 @@ void OpenGl_Context::init()
|
||||
core20 = (OpenGl_GlCore20* )(&(*myFuncs));
|
||||
core20fwd = (OpenGl_GlCore20Fwd* )(&(*myFuncs));
|
||||
core15fwd = (OpenGl_GlCore15Fwd* )(&(*myFuncs));
|
||||
arbFBO = (OpenGl_ArbFBO* )(&(*myFuncs));
|
||||
arbFBO = (OpenGl_ArbFBO* )(&(*myFuncs));
|
||||
}
|
||||
if (IsGlGreaterEqual (3, 0)
|
||||
&& FindProc ("glBlitFramebuffer", myFuncs->glBlitFramebuffer))
|
||||
{
|
||||
arbFBOBlit = (OpenGl_ArbFBOBlit* )(&(*myFuncs));
|
||||
}
|
||||
|
||||
hasHighp = CheckExtension ("OES_fragment_precision_high");
|
||||
@@ -1762,7 +1769,8 @@ void OpenGl_Context::init()
|
||||
// initialize FBO extension (ARB)
|
||||
if (hasFBO)
|
||||
{
|
||||
arbFBO = (OpenGl_ArbFBO* )(&(*myFuncs));
|
||||
arbFBO = (OpenGl_ArbFBO* )(&(*myFuncs));
|
||||
arbFBOBlit = (OpenGl_ArbFBOBlit* )(&(*myFuncs));
|
||||
extPDS = Standard_True; // extension for EXT, but part of ARB
|
||||
}
|
||||
|
||||
|
@@ -45,6 +45,7 @@ struct OpenGl_ArbTBO;
|
||||
struct OpenGl_ArbIns;
|
||||
struct OpenGl_ArbDbg;
|
||||
struct OpenGl_ArbFBO;
|
||||
struct OpenGl_ArbFBOBlit;
|
||||
struct OpenGl_ExtGS;
|
||||
struct OpenGl_ArbTexBindless;
|
||||
|
||||
@@ -522,6 +523,7 @@ public: //! @name extensions
|
||||
OpenGl_ArbIns* arbIns; //!< GL_ARB_draw_instanced
|
||||
OpenGl_ArbDbg* arbDbg; //!< GL_ARB_debug_output
|
||||
OpenGl_ArbFBO* arbFBO; //!< GL_ARB_framebuffer_object
|
||||
OpenGl_ArbFBOBlit* arbFBOBlit; //!< glBlitFramebuffer function, moved out from OpenGl_ArbFBO structure for compatibility with OpenGL ES 2.0
|
||||
OpenGl_ExtGS* extGS; //!< GL_EXT_geometry_shader4
|
||||
Standard_Boolean extBgra; //!< GL_EXT_bgra or GL_EXT_texture_format_BGRA8888 on OpenGL ES
|
||||
Standard_Boolean extAnis; //!< GL_EXT_texture_filter_anisotropic
|
||||
|
@@ -20,22 +20,6 @@
|
||||
IMPLEMENT_STANDARD_HANDLE (OpenGl_FrameBuffer, OpenGl_Resource)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_FrameBuffer, OpenGl_Resource)
|
||||
|
||||
static inline bool isOddNumber (const GLsizei theNumber)
|
||||
{
|
||||
return theNumber & 0x01;
|
||||
}
|
||||
|
||||
static inline GLsizei getEvenNumber (const GLsizei theNumber)
|
||||
{
|
||||
return isOddNumber (theNumber) ? (theNumber + 1) : theNumber;
|
||||
}
|
||||
|
||||
//! Notice - 0 is not power of two here
|
||||
static inline bool isPowerOfTwo (const GLsizei theNumber)
|
||||
{
|
||||
return !(theNumber & (theNumber - 1));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_FrameBuffer
|
||||
// purpose :
|
||||
@@ -176,6 +160,24 @@ void OpenGl_FrameBuffer::BindBuffer (const Handle(OpenGl_Context)& theGlCtx)
|
||||
theGlCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : BindDrawBuffer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_FrameBuffer::BindDrawBuffer (const Handle(OpenGl_Context)& theGlCtx)
|
||||
{
|
||||
theGlCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, myGlFBufferId);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : BindReadBuffer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_FrameBuffer::BindReadBuffer (const Handle(OpenGl_Context)& theGlCtx)
|
||||
{
|
||||
theGlCtx->arbFBO->glBindFramebuffer (GL_READ_FRAMEBUFFER, myGlFBufferId);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : UnbindBuffer
|
||||
// purpose :
|
||||
|
@@ -92,9 +92,15 @@ public:
|
||||
Standard_EXPORT void ChangeViewport (const GLsizei theVPSizeX,
|
||||
const GLsizei theVPSizeY);
|
||||
|
||||
//! Bind frame buffer (to render into the texture).
|
||||
//! Bind frame buffer for drawing and reading (to render into the texture).
|
||||
Standard_EXPORT virtual void BindBuffer (const Handle(OpenGl_Context)& theGlCtx);
|
||||
|
||||
//! Bind frame buffer for drawing GL_DRAW_FRAMEBUFFER (to render into the texture).
|
||||
Standard_EXPORT virtual void BindDrawBuffer (const Handle(OpenGl_Context)& theGlCtx);
|
||||
|
||||
//! Bind frame buffer for reading GL_READ_FRAMEBUFFER
|
||||
Standard_EXPORT virtual void BindReadBuffer (const Handle(OpenGl_Context)& theGlCtx);
|
||||
|
||||
//! Unbind frame buffer.
|
||||
Standard_EXPORT virtual void UnbindBuffer (const Handle(OpenGl_Context)& theGlCtx);
|
||||
|
||||
|
@@ -95,6 +95,9 @@
|
||||
#define GL_UNSIGNED_INT_24_8 0x84FA
|
||||
#define GL_DEPTH24_STENCIL8 0x88F0
|
||||
|
||||
#define GL_READ_FRAMEBUFFER 0x8CA8
|
||||
#define GL_DRAW_FRAMEBUFFER 0x8CA9
|
||||
|
||||
// GL_EXT_texture_filter_anisotropic
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||
@@ -688,6 +691,11 @@ public: //! @name OpenGL ES 2.0
|
||||
::glVertexAttribPointer (index, size, type, normalized, stride, pointer);
|
||||
}
|
||||
|
||||
public: //! @name OpenGL ES 3.0
|
||||
|
||||
typedef void (*glBlitFramebuffer_t)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
glBlitFramebuffer_t glBlitFramebuffer;
|
||||
|
||||
#else // OpenGL ES vs. desktop
|
||||
|
||||
public: //! @name OpenGL 1.2
|
||||
|
@@ -234,6 +234,7 @@ void OpenGl_ShaderManager::clear()
|
||||
myFlatPrograms = OpenGl_SetOfShaderPrograms();
|
||||
myMapOfLightPrograms.Clear();
|
||||
myFontProgram.Nullify();
|
||||
myBlitProgram.Nullify();
|
||||
switchLightPrograms();
|
||||
}
|
||||
|
||||
@@ -1030,6 +1031,69 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramFont()
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : prepareStdProgramFboBlit
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_ShaderManager::prepareStdProgramFboBlit()
|
||||
{
|
||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||
TCollection_AsciiString aSrcVert =
|
||||
EOL"THE_SHADER_OUT vec2 TexCoord;"
|
||||
EOL"void main()"
|
||||
EOL"{"
|
||||
EOL" TexCoord = occVertex.zw;"
|
||||
EOL" gl_Position = vec4(occVertex.x, occVertex.y, 0.0, 1.0);"
|
||||
EOL"}";
|
||||
|
||||
TCollection_AsciiString aSrcFrag =
|
||||
EOL"uniform sampler2D uColorSampler;"
|
||||
EOL"uniform sampler2D uDepthSampler;"
|
||||
EOL
|
||||
EOL"THE_SHADER_IN vec2 TexCoord;"
|
||||
EOL
|
||||
EOL"void main()"
|
||||
EOL"{"
|
||||
EOL" gl_FragDepth = occTexture2D (uDepthSampler, TexCoord).r;"
|
||||
EOL" occFragColor = occTexture2D (uColorSampler, TexCoord);"
|
||||
EOL"}";
|
||||
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
if (myContext->IsGlGreaterEqual (3, 0))
|
||||
{
|
||||
aProgramSrc->SetHeader ("#version 300 es");
|
||||
}
|
||||
else
|
||||
{
|
||||
// there is no way to draw into depth buffer
|
||||
aSrcFrag =
|
||||
EOL"uniform sampler2D uColorSampler;"
|
||||
EOL
|
||||
EOL"THE_SHADER_IN vec2 TexCoord;"
|
||||
EOL
|
||||
EOL"void main()"
|
||||
EOL"{"
|
||||
EOL" occFragColor = occTexture2D (uColorSampler, TexCoord);"
|
||||
EOL"}";
|
||||
}
|
||||
#endif
|
||||
|
||||
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (Graphic3d_TOS_VERTEX, aSrcVert));
|
||||
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (Graphic3d_TOS_FRAGMENT, aSrcFrag));
|
||||
TCollection_AsciiString aKey;
|
||||
if (!Create (aProgramSrc, aKey, myBlitProgram))
|
||||
{
|
||||
myBlitProgram = new OpenGl_ShaderProgram(); // just mark as invalid
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myContext->BindProgram (myBlitProgram);
|
||||
myBlitProgram->SetSampler (myContext, "uColorSampler", 0);
|
||||
myBlitProgram->SetSampler (myContext, "uDepthSampler", 1);
|
||||
myContext->BindProgram (NULL);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : prepareStdProgramFlat
|
||||
// purpose :
|
||||
|
@@ -145,6 +145,17 @@ public:
|
||||
return bindProgramWithState (myFontProgram, theAspect);
|
||||
}
|
||||
|
||||
//! Bind program for FBO blit operation.
|
||||
Standard_Boolean BindFboBlitProgram()
|
||||
{
|
||||
if (myBlitProgram.IsNull())
|
||||
{
|
||||
prepareStdProgramFboBlit();
|
||||
}
|
||||
return !myBlitProgram.IsNull()
|
||||
&& myContext->BindProgram (myBlitProgram);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Returns current state of OCCT light sources.
|
||||
@@ -292,6 +303,9 @@ protected:
|
||||
//! Prepare standard GLSL program for textured font.
|
||||
Standard_EXPORT Standard_Boolean prepareStdProgramFont();
|
||||
|
||||
//! Prepare standard GLSL program for FBO blit operation.
|
||||
Standard_EXPORT Standard_Boolean prepareStdProgramFboBlit();
|
||||
|
||||
//! Prepare standard GLSL program without lighting.
|
||||
Standard_EXPORT Standard_Boolean prepareStdProgramFlat (Handle(OpenGl_ShaderProgram)& theProgram,
|
||||
const Standard_Integer theBits);
|
||||
@@ -331,6 +345,7 @@ protected:
|
||||
Handle(OpenGl_SetOfShaderPrograms) myLightPrograms; //!< pointer to active lighting programs matrix
|
||||
OpenGl_SetOfShaderPrograms myFlatPrograms; //!< programs matrix without lighting
|
||||
Handle(OpenGl_ShaderProgram) myFontProgram; //!< standard program for textured text
|
||||
Handle(OpenGl_ShaderProgram) myBlitProgram; //!< standard program for FBO blit emulation
|
||||
OpenGl_MapOfShaderPrograms myMapOfLightPrograms; //!< map of lighting programs depending on shading model and lights configuration
|
||||
|
||||
OpenGl_Context* myContext; //!< OpenGL context
|
||||
|
@@ -155,6 +155,10 @@ Standard_Boolean OpenGl_ShaderProgram::Initialize (const Handle(OpenGl_Context)&
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aHeader = !myProxy.IsNull() && !myProxy->Header().IsEmpty()
|
||||
? (myProxy->Header() + "\n")
|
||||
: TCollection_AsciiString();
|
||||
|
||||
TCollection_AsciiString aDeclarations;
|
||||
aDeclFile.Open (OSD_ReadOnly, OSD_Protection());
|
||||
aDeclFile.Read (aDeclarations, (int)aDeclFile.Size());
|
||||
@@ -216,7 +220,7 @@ Standard_Boolean OpenGl_ShaderProgram::Initialize (const Handle(OpenGl_Context)&
|
||||
{
|
||||
case Graphic3d_TOS_VERTEX:
|
||||
{
|
||||
aSource = TCollection_AsciiString ("#define VERTEX_SHADER\n") + aSource;
|
||||
aSource = aHeader + TCollection_AsciiString ("#define VERTEX_SHADER\n") + aSource;
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TOS_FRAGMENT:
|
||||
@@ -225,7 +229,7 @@ Standard_Boolean OpenGl_ShaderProgram::Initialize (const Handle(OpenGl_Context)&
|
||||
TCollection_AsciiString aPrefix (theCtx->hasHighp
|
||||
? "precision highp float;\n"
|
||||
: "precision mediump float;\n");
|
||||
aSource = aPrefix + aSource;
|
||||
aSource = aHeader + aPrefix + aSource;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -644,7 +648,7 @@ Standard_Boolean OpenGl_ShaderProgram::SetAttributeName (const Handle(OpenGl_Con
|
||||
theCtx->core20fwd->glBindAttribLocation (myProgramID, theIndex, theName);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================
|
||||
// function : SetAttribute
|
||||
// purpose :
|
||||
|
@@ -306,8 +306,8 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||
myBVHSelector.SetViewVolume (myCamera);
|
||||
}
|
||||
|
||||
const Handle(OpenGl_ShaderManager) aManager = aContext->ShaderManager();
|
||||
const Standard_Boolean isSameView = aManager->IsSameView (this); // force camera state update when needed
|
||||
const Handle(OpenGl_ShaderManager)& aManager = aContext->ShaderManager();
|
||||
const Standard_Boolean isSameView = aManager->IsSameView (this); // force camera state update when needed
|
||||
if (StateInfo (myCurrLightSourceState, aManager->LightSourceState().Index()) != myLastLightSourceState)
|
||||
{
|
||||
aManager->UpdateLightSourceStateTo (&myLights);
|
||||
|
@@ -14,6 +14,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <OpenGl_GlCore15.hxx>
|
||||
#include <OpenGl_ArbFBO.hxx>
|
||||
|
||||
#include <InterfaceGraphic.hxx>
|
||||
|
||||
@@ -26,6 +27,7 @@
|
||||
#include <OpenGl_FrameBuffer.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
#include <OpenGl_Sampler.hxx>
|
||||
#include <OpenGl_ShaderManager.hxx>
|
||||
#include <OpenGl_Texture.hxx>
|
||||
#include <OpenGl_Utils.hxx>
|
||||
#include <OpenGl_View.hxx>
|
||||
@@ -179,6 +181,7 @@ OpenGl_Workspace::OpenGl_Workspace (const Handle(OpenGl_GraphicDriver)& theDrive
|
||||
PolygonOffset_applied (THE_DEFAULT_POFFSET)
|
||||
{
|
||||
myGlContext->core11fwd->glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
|
||||
myResultFBO = new OpenGl_FrameBuffer();
|
||||
|
||||
if (!myGlContext->GetResource ("OpenGl_LineAttributes", myLineAttribs))
|
||||
{
|
||||
@@ -234,6 +237,16 @@ OpenGl_Workspace::~OpenGl_Workspace()
|
||||
myGlContext->ReleaseResource ("OpenGl_LineAttributes", Standard_True);
|
||||
}
|
||||
|
||||
if (!myResultFBO.IsNull())
|
||||
{
|
||||
myResultFBO->Release (myGlContext.operator->());
|
||||
myResultFBO.Nullify();
|
||||
}
|
||||
if (myFullScreenQuad.IsValid())
|
||||
{
|
||||
myFullScreenQuad.Release (myGlContext.operator->());
|
||||
}
|
||||
|
||||
ReleaseRaytraceResources();
|
||||
}
|
||||
|
||||
@@ -655,6 +668,22 @@ void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView,
|
||||
aGlCtx->core11fwd->glViewport (0, 0, myWidth, myHeight);
|
||||
}
|
||||
|
||||
Standard_Integer aSizeX = aFrameBuffer != NULL ? aFrameBuffer->GetVPSizeX() : myWidth;
|
||||
Standard_Integer aSizeY = aFrameBuffer != NULL ? aFrameBuffer->GetVPSizeY() : myHeight;
|
||||
|
||||
if (myResultFBO->GetVPSizeX() != aSizeX
|
||||
|| myResultFBO->GetVPSizeY() != aSizeY)
|
||||
{
|
||||
myResultFBO->Init (aGlCtx, aSizeX, aSizeY);
|
||||
}
|
||||
if (myResultFBO->IsValid())
|
||||
{
|
||||
myResultFBO->SetupViewport (aGlCtx);
|
||||
}
|
||||
|
||||
const Standard_Boolean isImmediate = myView->HasImmediateStructures()
|
||||
|| myResultFBO->IsValid();
|
||||
|
||||
myToRedrawGL = Standard_True;
|
||||
if (theCView.RenderParams.Method == Graphic3d_RM_RAYTRACING
|
||||
&& myComputeInitStatus != OpenGl_RT_FAIL)
|
||||
@@ -668,9 +697,6 @@ void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView,
|
||||
myRaytraceFilter->SetPrevRenderFilter (aRenderFilter);
|
||||
SetRenderFilter (myRaytraceFilter);
|
||||
|
||||
Standard_Integer aSizeX = aFrameBuffer != NULL ? aFrameBuffer->GetVPSizeX() : myWidth;
|
||||
Standard_Integer aSizeY = aFrameBuffer != NULL ? aFrameBuffer->GetVPSizeY() : myHeight;
|
||||
|
||||
if (myOpenGlFBO.IsNull())
|
||||
{
|
||||
myOpenGlFBO = new OpenGl_FrameBuffer();
|
||||
@@ -690,13 +716,13 @@ void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView,
|
||||
redraw1 (theCView, anEmptyCLayer, anEmptyCLayer, 0);
|
||||
myOpenGlFBO->UnbindBuffer (aGlCtx);
|
||||
|
||||
const Standard_Boolean isImmediate = myView->HasImmediateStructures();
|
||||
Raytrace (theCView, aSizeX, aSizeY, isImmediate ? 0 : toSwap,
|
||||
theCOverLayer, theCUnderLayer, aFrameBuffer);
|
||||
theCOverLayer, theCUnderLayer,
|
||||
myResultFBO->IsValid() ? myResultFBO.operator->() : aFrameBuffer);
|
||||
|
||||
if (isImmediate)
|
||||
{
|
||||
RedrawImmediate (theCView, theCUnderLayer, theCOverLayer, Standard_True);
|
||||
RedrawImmediate (theCView, theCUnderLayer, theCOverLayer, Standard_True, aFrameBuffer);
|
||||
}
|
||||
|
||||
SetRenderFilter (aRenderFilter);
|
||||
@@ -708,16 +734,19 @@ void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView,
|
||||
if (myToRedrawGL)
|
||||
{
|
||||
// draw entire frame using normal OpenGL pipeline
|
||||
if (aFrameBuffer != NULL)
|
||||
if (myResultFBO->IsValid())
|
||||
{
|
||||
myResultFBO->BindBuffer (aGlCtx);
|
||||
}
|
||||
else if (aFrameBuffer != NULL)
|
||||
{
|
||||
aFrameBuffer->BindBuffer (aGlCtx);
|
||||
}
|
||||
|
||||
const Standard_Boolean isImmediate = myView->HasImmediateStructures();
|
||||
redraw1 (theCView, theCUnderLayer, theCOverLayer, isImmediate ? 0 : toSwap);
|
||||
if (isImmediate)
|
||||
{
|
||||
RedrawImmediate (theCView, theCUnderLayer, theCOverLayer, Standard_True);
|
||||
RedrawImmediate (theCView, theCUnderLayer, theCOverLayer, Standard_True, aFrameBuffer);
|
||||
}
|
||||
|
||||
theCView.WasRedrawnGL = Standard_True;
|
||||
@@ -902,7 +931,8 @@ void OpenGl_Workspace::DisplayCallback (const Graphic3d_CView& theCView,
|
||||
void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer,
|
||||
const Standard_Boolean theToForce)
|
||||
const Standard_Boolean theToForce,
|
||||
OpenGl_FrameBuffer* theTargetFBO)
|
||||
{
|
||||
if (!Activate())
|
||||
{
|
||||
@@ -913,7 +943,8 @@ void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glGetBooleanv (GL_DOUBLEBUFFER, &isDoubleBuffer);
|
||||
#endif
|
||||
if (!myView->HasImmediateStructures())
|
||||
if (!myView->HasImmediateStructures()
|
||||
&& !myResultFBO->IsValid())
|
||||
{
|
||||
if (theToForce
|
||||
|| !myIsImmediateDrawn)
|
||||
@@ -935,7 +966,94 @@ void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDoubleBuffer && myTransientDrawToFront)
|
||||
if (myResultFBO->IsValid()
|
||||
&& myGlContext->IsRender())
|
||||
{
|
||||
if (!myBackBufferRestored)
|
||||
{
|
||||
Redraw (theCView, theCUnderLayer, theCOverLayer);
|
||||
return;
|
||||
}
|
||||
|
||||
// clear destination before blitting
|
||||
if (theTargetFBO != NULL)
|
||||
{
|
||||
theTargetFBO->BindBuffer (myGlContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
myGlContext->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
||||
}
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
myGlContext->core20fwd->glClearDepth (1.0);
|
||||
#else
|
||||
myGlContext->core20fwd->glClearDepthf (1.0f);
|
||||
#endif
|
||||
myGlContext->core20fwd->glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
/*#if !defined(GL_ES_VERSION_2_0)
|
||||
if (myGlContext->arbFBOBlit != NULL)
|
||||
{
|
||||
myResultFBO->BindReadBuffer (myGlContext);
|
||||
if (theTargetFBO != NULL)
|
||||
{
|
||||
theTargetFBO->BindDrawBuffer (myGlContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
myGlContext->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
||||
}
|
||||
// we don't copy stencil buffer here... does it matter for performance?
|
||||
myGlContext->arbFBOBlit->glBlitFramebuffer (0, 0, myResultFBO->GetVPSizeX(), myResultFBO->GetVPSizeY(),
|
||||
0, 0, myResultFBO->GetVPSizeX(), myResultFBO->GetVPSizeY(),
|
||||
GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||
|
||||
if (theTargetFBO != NULL)
|
||||
{
|
||||
theTargetFBO->BindBuffer (myGlContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
myGlContext->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif*/
|
||||
{
|
||||
myGlContext->core20fwd->glDepthFunc (GL_ALWAYS);
|
||||
myGlContext->core20fwd->glDepthMask (GL_TRUE);
|
||||
myGlContext->core20fwd->glEnable (GL_DEPTH_TEST);
|
||||
|
||||
DisableTexture();
|
||||
if (!myFullScreenQuad.IsValid())
|
||||
{
|
||||
OpenGl_Vec4 aQuad[4] =
|
||||
{
|
||||
OpenGl_Vec4( 1.0f, -1.0f, 1.0f, 0.0f),
|
||||
OpenGl_Vec4( 1.0f, 1.0f, 1.0f, 1.0f),
|
||||
OpenGl_Vec4(-1.0f, -1.0f, 0.0f, 0.0f),
|
||||
OpenGl_Vec4(-1.0f, 1.0f, 0.0f, 1.0f)
|
||||
};
|
||||
myFullScreenQuad.Init (myGlContext, 4, 4, aQuad[0].GetData());
|
||||
}
|
||||
|
||||
const Handle(OpenGl_ShaderManager)& aManager = myGlContext->ShaderManager();
|
||||
if (myFullScreenQuad.IsValid()
|
||||
&& aManager->BindFboBlitProgram())
|
||||
{
|
||||
myResultFBO->ColorTexture() ->Bind (myGlContext, GL_TEXTURE0 + 0);
|
||||
myResultFBO->DepthStencilTexture()->Bind (myGlContext, GL_TEXTURE0 + 1);
|
||||
myFullScreenQuad.BindVertexAttrib (myGlContext, 0);
|
||||
|
||||
myGlContext->core20fwd->glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
myFullScreenQuad.UnbindVertexAttrib (myGlContext, 0);
|
||||
myResultFBO->DepthStencilTexture()->Unbind (myGlContext, GL_TEXTURE0 + 1);
|
||||
myResultFBO->ColorTexture() ->Unbind (myGlContext, GL_TEXTURE0 + 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isDoubleBuffer && myTransientDrawToFront)
|
||||
{
|
||||
if (!myBackBufferRestored)
|
||||
{
|
||||
@@ -994,7 +1112,16 @@ void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
aStructure->Render (aWS);
|
||||
}
|
||||
|
||||
if (isDoubleBuffer && myTransientDrawToFront)
|
||||
if (myResultFBO->IsValid())
|
||||
{
|
||||
if (theTargetFBO == NULL
|
||||
&& myGlContext->IsRender()
|
||||
&& !myGlContext->caps->buffersNoSwap)
|
||||
{
|
||||
myGlContext->SwapBuffers();
|
||||
}
|
||||
}
|
||||
else if (isDoubleBuffer && myTransientDrawToFront)
|
||||
{
|
||||
glFlush();
|
||||
MakeBackBufCurrent();
|
||||
|
@@ -152,7 +152,8 @@ public:
|
||||
void RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer,
|
||||
const Standard_Boolean theToForce = Standard_False);
|
||||
const Standard_Boolean theToForce = Standard_False,
|
||||
OpenGl_FrameBuffer* theTargetFBO = NULL);
|
||||
|
||||
void Invalidate (const Graphic3d_CView& /*theCView*/)
|
||||
{
|
||||
@@ -626,6 +627,12 @@ protected: //! @name fields related to ray-tracing
|
||||
//! Framebuffer (FBO) for pre-raytrace rendering by OpenGL.
|
||||
Handle(OpenGl_FrameBuffer) myOpenGlFBO;
|
||||
|
||||
//! Framebuffer stores cached main presentation of the view (without presentation of immediate layers).
|
||||
Handle(OpenGl_FrameBuffer) myResultFBO;
|
||||
|
||||
//! Vertices for full-screen quad rendering.
|
||||
OpenGl_VertexBuffer myFullScreenQuad;
|
||||
|
||||
//! State of OpenGL view.
|
||||
Standard_Size myViewModificationStatus;
|
||||
//! State of OpenGL layer list.
|
||||
|
@@ -72,15 +72,17 @@ ProjLib_PrjResolve::ProjLib_PrjResolve(const Adaptor3d_Curve& C,const Adaptor3d_
|
||||
// if (!S1.IsDone()) { return; }
|
||||
// }
|
||||
// else {
|
||||
math_NewtonFunctionSetRoot SR (F, Tol, 1.e-10);
|
||||
SR.Perform(F, Start, BInf, BSup);
|
||||
math_NewtonFunctionSetRoot SR (F, Tol, 1.e-10);
|
||||
SR.Perform(F, Start, BInf, BSup);
|
||||
// if (!SR.IsDone()) { return; }
|
||||
if (!SR.IsDone()) {
|
||||
math_FunctionSetRoot S1 (F, Start,Tol, BInf, BSup);
|
||||
if (!S1.IsDone()) { return; }
|
||||
}
|
||||
|
||||
if (!SR.IsDone())
|
||||
{
|
||||
math_FunctionSetRoot S1 (F, Tol);
|
||||
S1.Perform(F, Start, BInf, BSup);
|
||||
|
||||
if (!S1.IsDone())
|
||||
return;
|
||||
}
|
||||
|
||||
mySolution.SetXY(F.Solution().XY());
|
||||
|
||||
|
@@ -1802,7 +1802,7 @@ struct QABugs_NHandleClass
|
||||
#include <STEPCAFControl_Writer.hxx>
|
||||
static Standard_Integer OCC23951 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
|
||||
{
|
||||
if (argc != 1) {
|
||||
if (argc != 2) {
|
||||
di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
|
||||
return 1;
|
||||
}
|
||||
@@ -1824,7 +1824,7 @@ static Standard_Integer OCC23951 (Draw_Interpretor& di, Standard_Integer argc, c
|
||||
return 1;
|
||||
}
|
||||
|
||||
writer.Write("test_box.step");
|
||||
writer.Write(argv[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2247,11 +2247,11 @@ static TopoDS_Shape CreateTestShape (int& theShapeNb)
|
||||
#include <TNaming_Builder.hxx>
|
||||
static Standard_Integer OCC24931 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 1) {
|
||||
if (argc != 2) {
|
||||
di << "Usage: " << argv[0] << " invalid number of arguments"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
TCollection_ExtendedString aFileName ("testdocument.xml");
|
||||
TCollection_ExtendedString aFileName (argv[1]);
|
||||
PCDM_StoreStatus aSStatus = PCDM_SS_Failure;
|
||||
|
||||
Handle(TDocStd_Application) anApp = new AppStd_Application;
|
||||
@@ -3593,8 +3593,8 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
||||
theCommands.Add ("OCC24755", "OCC24755", __FILE__, OCC24755, group);
|
||||
theCommands.Add ("OCC24834", "OCC24834", __FILE__, OCC24834, group);
|
||||
theCommands.Add ("OCC24889", "OCC24889", __FILE__, OCC24889, group);
|
||||
theCommands.Add ("OCC23951", "OCC23951", __FILE__, OCC23951, group);
|
||||
theCommands.Add ("OCC24931", "OCC24931", __FILE__, OCC24931, group);
|
||||
theCommands.Add ("OCC23951", "OCC23951 path to saved step file", __FILE__, OCC23951, group);
|
||||
theCommands.Add ("OCC24931", "OCC24931 path to saved xml file", __FILE__, OCC24931, group);
|
||||
theCommands.Add ("OCC24945", "OCC24945", __FILE__, OCC24945, group);
|
||||
theCommands.Add ("OCC23950", "OCC23950 step_file", __FILE__, OCC23950, group);
|
||||
theCommands.Add ("OCC25004", "OCC25004", __FILE__, OCC25004, group);
|
||||
|
@@ -18,12 +18,31 @@
|
||||
#define THE_MAX_LIGHTS 8
|
||||
#define THE_MAX_CLIP_PLANES 8
|
||||
|
||||
// compatibility macros
|
||||
#if (__VERSION__ >= 130)
|
||||
#define THE_ATTRIBUTE in
|
||||
#define THE_SHADER_IN in
|
||||
#define THE_SHADER_OUT out
|
||||
#define THE_OUT out
|
||||
#define occTexture2D texture
|
||||
#else
|
||||
#define THE_ATTRIBUTE attribute
|
||||
#define THE_SHADER_IN varying
|
||||
#define THE_SHADER_OUT varying
|
||||
#define THE_OUT
|
||||
#define occTexture2D texture2D
|
||||
#endif
|
||||
|
||||
// Vertex attributes
|
||||
#ifdef VERTEX_SHADER
|
||||
attribute vec4 occVertex;
|
||||
attribute vec3 occNormal;
|
||||
attribute vec4 occTexCoord;
|
||||
attribute vec4 occVertColor;
|
||||
THE_ATTRIBUTE vec4 occVertex;
|
||||
THE_ATTRIBUTE vec3 occNormal;
|
||||
THE_ATTRIBUTE vec4 occTexCoord;
|
||||
THE_ATTRIBUTE vec4 occVertColor;
|
||||
#elif (__VERSION__ >= 130)
|
||||
out vec4 occFragColor;
|
||||
#else
|
||||
#define occFragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
// Matrix state
|
||||
|
@@ -1287,7 +1287,8 @@ Standard_Boolean ShapeFix_ComposeShell::SplitByLine (ShapeFix_WireSegment &wire,
|
||||
// get bounding box of pcurve
|
||||
ShapeAnalysis_Curve sac;
|
||||
Bnd_Box2d box;
|
||||
sac.FillBndBox ( c2d, f, l, 11, Standard_True, box );
|
||||
const Standard_Integer aNbPoints = 41;
|
||||
sac.FillBndBox ( c2d, f, l, aNbPoints, Standard_True, box );
|
||||
Standard_Real umin, vmin, umax, vmax;
|
||||
box.Get ( umin, vmin, umax, vmax );
|
||||
|
||||
|
@@ -169,6 +169,8 @@ is
|
||||
instantiates Sequence from TCollection (Vec from gp);
|
||||
class SequenceOfXYZ
|
||||
instantiates Sequence from TCollection (XYZ from gp);
|
||||
class SequenceOfAx1
|
||||
instantiates Sequence from TCollection (Ax1 from gp);
|
||||
|
||||
|
||||
-- HSequences of 3D objects.
|
||||
|
@@ -29,7 +29,7 @@ is
|
||||
|
||||
---Category: Public
|
||||
|
||||
Create(aMgr : LayerMgr from V3d)
|
||||
Create(theMgr : LayerMgr from V3d)
|
||||
returns ColorScale from V3d;
|
||||
---Purpose: Returns returns ColorScale from V3d.
|
||||
|
||||
@@ -57,30 +57,30 @@ is
|
||||
--returns Boolean from Standard
|
||||
--is redefined protected;
|
||||
|
||||
PaintRect(me : mutable; X, Y, W, H : Integer from Standard;
|
||||
aColor : Color from Quantity;
|
||||
aFilled : Boolean from Standard = Standard_False)
|
||||
PaintRect(me : mutable; theX, theY, theWidth, theHeight : Integer from Standard;
|
||||
theColor : Color from Quantity;
|
||||
theFilled : Boolean from Standard = Standard_False)
|
||||
is redefined;
|
||||
|
||||
PaintText(me : mutable; aText : ExtendedString from TCollection;
|
||||
X, Y : Integer from Standard;
|
||||
aColor : Color from Quantity)
|
||||
PaintText(me : mutable; theText : ExtendedString from TCollection;
|
||||
theX, theY : Integer from Standard;
|
||||
theColor : Color from Quantity)
|
||||
is redefined;
|
||||
|
||||
TextWidth(me; aText : ExtendedString from TCollection)
|
||||
TextWidth(me; theText : ExtendedString from TCollection)
|
||||
returns Integer from Standard
|
||||
is redefined;
|
||||
|
||||
TextHeight(me; aText : ExtendedString from TCollection)
|
||||
TextHeight(me; theText : ExtendedString from TCollection)
|
||||
returns Integer from Standard
|
||||
is redefined;
|
||||
|
||||
TextSize( me;
|
||||
AText : ExtendedString from TCollection;
|
||||
AHeight : Integer from Standard;
|
||||
AWidth : in out Integer from Standard;
|
||||
AnAscent : in out Integer from Standard;
|
||||
ADescent : in out Integer from Standard );
|
||||
theText : ExtendedString from TCollection;
|
||||
theHeight : Integer from Standard;
|
||||
theWidth : in out Integer from Standard;
|
||||
theAscent : in out Integer from Standard;
|
||||
theDescent : in out Integer from Standard );
|
||||
|
||||
DrawScale(me : mutable);
|
||||
|
||||
|
@@ -31,9 +31,9 @@
|
||||
#include <TColStd_SequenceOfExtendedString.hxx>
|
||||
#include <Font_NameOfFont.hxx>
|
||||
|
||||
V3d_ColorScale::V3d_ColorScale( const Handle(V3d_LayerMgr)& aMgr )
|
||||
V3d_ColorScale::V3d_ColorScale (const Handle(V3d_LayerMgr)& theMgr)
|
||||
: Aspect_ColorScale(),
|
||||
myLayerMgr( aMgr.operator->() ),
|
||||
myLayerMgr( theMgr.operator->() ),
|
||||
myDisplay( Standard_False )
|
||||
{
|
||||
}
|
||||
@@ -60,94 +60,94 @@ void V3d_ColorScale::UpdateColorScale()
|
||||
myLayerMgr->Compute();
|
||||
}
|
||||
|
||||
void V3d_ColorScale::PaintRect( const Standard_Integer X, const Standard_Integer Y,
|
||||
const Standard_Integer W, const Standard_Integer H,
|
||||
const Quantity_Color& aColor, const Standard_Boolean aFilled )
|
||||
void V3d_ColorScale::PaintRect (const Standard_Integer theX, const Standard_Integer theY,
|
||||
const Standard_Integer theWidth, const Standard_Integer theHeight,
|
||||
const Quantity_Color& theColor, const Standard_Boolean theFilled)
|
||||
{
|
||||
const Handle(Visual3d_Layer) &theLayer = myLayerMgr->Overlay();
|
||||
if ( theLayer.IsNull() )
|
||||
if (theLayer.IsNull())
|
||||
return;
|
||||
|
||||
theLayer->SetColor( aColor );
|
||||
if ( aFilled )
|
||||
theLayer->DrawRectangle( X, Y, W, H );
|
||||
theLayer->SetColor (theColor);
|
||||
if (theFilled)
|
||||
theLayer->DrawRectangle (theX, theY, theWidth, theHeight);
|
||||
else {
|
||||
theLayer->SetLineAttributes( Aspect_TOL_SOLID, 0.5 );
|
||||
theLayer->BeginPolyline();
|
||||
theLayer->AddVertex( X, Y, Standard_False );
|
||||
theLayer->AddVertex( X, Y + H, Standard_True );
|
||||
theLayer->AddVertex( X + W, Y + H, Standard_True );
|
||||
theLayer->AddVertex( X + W, Y, Standard_True );
|
||||
theLayer->AddVertex( X, Y, Standard_True );
|
||||
theLayer->AddVertex (theX, theY, Standard_False);
|
||||
theLayer->AddVertex (theX, theY + theHeight, Standard_True);
|
||||
theLayer->AddVertex (theX + theWidth, theY + theHeight, Standard_True);
|
||||
theLayer->AddVertex (theX + theWidth, theY, Standard_True);
|
||||
theLayer->AddVertex (theX, theY, Standard_True);
|
||||
theLayer->ClosePrimitive();
|
||||
}
|
||||
}
|
||||
|
||||
void V3d_ColorScale::PaintText( const TCollection_ExtendedString& aText,
|
||||
const Standard_Integer X, const Standard_Integer Y,
|
||||
const Quantity_Color& aColor )
|
||||
void V3d_ColorScale::PaintText (const TCollection_ExtendedString& theText,
|
||||
const Standard_Integer theX, const Standard_Integer theY,
|
||||
const Quantity_Color& theColor)
|
||||
{
|
||||
const Handle(Visual3d_Layer) &theLayer = myLayerMgr->Overlay();
|
||||
if ( theLayer.IsNull() )
|
||||
if (theLayer.IsNull())
|
||||
return;
|
||||
|
||||
theLayer->SetColor( aColor );
|
||||
theLayer->SetTextAttributes( Font_NOF_ASCII_MONO, Aspect_TODT_NORMAL, aColor );
|
||||
TCollection_AsciiString theText( aText.ToExtString(), '?' );
|
||||
theLayer->SetColor (theColor);
|
||||
theLayer->SetTextAttributes (Font_NOF_ASCII_MONO, Aspect_TODT_NORMAL, theColor);
|
||||
TCollection_AsciiString aText (theText.ToExtString(), '?');
|
||||
Standard_Integer aTextH = GetTextHeight();
|
||||
Standard_Integer aWidth, anAscent, aDescent;
|
||||
TextSize(aText, aTextH, aWidth, anAscent, aDescent);
|
||||
theLayer->DrawText( theText.ToCString(), X, Y + anAscent, aTextH);
|
||||
TextSize (theText, aTextH, aWidth, anAscent, aDescent);
|
||||
theLayer->DrawText (aText.ToCString(), theX, theY + anAscent, aTextH);
|
||||
}
|
||||
|
||||
Standard_Integer V3d_ColorScale::TextWidth( const TCollection_ExtendedString& aText ) const
|
||||
Standard_Integer V3d_ColorScale::TextWidth (const TCollection_ExtendedString& theText) const
|
||||
{
|
||||
Standard_Integer aWidth, anAscent, aDescent;
|
||||
TextSize(aText, GetTextHeight(), aWidth, anAscent, aDescent);
|
||||
TextSize (theText, GetTextHeight(), aWidth, anAscent, aDescent);
|
||||
return aWidth;
|
||||
}
|
||||
|
||||
Standard_Integer V3d_ColorScale::TextHeight( const TCollection_ExtendedString& aText ) const
|
||||
Standard_Integer V3d_ColorScale::TextHeight (const TCollection_ExtendedString& theText) const
|
||||
{
|
||||
Standard_Integer aWidth, anAscent, aDescent;
|
||||
TextSize(aText, GetTextHeight(), aWidth, anAscent, aDescent);
|
||||
TextSize (theText, GetTextHeight(), aWidth, anAscent, aDescent);
|
||||
return anAscent+aDescent;
|
||||
}
|
||||
|
||||
void V3d_ColorScale::TextSize (const TCollection_ExtendedString& AText, const Standard_Integer AHeight, Standard_Integer& AWidth, Standard_Integer& AnAscent, Standard_Integer& ADescent) const
|
||||
void V3d_ColorScale::TextSize (const TCollection_ExtendedString& theText, const Standard_Integer theHeight, Standard_Integer& theWidth, Standard_Integer& theAscent, Standard_Integer& theDescent) const
|
||||
{
|
||||
const Handle(Visual3d_Layer) &theLayer = myLayerMgr->Overlay();
|
||||
if ( !theLayer.IsNull() ) {
|
||||
if (!theLayer.IsNull()) {
|
||||
Standard_Real aWidth, anAscent, aDescent;
|
||||
TCollection_AsciiString theText( AText.ToExtString(), '?' );
|
||||
theLayer->TextSize(theText.ToCString(),AHeight,aWidth,anAscent,aDescent);
|
||||
AWidth = (Standard_Integer)aWidth;
|
||||
AnAscent = (Standard_Integer)anAscent;
|
||||
ADescent = (Standard_Integer)aDescent;
|
||||
TCollection_AsciiString aText (theText.ToExtString(), '?');
|
||||
theLayer->TextSize (aText.ToCString(),theHeight,aWidth,anAscent,aDescent);
|
||||
theWidth = (Standard_Integer)aWidth;
|
||||
theAscent = (Standard_Integer)anAscent;
|
||||
theDescent = (Standard_Integer)aDescent;
|
||||
}
|
||||
else {
|
||||
AWidth=AnAscent=ADescent=0;
|
||||
theWidth=theAscent=theDescent=0;
|
||||
}
|
||||
}
|
||||
|
||||
void V3d_ColorScale::DrawScale ()
|
||||
{
|
||||
const Handle(V3d_View) &theView = myLayerMgr->View();
|
||||
if ( theView.IsNull() )
|
||||
if (theView.IsNull())
|
||||
return;
|
||||
|
||||
const Handle(Aspect_Window) &theWin = theView->Window();
|
||||
if ( theWin.IsNull() )
|
||||
if (theWin.IsNull())
|
||||
return;
|
||||
|
||||
Standard_Integer WinWidth( 0 ), WinHeight( 0 );
|
||||
theWin->Size( WinWidth, WinHeight );
|
||||
theWin->Size (WinWidth, WinHeight);
|
||||
|
||||
const Standard_Integer X = RealToInt(GetXPosition() * WinWidth);
|
||||
const Standard_Integer Y = RealToInt(GetYPosition() * WinHeight);
|
||||
const Standard_Integer X = RealToInt (GetXPosition() * WinWidth);
|
||||
const Standard_Integer Y = RealToInt (GetYPosition() * WinHeight);
|
||||
|
||||
const Standard_Integer W = RealToInt(GetWidth() * WinWidth);
|
||||
const Standard_Integer H = RealToInt(GetHeight() * WinHeight);
|
||||
const Standard_Integer W = RealToInt (GetWidth() * WinWidth);
|
||||
const Standard_Integer H = RealToInt (GetHeight() * WinHeight);
|
||||
|
||||
Aspect_ColorScale::DrawScale( theView->BackgroundColor(), X, Y, W, H );
|
||||
Aspect_ColorScale::DrawScale (theView->BackgroundColor(), X, Y, W, H);
|
||||
}
|
||||
|
@@ -50,6 +50,8 @@ void V3d_LayerMgr::Resized()
|
||||
|
||||
void V3d_LayerMgr::ColorScaleDisplay()
|
||||
{
|
||||
if (ColorScaleIsDisplayed())
|
||||
return;
|
||||
ColorScale();
|
||||
myColorScale->Display();
|
||||
myOverlay->AddLayerItem( myColorScaleLayerItem );
|
||||
|
@@ -2129,7 +2129,7 @@ void V3d_View::Gravity (Standard_Real& theX,
|
||||
}
|
||||
|
||||
Bnd_Box aBox = aStruct->MinMaxValues();
|
||||
if (aBox.IsVoid())
|
||||
if (aBox.IsVoid() || aStruct->IsInfinite())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -2170,7 +2170,7 @@ void V3d_View::Gravity (Standard_Real& theX,
|
||||
}
|
||||
|
||||
Bnd_Box aBox = aStruct->MinMaxValues();
|
||||
if (aBox.IsVoid())
|
||||
if (aBox.IsVoid() || aStruct->IsInfinite())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include <Visual3d_View.hxx>
|
||||
#include <Visual3d_ViewManager.hxx>
|
||||
#include <V3d_AmbientLight.hxx>
|
||||
#include <V3d_ColorScale.hxx>
|
||||
#include <V3d_DirectionalLight.hxx>
|
||||
#include <V3d_LayerMgr.hxx>
|
||||
#include <V3d_LayerMgrPointer.hxx>
|
||||
@@ -3185,63 +3186,461 @@ static int VExport(Draw_Interpretor& di, Standard_Integer argc, const char** arg
|
||||
//function : VColorScale
|
||||
//purpose : representation color scale
|
||||
//==============================================================================
|
||||
#include <V3d_ColorScale.hxx>
|
||||
|
||||
static int VColorScale (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
|
||||
static Standard_Boolean checkColor (const TCollection_AsciiString& theRed,
|
||||
const TCollection_AsciiString& theGreen,
|
||||
const TCollection_AsciiString& theBlue,
|
||||
Standard_Real& theRedValue,
|
||||
Standard_Real& theGreenValue,
|
||||
Standard_Real& theBlueValue)
|
||||
{
|
||||
if ( argc != 1 && argc != 4 && argc != 5 && argc != 6 && argc != 8 )
|
||||
if (!theRed.IsRealValue()
|
||||
|| !theGreen.IsRealValue()
|
||||
|| !theBlue.IsRealValue())
|
||||
{
|
||||
di << "Usage : " << argv[0] << " [RangeMin = 0 RangeMax = 100 Intervals = 10 HeightFont = 16 Position = Right X = 0 Y = 0] " << "\n";
|
||||
return 1;
|
||||
std::cout << "Error: RGB color values should be real!\n";
|
||||
return Standard_True;
|
||||
}
|
||||
theRedValue = theRed .RealValue();
|
||||
theGreenValue = theGreen.RealValue();
|
||||
theBlueValue = theBlue .RealValue();
|
||||
if (theRedValue < 0.0 || theRedValue > 1.0
|
||||
|| theGreenValue < 0.0 || theGreenValue > 1.0
|
||||
|| theBlueValue < 0.0 || theBlueValue > 1.0)
|
||||
{
|
||||
std::cout << "Error: RGB color values should be within range 0..1!\n";
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
static int VColorScale (Draw_Interpretor& theDI,
|
||||
Standard_Integer theArgNb,
|
||||
const char** theArgVec)
|
||||
{
|
||||
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
|
||||
if(aContext.IsNull()) {
|
||||
di << argv[0] << " ERROR : use 'vinit' command before " << "\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
Standard_Real minRange = 0. , maxRange = 100. ;
|
||||
|
||||
Standard_Integer numIntervals = 10 ;
|
||||
Standard_Integer textHeight = 16;
|
||||
Aspect_TypeOfColorScalePosition position = Aspect_TOCSP_RIGHT;
|
||||
Standard_Real X = 0., Y = 0. ;
|
||||
|
||||
if ( argc < 9 )
|
||||
Handle(V3d_View) aView = ViewerTest::CurrentView();
|
||||
if (aContext.IsNull())
|
||||
{
|
||||
if( argc > 3 )
|
||||
{
|
||||
minRange = Draw::Atof( argv[1] );
|
||||
maxRange = Draw::Atof( argv[2] );
|
||||
numIntervals = Draw::Atoi( argv[3] );
|
||||
}
|
||||
if ( argc > 4 )
|
||||
textHeight = Draw::Atoi( argv[4] );
|
||||
if ( argc > 5 )
|
||||
position = (Aspect_TypeOfColorScalePosition)Draw::Atoi( argv[5] );
|
||||
if ( argc > 7 )
|
||||
{
|
||||
X = Draw::Atof( argv[6] );
|
||||
Y = Draw::Atof( argv[7] );
|
||||
}
|
||||
}
|
||||
Handle(V3d_View) curView = ViewerTest::CurrentView( );
|
||||
if ( curView.IsNull( ) )
|
||||
std::cout << "Error: no active view!\n";
|
||||
return 1;
|
||||
Handle(Aspect_ColorScale) aCSV = curView->ColorScale( );
|
||||
Handle(V3d_ColorScale) aCS = ( Handle( V3d_ColorScale )::DownCast( aCSV ) );
|
||||
if( ! aCS.IsNull( ) )
|
||||
{
|
||||
aCS->SetPosition( X , Y );
|
||||
aCS->SetHeight( 0.95) ;
|
||||
aCS->SetTextHeight( textHeight );
|
||||
aCS->SetRange( minRange , maxRange );
|
||||
aCS->SetNumberOfIntervals( numIntervals );
|
||||
aCS->SetLabelPosition( position );
|
||||
if( !curView->ColorScaleIsDisplayed() )
|
||||
curView->ColorScaleDisplay( );
|
||||
}
|
||||
|
||||
Handle(V3d_ColorScale) aCS = Handle(V3d_ColorScale)::DownCast (aView->ColorScale());
|
||||
if (aCS.IsNull())
|
||||
{
|
||||
std::cout << "Error: color scale is undefined!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Real aMinRange = aCS->GetMin();
|
||||
Standard_Real aMaxRange = aCS->GetMax();
|
||||
Standard_Integer aNbIntervals = aCS->GetNumberOfIntervals();
|
||||
Standard_Integer aTextHeight = aCS->GetTextHeight();
|
||||
Aspect_TypeOfColorScalePosition aLabPosition = aCS->GetLabelPosition();
|
||||
gp_XY aPos (aCS->GetXPosition(), aCS->GetYPosition());
|
||||
|
||||
ViewerTest_AutoUpdater anUpdateTool (aContext, aView);
|
||||
|
||||
if (theArgNb <= 1)
|
||||
{
|
||||
theDI << "Current color scale parameters:\n"
|
||||
<< "Min range: " << aMinRange << "\n"
|
||||
<< "Max range: " << aMaxRange << "\n"
|
||||
<< "Number of intervals: " << aNbIntervals << "\n"
|
||||
<< "Text height: " << aTextHeight << "\n"
|
||||
<< "Color scale position: " << aPos.X() <<" "<< aPos.Y()<< "\n"
|
||||
<< "Color scale title: " << aCS->GetTitle() << "\n"
|
||||
<< "Label position: ";
|
||||
switch (aLabPosition)
|
||||
{
|
||||
case Aspect_TOCSP_NONE:
|
||||
theDI << "None\n";
|
||||
break;
|
||||
case Aspect_TOCSP_LEFT:
|
||||
theDI << "Left\n";
|
||||
break;
|
||||
case Aspect_TOCSP_RIGHT:
|
||||
theDI << "Right\n";
|
||||
break;
|
||||
case Aspect_TOCSP_CENTER:
|
||||
theDI << "Center\n";
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Standard_CString aFirstArg = theArgVec[1];
|
||||
TCollection_AsciiString aFlag (aFirstArg);
|
||||
aFlag.LowerCase();
|
||||
if (aFlag == "-hide" ||
|
||||
aFlag == "-erase")
|
||||
{
|
||||
if (theArgNb > 2)
|
||||
{
|
||||
std::cout << "Error: wrong syntax at argument '" << theArgVec[1] << "'!\n";
|
||||
return 1;
|
||||
}
|
||||
if (!aView->ColorScaleIsDisplayed())
|
||||
{
|
||||
std::cout << "Error: color scale is not displayed!\n";
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
aView->ColorScaleErase();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (aFlag == "-show" ||
|
||||
aFlag == "-display")
|
||||
{
|
||||
if (theArgNb > 2)
|
||||
{
|
||||
std::cout << "Error: wrong syntax at argument '" << theArgVec[1] << "'!\n";
|
||||
return 1;
|
||||
}
|
||||
aView->ColorScaleDisplay();
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
|
||||
{
|
||||
Standard_CString anArg = theArgVec[anArgIter];
|
||||
TCollection_AsciiString aFlag (anArg);
|
||||
aFlag.LowerCase();
|
||||
if (anUpdateTool.parseRedrawMode (aFlag))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (aFlag == "-range")
|
||||
{
|
||||
if (anArgIter + 3 >= theArgNb)
|
||||
{
|
||||
std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_AsciiString anArg1 (theArgVec[++anArgIter]);
|
||||
TCollection_AsciiString anArg2 (theArgVec[++anArgIter]);
|
||||
TCollection_AsciiString anArg3 (theArgVec[++anArgIter]);
|
||||
if (!anArg1.IsRealValue())
|
||||
{
|
||||
std::cout << "Error: the minRange value should be real!\n";
|
||||
return 1;
|
||||
}
|
||||
else if (!anArg2.IsRealValue())
|
||||
{
|
||||
std::cout << "Error: the maxRange value should be real!\n";
|
||||
return 1;
|
||||
}
|
||||
else if (!anArg3.IsIntegerValue())
|
||||
{
|
||||
std::cout << "Error: the number of intervals should be integer!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
aMinRange = anArg1.RealValue();
|
||||
aMaxRange = anArg2.RealValue();
|
||||
aNbIntervals = anArg3.IntegerValue();
|
||||
}
|
||||
else if (aFlag == "-font")
|
||||
{
|
||||
if (anArgIter + 1 >= theArgNb)
|
||||
{
|
||||
std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
|
||||
return 1;
|
||||
}
|
||||
TCollection_AsciiString anArg (theArgVec[anArgIter + 1]);
|
||||
if (!anArg.IsIntegerValue())
|
||||
{
|
||||
std::cout << "Error: HeightFont value should be integer!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
aTextHeight = anArg.IntegerValue();
|
||||
anArgIter += 1;
|
||||
}
|
||||
else if (aFlag == "-textpos")
|
||||
{
|
||||
if (anArgIter + 1 >= theArgNb)
|
||||
{
|
||||
std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
|
||||
return 1;
|
||||
}
|
||||
TCollection_AsciiString anArg (theArgVec[++anArgIter]);
|
||||
anArg.LowerCase();
|
||||
if (anArg == "none")
|
||||
{
|
||||
aLabPosition = Aspect_TOCSP_NONE;
|
||||
}
|
||||
else if (anArg == "left")
|
||||
{
|
||||
aLabPosition = Aspect_TOCSP_LEFT;
|
||||
}
|
||||
else if (anArg == "right")
|
||||
{
|
||||
aLabPosition = Aspect_TOCSP_RIGHT;
|
||||
}
|
||||
else if (anArg == "center")
|
||||
{
|
||||
aLabPosition = Aspect_TOCSP_CENTER;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Error: unknown position '" << anArg << "'!\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (aFlag == "-xy")
|
||||
{
|
||||
if (anArgIter + 2 >= theArgNb)
|
||||
{
|
||||
std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aX (theArgVec[++anArgIter]);
|
||||
TCollection_AsciiString aY (theArgVec[++anArgIter]);
|
||||
if (!aX.IsRealValue()
|
||||
|| !aY.IsRealValue())
|
||||
{
|
||||
std::cout << "Error: coordinates should be real values!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
aPos.SetCoord (aX.RealValue(), aY.RealValue());
|
||||
}
|
||||
else if (aFlag == "-color")
|
||||
{
|
||||
if (aCS->GetColorType() != Aspect_TOCSD_USER)
|
||||
{
|
||||
std::cout << "Error: wrong color type! Call -colors before to set user-specified colors!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Quantity_NameOfColor aColorName;
|
||||
if (anArgIter + 4 >= theArgNb)
|
||||
{
|
||||
if (anArgIter + 2 >= theArgNb)
|
||||
{
|
||||
std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
|
||||
return 1;
|
||||
}
|
||||
else if (!Quantity_Color::ColorFromName (theArgVec[anArgIter + 2], aColorName))
|
||||
{
|
||||
std::cout << "Error: wrong color name: '" << theArgVec[anArgIter + 2] << "' !\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
TCollection_AsciiString anInd (theArgVec[anArgIter + 1]);
|
||||
if (!anInd.IsIntegerValue())
|
||||
{
|
||||
std::cout << "Error: Index value should be integer!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer anIndex = anInd.IntegerValue();
|
||||
if (anIndex < 0
|
||||
|| anIndex > aNbIntervals - 1)
|
||||
{
|
||||
std::cout << "Error: Index value should be within range 0..." << (aNbIntervals - 1) <<"!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Quantity_Color::ColorFromName (theArgVec[anArgIter + 2], aColorName))
|
||||
{
|
||||
aCS->SetColor (Quantity_Color (aColorName), anIndex);
|
||||
aCS->SetColorType(Aspect_TOCSD_USER);
|
||||
anArgIter += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aRed (theArgVec[anArgIter + 2]);
|
||||
TCollection_AsciiString aGreen (theArgVec[anArgIter + 3]);
|
||||
TCollection_AsciiString aBlue (theArgVec[anArgIter + 4]);
|
||||
Standard_Real aRedValue,aGreenValue, aBlueValue;
|
||||
if(checkColor (aRed, aGreen, aBlue, aRedValue, aGreenValue, aBlueValue))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
aCS->SetColor (Quantity_Color (aRedValue, aGreenValue, aBlueValue, Quantity_TOC_RGB), anIndex);
|
||||
aCS->SetColorType (Aspect_TOCSD_USER);
|
||||
anArgIter += 4;
|
||||
}
|
||||
else if (aFlag == "-label")
|
||||
{
|
||||
if (aCS->GetColorType() != Aspect_TOCSD_USER)
|
||||
{
|
||||
std::cout << "Error: wrong label type! Call -labels before to set user-specified labels!\n";
|
||||
return 1;
|
||||
}
|
||||
else if (anArgIter + 2 >= theArgNb)
|
||||
{
|
||||
std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer anIndex = Draw::Atoi (theArgVec[anArgIter + 1]);
|
||||
if (anIndex < 0
|
||||
|| anIndex > aNbIntervals)
|
||||
{
|
||||
std::cout << "Error: Index value should be within range 0..." << aNbIntervals <<"!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_ExtendedString aText (theArgVec[anArgIter + 2]);
|
||||
aCS->SetLabel (aText, anIndex);
|
||||
aCS->SetLabelType (Aspect_TOCSD_USER);
|
||||
anArgIter += 2;
|
||||
}
|
||||
else if (aFlag == "-colors")
|
||||
{
|
||||
Aspect_SequenceOfColor aSeq;
|
||||
if (anArgIter + aNbIntervals + 1 > theArgNb)
|
||||
{
|
||||
std::cout << "Error: not enough arguments! You should provide color names or RGB color values for every interval of the "
|
||||
<< aNbIntervals << " intervals\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer aColorIter = anArgIter + 1;
|
||||
while (aColorIter < theArgNb)
|
||||
{
|
||||
if (theArgVec[aColorIter][0] == '-')
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
else if (theArgVec[aColorIter][0] >= 97
|
||||
&& theArgVec[aColorIter][0] <= 122)
|
||||
{
|
||||
Quantity_NameOfColor aColorName;
|
||||
if (!Quantity_Color::ColorFromName (theArgVec[aColorIter], aColorName))
|
||||
{
|
||||
std::cout << "Error: wrong color name: " << theArgVec[aColorIter] << " !\n";
|
||||
return 1;
|
||||
}
|
||||
aSeq.Append (Quantity_Color (aColorName));
|
||||
aColorIter++;
|
||||
anArgIter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
TCollection_AsciiString aRed (theArgVec[aColorIter]);
|
||||
TCollection_AsciiString aGreen (theArgVec[aColorIter + 1]);
|
||||
TCollection_AsciiString aBlue (theArgVec[aColorIter + 2]);
|
||||
Standard_Real aRedValue,aGreenValue, aBlueValue;
|
||||
if (checkColor (aRed, aGreen, aBlue, aRedValue, aGreenValue, aBlueValue))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
aSeq.Append (Quantity_Color (aRedValue, aGreenValue, aBlueValue, Quantity_TOC_RGB));
|
||||
aColorIter += 3;
|
||||
anArgIter += 3;
|
||||
}
|
||||
}
|
||||
if (aSeq.Length() < aNbIntervals)
|
||||
{
|
||||
std::cout << "Error: not enough arguments! You should provide color names or RGB color values for every interval of the "
|
||||
<< aNbIntervals << " intervals\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
aCS->SetColors (aSeq);
|
||||
aCS->SetColorType (Aspect_TOCSD_USER);
|
||||
}
|
||||
else if (aFlag == "-labels")
|
||||
{
|
||||
if (anArgIter + aNbIntervals + 1 >= theArgNb)
|
||||
{
|
||||
std::cout << "Error: not enough arguments! You should provide " << (aNbIntervals + 1)
|
||||
<< " text labels for " << aNbIntervals << " intervals.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TColStd_SequenceOfExtendedString aSeq;
|
||||
for (int aLabelIter = anArgIter + 1; aLabelIter <= anArgIter + aNbIntervals + 1; aLabelIter += 1)
|
||||
{
|
||||
aSeq.Append (TCollection_ExtendedString (theArgVec[aLabelIter]));
|
||||
}
|
||||
aCS->SetLabels (aSeq);
|
||||
aCS->SetLabelType (Aspect_TOCSD_USER);
|
||||
anArgIter += aSeq.Length();
|
||||
}
|
||||
else if (aFlag == "-title")
|
||||
{
|
||||
if (anArgIter + 1 >= theArgNb)
|
||||
{
|
||||
std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Boolean isTwoArgs = Standard_False;
|
||||
if (anArgIter + 2 < theArgNb)
|
||||
{
|
||||
TCollection_AsciiString aSecondArg (theArgVec[anArgIter + 2]);
|
||||
aSecondArg.LowerCase();
|
||||
if (aSecondArg == "none")
|
||||
{
|
||||
aCS->SetTitlePosition (Aspect_TOCSP_NONE);
|
||||
isTwoArgs = Standard_True;
|
||||
}
|
||||
else if (aSecondArg == "left")
|
||||
{
|
||||
aCS->SetTitlePosition (Aspect_TOCSP_LEFT);
|
||||
isTwoArgs = Standard_True;
|
||||
}
|
||||
else if (aSecondArg == "right")
|
||||
{
|
||||
aCS->SetTitlePosition (Aspect_TOCSP_RIGHT);
|
||||
isTwoArgs = Standard_True;
|
||||
}
|
||||
else if (aSecondArg == "center")
|
||||
{
|
||||
aCS->SetTitlePosition (Aspect_TOCSP_CENTER);
|
||||
isTwoArgs = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
aCS->SetTitle (theArgVec[anArgIter + 1]);
|
||||
if (isTwoArgs)
|
||||
{
|
||||
anArgIter += 1;
|
||||
}
|
||||
anArgIter += 1;
|
||||
}
|
||||
else if (aFlag == "-demoversion"
|
||||
|| aFlag == "-demo")
|
||||
{
|
||||
aPos.SetCoord (0.0, 0.0);
|
||||
aTextHeight = 16;
|
||||
aMinRange = 0.0;
|
||||
aMaxRange = 100;
|
||||
aNbIntervals = 10;
|
||||
aLabPosition = Aspect_TOCSP_RIGHT;
|
||||
aCS->SetColorType(Aspect_TOCSD_AUTO);
|
||||
aCS->SetLabelType(Aspect_TOCSD_AUTO);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Error: wrong syntax at " << anArg << " - unknown argument!\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
aCS->SetPosition (aPos.X(), aPos.Y());
|
||||
aCS->SetHeight (0.95);
|
||||
aCS->SetTextHeight (aTextHeight);
|
||||
aCS->SetRange (aMinRange, aMaxRange);
|
||||
aCS->SetNumberOfIntervals (aNbIntervals);
|
||||
aCS->SetLabelPosition (aLabPosition);
|
||||
|
||||
if (!aView->ColorScaleIsDisplayed())
|
||||
{
|
||||
aView->ColorScaleDisplay();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -7329,7 +7728,21 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
||||
" : notice that EMF format requires patched gl2ps",
|
||||
__FILE__,VExport,group);
|
||||
theCommands.Add("vcolorscale",
|
||||
"vcolorscale : vcolorscale [RangeMin = 0 RangeMax = 100 Intervals = 10 HeightFont = 16 Position = 2 X = 0 Y = 0]: draw color scale",
|
||||
"vcolorscale : vcolorscale [-range RangeMin = 0 RangeMax = 100 Intervals = 10 -font HeightFont = 16 -textpos "
|
||||
"Position = left -xy X = 0 Y = 0] [-noupdate|-update]: draw color scale\n"
|
||||
"-demo/-demoversion draw a demoversion of color scale.\n"
|
||||
"-show/display display color scale.\n"
|
||||
"-hide/erase erase color scale.\n"
|
||||
"Please note that -show/-hide option must be the first argument!\n"
|
||||
"-color Index R G B: set color for indexed interval\n"
|
||||
"-color Index ColorName: set color for indexed interval\n"
|
||||
"-colors R G B R G B ...: set colors for all intervals\n"
|
||||
"-colors ColorName1 ColorName2 ...: set colors for all intervals\n"
|
||||
"-colors supports both color names and rgb values in one call\n"
|
||||
"-label Index Text: set label for indexed interval\n"
|
||||
"-labels Text Text Text ...: set labels for all intervals\n"
|
||||
"-title Title [Position]: set the title for color scale with certain position. Default position = center;\n"
|
||||
"Available text positions: left, right, center, none;\n",
|
||||
__FILE__,VColorScale,group);
|
||||
theCommands.Add("vgraduatedtrihedron",
|
||||
"vgraduatedtrihedron : 1/0 (display/erase) [Xname Yname Zname [Font [isMultibyte]]]",
|
||||
|
@@ -30,41 +30,34 @@ raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create(theXTolerance: in Real) returns BissecNewton;
|
||||
---Purpose: Constructor.
|
||||
-- @param theXTolerance - algorithm tolerance.
|
||||
|
||||
Perform(me: in out; F: out FunctionWithDerivative;
|
||||
Bound1, Bound2: Real;
|
||||
NbIterations: Integer)
|
||||
Bound1, Bound2: Real;
|
||||
NbIterations: Integer = 100)
|
||||
---Purpose:
|
||||
-- A combination of Newton-Raphson and bissection methods is done to find
|
||||
-- the root of the function F between the bounds Bound1 and Bound2
|
||||
-- on the function F.
|
||||
-- The tolerance required on the root is given by TolX.
|
||||
-- The solution is found when:
|
||||
-- abs(Xi - Xi-1) <= TolX and F(Xi) * F(Xi-1) <= 0
|
||||
-- The maximum number of iterations allowed is given by NbIterations.
|
||||
is static;
|
||||
|
||||
is static protected;
|
||||
|
||||
|
||||
Create(F: in out FunctionWithDerivative;
|
||||
Bound1, Bound2, TolX: Real;
|
||||
NbIterations: Integer = 100)
|
||||
---Purpose:
|
||||
-- A combination of Newton-Raphson and bissection methods is done to find
|
||||
-- the root of the function F between the bounds Bound1 and Bound2.
|
||||
-- on the function F.
|
||||
-- The tolerance required on the root is given by TolX.
|
||||
-- The solution is found when :
|
||||
-- abs(Xi - Xi-1) <= TolX and F(Xi) * F(Xi-1) <= 0
|
||||
-- The maximum number of iterations allowed is given by NbIterations.
|
||||
IsSolutionReached(me: in out; theFunction: out FunctionWithDerivative)
|
||||
---Purpose:
|
||||
-- This method is called at the end of each iteration to check if the
|
||||
-- solution has been found.
|
||||
-- It can be redefined in a sub-class to implement a specific test to
|
||||
-- stop the iterations.
|
||||
---C++: inline
|
||||
returns Boolean is virtual;
|
||||
|
||||
returns BissecNewton;
|
||||
|
||||
---C++: alias " Standard_EXPORT virtual ~math_BissecNewton();"
|
||||
|
||||
IsSolutionReached(me: in out; F: out FunctionWithDerivative)
|
||||
---Purpose:
|
||||
-- This method is called at the end of each iteration to check if the
|
||||
-- solution has been found.
|
||||
-- It can be redefined in a sub-class to implement a specific test to
|
||||
-- stop the iterations.
|
||||
|
||||
returns Boolean
|
||||
is virtual;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
---Purpose: Tests is the root has been successfully found.
|
||||
---C++: inline
|
||||
@@ -99,7 +92,7 @@ is
|
||||
raises NotDone
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
Dump(me; o: in out OStream)
|
||||
---Purpose: Prints on the stream o information on the current state
|
||||
-- of the object.
|
||||
@@ -108,6 +101,12 @@ is
|
||||
is static;
|
||||
|
||||
|
||||
Delete(me) is static;
|
||||
---Purpose: Destructor alias.
|
||||
---C++: inline
|
||||
---C++: alias " Standard_EXPORT virtual ~math_BissecNewton();"
|
||||
|
||||
|
||||
fields
|
||||
|
||||
Done: Boolean;
|
||||
|
@@ -15,14 +15,37 @@
|
||||
#include <math_BissecNewton.ixx>
|
||||
#include <math_FunctionWithDerivative.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : math_BissecNewton
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
math_BissecNewton::math_BissecNewton(const Standard_Real theXTolerance)
|
||||
: TheStatus(math_NotBracketed),
|
||||
XTol (theXTolerance),
|
||||
x (0.0),
|
||||
dx (0.0),
|
||||
f (0.0),
|
||||
df (0.0),
|
||||
Done (Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~math_BissecNewton
|
||||
//purpose : Destructor
|
||||
//=======================================================================
|
||||
math_BissecNewton::~math_BissecNewton()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_BissecNewton::Perform(math_FunctionWithDerivative& F,
|
||||
const Standard_Real Bound1,
|
||||
const Standard_Real Bound2,
|
||||
const Standard_Integer NbIterations)
|
||||
const Standard_Real Bound1,
|
||||
const Standard_Real Bound2,
|
||||
const Standard_Integer NbIterations)
|
||||
{
|
||||
Standard_Boolean GOOD;
|
||||
Standard_Integer j;
|
||||
@@ -125,25 +148,10 @@ void math_BissecNewton::Perform(math_FunctionWithDerivative& F,
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Boolean math_BissecNewton::IsSolutionReached
|
||||
//(math_FunctionWithDerivative& F)
|
||||
(math_FunctionWithDerivative& )
|
||||
{
|
||||
return Abs(dx) <= XTol;
|
||||
}
|
||||
|
||||
|
||||
math_BissecNewton::math_BissecNewton(math_FunctionWithDerivative& F,
|
||||
const Standard_Real Bound1,
|
||||
const Standard_Real Bound2,
|
||||
const Standard_Real TolX,
|
||||
const Standard_Integer NbIterations) {
|
||||
|
||||
XTol = TolX;
|
||||
Perform(F, Bound1, Bound2, NbIterations);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_BissecNewton::Dump(Standard_OStream& o) const {
|
||||
|
||||
o << "math_BissecNewton ";
|
||||
|
@@ -14,6 +14,16 @@
|
||||
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
inline void math_BissecNewton::Delete() const
|
||||
{
|
||||
}
|
||||
|
||||
inline Standard_Boolean math_BissecNewton::IsSolutionReached(math_FunctionWithDerivative&)
|
||||
{
|
||||
return Abs(dx) <= XTol;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_OStream& operator<<(Standard_OStream& o,
|
||||
const math_BissecNewton& Bi)
|
||||
{
|
||||
|
@@ -32,63 +32,46 @@ is
|
||||
Create(TolX: Real;
|
||||
NbIterations: Integer = 100;
|
||||
ZEPS: Real = 1.0e-12)
|
||||
---Purpose:
|
||||
-- This constructor should be used in a sub-class to initialize
|
||||
-- correctly all the fields of this class.
|
||||
|
||||
---Purpose:
|
||||
-- This constructor should be used in a sub-class to initialize
|
||||
-- correctly all the fields of this class.
|
||||
returns BrentMinimum;
|
||||
|
||||
|
||||
Create(TolX: Real; Fbx: Real;
|
||||
NbIterations: Integer = 100;
|
||||
ZEPS: Real = 1.0e-12)
|
||||
---Purpose:
|
||||
-- This constructor should be used in a sub-class to initialize
|
||||
-- correctly all the fields of this class.
|
||||
-- It has to be used if F(Bx) is known.
|
||||
|
||||
---Purpose:
|
||||
-- This constructor should be used in a sub-class to initialize
|
||||
-- correctly all the fields of this class.
|
||||
-- It has to be used if F(Bx) is known.
|
||||
returns BrentMinimum;
|
||||
|
||||
|
||||
|
||||
Create(F: in out Function; Ax, Bx, Cx, TolX: Real;
|
||||
NbIterations: Integer = 100; ZEPS: Real=1.0e-12)
|
||||
---Purpose:
|
||||
-- Given a bracketing triplet of abscissae Ax, Bx, Cx
|
||||
-- (such as Bx is between Ax and Cx, F(Bx) is
|
||||
-- less than both F(Bx) and F(Cx)) the Brent minimization is done
|
||||
-- on the function F.
|
||||
-- The tolerance required on F is given by Tolerance.
|
||||
-- The solution is found when :
|
||||
-- abs(Xi - Xi-1) <= TolX * abs(Xi) + ZEPS;
|
||||
-- The maximum number of iterations allowed is given by NbIterations.
|
||||
|
||||
returns BrentMinimum;
|
||||
|
||||
Delete(me) is static;
|
||||
---Purpose: Destructor alias.
|
||||
---C++: inline
|
||||
---C++: alias " Standard_EXPORT virtual ~math_BrentMinimum();"
|
||||
|
||||
Perform(me: in out; F: in out Function;
|
||||
Ax, Bx, Cx: Real)
|
||||
---Purpose:
|
||||
-- Brent minimization is performed on function F from a given
|
||||
-- bracketing triplet of abscissas Ax, Bx, Cx (such that Bx is
|
||||
-- between Ax and Cx, F(Bx) is less than both F(Bx) and F(Cx))
|
||||
-- Warning
|
||||
-- The initialization constructors must have been called
|
||||
-- before the call to the Perform method.
|
||||
|
||||
Perform(me: in out; F: in out Function;
|
||||
Ax, Bx, Cx: Real)
|
||||
---Purpose:
|
||||
-- Brent minimization is performed on function F from a given
|
||||
-- bracketing triplet of abscissas Ax, Bx, Cx (such that Bx is
|
||||
-- between Ax and Cx, F(Bx) is less than both F(Bx) and F(Cx))
|
||||
-- The solution is found when: abs(Xi - Xi-1) <= TolX * abs(Xi) + ZEPS;
|
||||
is static;
|
||||
|
||||
|
||||
IsSolutionReached(me: in out; F: in out Function)
|
||||
---Purpose:
|
||||
-- This method is called at the end of each iteration to check if the
|
||||
-- solution is found.
|
||||
-- It can be redefined in a sub-class to implement a specific test to
|
||||
-- stop the iterations.
|
||||
|
||||
returns Boolean
|
||||
is virtual;
|
||||
IsSolutionReached(me: in out; theFunction: in out Function)
|
||||
---Purpose:
|
||||
-- This method is called at the end of each iteration to check if the
|
||||
-- solution is found.
|
||||
-- It can be redefined in a sub-class to implement a specific test to
|
||||
-- stop the iterations.
|
||||
---C++:inline
|
||||
returns Boolean is virtual;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
@@ -137,7 +120,6 @@ is
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
Done: Boolean;
|
||||
|
@@ -23,15 +23,68 @@
|
||||
#define SIGN(a,b) ((b) > 0.0 ? fabs(a) : -fabs(a))
|
||||
#define SHFT(a,b,c,d) (a)=(b);(b)=(c);(c)=(d)
|
||||
|
||||
//=======================================================================
|
||||
//function : math_BrentMinimum
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
math_BrentMinimum::math_BrentMinimum(const Standard_Real theTolX,
|
||||
const Standard_Integer theNbIterations,
|
||||
const Standard_Real theZEPS)
|
||||
: a (0.0),
|
||||
b (0.0),
|
||||
x (0.0),
|
||||
fx (0.0),
|
||||
fv (0.0),
|
||||
fw (0.0),
|
||||
XTol(theTolX),
|
||||
EPSZ(theZEPS),
|
||||
Done (Standard_False),
|
||||
iter (0),
|
||||
Itermax(theNbIterations),
|
||||
myF (Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : math_BrentMinimum
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
math_BrentMinimum::math_BrentMinimum(const Standard_Real theTolX,
|
||||
const Standard_Real theFbx,
|
||||
const Standard_Integer theNbIterations,
|
||||
const Standard_Real theZEPS)
|
||||
: a (0.0),
|
||||
b (0.0),
|
||||
x (0.0),
|
||||
fx (theFbx),
|
||||
fv (0.0),
|
||||
fw (0.0),
|
||||
XTol(theTolX),
|
||||
EPSZ(theZEPS),
|
||||
Done (Standard_False),
|
||||
iter (0),
|
||||
Itermax(theNbIterations),
|
||||
myF (Standard_True)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~math_BrentMinimum
|
||||
//purpose : Destructor
|
||||
//=======================================================================
|
||||
math_BrentMinimum::~math_BrentMinimum()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_BrentMinimum::Perform(math_Function& F,
|
||||
const Standard_Real ax,
|
||||
const Standard_Real bx,
|
||||
const Standard_Real cx) {
|
||||
|
||||
const Standard_Real ax,
|
||||
const Standard_Real bx,
|
||||
const Standard_Real cx)
|
||||
{
|
||||
Standard_Boolean OK;
|
||||
Standard_Real etemp, fu, p, q, r;
|
||||
Standard_Real tol1, tol2, u, v, w, xm;
|
||||
@@ -104,70 +157,20 @@ void math_BrentMinimum::Perform(math_Function& F,
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
math_BrentMinimum::math_BrentMinimum(math_Function& F,
|
||||
const Standard_Real Ax,
|
||||
const Standard_Real Bx,
|
||||
const Standard_Real Cx,
|
||||
const Standard_Real TolX,
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Real ZEPS) {
|
||||
|
||||
XTol = TolX;
|
||||
EPSZ = ZEPS;
|
||||
Itermax = NbIterations;
|
||||
myF = Standard_False;
|
||||
Perform(F, Ax, Bx, Cx);
|
||||
}
|
||||
|
||||
|
||||
// Constructeur d'initialisation des champs.
|
||||
|
||||
math_BrentMinimum::math_BrentMinimum(const Standard_Real TolX,
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Real ZEPS) {
|
||||
myF = Standard_False;
|
||||
XTol = TolX;
|
||||
EPSZ = ZEPS;
|
||||
Itermax = NbIterations;
|
||||
}
|
||||
|
||||
math_BrentMinimum::math_BrentMinimum(const Standard_Real TolX,
|
||||
const Standard_Real Fbx,
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Real ZEPS) {
|
||||
|
||||
fx = Fbx;
|
||||
myF = Standard_True;
|
||||
XTol = TolX;
|
||||
EPSZ = ZEPS;
|
||||
Itermax = NbIterations;
|
||||
}
|
||||
|
||||
|
||||
// Standard_Boolean math_BrentMinimum::IsSolutionReached(math_Function& F) {
|
||||
Standard_Boolean math_BrentMinimum::IsSolutionReached(math_Function& ) {
|
||||
|
||||
// Standard_Real xm = 0.5 * (a + b);
|
||||
// modified by NIZHNY-MKK Mon Oct 3 17:45:57 2005.BEGIN
|
||||
// Standard_Real tol = XTol * fabs(x) + EPSZ;
|
||||
// return fabs(x - xm) <= 2.0 * tol - 0.5 * (b - a);
|
||||
Standard_Real TwoTol = 2.0 *(XTol * fabs(x) + EPSZ);
|
||||
return ((x <= (TwoTol + a)) && (x >= (b - TwoTol)));
|
||||
// modified by NIZHNY-MKK Mon Oct 3 17:46:00 2005.END
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_BrentMinimum::Dump(Standard_OStream& o) const
|
||||
{
|
||||
o << "math_BrentMinimum ";
|
||||
if(Done) {
|
||||
o << " Status = Done \n";
|
||||
o << " Location value = " << x <<"\n";
|
||||
o << " Minimum value = " << fx << "\n";
|
||||
o << " Number of iterations = " << iter <<"\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
void math_BrentMinimum::Dump(Standard_OStream& o) const {
|
||||
o << "math_BrentMinimum ";
|
||||
if(Done) {
|
||||
o << " Status = Done \n";
|
||||
o << " Location value = " << x <<"\n";
|
||||
o << " Minimum value = " << fx << "\n";
|
||||
o << " Number of iterations = " << iter <<"\n";
|
||||
}
|
||||
else {
|
||||
o << " Status = not Done \n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
o << " Status = not Done \n";
|
||||
}
|
||||
}
|
||||
|
@@ -14,7 +14,23 @@
|
||||
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
inline Standard_Boolean math_BrentMinimum::IsDone() const { return Done; }
|
||||
inline void math_BrentMinimum::Delete() const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean math_BrentMinimum::IsSolutionReached(math_Function&)
|
||||
{
|
||||
const Standard_Real TwoTol = 2.0 * (XTol * fabs(x) + EPSZ);
|
||||
return (x <= (TwoTol + a)) && (x >= (b - TwoTol));
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean math_BrentMinimum::IsDone() const
|
||||
{
|
||||
return Done;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_OStream& operator<< (Standard_OStream& o,
|
||||
const math_BrentMinimum& Br)
|
||||
|
@@ -30,53 +30,40 @@ raises DimensionError from Standard,
|
||||
|
||||
is
|
||||
|
||||
Create(F: in out MultipleVarFunctionWithGradient;
|
||||
StartingPoint: Vector; Tolerance: Real;
|
||||
NbIterations: Integer=200; ZEPS: Real=1.0e-12)
|
||||
---Purpose: Computes FRPR minimization function F from input vector
|
||||
-- StartingPoint. The solution F = Fi is found when 2.0 *
|
||||
-- abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1) +
|
||||
-- ZEPS). The maximum number of iterations allowed is given
|
||||
-- by NbIterations.
|
||||
returns FRPR;
|
||||
|
||||
|
||||
Create(F: in out MultipleVarFunctionWithGradient;
|
||||
Tolerance: Real;
|
||||
NbIterations: Integer = 200;
|
||||
ZEPS: Real = 1.0e-12)
|
||||
---Purpose: Purpose
|
||||
-- Initializes the computation of the minimum of F.
|
||||
-- Warning
|
||||
-- A call to the Perform method must be made after this
|
||||
-- initialization to compute the minimum of the function.
|
||||
Create(theFunction: in MultipleVarFunctionWithGradient;
|
||||
theTolerance: Real;
|
||||
theNbIterations: Integer = 200;
|
||||
theZEPS: Real = 1.0e-12)
|
||||
---Purpose:
|
||||
-- Initializes the computation of the minimum of F.
|
||||
-- Warning: constructor does not perform computations.
|
||||
returns FRPR;
|
||||
|
||||
Delete(me) is static;
|
||||
---Purpose: Destructor alias.
|
||||
---C++: alias " Standard_EXPORT virtual ~math_FRPR();"
|
||||
|
||||
Perform(me: in out; F: in out MultipleVarFunctionWithGradient;
|
||||
StartingPoint: Vector)
|
||||
---Purpose: Use this method after a call to the initialization constructor
|
||||
-- to compute the minimum of function F.
|
||||
-- Warning
|
||||
-- The initialization constructor must have been called before
|
||||
-- the Perform method is called
|
||||
|
||||
Perform(me: in out;
|
||||
theFunction: in out MultipleVarFunctionWithGradient;
|
||||
theStartingPoint: Vector)
|
||||
---Purpose:
|
||||
-- The solution F = Fi is found when
|
||||
-- 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1) + ZEPS).
|
||||
is static;
|
||||
|
||||
|
||||
IsSolutionReached(me: in out; F: in out MultipleVarFunctionWithGradient)
|
||||
---Purpose:
|
||||
-- The solution F = Fi is found when :
|
||||
-- 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1)) + ZEPS.
|
||||
-- The maximum number of iterations allowed is given by NbIterations.
|
||||
|
||||
returns Boolean
|
||||
is virtual;
|
||||
|
||||
|
||||
IsSolutionReached(me: in out; theFunction: in out MultipleVarFunctionWithGradient)
|
||||
---Purpose:
|
||||
-- The solution F = Fi is found when:
|
||||
-- 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1)) + ZEPS.
|
||||
-- The maximum number of iterations allowed is given by NbIterations.
|
||||
---C++:inline
|
||||
returns Boolean is virtual;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
---Purpose: Returns true if the computations are successful, otherwise returns false.
|
||||
---Purpose: Returns true if the computations are successful, otherwise returns false.
|
||||
---C++: inline
|
||||
returns Boolean
|
||||
is static;
|
||||
@@ -158,6 +145,7 @@ is
|
||||
|
||||
|
||||
fields
|
||||
|
||||
Done: Boolean;
|
||||
TheLocation: Vector is protected;
|
||||
TheGradient: Vector is protected;
|
||||
|
@@ -88,8 +88,9 @@ static Standard_Boolean MinimizeDirection(math_Vector& P,
|
||||
math_BracketMinimum Bracket(F, 0.0, 1.0);
|
||||
if(Bracket.IsDone()) {
|
||||
Bracket.Values(ax, xx, bx);
|
||||
math_BrentMinimum Sol(F, ax, xx, bx, 1.0e-10, 100);
|
||||
if(Sol.IsDone()) {
|
||||
math_BrentMinimum Sol(1.e-10);
|
||||
Sol.Perform(F, ax, xx, bx);
|
||||
if (Sol.IsDone()) {
|
||||
Standard_Real Scale = Sol.Location();
|
||||
Result = Sol.Minimum();
|
||||
Dir.Multiply(Scale);
|
||||
@@ -100,10 +101,45 @@ static Standard_Boolean MinimizeDirection(math_Vector& P,
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : math_FRPR
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
math_FRPR::math_FRPR(const math_MultipleVarFunctionWithGradient& theFunction,
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Integer theNbIterations,
|
||||
const Standard_Real theZEPS)
|
||||
|
||||
: TheLocation(1, theFunction.NbVariables()),
|
||||
TheGradient(1, theFunction.NbVariables()),
|
||||
TheMinimum (0.0),
|
||||
PreviousMinimum(0.0),
|
||||
XTol (theTolerance),
|
||||
EPSZ (theZEPS),
|
||||
Done (Standard_False),
|
||||
Iter (0),
|
||||
State (0),
|
||||
TheStatus (math_NotBracketed),
|
||||
Itermax (theNbIterations)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~math_FRPR
|
||||
//purpose : Destructor
|
||||
//=======================================================================
|
||||
math_FRPR::~math_FRPR()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_FRPR::Perform(math_MultipleVarFunctionWithGradient& F,
|
||||
const math_Vector& StartingPoint) {
|
||||
|
||||
const math_Vector& StartingPoint)
|
||||
{
|
||||
Standard_Boolean Good;
|
||||
Standard_Integer n = TheLocation.Length();
|
||||
Standard_Integer j, its;
|
||||
@@ -140,7 +176,7 @@ void math_FRPR::Perform(math_MultipleVarFunctionWithGradient& F,
|
||||
}
|
||||
if(IsSolutionReached(F)) {
|
||||
Done = Standard_True;
|
||||
State = F.GetStateNumber();
|
||||
State = F.GetStateNumber();
|
||||
TheStatus = math_OK;
|
||||
return;
|
||||
}
|
||||
@@ -175,64 +211,25 @@ void math_FRPR::Perform(math_MultipleVarFunctionWithGradient& F,
|
||||
Done = Standard_False;
|
||||
TheStatus = math_TooManyIterations;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Standard_Boolean math_FRPR::IsSolutionReached(
|
||||
// math_MultipleVarFunctionWithGradient& F) {
|
||||
math_MultipleVarFunctionWithGradient& ) {
|
||||
|
||||
return (2.0 * fabs(TheMinimum - PreviousMinimum)) <=
|
||||
XTol * (fabs(TheMinimum) + fabs(PreviousMinimum) + EPSZ);
|
||||
}
|
||||
|
||||
math_FRPR::math_FRPR(math_MultipleVarFunctionWithGradient& F,
|
||||
const math_Vector& StartingPoint,
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Real ZEPS)
|
||||
: TheLocation(1, StartingPoint.Length()),
|
||||
TheGradient(1, StartingPoint.Length()) {
|
||||
|
||||
XTol = Tolerance;
|
||||
EPSZ = ZEPS;
|
||||
Itermax = NbIterations;
|
||||
Perform(F, StartingPoint);
|
||||
}
|
||||
|
||||
|
||||
math_FRPR::math_FRPR(math_MultipleVarFunctionWithGradient& F,
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Real ZEPS)
|
||||
: TheLocation(1, F.NbVariables()),
|
||||
TheGradient(1, F.NbVariables()) {
|
||||
|
||||
XTol = Tolerance;
|
||||
EPSZ = ZEPS;
|
||||
Itermax = NbIterations;
|
||||
}
|
||||
|
||||
|
||||
math_FRPR::~math_FRPR()
|
||||
{
|
||||
}
|
||||
|
||||
void math_FRPR::Dump(Standard_OStream& o) const {
|
||||
|
||||
o << "math_FRPR ";
|
||||
if(Done) {
|
||||
o << " Status = Done \n";
|
||||
o << " Location Vector = "<< TheLocation << "\n";
|
||||
o << " Minimum value = " << TheMinimum <<"\n";
|
||||
o << " Number of iterations = " << Iter <<"\n";
|
||||
}
|
||||
else {
|
||||
o << " Status = not Done because " << (Standard_Integer)TheStatus << "\n";
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_FRPR::Dump(Standard_OStream& o) const
|
||||
{
|
||||
o << "math_FRPR ";
|
||||
if(Done) {
|
||||
o << " Status = Done \n";
|
||||
o << " Location Vector = "<< TheLocation << "\n";
|
||||
o << " Minimum value = " << TheMinimum <<"\n";
|
||||
o << " Number of iterations = " << Iter <<"\n";
|
||||
}
|
||||
else {
|
||||
o << " Status = not Done because " << (Standard_Integer)TheStatus << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -15,8 +15,21 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
|
||||
inline void math_FRPR::Delete() const
|
||||
{
|
||||
}
|
||||
|
||||
inline Standard_Boolean math_FRPR::IsDone() const { return Done; }
|
||||
inline Standard_Boolean math_FRPR::IsSolutionReached(math_MultipleVarFunctionWithGradient&)
|
||||
{
|
||||
return 2.0 * fabs(TheMinimum - PreviousMinimum) <=
|
||||
XTol * (fabs(TheMinimum) + fabs(PreviousMinimum) + EPSZ);
|
||||
}
|
||||
|
||||
inline Standard_Boolean math_FRPR::IsDone() const
|
||||
{
|
||||
return Done;
|
||||
|
||||
}
|
||||
|
||||
inline Standard_OStream& operator<<(Standard_OStream& o,
|
||||
const math_FRPR& Fr)
|
||||
|
@@ -76,7 +76,8 @@ class math_MyFunctionSetWithDerivatives : public math_FunctionSetWithDerivatives
|
||||
math_MyFunctionSetWithDerivatives Ff(F);
|
||||
V(1)=Guess;
|
||||
Tol(1) = Tolerance;
|
||||
math_FunctionSetRoot Sol(Ff,V,Tol,NbIterations);
|
||||
math_FunctionSetRoot Sol(Ff, Tol, NbIterations);
|
||||
Sol.Perform(Ff, V);
|
||||
Done = Sol.IsDone();
|
||||
if (Done) {
|
||||
F.GetStateNumber();
|
||||
@@ -98,7 +99,8 @@ class math_MyFunctionSetWithDerivatives : public math_FunctionSetWithDerivatives
|
||||
Tol(1) = Tolerance;
|
||||
Aa(1)=A;
|
||||
Bb(1)=B;
|
||||
math_FunctionSetRoot Sol(Ff,V,Tol,Aa,Bb,NbIterations);
|
||||
math_FunctionSetRoot Sol(Ff, Tol, NbIterations);
|
||||
Sol.Perform(Ff, V, Aa, Bb);
|
||||
Done = Sol.IsDone();
|
||||
if (Done) {
|
||||
F.GetStateNumber();
|
||||
|
@@ -57,66 +57,52 @@ is
|
||||
-- constructor.
|
||||
|
||||
returns FunctionSetRoot from math;
|
||||
|
||||
|
||||
|
||||
Create(F: in out FunctionSetWithDerivatives; StartingPoint: Vector;
|
||||
Tolerance: Vector; NbIterations: Integer = 100)
|
||||
---Purpose: is used to improve the root of the function F
|
||||
-- from the initial guess StartingPoint.
|
||||
-- The maximum number of iterations allowed is given by
|
||||
-- NbIterations.
|
||||
-- In this case, the solution is found when:
|
||||
-- abs(Xi - Xi-1)(j) <= Tolerance(j) for all unknowns.
|
||||
|
||||
returns FunctionSetRoot from math;
|
||||
|
||||
|
||||
|
||||
Create(F: in out FunctionSetWithDerivatives; StartingPoint: Vector;
|
||||
Tolerance: Vector; infBound, supBound: Vector;
|
||||
NbIterations: Integer = 100; theStopOnDivergent : Boolean from Standard = Standard_False)
|
||||
---Purpose: is used to improve the root of the function F
|
||||
-- from the initial guess StartingPoint.
|
||||
-- The maximum number of iterations allowed is given
|
||||
-- by NbIterations.
|
||||
-- In this case, the solution is found when:
|
||||
-- abs(Xi - Xi-1) <= Tolerance for all unknowns.
|
||||
|
||||
returns FunctionSetRoot from math;
|
||||
|
||||
Delete(me) is static;
|
||||
---Purpose: Destructor alias.
|
||||
---C++: alias " Standard_EXPORT virtual ~math_FunctionSetRoot();"
|
||||
|
||||
|
||||
SetTolerance(me: in out; Tolerance: Vector)
|
||||
---Purpose: Initializes the tolerance values.
|
||||
|
||||
---Purpose: Initializes the tolerance values.
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
Perform(me: in out; F: in out FunctionSetWithDerivatives;
|
||||
StartingPoint: Vector;
|
||||
infBound, supBound: Vector; theStopOnDivergent : Boolean from Standard = Standard_False)
|
||||
---Purpose: Improves the root of function F from the initial guess
|
||||
-- StartingPoint. infBound and supBound may be given to constrain the solution.
|
||||
-- Warning
|
||||
-- This method is called when computation of the solution is
|
||||
-- not performed by the constructors.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsSolutionReached(me: in out; F: in out FunctionSetWithDerivatives)
|
||||
---Purpose: This routine is called at the end of each iteration
|
||||
-- to check if the solution was found. It can be redefined
|
||||
-- in a sub-class to implement a specific test to stop the
|
||||
-- iterations.
|
||||
-- In this case, the solution is found when:
|
||||
-- abs(Xi - Xi-1) <= Tolerance for all unknowns.
|
||||
|
||||
---Purpose: This routine is called at the end of each iteration
|
||||
-- to check if the solution was found. It can be redefined
|
||||
-- in a sub-class to implement a specific test to stop the iterations.
|
||||
-- In this case, the solution is found when: abs(Xi - Xi-1) <= Tolerance
|
||||
-- for all unknowns.
|
||||
---C++: inline
|
||||
returns Boolean is virtual;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
theFunction: in out FunctionSetWithDerivatives;
|
||||
theStartingPoint: Vector;
|
||||
theStopOnDivergent: Boolean from Standard = Standard_False)
|
||||
---Purpose:
|
||||
-- Improves the root of function from the initial guess point.
|
||||
-- The infinum and supremum may be given to constrain the solution.
|
||||
-- In this case, the solution is found when: abs(Xi - Xi-1)(j) <= Tolerance(j)
|
||||
-- for all unknowns.
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
theFunction: in out FunctionSetWithDerivatives;
|
||||
theStartingPoint: Vector;
|
||||
theInfBound, theSupBound: Vector;
|
||||
theStopOnDivergent: Boolean from Standard = Standard_False)
|
||||
---Purpose:
|
||||
-- Improves the root of function from the initial guess point.
|
||||
-- The infinum and supremum may be given to constrain the solution.
|
||||
-- In this case, the solution is found when: abs(Xi - Xi-1) <= Tolerance
|
||||
-- for all unknowns.
|
||||
is static;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
---Purpose:
|
||||
-- Returns true if the computations are successful, otherwise returns false.
|
||||
|
@@ -228,8 +228,12 @@ static Standard_Boolean MinimizeDirection(const math_Vector& P0,
|
||||
FSR_DEBUG (" minimisation dans la direction")
|
||||
ax = -1; bx = 0;
|
||||
cx = (P2-P1).Norm()*invnorme;
|
||||
if (cx < 1.e-2) return Standard_False;
|
||||
math_BrentMinimum Sol(F, ax, bx, cx, tol1d, 100, tol1d);
|
||||
if (cx < 1.e-2)
|
||||
return Standard_False;
|
||||
|
||||
math_BrentMinimum Sol(tol1d, 100, tol1d);
|
||||
Sol.Perform(F, ax, bx, cx);
|
||||
|
||||
if(Sol.IsDone()) {
|
||||
tsol = Sol.Location();
|
||||
if (Sol.Minimum() < F1) {
|
||||
@@ -322,7 +326,10 @@ static Standard_Boolean MinimizeDirection(const math_Vector& P,
|
||||
ax = 0.0; bx = tsol; cx = 1.0;
|
||||
}
|
||||
FSR_DEBUG(" minimisation dans la direction");
|
||||
math_BrentMinimum Sol(F, ax, bx, cx, tol1d, 100, tol1d);
|
||||
|
||||
math_BrentMinimum Sol(tol1d, 100, tol1d);
|
||||
Sol.Perform(F, ax, bx, cx);
|
||||
|
||||
if(Sol.IsDone()) {
|
||||
if (Sol.Minimum() <= Result) {
|
||||
tsol = Sol.Location();
|
||||
@@ -551,155 +558,109 @@ Standard_Boolean Bounds(const math_Vector& InfBound,
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : math_FunctionSetRoot
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
math_FunctionSetRoot::math_FunctionSetRoot(
|
||||
math_FunctionSetWithDerivatives& theFunction,
|
||||
const math_Vector& theTolerance,
|
||||
const Standard_Integer theNbIterations)
|
||||
|
||||
math_FunctionSetRoot::math_FunctionSetRoot(math_FunctionSetWithDerivatives& F,
|
||||
const math_Vector& Tolerance,
|
||||
const Standard_Integer NbIterations) :
|
||||
Delta(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DF(1, F.NbEquations(),
|
||||
1, F.NbVariables()),
|
||||
Tol(1,F.NbVariables()),
|
||||
|
||||
InfBound(1, F.NbVariables()),
|
||||
SupBound(1, F.NbVariables()),
|
||||
|
||||
SolSave(1, F.NbVariables()),
|
||||
GH(1, F.NbVariables()),
|
||||
DH(1, F.NbVariables()),
|
||||
DHSave(1, F.NbVariables()),
|
||||
FF(1, F.NbEquations()),
|
||||
PreviousSolution(1, F.NbVariables()),
|
||||
Save(0, NbIterations),
|
||||
Constraints(1, F.NbVariables()),
|
||||
Temp1(1, F.NbVariables()),
|
||||
Temp2(1, F.NbVariables()),
|
||||
Temp3(1, F.NbVariables()),
|
||||
Temp4(1, F.NbEquations())
|
||||
|
||||
: Delta(1, theFunction.NbVariables()),
|
||||
Sol (1, theFunction.NbVariables()),
|
||||
DF (1, theFunction.NbEquations() , 1, theFunction.NbVariables()),
|
||||
Tol (1, theFunction.NbVariables()),
|
||||
Done (Standard_False),
|
||||
Kount (0),
|
||||
State (0),
|
||||
Itermax (theNbIterations),
|
||||
InfBound(1, theFunction.NbVariables(), RealFirst()),
|
||||
SupBound(1, theFunction.NbVariables(), RealLast ()),
|
||||
SolSave (1, theFunction.NbVariables()),
|
||||
GH (1, theFunction.NbVariables()),
|
||||
DH (1, theFunction.NbVariables()),
|
||||
DHSave (1, theFunction.NbVariables()),
|
||||
FF (1, theFunction.NbEquations()),
|
||||
PreviousSolution(1, theFunction.NbVariables()),
|
||||
Save (0, theNbIterations),
|
||||
Constraints(1, theFunction.NbVariables()),
|
||||
Temp1 (1, theFunction.NbVariables()),
|
||||
Temp2 (1, theFunction.NbVariables()),
|
||||
Temp3 (1, theFunction.NbVariables()),
|
||||
Temp4 (1, theFunction.NbEquations()),
|
||||
myIsDivergent(Standard_False)
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= Tol.Length(); i++) {
|
||||
Tol(i) =Tolerance(i);
|
||||
}
|
||||
Itermax = NbIterations;
|
||||
SetTolerance(theTolerance);
|
||||
}
|
||||
|
||||
math_FunctionSetRoot::math_FunctionSetRoot(math_FunctionSetWithDerivatives& F,
|
||||
const Standard_Integer NbIterations) :
|
||||
Delta(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DF(1, F.NbEquations(),
|
||||
1, F.NbVariables()),
|
||||
Tol(1, F.NbVariables()),
|
||||
|
||||
InfBound(1, F.NbVariables()),
|
||||
SupBound(1, F.NbVariables()),
|
||||
|
||||
SolSave(1, F.NbVariables()),
|
||||
GH(1, F.NbVariables()),
|
||||
DH(1, F.NbVariables()),
|
||||
DHSave(1, F.NbVariables()),
|
||||
FF(1, F.NbEquations()),
|
||||
PreviousSolution(1, F.NbVariables()),
|
||||
Save(0, NbIterations),
|
||||
Constraints(1, F.NbVariables()),
|
||||
Temp1(1, F.NbVariables()),
|
||||
Temp2(1, F.NbVariables()),
|
||||
Temp3(1, F.NbVariables()),
|
||||
Temp4(1, F.NbEquations())
|
||||
//=======================================================================
|
||||
//function : math_FunctionSetRoot
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
math_FunctionSetRoot::math_FunctionSetRoot(math_FunctionSetWithDerivatives& theFunction,
|
||||
const Standard_Integer theNbIterations)
|
||||
|
||||
: Delta(1, theFunction.NbVariables()),
|
||||
Sol (1, theFunction.NbVariables()),
|
||||
DF (1, theFunction.NbEquations() , 1, theFunction.NbVariables()),
|
||||
Tol (1, theFunction.NbVariables()),
|
||||
Done (Standard_False),
|
||||
Kount (0),
|
||||
State (0),
|
||||
Itermax (theNbIterations),
|
||||
InfBound(1, theFunction.NbVariables(), RealFirst()),
|
||||
SupBound(1, theFunction.NbVariables(), RealLast ()),
|
||||
SolSave (1, theFunction.NbVariables()),
|
||||
GH (1, theFunction.NbVariables()),
|
||||
DH (1, theFunction.NbVariables()),
|
||||
DHSave (1, theFunction.NbVariables()),
|
||||
FF (1, theFunction.NbEquations()),
|
||||
PreviousSolution(1, theFunction.NbVariables()),
|
||||
Save (0, theNbIterations),
|
||||
Constraints(1, theFunction.NbVariables()),
|
||||
Temp1 (1, theFunction.NbVariables()),
|
||||
Temp2 (1, theFunction.NbVariables()),
|
||||
Temp3 (1, theFunction.NbVariables()),
|
||||
Temp4 (1, theFunction.NbEquations()),
|
||||
myIsDivergent(Standard_False)
|
||||
{
|
||||
Itermax = NbIterations;
|
||||
}
|
||||
|
||||
|
||||
|
||||
math_FunctionSetRoot::math_FunctionSetRoot(math_FunctionSetWithDerivatives& F,
|
||||
const math_Vector& StartingPoint,
|
||||
const math_Vector& Tolerance,
|
||||
const math_Vector& infBound,
|
||||
const math_Vector& supBound,
|
||||
const Standard_Integer NbIterations,
|
||||
Standard_Boolean theStopOnDivergent) :
|
||||
Delta(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DF(1, F.NbEquations(),
|
||||
1, F.NbVariables()),
|
||||
Tol(1,F.NbVariables()),
|
||||
|
||||
|
||||
InfBound(1, F.NbVariables()),
|
||||
SupBound(1, F.NbVariables()),
|
||||
|
||||
SolSave(1, F.NbVariables()),
|
||||
GH(1, F.NbVariables()),
|
||||
DH(1, F.NbVariables()),
|
||||
DHSave(1, F.NbVariables()),
|
||||
FF(1, F.NbEquations()),
|
||||
PreviousSolution(1, F.NbVariables()),
|
||||
Save(0, NbIterations),
|
||||
Constraints(1, F.NbVariables()),
|
||||
Temp1(1, F.NbVariables()),
|
||||
Temp2(1, F.NbVariables()),
|
||||
Temp3(1, F.NbVariables()),
|
||||
Temp4(1, F.NbEquations())
|
||||
|
||||
{
|
||||
|
||||
for (Standard_Integer i = 1; i <= Tol.Length(); i++) {
|
||||
Tol(i) =Tolerance(i);
|
||||
}
|
||||
Itermax = NbIterations;
|
||||
Perform(F, StartingPoint, infBound, supBound, theStopOnDivergent);
|
||||
}
|
||||
|
||||
math_FunctionSetRoot::math_FunctionSetRoot(math_FunctionSetWithDerivatives& F,
|
||||
const math_Vector& StartingPoint,
|
||||
const math_Vector& Tolerance,
|
||||
const Standard_Integer NbIterations) :
|
||||
Delta(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DF(1, F.NbEquations(),
|
||||
1, StartingPoint.Length()),
|
||||
Tol(1,F.NbVariables()),
|
||||
|
||||
InfBound(1, F.NbVariables()),
|
||||
SupBound(1, F.NbVariables()),
|
||||
|
||||
SolSave(1, F.NbVariables()),
|
||||
GH(1, F.NbVariables()),
|
||||
DH(1, F.NbVariables()),
|
||||
DHSave(1, F.NbVariables()),
|
||||
FF(1, F.NbEquations()),
|
||||
PreviousSolution(1, F.NbVariables()),
|
||||
Save(0, NbIterations),
|
||||
Constraints(1, F.NbVariables()),
|
||||
Temp1(1, F.NbVariables()),
|
||||
Temp2(1, F.NbVariables()),
|
||||
Temp3(1, F.NbVariables()),
|
||||
Temp4(1, F.NbEquations())
|
||||
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= Tol.Length(); i++) {
|
||||
Tol(i) = Tolerance(i);
|
||||
}
|
||||
Itermax = NbIterations;
|
||||
InfBound.Init(RealFirst());
|
||||
SupBound.Init(RealLast());
|
||||
Perform(F, StartingPoint, InfBound, SupBound);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~math_FunctionSetRoot
|
||||
//purpose : Destructor
|
||||
//=======================================================================
|
||||
math_FunctionSetRoot::~math_FunctionSetRoot()
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
|
||||
void math_FunctionSetRoot::SetTolerance(const math_Vector& Tolerance)
|
||||
//=======================================================================
|
||||
//function : SetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_FunctionSetRoot::SetTolerance(const math_Vector& theTolerance)
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= Tol.Length(); i++) {
|
||||
Tol(i) = Tolerance(i);
|
||||
}
|
||||
for (Standard_Integer i = 1; i <= Tol.Length(); ++i)
|
||||
Tol(i) = theTolerance(i);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& theFunction,
|
||||
const math_Vector& theStartingPoint,
|
||||
const Standard_Boolean theStopOnDivergent)
|
||||
{
|
||||
Perform(theFunction, theStartingPoint, InfBound, SupBound, theStopOnDivergent);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
const math_Vector& StartingPoint,
|
||||
const math_Vector& theInfBound,
|
||||
@@ -1232,38 +1193,40 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Standard_Boolean math_FunctionSetRoot::IsSolutionReached(math_FunctionSetWithDerivatives& ) {
|
||||
for(Standard_Integer i = 1; i<= Sol.Length(); i++) {
|
||||
if(Abs(Delta(i)) > Tol(i)) {return Standard_False;}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
void math_FunctionSetRoot::Dump(Standard_OStream& o) const {
|
||||
o<<" math_FunctionSetRoot";
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_FunctionSetRoot::Dump(Standard_OStream& o) const
|
||||
{
|
||||
o << " math_FunctionSetRoot";
|
||||
if (Done) {
|
||||
o << " Status = Done\n";
|
||||
o << " Location value = " << Sol << "\n";
|
||||
o << " Number of iterations = " << Kount << "\n";
|
||||
}
|
||||
else {
|
||||
o<<"Status = Not Done\n";
|
||||
o << "Status = Not Done\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void math_FunctionSetRoot::Root(math_Vector& Root) const{
|
||||
//=======================================================================
|
||||
//function : Root
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_FunctionSetRoot::Root(math_Vector& Root) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!Done, " ");
|
||||
Standard_DimensionError_Raise_if(Root.Length() != Sol.Length(), " ");
|
||||
Root = Sol;
|
||||
}
|
||||
|
||||
|
||||
void math_FunctionSetRoot::FunctionSetErrors(math_Vector& Err) const{
|
||||
//=======================================================================
|
||||
//function : FunctionSetErrors
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_FunctionSetRoot::FunctionSetErrors(math_Vector& Err) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!Done, " ");
|
||||
Standard_DimensionError_Raise_if(Err.Length() != Sol.Length(), " ");
|
||||
Err = Delta;
|
||||
|
@@ -15,8 +15,26 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_DimensionError.hxx>
|
||||
|
||||
inline void math_FunctionSetRoot::Delete() const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean math_FunctionSetRoot::IsSolutionReached(math_FunctionSetWithDerivatives&)
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= Sol.Length(); ++i)
|
||||
if ( Abs(Delta(i)) > Tol(i) )
|
||||
return Standard_False;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean math_FunctionSetRoot::IsDone() const
|
||||
{
|
||||
return Done;
|
||||
}
|
||||
|
||||
inline Standard_Boolean math_FunctionSetRoot::IsDone() const { return Done; }
|
||||
|
||||
inline Standard_OStream& operator<<(Standard_OStream& o,
|
||||
const math_FunctionSetRoot& F)
|
||||
|
@@ -247,7 +247,9 @@ Standard_Boolean math_GlobOptMin::computeLocalExtremum(const math_Vector& thePnt
|
||||
math_MultipleVarFunctionWithHessian* myTmp =
|
||||
dynamic_cast<math_MultipleVarFunctionWithHessian*> (myFunc);
|
||||
|
||||
math_NewtonMinimum newtonMinimum(*myTmp, thePnt);
|
||||
math_NewtonMinimum newtonMinimum(*myTmp);
|
||||
newtonMinimum.Perform(*myTmp, thePnt);
|
||||
|
||||
if (newtonMinimum.IsDone())
|
||||
{
|
||||
newtonMinimum.Location(theOutPnt);
|
||||
@@ -278,7 +280,8 @@ Standard_Boolean math_GlobOptMin::computeLocalExtremum(const math_Vector& thePnt
|
||||
for(i = 1; i <= myN; i++)
|
||||
m(1, 1) = 1.0;
|
||||
|
||||
math_Powell powell(*myFunc, thePnt, m, 1e-10);
|
||||
math_Powell powell(*myFunc, 1e-10);
|
||||
powell.Perform(*myFunc, thePnt, m);
|
||||
|
||||
if (powell.IsDone())
|
||||
{
|
||||
|
@@ -30,96 +30,66 @@ raises NotDone from StdFail,
|
||||
|
||||
is
|
||||
|
||||
Create(F: in out FunctionSetWithDerivatives;
|
||||
XTol: Vector; FTol: Real;
|
||||
NbIterations: Integer = 100)
|
||||
---Purpose:
|
||||
-- This constructor should be used in a sub-class to initialize
|
||||
-- correctly all the fields of this class.
|
||||
-- The range (1, F.NbVariables()) must be especially respected for
|
||||
-- all vectors and matrix declarations.
|
||||
|
||||
returns NewtonFunctionSetRoot;
|
||||
|
||||
|
||||
Create(F: in out FunctionSetWithDerivatives;
|
||||
FTol: Real; NbIterations: Integer = 100)
|
||||
---Purpose:
|
||||
-- This constructor should be used in a sub-class to initialize
|
||||
-- correctly all the fields of this class.
|
||||
-- The range (1, F.NbVariables()) must be especially respected for
|
||||
-- all vectors and matrix declarations.
|
||||
-- The method SetTolerance must be called before performing the
|
||||
-- algorithm.
|
||||
|
||||
returns NewtonFunctionSetRoot;
|
||||
|
||||
|
||||
|
||||
Create(F: in out FunctionSetWithDerivatives;
|
||||
StartingPoint: Vector;
|
||||
XTol: Vector; FTol: Real;
|
||||
NbIterations: Integer = 100)
|
||||
---Purpose:
|
||||
-- The Newton method is done to improve the root of the function F
|
||||
-- from the initial guess StartingPoint.
|
||||
-- The tolerance required on the root is given by Tolerance.
|
||||
-- The solution is found when :
|
||||
-- abs(Xj - Xj-1)(i) <= XTol(i) and abs(Fi) <= FTol for all i;
|
||||
-- The maximum number of iterations allowed is given by NbIterations.
|
||||
|
||||
returns NewtonFunctionSetRoot;
|
||||
|
||||
Create(theFunction: in out FunctionSetWithDerivatives;
|
||||
theXTolerance: Vector; theFTolerance: Real;
|
||||
tehNbIterations: Integer = 100)
|
||||
---Purpose:
|
||||
-- Initialize correctly all the fields of this class.
|
||||
-- The range (1, F.NbVariables()) must be especially respected for
|
||||
-- all vectors and matrix declarations.
|
||||
returns NewtonFunctionSetRoot;
|
||||
|
||||
|
||||
Create(F: in out FunctionSetWithDerivatives;
|
||||
StartingPoint: Vector;
|
||||
InfBound, SupBound: Vector;
|
||||
XTol: Vector; FTol: Real;
|
||||
NbIterations: Integer = 100)
|
||||
---Purpose:
|
||||
-- The Newton method is done to improve the root of the function F
|
||||
-- from the initial guess StartingPoint.
|
||||
-- The tolerance required on the root is given by Tolerance.
|
||||
-- The solution is found when :
|
||||
-- abs(Xj - Xj-1)(i) <= XTol(i) and abs(Fi) <= FTol for all i;
|
||||
-- The maximum number of iterations allowed is given by NbIterations.
|
||||
|
||||
returns NewtonFunctionSetRoot;
|
||||
Create(theFunction: in out FunctionSetWithDerivatives;
|
||||
theFTolerance: Real; theNbIterations: Integer = 100)
|
||||
---Purpose:
|
||||
-- This constructor should be used in a sub-class to initialize
|
||||
-- correctly all the fields of this class.
|
||||
-- The range (1, F.NbVariables()) must be especially respected for
|
||||
-- all vectors and matrix declarations.
|
||||
-- The method SetTolerance must be called before performing the algorithm.
|
||||
returns NewtonFunctionSetRoot;
|
||||
|
||||
|
||||
Delete(me) is static;
|
||||
---Purpose: Destructor alias.
|
||||
---C++: alias " Standard_EXPORT virtual ~math_NewtonFunctionSetRoot();"
|
||||
|
||||
|
||||
|
||||
SetTolerance(me: in out; XTol: Vector)
|
||||
---Purpose: Initializes the tolerance values for the unknowns.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me: in out; F:in out FunctionSetWithDerivatives;
|
||||
StartingPoint: Vector;
|
||||
InfBound, SupBound: Vector)
|
||||
---Purpose: Improves the root of function F from the initial guess
|
||||
-- StartingPoint. infBound and supBound may be given, to constrain the solution.
|
||||
-- Warning
|
||||
-- This method must be called when the solution is not computed by the constructors.
|
||||
|
||||
---Purpose: Initializes the tolerance values for the unknowns.
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me: in out; theFunction: in out FunctionSetWithDerivatives; theStartingPoint: Vector)
|
||||
---Purpose:
|
||||
-- The Newton method is done to improve the root of the function
|
||||
-- from the initial guess point. The solution is found when:
|
||||
-- abs(Xj - Xj-1)(i) <= XTol(i) and abs(Fi) <= FTol for all i;
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me: in out; theFunction: in out FunctionSetWithDerivatives;
|
||||
theStartingPoint: Vector; theInfBound, theSupBound: Vector)
|
||||
---Purpose:
|
||||
-- The Newton method is done to improve the root of the function
|
||||
-- from the initial guess point. Bounds may be given, to constrain the solution.
|
||||
-- The solution is found when:
|
||||
-- abs(Xj - Xj-1)(i) <= XTol(i) and abs(Fi) <= FTol for all i;
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
IsSolutionReached(me: in out; F: in out FunctionSetWithDerivatives)
|
||||
---Purpose:
|
||||
-- This method is called at the end of each iteration to check if the
|
||||
-- solution is found.
|
||||
-- Vectors DeltaX, Fvalues and Jacobian Matrix are consistent with the
|
||||
-- possible solution Vector Sol and can be inspected to decide whether
|
||||
-- the solution is reached or not.
|
||||
---Purpose:
|
||||
-- This method is called at the end of each iteration to check if the
|
||||
-- solution is found.
|
||||
-- Vectors DeltaX, Fvalues and Jacobian Matrix are consistent with the
|
||||
-- possible solution Vector Sol and can be inspected to decide whether
|
||||
-- the solution is reached or not.
|
||||
---C++: inline
|
||||
returns Boolean is virtual;
|
||||
|
||||
|
||||
returns Boolean
|
||||
is virtual;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
---Purpose: Returns true if the computations are successful, otherwise returns false.
|
||||
---C++: inline
|
||||
|
@@ -22,128 +22,93 @@
|
||||
#include <math_Recipes.hxx>
|
||||
#include <math_FunctionSetWithDerivatives.hxx>
|
||||
|
||||
Standard_Boolean math_NewtonFunctionSetRoot::IsSolutionReached
|
||||
// (math_FunctionSetWithDerivatives& F)
|
||||
(math_FunctionSetWithDerivatives& )
|
||||
{
|
||||
|
||||
for(Standard_Integer i = DeltaX.Lower(); i <= DeltaX.Upper(); i++) {
|
||||
if(Abs(DeltaX(i)) > TolX(i) || Abs(FValues(i)) > TolF) return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
// Constructeurs d'initialisation des champs (pour utiliser Perform)
|
||||
|
||||
//=======================================================================
|
||||
//function : math_NewtonFunctionSetRoot
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
math_NewtonFunctionSetRoot::math_NewtonFunctionSetRoot(
|
||||
math_FunctionSetWithDerivatives& F,
|
||||
const math_Vector& XTol,
|
||||
const Standard_Real FTol,
|
||||
const Standard_Integer NbIterations):
|
||||
TolX(1, F.NbVariables()),
|
||||
TolF(FTol),
|
||||
Indx(1, F.NbVariables()),
|
||||
Scratch(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DeltaX(1, F.NbVariables()),
|
||||
FValues(1, F.NbVariables()),
|
||||
Jacobian(1, F.NbVariables(),
|
||||
1, F.NbVariables()),
|
||||
Itermax(NbIterations)
|
||||
math_FunctionSetWithDerivatives& theFunction,
|
||||
const math_Vector& theXTolerance,
|
||||
const Standard_Real theFTolerance,
|
||||
const Standard_Integer theNbIterations)
|
||||
|
||||
: TolX (1, theFunction.NbVariables()),
|
||||
TolF (theFTolerance),
|
||||
Indx (1, theFunction.NbVariables()),
|
||||
Scratch (1, theFunction.NbVariables()),
|
||||
Sol (1, theFunction.NbVariables()),
|
||||
DeltaX (1, theFunction.NbVariables()),
|
||||
FValues (1, theFunction.NbVariables()),
|
||||
Jacobian(1, theFunction.NbVariables(), 1, theFunction.NbVariables()),
|
||||
Done (Standard_False),
|
||||
State (0),
|
||||
Iter (0),
|
||||
Itermax (theNbIterations)
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= TolX.Length(); i++) {
|
||||
TolX(i) = XTol(i);
|
||||
}
|
||||
SetTolerance(theXTolerance);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : math_NewtonFunctionSetRoot
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
math_NewtonFunctionSetRoot::math_NewtonFunctionSetRoot(
|
||||
math_FunctionSetWithDerivatives& F,
|
||||
const Standard_Real FTol,
|
||||
const Standard_Integer NbIterations):
|
||||
TolX(1, F.NbVariables()),
|
||||
TolF(FTol),
|
||||
Indx(1, F.NbVariables()),
|
||||
Scratch(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DeltaX(1, F.NbVariables()),
|
||||
FValues(1, F.NbVariables()),
|
||||
Jacobian(1, F.NbVariables(),
|
||||
1, F.NbVariables()),
|
||||
Itermax(NbIterations)
|
||||
math_FunctionSetWithDerivatives& theFunction,
|
||||
const Standard_Real theFTolerance,
|
||||
const Standard_Integer theNbIterations)
|
||||
|
||||
: TolX (1, theFunction.NbVariables()),
|
||||
TolF (theFTolerance),
|
||||
Indx (1, theFunction.NbVariables()),
|
||||
Scratch (1, theFunction.NbVariables()),
|
||||
Sol (1, theFunction.NbVariables()),
|
||||
DeltaX (1, theFunction.NbVariables()),
|
||||
FValues (1, theFunction.NbVariables()),
|
||||
Jacobian(1, theFunction.NbVariables(), 1, theFunction.NbVariables()),
|
||||
Done (Standard_False),
|
||||
State (0),
|
||||
Iter (0),
|
||||
Itermax (theNbIterations)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
math_NewtonFunctionSetRoot::math_NewtonFunctionSetRoot
|
||||
(math_FunctionSetWithDerivatives& F,
|
||||
const math_Vector& StartingPoint,
|
||||
const math_Vector& XTol,
|
||||
const Standard_Real FTol,
|
||||
const Standard_Integer NbIterations) :
|
||||
|
||||
TolX(1, F.NbVariables()),
|
||||
TolF(FTol),
|
||||
Indx (1, F.NbVariables()),
|
||||
Scratch (1, F.NbVariables()),
|
||||
Sol (1, F.NbVariables()),
|
||||
DeltaX (1, F.NbVariables()),
|
||||
FValues (1, F.NbVariables()),
|
||||
Jacobian(1, F.NbVariables(),
|
||||
1, F.NbVariables()),
|
||||
Itermax(NbIterations)
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= TolX.Length(); i++) {
|
||||
TolX(i) = XTol(i);
|
||||
}
|
||||
math_Vector UFirst(1, F.NbVariables()),
|
||||
ULast(1, F.NbVariables());
|
||||
UFirst.Init(RealFirst());
|
||||
ULast.Init(RealLast());
|
||||
Perform(F, StartingPoint, UFirst, ULast);
|
||||
}
|
||||
|
||||
math_NewtonFunctionSetRoot::math_NewtonFunctionSetRoot
|
||||
(math_FunctionSetWithDerivatives& F,
|
||||
const math_Vector& StartingPoint,
|
||||
const math_Vector& InfBound,
|
||||
const math_Vector& SupBound,
|
||||
const math_Vector& XTol,
|
||||
const Standard_Real FTol,
|
||||
const Standard_Integer NbIterations) :
|
||||
|
||||
TolX(1, F.NbVariables()),
|
||||
TolF(FTol),
|
||||
Indx (1, F.NbVariables()),
|
||||
Scratch (1, F.NbVariables()),
|
||||
Sol (1, F.NbVariables()),
|
||||
DeltaX (1, F.NbVariables()),
|
||||
FValues (1, F.NbVariables()),
|
||||
Jacobian(1, F.NbVariables(),
|
||||
1, F.NbVariables()),
|
||||
Itermax(NbIterations)
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= TolX.Length(); i++) {
|
||||
TolX(i) = XTol(i);
|
||||
}
|
||||
Perform(F, StartingPoint, InfBound, SupBound);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~math_NewtonFunctionSetRoot
|
||||
//purpose : Destructor
|
||||
//=======================================================================
|
||||
math_NewtonFunctionSetRoot::~math_NewtonFunctionSetRoot()
|
||||
{
|
||||
}
|
||||
|
||||
void math_NewtonFunctionSetRoot::SetTolerance
|
||||
(const math_Vector& XTol)
|
||||
//=======================================================================
|
||||
//function : SetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_NewtonFunctionSetRoot::SetTolerance(const math_Vector& theXTolerance)
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= TolX.Length(); i++) {
|
||||
TolX(i) = XTol(i);
|
||||
}
|
||||
for (Standard_Integer i = 1; i <= TolX.Length(); ++i)
|
||||
TolX(i) = theXTolerance(i);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_NewtonFunctionSetRoot::Perform(
|
||||
math_FunctionSetWithDerivatives& theFunction,
|
||||
const math_Vector& theStartingPoint)
|
||||
{
|
||||
const math_Vector anInf(1, theFunction.NbVariables(), RealFirst());
|
||||
const math_Vector aSup (1, theFunction.NbVariables(), RealLast ());
|
||||
|
||||
Perform(theFunction, theStartingPoint, anInf, aSup);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_NewtonFunctionSetRoot::Perform(
|
||||
math_FunctionSetWithDerivatives& F,
|
||||
const math_Vector& StartingPoint,
|
||||
@@ -184,6 +149,10 @@ void math_NewtonFunctionSetRoot::Perform(
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_NewtonFunctionSetRoot::Dump(Standard_OStream& o) const
|
||||
{
|
||||
o <<"math_NewtonFunctionSetRoot ";
|
||||
|
@@ -14,8 +14,23 @@
|
||||
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
inline Standard_Boolean math_NewtonFunctionSetRoot::IsDone() const
|
||||
{ return Done;}
|
||||
inline void math_NewtonFunctionSetRoot::Delete() const
|
||||
{
|
||||
}
|
||||
|
||||
inline Standard_Boolean math_NewtonFunctionSetRoot::IsSolutionReached(math_FunctionSetWithDerivatives&)
|
||||
{
|
||||
for (Standard_Integer i = DeltaX.Lower(); i <= DeltaX.Upper(); ++i)
|
||||
if ( Abs(DeltaX(i)) > TolX(i) || Abs(FValues(i)) > TolF )
|
||||
return Standard_False;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
inline Standard_Boolean math_NewtonFunctionSetRoot::IsDone() const
|
||||
{
|
||||
return Done;
|
||||
}
|
||||
|
||||
inline Standard_OStream& operator<<(Standard_OStream& o,
|
||||
const math_NewtonFunctionSetRoot& N)
|
||||
|
@@ -28,57 +28,41 @@ raises NotDone, DimensionError
|
||||
|
||||
is
|
||||
|
||||
Create(F: in out MultipleVarFunctionWithHessian;
|
||||
StartingPoint: Vector;
|
||||
Tolerance: Real=1.0e-7;
|
||||
NbIterations: Integer=40;
|
||||
Convexity: Real=1.0e-6;
|
||||
WithSingularity : Boolean = Standard_True)
|
||||
---Purpose: -- Given the starting point StartingPoint,
|
||||
-- The tolerance required on the solution is given by
|
||||
-- Tolerance.
|
||||
-- Iteration are stopped if
|
||||
-- (!WithSingularity) and H(F(Xi)) is not definite
|
||||
-- positive (if the smaller eigenvalue of H < Convexity)
|
||||
-- or IsConverged() returns True for 2 successives Iterations.
|
||||
-- Warning: Obsolete Constructor (because IsConverged can not be redefined
|
||||
-- with this. )
|
||||
Create(theFunction: in MultipleVarFunctionWithHessian;
|
||||
theTolerance: Real=1.0e-7;
|
||||
theNbIterations: Integer=40;
|
||||
theConvexity: Real=1.0e-6;
|
||||
theWithSingularity: Boolean = Standard_True)
|
||||
---Purpose:
|
||||
-- The tolerance required on the solution is given by Tolerance.
|
||||
-- Iteration are stopped if (!WithSingularity) and H(F(Xi)) is not definite
|
||||
-- positive (if the smaller eigenvalue of H < Convexity)
|
||||
-- or IsConverged() returns True for 2 successives Iterations.
|
||||
-- Warning: This constructor does not perform computation.
|
||||
returns NewtonMinimum;
|
||||
|
||||
Create(F: in out MultipleVarFunctionWithHessian;
|
||||
Tolerance: Real=1.0e-7;
|
||||
NbIterations: Integer=40;
|
||||
Convexity: Real=1.0e-6;
|
||||
WithSingularity : Boolean = Standard_True)
|
||||
---Purpose:
|
||||
-- The tolerance required on the solution is given by
|
||||
-- Tolerance.
|
||||
-- Iteration are stopped if
|
||||
-- (!WithSingularity) and H(F(Xi)) is not definite
|
||||
-- positive (if the smaller eigenvalue of H < Convexity)
|
||||
-- or IsConverged() returns True for 2 successives Iterations.
|
||||
-- Warning: This constructor do not computation
|
||||
returns NewtonMinimum;
|
||||
|
||||
---C++: alias " Standard_EXPORT virtual ~math_NewtonMinimum();"
|
||||
|
||||
Perform(me: in out; F: in out MultipleVarFunctionWithHessian;
|
||||
StartingPoint: Vector)
|
||||
---Purpose: Search the solution.
|
||||
|
||||
Perform(me: in out; theFunction: in out MultipleVarFunctionWithHessian;
|
||||
theStartingPoint: Vector)
|
||||
---Purpose: Search the solution.
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
Delete(me) is static;
|
||||
---Purpose: Destructor alias.
|
||||
---C++: inline
|
||||
---C++: alias " Standard_EXPORT virtual ~math_NewtonMinimum();"
|
||||
|
||||
|
||||
IsConverged(me)
|
||||
---Purpose: This method is called at the end of each
|
||||
-- iteration to check the convergence :
|
||||
-- || Xi+1 - Xi || < Tolerance
|
||||
-- or || F(Xi+1) - F(Xi)|| < Tolerance * || F(Xi) ||
|
||||
-- It can be redefined in a sub-class to implement a specific test.
|
||||
|
||||
returns Boolean
|
||||
is virtual;
|
||||
|
||||
|
||||
---Purpose:
|
||||
-- This method is called at the end of each iteration to check the convergence:
|
||||
-- || Xi+1 - Xi || < Tolerance or || F(Xi+1) - F(Xi)|| < Tolerance * || F(Xi) ||
|
||||
-- It can be redefined in a sub-class to implement a specific test.
|
||||
---C++: inline
|
||||
returns Boolean is virtual;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
---Purpose: Tests if an error has occured.
|
||||
---C++: inline
|
||||
|
@@ -25,58 +25,49 @@
|
||||
#include <math_Gauss.hxx>
|
||||
#include <math_Jacobi.hxx>
|
||||
|
||||
//============================================================================
|
||||
math_NewtonMinimum::math_NewtonMinimum(math_MultipleVarFunctionWithHessian& F,
|
||||
const math_Vector& StartingPoint,
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Real Convexity,
|
||||
const Standard_Boolean WithSingularity)
|
||||
//============================================================================
|
||||
: TheLocation(1, F.NbVariables()),
|
||||
TheGradient(1, F.NbVariables()),
|
||||
TheStep(1, F.NbVariables(), 10*Tolerance),
|
||||
TheHessian(1, F.NbVariables(), 1, F.NbVariables() )
|
||||
//=======================================================================
|
||||
//function : math_NewtonMinimum
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
math_NewtonMinimum::math_NewtonMinimum(
|
||||
const math_MultipleVarFunctionWithHessian& theFunction,
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Integer theNbIterations,
|
||||
const Standard_Real theConvexity,
|
||||
const Standard_Boolean theWithSingularity
|
||||
)
|
||||
: TheStatus (math_NotBracketed),
|
||||
TheLocation(1, theFunction.NbVariables()),
|
||||
TheGradient(1, theFunction.NbVariables()),
|
||||
TheStep (1, theFunction.NbVariables(), 10.0 * theTolerance),
|
||||
TheHessian (1, theFunction.NbVariables(), 1, theFunction.NbVariables()),
|
||||
PreviousMinimum (0.0),
|
||||
TheMinimum (0.0),
|
||||
MinEigenValue (0.0),
|
||||
XTol (theTolerance),
|
||||
CTol (theConvexity),
|
||||
nbiter (0),
|
||||
NoConvexTreatement(theWithSingularity),
|
||||
Convex (Standard_True),
|
||||
Done (Standard_False),
|
||||
Itermax (theNbIterations)
|
||||
{
|
||||
XTol = Tolerance;
|
||||
CTol = Convexity;
|
||||
Itermax = NbIterations;
|
||||
NoConvexTreatement = WithSingularity;
|
||||
Convex = Standard_True;
|
||||
// Done = Standard_True;
|
||||
// TheStatus = math_OK;
|
||||
Perform ( F, StartingPoint);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
math_NewtonMinimum::math_NewtonMinimum(math_MultipleVarFunctionWithHessian& F,
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Real Convexity,
|
||||
const Standard_Boolean WithSingularity)
|
||||
//============================================================================
|
||||
: TheLocation(1, F.NbVariables()),
|
||||
TheGradient(1, F.NbVariables()),
|
||||
TheStep(1, F.NbVariables(), 10*Tolerance),
|
||||
TheHessian(1, F.NbVariables(), 1, F.NbVariables() )
|
||||
{
|
||||
XTol = Tolerance;
|
||||
CTol = Convexity;
|
||||
Itermax = NbIterations;
|
||||
NoConvexTreatement = WithSingularity;
|
||||
Convex = Standard_True;
|
||||
Done = Standard_False;
|
||||
TheStatus = math_NotBracketed;
|
||||
}
|
||||
//============================================================================
|
||||
//=======================================================================
|
||||
//function : ~math_NewtonMinimum
|
||||
//purpose : Destructor
|
||||
//=======================================================================
|
||||
math_NewtonMinimum::~math_NewtonMinimum()
|
||||
{
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_NewtonMinimum::Perform(math_MultipleVarFunctionWithHessian& F,
|
||||
const math_Vector& StartingPoint)
|
||||
//============================================================================
|
||||
const math_Vector& StartingPoint)
|
||||
{
|
||||
math_Vector Point1 (1, F.NbVariables());
|
||||
Point1 = StartingPoint;
|
||||
@@ -191,26 +182,20 @@ void math_NewtonMinimum::Perform(math_MultipleVarFunctionWithHessian& F,
|
||||
TheLocation = *precedent;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
Standard_Boolean math_NewtonMinimum::IsConverged() const
|
||||
//============================================================================
|
||||
{
|
||||
return ( (TheStep.Norm() <= XTol ) ||
|
||||
( Abs(TheMinimum-PreviousMinimum) <= XTol*Abs(PreviousMinimum) ));
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_NewtonMinimum::Dump(Standard_OStream& o) const
|
||||
//============================================================================
|
||||
{
|
||||
o<< "math_Newton Optimisation: ";
|
||||
o << " Done =" << Done << endl;
|
||||
o << " Status = " << (Standard_Integer)TheStatus << endl;
|
||||
o <<" Location Vector = " << Location() << endl;
|
||||
o <<" Minimum value = "<< Minimum()<< endl;
|
||||
o <<" Previous value = "<< PreviousMinimum << endl;
|
||||
o <<" Number of iterations = " <<NbIterations() << endl;
|
||||
o <<" Convexity = " << Convex << endl;
|
||||
o <<" Eigen Value = " << MinEigenValue << endl;
|
||||
o<< "math_Newton Optimisation: ";
|
||||
o << " Done =" << Done << endl;
|
||||
o << " Status = " << (Standard_Integer)TheStatus << endl;
|
||||
o << " Location Vector = " << Location() << endl;
|
||||
o << " Minimum value = "<< Minimum()<< endl;
|
||||
o << " Previous value = "<< PreviousMinimum << endl;
|
||||
o << " Number of iterations = " <<NbIterations() << endl;
|
||||
o << " Convexity = " << Convex << endl;
|
||||
o << " Eigen Value = " << MinEigenValue << endl;
|
||||
}
|
||||
|
||||
|
@@ -16,6 +16,16 @@
|
||||
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
inline void math_NewtonMinimum::Delete() const
|
||||
{
|
||||
}
|
||||
|
||||
inline Standard_Boolean math_NewtonMinimum::IsConverged() const
|
||||
{
|
||||
return ( (TheStep.Norm() <= XTol ) ||
|
||||
( Abs(TheMinimum-PreviousMinimum) <= XTol * Abs(PreviousMinimum) ));
|
||||
}
|
||||
|
||||
inline Standard_Boolean math_NewtonMinimum::IsDone() const
|
||||
{
|
||||
return Done;
|
||||
|
@@ -27,52 +27,37 @@ raises NotDone from StdFail,
|
||||
|
||||
is
|
||||
|
||||
Create(F: in out MultipleVarFunction; StartingPoint: Vector;
|
||||
StartingDirections: Matrix; Tolerance: Real;
|
||||
NbIterations: Integer=200; ZEPS: Real=1.0e-12)
|
||||
---Purpose:
|
||||
-- Computes Powell minimization on the function F given
|
||||
-- StartingPoint, and an initial matrix StartingDirection
|
||||
-- whose columns contain the initial set of directions. The
|
||||
-- solution F = Fi is found when 2.0 * abs(Fi - Fi-1) =
|
||||
-- <Tolerance * (abs(Fi) + abs(Fi-1) + ZEPS). The maximum
|
||||
-- number of iterations allowed is given by NbIterations.
|
||||
returns Powell;
|
||||
|
||||
|
||||
Create(F: in out MultipleVarFunction;
|
||||
Tolerance: Real;
|
||||
NbIterations: Integer = 200;
|
||||
ZEPS: Real = 1.0e-12)
|
||||
---Purpose: is used in a sub-class to initialize correctly all the fields
|
||||
-- of this class.
|
||||
|
||||
Create(theFunction: in MultipleVarFunction;
|
||||
theTolerance: Real; theNbIterations: Integer = 200; theZEPS: Real = 1.0e-12)
|
||||
---Purpose: Constructor. Initialize new entity.
|
||||
returns Powell;
|
||||
|
||||
|
||||
Delete(me) is static;
|
||||
---Purpose: Destructor alias
|
||||
---C++: inline
|
||||
---C++: alias " Standard_EXPORT virtual ~math_Powell();"
|
||||
|
||||
Perform(me: in out;F: in out MultipleVarFunction;
|
||||
StartingPoint: Vector;
|
||||
StartingDirections: Matrix)
|
||||
---Purpose: Use this method after a call to the initialization constructor
|
||||
-- to compute the minimum of function F.
|
||||
-- Warning
|
||||
-- The initialization constructor must have been called before
|
||||
-- the Perform method is called.
|
||||
|
||||
|
||||
Perform(me: in out; theFunction: in out MultipleVarFunction; theStartingPoint: Vector; theStartingDirections: Matrix)
|
||||
---Purpose:
|
||||
-- Computes Powell minimization on the function F given
|
||||
-- theStartingPoint, and an initial matrix theStartingDirection
|
||||
-- whose columns contain the initial set of directions.
|
||||
-- The solution F = Fi is found when:
|
||||
-- 2.0 * abs(Fi - Fi-1) =< Tolerance * (abs(Fi) + abs(Fi-1) + ZEPS).
|
||||
is static;
|
||||
|
||||
|
||||
IsSolutionReached(me: in out; F: in out MultipleVarFunction)
|
||||
---Purpose:
|
||||
-- solution F = Fi is found when :
|
||||
-- 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1)) + ZEPS.
|
||||
-- The maximum number of iterations allowed is given by NbIterations.
|
||||
|
||||
returns Boolean
|
||||
is virtual;
|
||||
|
||||
|
||||
IsSolutionReached(me: in out; theFunction: in out MultipleVarFunction)
|
||||
---Purpose:
|
||||
-- Solution F = Fi is found when:
|
||||
-- 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1)) + ZEPS.
|
||||
-- The maximum number of iterations allowed is given by NbIterations.
|
||||
---C++: inline
|
||||
returns Boolean is virtual;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
---Purpose: Returns true if the computations are successful, otherwise returns false.
|
||||
---C++: inline
|
||||
@@ -150,4 +135,3 @@ State: Integer;
|
||||
Itermax: Integer;
|
||||
|
||||
end Powell;
|
||||
|
||||
|
@@ -92,7 +92,8 @@ static Standard_Boolean MinimizeDirection(math_Vector& P,
|
||||
math_BracketMinimum Bracket(F, 0.0, 1.0);
|
||||
if (Bracket.IsDone()) {
|
||||
Bracket.Values(ax, xx, bx);
|
||||
math_BrentMinimum Sol(F, ax, xx, bx, 1.0e-10, 100);
|
||||
math_BrentMinimum Sol(1.0e-10);
|
||||
Sol.Perform(F, ax, xx, bx);
|
||||
if (Sol.IsDone()) {
|
||||
Standard_Real Scale = Sol.Location();
|
||||
Result = Sol.Minimum();
|
||||
@@ -104,15 +105,45 @@ static Standard_Boolean MinimizeDirection(math_Vector& P,
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : math_Powell
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
math_Powell::math_Powell(const math_MultipleVarFunction& theFunction,
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Integer theNbIterations,
|
||||
const Standard_Real theZEPS)
|
||||
: TheLocation (1, theFunction.NbVariables()),
|
||||
TheMinimum (RealLast()),
|
||||
TheLocationError(RealLast()),
|
||||
PreviousMinimum (RealLast()),
|
||||
XTol (theTolerance),
|
||||
EPSZ (theZEPS),
|
||||
Done (Standard_False),
|
||||
Iter (0),
|
||||
TheStatus (math_NotBracketed),
|
||||
TheDirections (1, theFunction.NbVariables(), 1, theFunction.NbVariables()),
|
||||
State (0),
|
||||
Itermax (theNbIterations)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~math_Powell
|
||||
//purpose : Destructor
|
||||
//=======================================================================
|
||||
math_Powell::~math_Powell()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_Powell::Perform(math_MultipleVarFunction& F,
|
||||
const math_Vector& StartingPoint,
|
||||
const math_Matrix& StartingDirections) {
|
||||
|
||||
|
||||
const math_Vector& StartingPoint,
|
||||
const math_Matrix& StartingDirections)
|
||||
{
|
||||
Done = Standard_False;
|
||||
Standard_Integer i, ibig, j;
|
||||
Standard_Real t, fptt, del;
|
||||
@@ -195,48 +226,13 @@ void math_Powell::Perform(math_MultipleVarFunction& F,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean math_Powell::IsSolutionReached(
|
||||
// math_MultipleVarFunction& F) {
|
||||
math_MultipleVarFunction& ) {
|
||||
|
||||
return 2.0*fabs(PreviousMinimum - TheMinimum) <=
|
||||
XTol*(fabs(PreviousMinimum)+fabs(TheMinimum) + EPSZ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
math_Powell::math_Powell(math_MultipleVarFunction& F,
|
||||
const math_Vector& StartingPoint,
|
||||
const math_Matrix& StartingDirections,
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Real ZEPS) :
|
||||
TheLocation(1, F.NbVariables()),
|
||||
TheDirections(1, F.NbVariables(),
|
||||
1, F.NbVariables()) {
|
||||
|
||||
XTol = Tolerance;
|
||||
EPSZ = ZEPS;
|
||||
Itermax = NbIterations;
|
||||
Perform(F, StartingPoint, StartingDirections);
|
||||
}
|
||||
|
||||
math_Powell::math_Powell(math_MultipleVarFunction& F,
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Real ZEPS) :
|
||||
TheLocation(1, F.NbVariables()),
|
||||
TheDirections(1, F.NbVariables(),
|
||||
1, F.NbVariables()) {
|
||||
|
||||
XTol = Tolerance;
|
||||
EPSZ = ZEPS;
|
||||
Itermax = NbIterations;
|
||||
}
|
||||
|
||||
void math_Powell::Dump(Standard_OStream& o) const {
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void math_Powell::Dump(Standard_OStream& o) const
|
||||
{
|
||||
o << "math_Powell resolution:";
|
||||
if(Done) {
|
||||
o << " Status = Done \n";
|
||||
|
@@ -15,7 +15,20 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
|
||||
inline Standard_Boolean math_Powell::IsDone() const { return Done; }
|
||||
inline void math_Powell::Delete() const
|
||||
{
|
||||
}
|
||||
|
||||
inline Standard_Boolean math_Powell::IsSolutionReached(math_MultipleVarFunction&)
|
||||
{
|
||||
return 2.0 * fabs(PreviousMinimum - TheMinimum) <=
|
||||
XTol * (fabs(PreviousMinimum) + fabs(TheMinimum) + EPSZ);
|
||||
}
|
||||
|
||||
inline Standard_Boolean math_Powell::IsDone() const
|
||||
{
|
||||
return Done;
|
||||
}
|
||||
|
||||
inline Standard_OStream& operator<<(Standard_OStream& o,
|
||||
const math_Powell& P)
|
||||
|
1
tests/3rdparty/end
vendored
1
tests/3rdparty/end
vendored
@@ -1,3 +1,4 @@
|
||||
vglinfo
|
||||
vdump $imagedir/${test_image}.png
|
||||
|
||||
puts ""
|
||||
|
13
tests/3rdparty/fonts/A1
vendored
13
tests/3rdparty/fonts/A1
vendored
@@ -3,17 +3,6 @@ puts "OCC21091"
|
||||
puts "OCC21450"
|
||||
puts "============"
|
||||
puts ""
|
||||
###### vcolorscale: vcolorscale [RangeMin RangeMax Intervals HeightFont Position X Y]: draw color scale
|
||||
###### RangeMin - min of color scale number range
|
||||
###### RangeMax - max of color scale number range
|
||||
###### Intervals - number of color scale segments
|
||||
###### HeightFont - height of font
|
||||
###### Position - Defines position for color scale labels
|
||||
############### 0 - NONE
|
||||
############### 1 - LEFT
|
||||
############### 2 - RIGHT
|
||||
############### 3 - CENTER
|
||||
###### X,Y - coordinates of color scale
|
||||
|
||||
vcolorscale 10 20 100 16 2 0 0
|
||||
vcolorscale -range 10 20 100 -font 16 -textpos right -xy 0 0
|
||||
|
||||
|
@@ -169,14 +169,15 @@ proc checknbshapes { res nbshapes_expected_s count_locations message} {
|
||||
|
||||
set EntityList {VERTEX EDGE WIRE FACE SHELL SOLID COMPSOLID COMPOUND SHAPE}
|
||||
|
||||
puts "Checking $message"
|
||||
foreach Entity ${EntityList} {
|
||||
set expr_string "${Entity} +: +(\[-0-9.+eE\]+)"
|
||||
if { [regexp "${expr_string}" ${nbshapes_expected_s} full nb_entity1] > 0 } {
|
||||
if { [regexp "${expr_string}" ${nb_info} full nb_entity2] > 0 } {
|
||||
if { ${nb_entity2} != ${nb_entity1} } {
|
||||
puts "Error : ${message} is WRONG because number of ${Entity} entities is ${nb_entity2} while ${nb_entity1} is expected"
|
||||
puts "Error: number of ${Entity} entities is wrong: ${nb_entity2} while ${nb_entity1} is expected"
|
||||
} else {
|
||||
puts "OK : ${message} is GOOD because number of ${Entity} entities is equal to number of expected ${Entity} entities"
|
||||
puts "OK: number of ${Entity} entities is as expected: ${nb_entity2}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user