mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-18 14:27:39 +03:00
Compare commits
26 Commits
CR27170_1
...
IR-2022-04
Author | SHA1 | Date | |
---|---|---|---|
|
7021de2fe7 | ||
|
e455c54bf0 | ||
|
d31e5dbbb4 | ||
|
878ea8cd2b | ||
|
ee6581adbe | ||
|
1fff4ad5a7 | ||
|
a793b75e21 | ||
|
5078d0d84e | ||
|
ad3825f821 | ||
|
fe12f15cb4 | ||
|
b2ec2f5d42 | ||
|
e3fd3d83da | ||
|
1f37f1d50a | ||
|
1f000e5974 | ||
|
2491eec38b | ||
|
ab279b126b | ||
|
e4753a7d16 | ||
|
5ae6f08cc6 | ||
|
9b337ad8e5 | ||
|
3425e83f4b | ||
|
e720157864 | ||
|
452ba192d5 | ||
|
9140163ba8 | ||
|
7573a45deb | ||
|
802180e1a5 | ||
|
8ca58a51a7 |
@@ -34,6 +34,8 @@ enum AIS_MouseGesture
|
||||
AIS_MouseGesture_Pan, //!< view panning gesture
|
||||
AIS_MouseGesture_RotateOrbit, //!< orbit rotation gesture
|
||||
AIS_MouseGesture_RotateView, //!< view rotation gesture
|
||||
AIS_MouseGesture_Drag, //!< object dragging;
|
||||
//! press button to start, move mouse to define rectangle, release to finish
|
||||
};
|
||||
|
||||
//! Map defining mouse gestures.
|
||||
|
@@ -92,6 +92,7 @@ AIS_ViewController::AIS_ViewController()
|
||||
myTouchPanThresholdPx (4.0f),
|
||||
myTouchZoomThresholdPx (6.0f),
|
||||
myTouchZoomRatio (0.13f),
|
||||
myTouchDraggingThresholdPx (6.0f),
|
||||
//
|
||||
myNbTouchesLast (0),
|
||||
myUpdateStartPointPan (true),
|
||||
@@ -133,6 +134,8 @@ AIS_ViewController::AIS_ViewController()
|
||||
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton, AIS_MouseGesture_Pan);
|
||||
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_Pan);
|
||||
|
||||
myMouseGestureMapDrag.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Drag);
|
||||
|
||||
myXRTeleportHaptic.Duration = 3600.0f;
|
||||
myXRTeleportHaptic.Frequency = 0.1f;
|
||||
myXRTeleportHaptic.Amplitude = 0.2f;
|
||||
@@ -261,12 +264,21 @@ void AIS_ViewController::flushBuffers (const Handle(AIS_InteractiveContext)& ,
|
||||
myUI.Dragging.ToStop = false;
|
||||
myGL.Dragging.ToStop = true;
|
||||
}
|
||||
else if (myUI.Dragging.ToStart)
|
||||
else
|
||||
{
|
||||
myUI.Dragging.ToStart = false;
|
||||
myGL.Dragging.ToStart = true;
|
||||
myGL.Dragging.PointStart = myUI.Dragging.PointStart;
|
||||
if (myUI.Dragging.ToStart)
|
||||
{
|
||||
myUI.Dragging.ToStart = false;
|
||||
myGL.Dragging.ToStart = true;
|
||||
myGL.Dragging.PointStart = myUI.Dragging.PointStart;
|
||||
}
|
||||
if (myUI.Dragging.ToMove)
|
||||
{
|
||||
myUI.Dragging.ToMove = false;
|
||||
myGL.Dragging.ToMove = true;
|
||||
}
|
||||
}
|
||||
|
||||
myGL.Dragging.PointTo = myUI.Dragging.PointTo;
|
||||
|
||||
if (myUI.OrbitRotation.ToStart)
|
||||
@@ -351,6 +363,7 @@ void AIS_ViewController::flushGestures (const Handle(AIS_InteractiveContext)& ,
|
||||
const Graphic3d_Vec2d aRotDelta = aTouch.To - myGL.OrbitRotation.PointStart;
|
||||
myGL.OrbitRotation.ToRotate = true;
|
||||
myGL.OrbitRotation.PointTo = myGL.OrbitRotation.PointStart + aRotDelta * aRotAccel;
|
||||
myGL.Dragging.ToMove = true;
|
||||
myGL.Dragging.PointTo.SetValues ((int )aTouch.To.x(), (int )aTouch.To.y());
|
||||
}
|
||||
else
|
||||
@@ -358,6 +371,7 @@ void AIS_ViewController::flushGestures (const Handle(AIS_InteractiveContext)& ,
|
||||
const Graphic3d_Vec2d aRotDelta = aTouch.To - myGL.ViewRotation.PointStart;
|
||||
myGL.ViewRotation.ToRotate = true;
|
||||
myGL.ViewRotation.PointTo = myGL.ViewRotation.PointStart + aRotDelta * aRotAccel;
|
||||
myGL.Dragging.ToMove = true;
|
||||
myGL.Dragging.PointTo.SetValues ((int )aTouch.To.x(), (int )aTouch.To.y());
|
||||
}
|
||||
|
||||
@@ -780,6 +794,19 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
|
||||
UpdatePolySelection (thePoint, true);
|
||||
break;
|
||||
}
|
||||
case AIS_MouseGesture_Drag:
|
||||
{
|
||||
if (myToAllowDragging)
|
||||
{
|
||||
myUI.Dragging.ToStart = true;
|
||||
myUI.Dragging.PointStart = thePoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
myMouseActiveGesture = AIS_MouseGesture_NONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AIS_MouseGesture_NONE:
|
||||
{
|
||||
break;
|
||||
@@ -787,12 +814,19 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
|
||||
}
|
||||
}
|
||||
|
||||
if (theButtons == Aspect_VKeyMouse_LeftButton
|
||||
&& theModifiers == Aspect_VKeyFlags_NONE
|
||||
&& myToAllowDragging)
|
||||
AIS_MouseGesture aSecGesture = AIS_MouseGesture_NONE;
|
||||
if (myMouseGestureMapDrag.Find (theButtons | theModifiers, aSecGesture))
|
||||
{
|
||||
myUI.Dragging.ToStart = true;
|
||||
myUI.Dragging.PointStart = thePoint;
|
||||
if (aSecGesture == AIS_MouseGesture_Drag
|
||||
&& myToAllowDragging)
|
||||
{
|
||||
myUI.Dragging.ToStart = true;
|
||||
myUI.Dragging.PointStart = thePoint;
|
||||
if (myMouseActiveGesture == AIS_MouseGesture_NONE)
|
||||
{
|
||||
myMouseActiveGesture = aSecGesture;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -932,6 +966,8 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
|
||||
myUI.ViewRotation.PointTo = Graphic3d_Vec2d (myMousePressPoint.x(), myMousePressPoint.y())
|
||||
+ Graphic3d_Vec2d (aRotDelta.x(), aRotDelta.y()) * aRotAccel;
|
||||
}
|
||||
|
||||
myUI.Dragging.ToMove = true;
|
||||
myUI.Dragging.PointTo = thePoint;
|
||||
|
||||
myMouseProgressPoint = thePoint;
|
||||
@@ -991,6 +1027,31 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AIS_MouseGesture_Drag:
|
||||
{
|
||||
if (!myToAllowDragging)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
const double aDragTol = theIsEmulated
|
||||
? double(myTouchToleranceScale) * myTouchDraggingThresholdPx
|
||||
: 0.0;
|
||||
if (double (Abs (aDelta.x()) + Abs (aDelta.y())) > aDragTol)
|
||||
{
|
||||
const double aRotAccel = myNavigationMode == AIS_NavigationMode_FirstPersonWalk ? myMouseAccel : myOrbitAccel;
|
||||
const Graphic3d_Vec2i aRotDelta = thePoint - myMousePressPoint;
|
||||
myUI.ViewRotation.ToRotate = true;
|
||||
myUI.ViewRotation.PointTo = Graphic3d_Vec2d (myMousePressPoint.x(), myMousePressPoint.y())
|
||||
+ Graphic3d_Vec2d (aRotDelta.x(), aRotDelta.y()) * aRotAccel;
|
||||
myUI.Dragging.ToMove = true;
|
||||
myUI.Dragging.PointTo = thePoint;
|
||||
|
||||
myMouseProgressPoint = thePoint;
|
||||
toUpdateView = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -2913,8 +2974,7 @@ void AIS_ViewController::handleDynamicHighlight (const Handle(AIS_InteractiveCon
|
||||
myGL.OrbitRotation.ToRotate = false;
|
||||
myGL.ViewRotation .ToRotate = false;
|
||||
}
|
||||
else if (myGL.OrbitRotation.ToRotate
|
||||
|| myGL.ViewRotation.ToRotate)
|
||||
else if (myGL.Dragging.ToMove)
|
||||
{
|
||||
OnObjectDragged (theCtx, theView, AIS_DragAction_Update);
|
||||
myGL.OrbitRotation.ToRotate = false;
|
||||
|
@@ -757,6 +757,7 @@ protected: //! @name mouse input variables
|
||||
Standard_ShortReal myScrollZoomRatio; //!< distance ratio for mapping mouse scroll event to zoom; 15.0 by default
|
||||
|
||||
AIS_MouseGestureMap myMouseGestureMap; //!< map defining mouse gestures
|
||||
AIS_MouseGestureMap myMouseGestureMapDrag; //!< secondary map defining mouse gestures for dragging
|
||||
AIS_MouseGesture myMouseActiveGesture; //!< initiated mouse gesture (by pressing mouse button)
|
||||
AIS_MouseSelectionSchemeMap
|
||||
myMouseSelectionSchemes; //!< map defining selection schemes bound to mouse + modifiers
|
||||
@@ -777,6 +778,7 @@ protected: //! @name multi-touch input variables
|
||||
Standard_ShortReal myTouchPanThresholdPx; //!< threshold for starting two-touch panning gesture in pixels; 4 by default
|
||||
Standard_ShortReal myTouchZoomThresholdPx; //!< threshold for starting two-touch zoom (pitch) gesture in pixels; 6 by default
|
||||
Standard_ShortReal myTouchZoomRatio; //!< distance ratio for mapping two-touch zoom (pitch) gesture from pixels to zoom; 0.13 by default
|
||||
Standard_ShortReal myTouchDraggingThresholdPx; //!< distance for starting one-touch dragging gesture in pixels; 6 by default
|
||||
|
||||
Aspect_Touch myTouchClick; //!< single touch position for handling clicks
|
||||
OSD_Timer myTouchDoubleTapTimer; //!< timer for handling double tap
|
||||
|
@@ -87,12 +87,13 @@ public:
|
||||
struct _draggingParams
|
||||
{
|
||||
bool ToStart; //!< start dragging
|
||||
bool ToMove; //!< perform dragging
|
||||
bool ToStop; //!< stop dragging
|
||||
bool ToAbort; //!< abort dragging (restore previous position)
|
||||
Graphic3d_Vec2i PointStart; //!< drag start point
|
||||
Graphic3d_Vec2i PointTo; //!< drag end point
|
||||
|
||||
_draggingParams() : ToStart (false), ToStop (false), ToAbort (false) {}
|
||||
_draggingParams() : ToStart (false), ToMove (false), ToStop (false), ToAbort (false) {}
|
||||
} Dragging;
|
||||
|
||||
struct _orbitRotation
|
||||
@@ -141,6 +142,7 @@ public:
|
||||
Panning.ToStart = false;
|
||||
Panning.ToPan = false;
|
||||
Dragging.ToStart = false;
|
||||
Dragging.ToMove = false;
|
||||
Dragging.ToStop = false;
|
||||
Dragging.ToAbort = false;
|
||||
OrbitRotation.ToStart = false;
|
||||
|
@@ -30,34 +30,6 @@ IMPLEMENT_STANDARD_RTTIEXT(Adaptor3d_TopolTool,Standard_Transient)
|
||||
|
||||
#define myInfinite Precision::Infinite()
|
||||
|
||||
static void GetConeApexParam(const gp_Cone& C, Standard_Real& U, Standard_Real& V)
|
||||
{
|
||||
const gp_Ax3& Pos = C.Position();
|
||||
Standard_Real Radius = C.RefRadius();
|
||||
Standard_Real SAngle = C.SemiAngle();
|
||||
const gp_Pnt& P = C.Apex();
|
||||
|
||||
gp_Trsf T;
|
||||
T.SetTransformation (Pos);
|
||||
gp_Pnt Ploc = P.Transformed (T);
|
||||
|
||||
if(Ploc.X() ==0.0 && Ploc.Y()==0.0 ) {
|
||||
U = 0.0;
|
||||
}
|
||||
else if ( -Radius > Ploc.Z()* Tan(SAngle) ) {
|
||||
// the point is at the `wrong` side of the apex
|
||||
U = atan2(-Ploc.Y(), -Ploc.X());
|
||||
}
|
||||
else {
|
||||
U = atan2(Ploc.Y(),Ploc.X());
|
||||
}
|
||||
if (U < -1.e-16) U += (M_PI+M_PI);
|
||||
else if (U < 0) U = 0;
|
||||
|
||||
V = sin(SAngle) * ( Ploc.X() * cos(U) + Ploc.Y() * sin(U) - Radius)
|
||||
+ cos(SAngle) * Ploc.Z();
|
||||
}
|
||||
|
||||
|
||||
Adaptor3d_TopolTool::Adaptor3d_TopolTool ()
|
||||
: myNbSamplesU(-1),
|
||||
@@ -1376,3 +1348,39 @@ Standard_Boolean Adaptor3d_TopolTool::IsUniformSampling() const
|
||||
return Standard_False;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetConeApexParam
|
||||
//purpose : Computes the cone's apex parameters
|
||||
//=======================================================================
|
||||
void Adaptor3d_TopolTool::GetConeApexParam (const gp_Cone& theC, Standard_Real& theU, Standard_Real& theV)
|
||||
{
|
||||
const gp_Ax3& Pos = theC.Position();
|
||||
Standard_Real Radius = theC.RefRadius();
|
||||
Standard_Real SAngle = theC.SemiAngle();
|
||||
const gp_Pnt& P = theC.Apex();
|
||||
|
||||
gp_Trsf T;
|
||||
T.SetTransformation(Pos);
|
||||
gp_Pnt Ploc = P.Transformed(T);
|
||||
|
||||
if (Ploc.X() == 0.0 && Ploc.Y() == 0.0)
|
||||
{
|
||||
theU = 0.0;
|
||||
}
|
||||
else if (-Radius > Ploc.Z() * Tan(SAngle))
|
||||
{
|
||||
// the point is at the `wrong` side of the apex
|
||||
theU = atan2(-Ploc.Y(), -Ploc.X());
|
||||
}
|
||||
else
|
||||
{
|
||||
theU = atan2(Ploc.Y(), Ploc.X());
|
||||
}
|
||||
|
||||
if (theU < -1.e-16) theU += (M_PI + M_PI);
|
||||
else if (theU < 0) theU = 0;
|
||||
|
||||
theV = sin(SAngle) * (Ploc.X() * cos(theU) + Ploc.Y() * sin(theU) - Radius)
|
||||
+ cos(SAngle) * Ploc.Z();
|
||||
}
|
||||
|
@@ -146,6 +146,12 @@ public:
|
||||
//! Returns true if provide uniform sampling of points.
|
||||
Standard_EXPORT virtual Standard_Boolean IsUniformSampling() const;
|
||||
|
||||
//! Computes the cone's apex parameters.
|
||||
//! @param[in] theC conical surface
|
||||
//! @param[in] theU U parameter of cone's apex
|
||||
//! @param[in] theV V parameter of cone's apex
|
||||
Standard_EXPORT static void GetConeApexParam (const gp_Cone& theC, Standard_Real& theU, Standard_Real& theV);
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Adaptor3d_TopolTool,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
@@ -861,7 +861,8 @@ static Standard_Boolean Filling(const TopoDS_Shape& EF,
|
||||
Prof2 = BRep_Tool::Curve(E2, f2, l2);
|
||||
|
||||
// Indeed, both Prof1 and Prof2 are the same curves but in different positions
|
||||
|
||||
// Prof1's param domain may equals to Prof2's param domain *(-1), which means EF.Orientation() == EL.Orientation()
|
||||
Standard_Boolean bSameCurveDomain = EF.Orientation() != EL.Orientation();
|
||||
gp_Pnt P1, P2, P;
|
||||
|
||||
// Choose the angle of opening
|
||||
@@ -887,7 +888,8 @@ static Standard_Boolean Filling(const TopoDS_Shape& EF,
|
||||
}
|
||||
}
|
||||
|
||||
const gp_Pnt aP2 = Prof2->Value(aPrm[aMaxIdx]).Transformed(aTf);
|
||||
const Standard_Real aPrm2[] = { f2, 0.5*(f2 + l2), l2 };
|
||||
const gp_Pnt aP2 = Prof2->Value(aPrm2[bSameCurveDomain ? aMaxIdx : 2 - aMaxIdx]).Transformed(aTf);
|
||||
const gp_Vec2d aV1(aP1[aMaxIdx].Z(), aP1[aMaxIdx].X());
|
||||
const gp_Vec2d aV2(aP2.Z(), aP2.X());
|
||||
if (aV1.SquareMagnitude() <= gp::Resolution() ||
|
||||
|
@@ -75,146 +75,150 @@ static OSD_Timer aTimer;
|
||||
|
||||
extern Standard_Boolean Draw_Chrono;
|
||||
|
||||
static Standard_Integer chronom(Draw_Interpretor& di,
|
||||
Standard_Integer n,const char** a)
|
||||
static Standard_Integer dchronom (Draw_Interpretor& theDI,
|
||||
Standard_Integer theNbArgs,
|
||||
const char** theArgVec)
|
||||
{
|
||||
if ((n == 1) || (*a[1] == '0') || (*a[1] == '1')) {
|
||||
if (n == 1)
|
||||
if (theNbArgs == 1
|
||||
|| (theNbArgs == 2
|
||||
&& (*theArgVec[1] == '0'
|
||||
|| *theArgVec[1] == '1')))
|
||||
{
|
||||
if (theNbArgs == 1)
|
||||
{
|
||||
Draw_Chrono = !Draw_Chrono;
|
||||
}
|
||||
else
|
||||
Draw_Chrono = (*a[1] == '1');
|
||||
{
|
||||
Draw_Chrono = (*theArgVec[1] == '1');
|
||||
}
|
||||
|
||||
if (Draw_Chrono) di << "Chronometers activated.\n";
|
||||
else di << "Chronometers deactivated.\n";
|
||||
theDI << (Draw_Chrono
|
||||
? "Chronometers activated.\n"
|
||||
: "Chronometers deactivated.\n");
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
Handle(Draw_Drawable3D) D = Draw::Get(a[1]);
|
||||
Handle(Draw_Chronometer) C;
|
||||
if (!D.IsNull()) {
|
||||
C = Handle(Draw_Chronometer)::DownCast(D);
|
||||
}
|
||||
if (C.IsNull()) {
|
||||
C = new Draw_Chronometer();
|
||||
Draw::Set(a[1],C,Standard_False);
|
||||
}
|
||||
if (n <= 2) {
|
||||
C->Timer().Reset();
|
||||
}
|
||||
else {
|
||||
for (Standard_Integer anIter = 2; anIter < n; ++anIter)
|
||||
{
|
||||
TCollection_AsciiString anArg (a[anIter]);
|
||||
anArg.LowerCase();
|
||||
|
||||
if (anArg == "reset")
|
||||
{
|
||||
C->Timer().Reset();
|
||||
}
|
||||
else if (anArg == "restart")
|
||||
{
|
||||
C->Timer().Restart();
|
||||
}
|
||||
else if (anArg == "start")
|
||||
{
|
||||
C->Timer().Start();
|
||||
}
|
||||
else if (anArg == "stop")
|
||||
{
|
||||
C->Timer().Stop();
|
||||
}
|
||||
else if (anArg == "show")
|
||||
{
|
||||
C->Timer().Show();
|
||||
}
|
||||
else if (anArg == "counter")
|
||||
{
|
||||
Standard_Real aSeconds,aCPUtime;
|
||||
Standard_Integer aMinutes, aHours;
|
||||
C->Timer().Show(aSeconds,aMinutes,aHours,aCPUtime);
|
||||
std::cout << "COUNTER " << a[++anIter] << ": " << aCPUtime << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Unknown argument '" << a[anIter] << "'!\n";
|
||||
}
|
||||
const char* aTimerName = theArgVec[1];
|
||||
Handle(Draw_Chronometer) aChronom;
|
||||
if (Handle(Draw_Drawable3D) aDrawable = Draw::Get (aTimerName))
|
||||
{
|
||||
aChronom = Handle(Draw_Chronometer)::DownCast (aDrawable);
|
||||
}
|
||||
if (aChronom.IsNull())
|
||||
{
|
||||
aChronom = new Draw_Chronometer();
|
||||
Draw::Set (aTimerName, aChronom, false);
|
||||
}
|
||||
|
||||
if (theNbArgs <= 2)
|
||||
{
|
||||
aChronom->Timer().Reset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const bool toShowCout = (TCollection_AsciiString (theArgVec[0]) == "chrono");
|
||||
int aNbPuts = false;
|
||||
for (Standard_Integer anIter = 2; anIter < theNbArgs; ++anIter)
|
||||
{
|
||||
TCollection_AsciiString anArg (theArgVec[anIter]);
|
||||
anArg.LowerCase();
|
||||
if (anArg == "-reset"
|
||||
|| anArg == "reset")
|
||||
{
|
||||
aChronom->Timer().Reset();
|
||||
}
|
||||
else if (anArg == "-restart"
|
||||
|| anArg == "restart")
|
||||
{
|
||||
aChronom->Timer().Restart();
|
||||
}
|
||||
else if (anArg == "-start"
|
||||
|| anArg == "-resume"
|
||||
|| anArg == "start")
|
||||
{
|
||||
aChronom->Timer().Start();
|
||||
}
|
||||
else if (anArg == "-stop"
|
||||
|| anArg == "-pause"
|
||||
|| anArg == "stop")
|
||||
{
|
||||
aChronom->Timer().Stop();
|
||||
}
|
||||
else if (anArg == "-show"
|
||||
|| anArg == "show")
|
||||
{
|
||||
if (toShowCout)
|
||||
{
|
||||
aChronom->Timer().Show (std::cout);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_SStream aStream;
|
||||
aChronom->Timer().Show (aStream);
|
||||
theDI << aStream;
|
||||
}
|
||||
}
|
||||
else if (anIter + 1 < theNbArgs
|
||||
&& (anArg == "-counter"
|
||||
|| anArg == "counter"))
|
||||
{
|
||||
Standard_Real aSeconds = 0.0, aCPUtime = 0.0;
|
||||
Standard_Integer aMinutes = 0, aHours = 0;
|
||||
aChronom->Timer().Show (aSeconds, aMinutes, aHours, aCPUtime);
|
||||
if (toShowCout)
|
||||
{
|
||||
std::cout << "COUNTER " << theArgVec[++anIter] << ": " << aCPUtime << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
theDI << "COUNTER " << theArgVec[++anIter] << ": " << aCPUtime << "\n";
|
||||
}
|
||||
}
|
||||
else if (anArg == "-elapsed")
|
||||
{
|
||||
if (++aNbPuts > 1) { theDI << " "; }
|
||||
theDI << aChronom->Timer().ElapsedTime();
|
||||
}
|
||||
else if (anArg == "-cpu"
|
||||
|| anArg == "-usercpu"
|
||||
|| anArg == "-cpuuser")
|
||||
{
|
||||
if (++aNbPuts > 1) { theDI << " "; }
|
||||
theDI << aChronom->Timer().UserTimeCPU();
|
||||
}
|
||||
else if (anArg == "-systemcpu"
|
||||
|| anArg == "-syscpu"
|
||||
|| anArg == "-cpusystem"
|
||||
|| anArg == "-cpusys")
|
||||
{
|
||||
if (++aNbPuts > 1) { theDI << " "; }
|
||||
theDI << aChronom->Timer().SystemTimeCPU();
|
||||
}
|
||||
else if (anArg == "-thread"
|
||||
|| anArg == "-threadonly")
|
||||
{
|
||||
bool isThreadOnly = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anIter);
|
||||
aChronom->Timer().Stop();
|
||||
aChronom->Timer().Reset();
|
||||
aChronom->Timer().SetThisThreadOnly (isThreadOnly);
|
||||
}
|
||||
else if (anArg == "-process")
|
||||
{
|
||||
bool isProcessTime = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anIter);
|
||||
aChronom->Timer().Stop();
|
||||
aChronom->Timer().Reset();
|
||||
aChronom->Timer().SetThisThreadOnly (!isProcessTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
theDI << "Syntax error at '" << theArgVec[anIter] << "'\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer dchronom(Draw_Interpretor& theDI,
|
||||
Standard_Integer n,const char** a)
|
||||
{
|
||||
if ((n == 1) || (*a[1] == '0') || (*a[1] == '1')) {
|
||||
if (n == 1)
|
||||
Draw_Chrono = !Draw_Chrono;
|
||||
else
|
||||
Draw_Chrono = (*a[1] == '1');
|
||||
|
||||
if (Draw_Chrono) theDI << "Chronometers activated.\n";
|
||||
else theDI << "Chronometers deactivated.\n";
|
||||
}
|
||||
else {
|
||||
Handle(Draw_Drawable3D) D = Draw::Get(a[1]);
|
||||
Handle(Draw_Chronometer) C;
|
||||
if (!D.IsNull()) {
|
||||
C = Handle(Draw_Chronometer)::DownCast(D);
|
||||
}
|
||||
if (C.IsNull()) {
|
||||
C = new Draw_Chronometer();
|
||||
Draw::Set(a[1],C,Standard_False);
|
||||
}
|
||||
if (n <= 2) {
|
||||
C->Timer().Reset();
|
||||
}
|
||||
else {
|
||||
for (Standard_Integer anIter = 2; anIter < n; ++anIter)
|
||||
{
|
||||
TCollection_AsciiString anArg (a[anIter]);
|
||||
anArg.LowerCase();
|
||||
|
||||
if (anArg == "reset")
|
||||
{
|
||||
C->Timer().Reset();
|
||||
}
|
||||
else if (anArg == "restart")
|
||||
{
|
||||
C->Timer().Restart();
|
||||
}
|
||||
else if (anArg == "start")
|
||||
{
|
||||
C->Timer().Start();
|
||||
}
|
||||
else if (anArg == "stop")
|
||||
{
|
||||
C->Timer().Stop();
|
||||
}
|
||||
else if (anArg == "show")
|
||||
{
|
||||
Standard_SStream ss;
|
||||
C->Timer().Show(ss);
|
||||
theDI << ss;
|
||||
}
|
||||
else if (anArg == "counter")
|
||||
{
|
||||
Standard_Real aSeconds,aCPUtime;
|
||||
Standard_Integer aMinutes, aHours;
|
||||
C->Timer().Show(aSeconds,aMinutes,aHours,aCPUtime);
|
||||
theDI << "COUNTER " << a[++anIter] << ": " << aCPUtime << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
theDI << "Unknown argument '" << a[anIter] << "'!\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ifbatch
|
||||
//purpose :
|
||||
@@ -878,7 +882,8 @@ static int dmeminfo (Draw_Interpretor& theDI,
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Unknown argument '" << theArgVec[anIter] << "'!\n";
|
||||
theDI << "Syntax error at '" << theArgVec[anIter] << "'!\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1304,11 +1309,33 @@ void Draw::BasicCommands(Draw_Interpretor& theCommands)
|
||||
__FILE__,Draw_wait,g);
|
||||
theCommands.Add("cpulimit","cpulimit [nbseconds], no args remove limits",
|
||||
__FILE__,cpulimit,g);
|
||||
theCommands.Add("chrono","chrono [name action [action...]] \n Operates named timer.\n"
|
||||
" Supported actions: reset, start, stop, restart, show, counter [text].\n"
|
||||
" Without arguments enables / disables global timer for all DRAW commands.",
|
||||
__FILE__,chronom,g);
|
||||
theCommands.Add("dchrono","see help of chrono command",
|
||||
|
||||
const char* aChronoHelp =
|
||||
"chrono Name [-start] [-stop] [-reset] [-restart] [-counter Text]"
|
||||
"\n\t\t: [-show] [-elapsed] [-userCPU] [-sysCPU]"
|
||||
"\n\t\t: [-thread|-process {0|1}]"
|
||||
"\n\t\t: Operates named timer:"
|
||||
"\n\t\t: -start starts (resumes) timer"
|
||||
"\n\t\t: -stop stops (pauses) timer"
|
||||
"\n\t\t: -reset resets timer progress"
|
||||
"\n\t\t: -restart resets and starts timer"
|
||||
"\n\t\t: -show prints timer progress"
|
||||
"\n\t\t: ('dchrono' puts into Tcl, 'chrono' puts into std::cout)"
|
||||
"\n\t\t: -elapsed prints elapsed time in seconds"
|
||||
"\n\t\t: -userCPU prints user CPU time in seconds"
|
||||
"\n\t\t: -sysCPU prints system CPU time in seconds"
|
||||
"\n\t\t: -counter prints 'COUNTER <Text>'"
|
||||
"\n\t\t: -thread stops timer and sets measuring of CPU time for this thread only (FALSE by default)"
|
||||
"\n\t\t: -process stops timer and sets measuring of CPU time for all threads (TRUE by default)"
|
||||
"\n\t\t: Without arguments enables / disables global timer for all DRAW commands."
|
||||
"\n\t\t: chrono {0|1}"
|
||||
"\n\t\t: Typical usage:"
|
||||
"\n\t\t: chrono t -restart"
|
||||
"\n\t\t: <algorithm>"
|
||||
"\n\t\t: chrono t -stop -show";
|
||||
theCommands.Add("chrono", aChronoHelp,
|
||||
__FILE__,dchronom,g);
|
||||
theCommands.Add("dchrono", aChronoHelp,
|
||||
__FILE__,dchronom,g);
|
||||
theCommands.Add("mallochook",
|
||||
"debug memory allocation/deallocation, w/o args for help",
|
||||
|
@@ -14,69 +14,50 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Draw_Chronometer.hxx>
|
||||
#include <Draw_Display.hxx>
|
||||
#include <Draw_Drawable3D.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Draw_Chronometer,Draw_Drawable3D)
|
||||
#include <Draw_Display.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Draw_Chronometer, Draw_Drawable3D)
|
||||
|
||||
//=======================================================================
|
||||
//function : Draw_Chronometer
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Draw_Chronometer::Draw_Chronometer()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Timer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
OSD_Timer& Draw_Chronometer::Timer()
|
||||
{
|
||||
return myTimer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DrawOn
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Draw_Chronometer::DrawOn(Draw_Display&)const
|
||||
void Draw_Chronometer::DrawOn (Draw_Display& ) const
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Copy
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Draw_Drawable3D) Draw_Chronometer::Copy()const
|
||||
Handle(Draw_Drawable3D) Draw_Chronometer::Copy() const
|
||||
{
|
||||
Handle(Draw_Chronometer) C = new Draw_Chronometer();
|
||||
return C;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Draw_Chronometer::Dump(Standard_OStream& S)const
|
||||
void Draw_Chronometer::Dump (Standard_OStream& S) const
|
||||
{
|
||||
S << "Chronometer : ";
|
||||
S << "Chronometer, ";
|
||||
myTimer.Show (S);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Whatis
|
||||
//purpose :
|
||||
|
@@ -17,32 +17,25 @@
|
||||
#ifndef _Draw_Chronometer_HeaderFile
|
||||
#define _Draw_Chronometer_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <Draw_Drawable3D.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
class Draw_Display;
|
||||
#include <OSD_Timer.hxx>
|
||||
|
||||
|
||||
class Draw_Chronometer;
|
||||
DEFINE_STANDARD_HANDLE(Draw_Chronometer, Draw_Drawable3D)
|
||||
|
||||
//! Class to store chronometer variables.
|
||||
class Draw_Chronometer : public Draw_Drawable3D
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Draw_Chronometer, Draw_Drawable3D)
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT Draw_Chronometer();
|
||||
|
||||
Standard_EXPORT OSD_Timer& Timer();
|
||||
|
||||
//! Does nothhing,
|
||||
|
||||
//! Return timer.
|
||||
OSD_Timer& Timer() { return myTimer; }
|
||||
|
||||
//! Does nothing,
|
||||
Standard_EXPORT void DrawOn (Draw_Display& dis) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! For variable copy.
|
||||
Standard_EXPORT virtual Handle(Draw_Drawable3D) Copy() const Standard_OVERRIDE;
|
||||
|
||||
@@ -52,28 +45,10 @@ public:
|
||||
//! For variable whatis command.
|
||||
Standard_EXPORT virtual void Whatis (Draw_Interpretor& I) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Draw_Chronometer,Draw_Drawable3D)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
OSD_Timer myTimer;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Draw_Chronometer_HeaderFile
|
||||
|
@@ -1402,10 +1402,10 @@ proc _run_test {scriptsdir group gridname casefile echo} {
|
||||
append stats "MEMORY DELTA: [expr ($memuse - $membase) / 1024] KiB\n"
|
||||
}
|
||||
uplevel dchrono _timer stop
|
||||
set time [uplevel dchrono _timer show]
|
||||
if { [regexp -nocase {CPU user time:[ \t]*([0-9.e-]+)} $time res cpu_usr] } {
|
||||
append stats "TOTAL CPU TIME: $cpu_usr sec\n"
|
||||
}
|
||||
set cpu_usr [uplevel dchrono _timer -userCPU]
|
||||
set elps [uplevel dchrono _timer -elapsed]
|
||||
append stats "TOTAL CPU TIME: $cpu_usr sec\n"
|
||||
append stats "ELAPSED TIME: $elps sec\n"
|
||||
if { $dlog_exists && ! $echo } {
|
||||
dlog add $stats
|
||||
} else {
|
||||
|
@@ -176,6 +176,8 @@ gp_Vec ElSLib::ConeDN (const Standard_Real U,
|
||||
}
|
||||
else if(Nv == 1) {
|
||||
Xdir.Multiply(sin(SAngle));
|
||||
if (Nu == 0)
|
||||
Xdir.Add(Pos.Direction().XYZ() * cos(SAngle));
|
||||
return gp_Vec(Xdir);
|
||||
}
|
||||
return gp_Vec(0.0,0.0,0.0);
|
||||
|
@@ -602,6 +602,9 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
|
||||
const Bnd_Range aRange(theUt21, theUt22);
|
||||
Bnd_Range aProjRng1;
|
||||
|
||||
// Precision of the calculation depends on circles radii
|
||||
const Standard_Real aPrecision = Max(Epsilon(myC[0]->Circle().Radius()), Epsilon(myC[1]->Circle().Radius()));
|
||||
|
||||
// Project arc of the 1st circle between points theUt11 and theUt12 to the
|
||||
// 2nd circle. It is necessary to chose correct arc from two possible ones.
|
||||
|
||||
@@ -678,7 +681,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
|
||||
aMinSqD = Min(aMinSqD, ExtPCir.SquareDistance(anExtID));
|
||||
}
|
||||
|
||||
if (aMinSqD <= aMinSquareDist + 10.* Epsilon(1. + aMinSqD))
|
||||
if (aMinSqD <= aMinSquareDist + (1. + aMinSqD) * aPrecision)
|
||||
{
|
||||
ClearSolutions();
|
||||
mySqDist.Append(aMinSqD);
|
||||
@@ -778,7 +781,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
|
||||
imin = k;
|
||||
}
|
||||
}
|
||||
if (aDmin <= aMinSquareDist + 10.* Epsilon(1. + aDmin))
|
||||
if (aDmin <= aMinSquareDist + (1. + aDmin) * aPrecision)
|
||||
{
|
||||
if (imin == 0)
|
||||
{
|
||||
|
@@ -58,6 +58,65 @@ static const Standard_Real PosTol = Precision::PConfusion() / 2;
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Geom2dAdaptor_Curve, Adaptor2d_Curve2d)
|
||||
|
||||
static void DefinFPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurFirst,
|
||||
Standard_Integer &theFPer);
|
||||
|
||||
static void DefinLPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurLast,
|
||||
Standard_Integer &theLPer);
|
||||
|
||||
static Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
|
||||
const TColStd_Array1OfInteger& theTM,
|
||||
const TColStd_Array1OfInteger& theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Boolean thePeriodicCur,
|
||||
Standard_Integer theNbIntervals,
|
||||
Standard_Real theLower = 0,
|
||||
Standard_Real thePeriod = 0,
|
||||
Standard_Integer theIndex1 = 0,
|
||||
Standard_Integer theIndex2 = 0);
|
||||
|
||||
static void WriteIntervals(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Integer theIndex1,
|
||||
const Standard_Integer theIndex2,
|
||||
const Standard_Real theCurPeriod,
|
||||
const Standard_Boolean theFlagForFirst,
|
||||
TColStd_Array1OfReal &theT,
|
||||
TColStd_Array1OfInteger &theFinalIntervals,
|
||||
Standard_Integer &theNbIntervals,
|
||||
Standard_Integer &theCurInt);
|
||||
|
||||
static void SpreadInt(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theTM,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theFPer,
|
||||
const Standard_Integer theLPer,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theLower,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real thePeriod,
|
||||
const Standard_Real theLastParam,
|
||||
const Standard_Real theEps,
|
||||
TColStd_Array1OfReal &theT,
|
||||
Standard_Integer &theNbIntervals);
|
||||
|
||||
//=======================================================================
|
||||
//function : ShallowCopy
|
||||
//purpose :
|
||||
@@ -115,7 +174,7 @@ GeomAbs_Shape Geom2dAdaptor_Curve::LocalContinuity(const Standard_Real U1,
|
||||
if ( myBSplineCurve->IsPeriodic() && Index1 == Nb )
|
||||
Index1 = 1;
|
||||
|
||||
if ( Index2 - Index1 <= 0) {
|
||||
if ((Index2 - Index1 <= 0) && (!myBSplineCurve->IsPeriodic())) {
|
||||
MultMax = 100; // CN entre 2 Noeuds consecutifs
|
||||
}
|
||||
else {
|
||||
@@ -295,6 +354,158 @@ GeomAbs_Shape Geom2dAdaptor_Curve::Continuity() const
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DefinFPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void DefinFPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurFirst,
|
||||
Standard_Integer &theFPer)
|
||||
{
|
||||
if (theCurFirst >= theLower)
|
||||
{
|
||||
while (theCurFirst >= theUpper)
|
||||
{
|
||||
theCurFirst = theCurFirst - thePeriod;
|
||||
theFPer++;
|
||||
}
|
||||
if (Abs(theUpper - theCurFirst) <= theEps)
|
||||
{
|
||||
theFPer++;
|
||||
theCurFirst = theLower;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (theCurFirst < theLower)
|
||||
{
|
||||
theCurFirst = theCurFirst + thePeriod;
|
||||
if (Abs(theLower - theCurFirst) > theEps)
|
||||
{
|
||||
theFPer--;
|
||||
}
|
||||
}
|
||||
|
||||
if (Abs(theUpper - theCurFirst) <= theEps)
|
||||
{
|
||||
theCurFirst = theLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DefinLPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void DefinLPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurLast,
|
||||
Standard_Integer &theLPer)
|
||||
{
|
||||
if (theCurLast >= theLower)
|
||||
{
|
||||
if ((theCurLast >= theUpper) && (Abs(theCurLast - theUpper) <= theEps))
|
||||
{
|
||||
theCurLast = theUpper;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (theCurLast >= theUpper)
|
||||
{
|
||||
theCurLast = theCurLast - thePeriod;
|
||||
theLPer++;
|
||||
}
|
||||
if (Abs(theUpper - theCurLast) <= theEps)
|
||||
{
|
||||
theCurLast = theLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (theCurLast < theLower)
|
||||
{
|
||||
theCurLast = theCurLast + thePeriod;
|
||||
if (Abs(theLower - theCurLast) > theEps)
|
||||
{
|
||||
theLPer--;
|
||||
}
|
||||
}
|
||||
if (Abs(theUpper - theCurLast) <= theEps)
|
||||
{
|
||||
theCurLast = theLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalNbIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
|
||||
const TColStd_Array1OfInteger& theTM,
|
||||
const TColStd_Array1OfInteger& theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Boolean thePeriodicCur,
|
||||
Standard_Integer theNbIntervals,
|
||||
Standard_Real theLower,
|
||||
Standard_Real thePeriod,
|
||||
Standard_Integer theIndex1,
|
||||
Standard_Integer theIndex2)
|
||||
{
|
||||
Standard_Real aNewFirst = theFirst;
|
||||
Standard_Real aNewLast = theLast;
|
||||
if (theIndex1 == 0)
|
||||
{
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
|
||||
thePeriodicCur, 1, theNb, theIndex1, aNewFirst);
|
||||
}
|
||||
if (theIndex2 == 0)
|
||||
{
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLast,
|
||||
thePeriodicCur, 1, theNb, theIndex2, aNewLast);
|
||||
}
|
||||
// Protection against theFirst = UFirst - eps, which located as ULast - eps
|
||||
if (thePeriodicCur && ((aNewLast - aNewFirst) < Precision::PConfusion()))
|
||||
{
|
||||
if (Abs(aNewLast - theLower) < Precision::PConfusion())
|
||||
{
|
||||
aNewLast += thePeriod;
|
||||
}
|
||||
else
|
||||
{
|
||||
aNewFirst -= thePeriod;
|
||||
}
|
||||
}
|
||||
|
||||
if (Abs(aNewFirst - theTK(theIndex1 + 1)) < theEps)
|
||||
{
|
||||
theIndex1++;
|
||||
}
|
||||
if ((aNewLast - theTK(theIndex2)) > theEps)
|
||||
{
|
||||
theIndex2++;
|
||||
}
|
||||
for (Standard_Integer i = 1; i <= theNbInt; i++)
|
||||
{
|
||||
if (theInter(i) > theIndex1 && theInter(i) < theIndex2) theNbIntervals++;
|
||||
}
|
||||
return theNbIntervals;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbIntervals
|
||||
//purpose :
|
||||
@@ -306,77 +517,179 @@ Standard_Integer Geom2dAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
||||
Standard_Integer NbSplit;
|
||||
if (myTypeCurve == GeomAbs_BSplineCurve) {
|
||||
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
|
||||
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
|
||||
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
|
||||
if ( S > Continuity()) {
|
||||
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
|
||||
TColStd_Array1OfInteger Inter(1, LastIndex - FirstIndex + 1);
|
||||
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
|
||||
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
|
||||
if (aContPer || aContNotPer) {
|
||||
Standard_Integer Cont;
|
||||
switch ( S) {
|
||||
switch (S) {
|
||||
case GeomAbs_G1:
|
||||
case GeomAbs_G2:
|
||||
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
|
||||
break;
|
||||
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
|
||||
break;
|
||||
case GeomAbs_C0:
|
||||
myNbIntervals = 1;
|
||||
break;
|
||||
myNbIntervals = 1;
|
||||
break;
|
||||
case GeomAbs_C1:
|
||||
case GeomAbs_C2:
|
||||
case GeomAbs_C3:
|
||||
case GeomAbs_CN:
|
||||
{
|
||||
if ( S == GeomAbs_C1) Cont = 1;
|
||||
else if ( S == GeomAbs_C2) Cont = 2;
|
||||
else if ( S == GeomAbs_C3) Cont = 3;
|
||||
else Cont = myBSplineCurve->Degree();
|
||||
Standard_Integer Degree = myBSplineCurve->Degree();
|
||||
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfInteger Mults (1, NbKnots);
|
||||
myBSplineCurve->Multiplicities (Mults);
|
||||
NbSplit = 1;
|
||||
Standard_Integer Index = FirstIndex;
|
||||
Inter (NbSplit) = Index;
|
||||
case GeomAbs_C3:
|
||||
case GeomAbs_CN:
|
||||
{
|
||||
if (S == GeomAbs_C1) Cont = 1;
|
||||
else if (S == GeomAbs_C2) Cont = 2;
|
||||
else if (S == GeomAbs_C3) Cont = 3;
|
||||
else Cont = myBSplineCurve->Degree();
|
||||
Standard_Integer Degree = myBSplineCurve->Degree();
|
||||
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfInteger Mults(1, NbKnots);
|
||||
myBSplineCurve->Multiplicities(Mults);
|
||||
NbSplit = 1;
|
||||
Standard_Integer Index = FirstIndex;
|
||||
Inter(NbSplit) = Index;
|
||||
Index++;
|
||||
NbSplit++;
|
||||
while (Index < LastIndex)
|
||||
{
|
||||
if (Degree - Mults(Index) < Cont)
|
||||
{
|
||||
Inter(NbSplit) = Index;
|
||||
NbSplit++;
|
||||
}
|
||||
Index++;
|
||||
NbSplit++;
|
||||
while (Index < LastIndex)
|
||||
{
|
||||
if (Degree - Mults (Index) < Cont)
|
||||
{
|
||||
Inter (NbSplit) = Index;
|
||||
NbSplit++;
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
Inter (NbSplit) = Index;
|
||||
|
||||
Standard_Integer NbInt = NbSplit-1;
|
||||
|
||||
Standard_Integer Nb = myBSplineCurve->NbKnots();
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
Standard_Real newFirst, newLast;
|
||||
TColStd_Array1OfReal TK(1,Nb);
|
||||
TColStd_Array1OfInteger TM(1,Nb);
|
||||
myBSplineCurve->Knots(TK);
|
||||
myBSplineCurve->Multiplicities(TM);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1,Nb,Index1,newFirst);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myLast,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1,Nb,Index2,newLast);
|
||||
|
||||
// On decale eventuellement les indices
|
||||
// On utilise une "petite" tolerance, la resolution ne doit
|
||||
// servir que pour les tres longue courbes....(PRO9248)
|
||||
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
|
||||
Precision::PConfusion());
|
||||
if ( Abs(newFirst-TK(Index1+1))< Eps) Index1++;
|
||||
if ( newLast-TK(Index2)> Eps) Index2++;
|
||||
|
||||
myNbIntervals = 1;
|
||||
for ( Standard_Integer i=1; i<=NbInt; i++)
|
||||
if (Inter(i)>Index1 && Inter(i)<Index2) myNbIntervals++;
|
||||
}
|
||||
break;
|
||||
Inter(NbSplit) = Index;
|
||||
|
||||
Standard_Integer NbInt = NbSplit - 1;
|
||||
|
||||
Standard_Integer Nb = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfReal TK(1, Nb);
|
||||
TColStd_Array1OfInteger TM(1, Nb);
|
||||
myBSplineCurve->Knots(TK);
|
||||
myBSplineCurve->Multiplicities(TM);
|
||||
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
|
||||
Precision::PConfusion());
|
||||
|
||||
myNbIntervals = 1;
|
||||
|
||||
if (!myBSplineCurve->IsPeriodic())
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_False, myNbIntervals);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real aCurFirst = myFirst;
|
||||
Standard_Real aCurLast = myLast;
|
||||
|
||||
Standard_Real aLower = myBSplineCurve->FirstParameter();
|
||||
Standard_Real anUpper = myBSplineCurve->LastParameter();
|
||||
|
||||
if ((Abs(aCurFirst - aLower) < Eps) && (aCurFirst < aLower))
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
}
|
||||
if ((Abs(aCurLast - anUpper) < Eps) && (aCurLast < anUpper))
|
||||
{
|
||||
aCurLast = anUpper;
|
||||
}
|
||||
|
||||
Standard_Real aPeriod = myBSplineCurve->Period();
|
||||
Standard_Integer aLPer = 1; Standard_Integer aFPer = 1;
|
||||
|
||||
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
}
|
||||
else
|
||||
{
|
||||
DefinFPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurFirst, aFPer);
|
||||
}
|
||||
DefinLPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurLast, aLPer);
|
||||
|
||||
if ((Abs(aLower - myFirst) < Eps) && (Abs(anUpper - myLast) < Eps))
|
||||
{
|
||||
myNbIntervals = NbInt;
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Integer aSumPer = Abs(aLPer - aFPer);
|
||||
|
||||
Standard_Real aFirst = 0;
|
||||
if (aLower < 0 && anUpper == 0)
|
||||
{
|
||||
if (Abs(aCurLast) < Eps)
|
||||
{
|
||||
aCurLast = 0;
|
||||
}
|
||||
aFirst = aLower;
|
||||
}
|
||||
|
||||
if (aSumPer <= 1)
|
||||
{
|
||||
if ((Abs(myFirst - TK(Nb) - aPeriod * (aFPer - 1)) <= Eps) && (myLast < (TK(Nb) + aPeriod * (aLPer - 1))))
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
return myNbIntervals;
|
||||
}
|
||||
if ((Abs(myFirst - aLower) < Eps) && (Abs(myLast - anUpper) < Eps))
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
return myNbIntervals;
|
||||
}
|
||||
}
|
||||
|
||||
if (aSumPer != 0)
|
||||
{
|
||||
Standard_Integer aFInt = 0;
|
||||
Standard_Integer aLInt = 0;
|
||||
Standard_Integer aPInt = NbInt;
|
||||
|
||||
if ((aCurFirst != aPeriod) || ((aCurFirst != anUpper) && (Abs(myFirst) < Eps)))
|
||||
{
|
||||
aFInt = 1;
|
||||
}
|
||||
if ((aCurLast != 0) && (aCurLast != anUpper))
|
||||
{
|
||||
aLInt = 1;
|
||||
}
|
||||
|
||||
aFInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aCurFirst, anUpper, Eps, Standard_True, aFInt, aLower, aPeriod);
|
||||
|
||||
if (aCurLast == anUpper)
|
||||
{
|
||||
aLInt = NbInt;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Abs(aCurLast - aFirst) > Eps)
|
||||
{
|
||||
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod);
|
||||
}
|
||||
}
|
||||
|
||||
myNbIntervals = aFInt + aLInt + aPInt * (aSumPer - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aCurFirst, aCurLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -399,6 +712,204 @@ Standard_Integer Geom2dAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
||||
return myNbIntervals;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void WriteIntervals(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Integer theIndex1,
|
||||
const Standard_Integer theIndex2,
|
||||
const Standard_Real theCurPeriod,
|
||||
const Standard_Boolean theFlagForFirst,
|
||||
TColStd_Array1OfReal &theT,
|
||||
TColStd_Array1OfInteger &theFinalIntervals,
|
||||
Standard_Integer &theNbIntervals,
|
||||
Standard_Integer &theCurInt)
|
||||
{
|
||||
if (theFlagForFirst)
|
||||
{
|
||||
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
|
||||
{
|
||||
if (theInter(anId) > theIndex1 && theInter(anId) <= theIndex2)
|
||||
{
|
||||
theNbIntervals++;
|
||||
theFinalIntervals(theNbIntervals) = theInter(anId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
|
||||
{
|
||||
if (theInter(anId) > theIndex1 && theInter(anId) < theIndex2)
|
||||
{
|
||||
theNbIntervals++;
|
||||
theFinalIntervals(theNbIntervals) = theInter(anId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
theFinalIntervals(theNbIntervals + 1) = theIndex2;
|
||||
|
||||
for (Standard_Integer anId = theCurInt; anId <= theNbIntervals + 1; anId++)
|
||||
{
|
||||
theT(anId) = theTK(theFinalIntervals(anId)) + theCurPeriod;
|
||||
theCurInt++;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SpreadInt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SpreadInt(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theTM,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theFPer,
|
||||
const Standard_Integer theLPer,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theLower,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real thePeriod,
|
||||
const Standard_Real theLastParam,
|
||||
const Standard_Real theEps,
|
||||
TColStd_Array1OfReal &theT,
|
||||
Standard_Integer &theNbIntervals)
|
||||
{
|
||||
Standard_Integer anIndex1 = 0;
|
||||
Standard_Integer anIndex2 = 0;
|
||||
Standard_Real aNewFirst, aNewLast;
|
||||
Standard_Integer anUpper;
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
|
||||
Standard_True, 1, theNb, anIndex1, aNewFirst);
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLastParam,
|
||||
Standard_True, 1, theNb, anIndex2, aNewLast);
|
||||
|
||||
if (Abs(aNewFirst - theTK(anIndex1 + 1)) < theEps)
|
||||
{
|
||||
anIndex1++;
|
||||
}
|
||||
if ((aNewLast - theTK(anIndex2)) > theEps)
|
||||
{
|
||||
anIndex2++;
|
||||
}
|
||||
theNbIntervals = 1;
|
||||
|
||||
if (anIndex1 == theNb)
|
||||
{
|
||||
anIndex1 = 1;
|
||||
}
|
||||
|
||||
// Count the max number of boundaries of intervals
|
||||
if (Abs(theLPer - theFPer) > 1)
|
||||
{
|
||||
anUpper = theNb - anIndex1 + anIndex2 + (theLPer - theFPer - 1) * theNb + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
anUpper = theNb - anIndex1 + anIndex2 + 1;
|
||||
}
|
||||
|
||||
if (theLPer == theFPer)
|
||||
{
|
||||
anUpper = theInter.Upper();
|
||||
}
|
||||
TColStd_Array1OfInteger aFinalIntervals(1, anUpper);
|
||||
aFinalIntervals(1) = anIndex1;
|
||||
|
||||
// If first and last are in the same period
|
||||
if ((Abs(theLPer - theFPer) == 0))
|
||||
{
|
||||
Standard_Integer aCurInt = 1;
|
||||
Standard_Real aCurPeriod = theFPer * thePeriod;
|
||||
|
||||
if (theFirst == aNewFirst && theLast == aNewLast)
|
||||
{
|
||||
aCurPeriod = 0;
|
||||
}
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
anIndex2, aCurPeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the first and the last are in neighboring periods
|
||||
if (Abs(theLPer - theFPer) == 1)
|
||||
{
|
||||
Standard_Integer aCurInt = 1;
|
||||
|
||||
if (Abs(theLastParam - theLower) < theEps)
|
||||
{
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// For period with first
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
// For period with last
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// If the first and the last are far apart
|
||||
if (Abs(theLPer - theFPer) > 1)
|
||||
{
|
||||
Standard_Integer aCurInt = 1;
|
||||
if (Abs(theLastParam - theLower) < theEps)
|
||||
{
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
Standard_Integer aNbPer = Abs(theLPer - theFPer);
|
||||
Standard_Integer aCurPer = theFPer + 1;
|
||||
|
||||
while (aNbPer > 1)
|
||||
{
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
aNbPer--;
|
||||
aCurPer++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// For period with first
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
Standard_Integer aNbPer = Abs(theLPer - theFPer);
|
||||
Standard_Integer aCurPer = theFPer + 1;
|
||||
while (aNbPer > 1)
|
||||
{
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
aNbPer--;
|
||||
aCurPer++;
|
||||
}
|
||||
// For period with last
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intervals
|
||||
//purpose :
|
||||
@@ -413,7 +924,9 @@ void Geom2dAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
|
||||
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
|
||||
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
|
||||
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
|
||||
if ( S > Continuity()) {
|
||||
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
|
||||
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
|
||||
if (aContPer || aContNotPer) {
|
||||
Standard_Integer Cont;
|
||||
switch ( S) {
|
||||
case GeomAbs_G1:
|
||||
@@ -427,72 +940,127 @@ void Geom2dAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
|
||||
case GeomAbs_C2:
|
||||
case GeomAbs_C3:
|
||||
case GeomAbs_CN:
|
||||
{
|
||||
if ( S == GeomAbs_C1) Cont = 1;
|
||||
else if ( S == GeomAbs_C2) Cont = 2;
|
||||
else if ( S == GeomAbs_C3) Cont = 3;
|
||||
else Cont = myBSplineCurve->Degree();
|
||||
Standard_Integer Degree = myBSplineCurve->Degree();
|
||||
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfInteger Mults (1, NbKnots);
|
||||
myBSplineCurve->Multiplicities (Mults);
|
||||
NbSplit = 1;
|
||||
Standard_Integer Index = FirstIndex;
|
||||
Inter (NbSplit) = Index;
|
||||
{
|
||||
if (S == GeomAbs_C1) Cont = 1;
|
||||
else if (S == GeomAbs_C2) Cont = 2;
|
||||
else if (S == GeomAbs_C3) Cont = 3;
|
||||
else Cont = myBSplineCurve->Degree();
|
||||
Standard_Integer Degree = myBSplineCurve->Degree();
|
||||
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfInteger Mults(1, NbKnots);
|
||||
myBSplineCurve->Multiplicities(Mults);
|
||||
NbSplit = 1;
|
||||
Standard_Integer Index = FirstIndex;
|
||||
Inter(NbSplit) = Index;
|
||||
Index++;
|
||||
NbSplit++;
|
||||
while (Index < LastIndex)
|
||||
{
|
||||
if (Degree - Mults(Index) < Cont)
|
||||
{
|
||||
Inter(NbSplit) = Index;
|
||||
NbSplit++;
|
||||
}
|
||||
Index++;
|
||||
NbSplit++;
|
||||
while (Index < LastIndex)
|
||||
{
|
||||
if (Degree - Mults (Index) < Cont)
|
||||
{
|
||||
Inter (NbSplit) = Index;
|
||||
NbSplit++;
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
Inter (NbSplit) = Index;
|
||||
Standard_Integer NbInt = NbSplit-1;
|
||||
|
||||
Standard_Integer Nb = myBSplineCurve->NbKnots();
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
Standard_Real newFirst, newLast;
|
||||
TColStd_Array1OfReal TK(1,Nb);
|
||||
TColStd_Array1OfInteger TM(1,Nb);
|
||||
myBSplineCurve->Knots(TK);
|
||||
myBSplineCurve->Multiplicities(TM);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1,Nb,Index1,newFirst);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myLast,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1,Nb,Index2,newLast);
|
||||
}
|
||||
Inter(NbSplit) = Index;
|
||||
Standard_Integer NbInt = NbSplit - 1;
|
||||
|
||||
Standard_Integer Nb = myBSplineCurve->NbKnots();
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
Standard_Real newFirst, newLast;
|
||||
TColStd_Array1OfReal TK(1, Nb);
|
||||
TColStd_Array1OfInteger TM(1, Nb);
|
||||
myBSplineCurve->Knots(TK);
|
||||
myBSplineCurve->Multiplicities(TM);
|
||||
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
|
||||
Precision::PConfusion());
|
||||
|
||||
if (!myBSplineCurve->IsPeriodic())
|
||||
{
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myFirst,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1, Nb, Index1, newFirst);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myLast,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1, Nb, Index2, newLast);
|
||||
|
||||
|
||||
// On decale eventuellement les indices
|
||||
// On utilise une "petite" tolerance, la resolution ne doit
|
||||
// servir que pour les tres longue courbes....(PRO9248)
|
||||
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
|
||||
Precision::PConfusion());
|
||||
if ( Abs(newFirst-TK(Index1+1))< Eps) Index1++;
|
||||
if ( newLast-TK(Index2)> Eps) Index2++;
|
||||
|
||||
Inter( 1) = Index1;
|
||||
myNbIntervals = 1;
|
||||
for ( Standard_Integer i=1; i<=NbInt; i++) {
|
||||
if (Inter(i) > Index1 && Inter(i)<Index2 ) {
|
||||
myNbIntervals++;
|
||||
Inter(myNbIntervals) = Inter(i);
|
||||
}
|
||||
}
|
||||
Inter(myNbIntervals+1) = Index2;
|
||||
|
||||
Standard_Integer ii = T.Lower() - 1;
|
||||
for (Standard_Integer I=1;I<=myNbIntervals+1;I++) {
|
||||
T(ii + I) = TK(Inter(I));
|
||||
}
|
||||
}
|
||||
break;
|
||||
// On decale eventuellement les indices
|
||||
// On utilise une "petite" tolerance, la resolution ne doit
|
||||
// servir que pour les tres longue courbes....(PRO9248)
|
||||
if (Abs(newFirst - TK(Index1 + 1)) < Eps) Index1++;
|
||||
if (newLast - TK(Index2) > Eps) Index2++;
|
||||
|
||||
Inter(1) = Index1;
|
||||
myNbIntervals = 1;
|
||||
for (Standard_Integer i = 1; i <= NbInt; i++) {
|
||||
if (Inter(i) > Index1 && Inter(i) < Index2) {
|
||||
myNbIntervals++;
|
||||
Inter(myNbIntervals) = Inter(i);
|
||||
}
|
||||
}
|
||||
Inter(myNbIntervals + 1) = Index2;
|
||||
|
||||
Standard_Integer ii = T.Lower() - 1;
|
||||
for (Standard_Integer I = 1; I <= myNbIntervals + 1; I++) {
|
||||
T(ii + I) = TK(Inter(I));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real aFirst = myFirst;
|
||||
Standard_Real aLast = myLast;
|
||||
|
||||
Standard_Real aCurFirst = aFirst;
|
||||
Standard_Real aCurLast = aLast;
|
||||
|
||||
Standard_Real aPeriod = myBSplineCurve->Period();
|
||||
Standard_Real aLower = myBSplineCurve->FirstParameter();
|
||||
Standard_Real anUpper = myBSplineCurve->LastParameter();
|
||||
|
||||
Standard_Integer aLPer = 0; Standard_Integer aFPer = 0;
|
||||
|
||||
if (Abs(myFirst - aLower) <= Eps)
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
aFirst = aCurFirst;
|
||||
}
|
||||
if (Abs(myLast - anUpper) <= Eps)
|
||||
{
|
||||
aCurLast = anUpper;
|
||||
aLast = aCurLast;
|
||||
}
|
||||
|
||||
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
}
|
||||
else
|
||||
{
|
||||
DefinFPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurFirst, aFPer);
|
||||
}
|
||||
DefinLPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurLast, aLPer);
|
||||
|
||||
if (myFirst == aLower)
|
||||
{
|
||||
aFPer = 0;
|
||||
}
|
||||
|
||||
SpreadInt(TK, TM, Inter, myBSplineCurve->Degree(), Nb, aFPer, aLPer, NbInt, aLower, myFirst, myLast, aPeriod,
|
||||
aCurLast, Eps, T, myNbIntervals);
|
||||
T(T.Lower()) = aFirst;
|
||||
T(T.Lower() + myNbIntervals) = aLast;
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
T(T.Lower()) = myFirst;
|
||||
T(T.Lower() + myNbIntervals) = myLast;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -58,6 +58,65 @@ static const Standard_Real PosTol = Precision::PConfusion() / 2;
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(GeomAdaptor_Curve, Adaptor3d_Curve)
|
||||
|
||||
static void DefinFPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurFirst,
|
||||
Standard_Integer &theFPer);
|
||||
|
||||
static void DefinLPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurLast,
|
||||
Standard_Integer &theLPer);
|
||||
|
||||
static Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
|
||||
const TColStd_Array1OfInteger& theTM,
|
||||
const TColStd_Array1OfInteger& theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Boolean thePeriodicCur,
|
||||
Standard_Integer theNbIntervals,
|
||||
Standard_Real theLower = 0,
|
||||
Standard_Real thePeriod = 0,
|
||||
Standard_Integer theIndex1 = 0,
|
||||
Standard_Integer theIndex2 = 0);
|
||||
|
||||
static void WriteIntervals(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Integer theIndex1,
|
||||
const Standard_Integer theIndex2,
|
||||
const Standard_Real theCurPeriod,
|
||||
const Standard_Boolean theFlagForFirst,
|
||||
TColStd_Array1OfReal &theT,
|
||||
TColStd_Array1OfInteger &theFinalIntervals,
|
||||
Standard_Integer &theNbIntervals,
|
||||
Standard_Integer &theCurInt);
|
||||
|
||||
static void SpreadInt(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theTM,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theFPer,
|
||||
const Standard_Integer theLPer,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theLower,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real thePeriod,
|
||||
const Standard_Real theLastParam,
|
||||
const Standard_Real theEps,
|
||||
TColStd_Array1OfReal &theT,
|
||||
Standard_Integer &theNbIntervals);
|
||||
|
||||
//=======================================================================
|
||||
//function : ShallowCopy
|
||||
//purpose :
|
||||
@@ -114,7 +173,7 @@ GeomAbs_Shape GeomAdaptor_Curve::LocalContinuity(const Standard_Real U1,
|
||||
if ( (myBSplineCurve->IsPeriodic()) && (Index1 == Nb) )
|
||||
Index1 = 1;
|
||||
|
||||
if ( Index2 - Index1 <= 0) {
|
||||
if ((Index2 - Index1 <= 0) && (!myBSplineCurve->IsPeriodic())) {
|
||||
MultMax = 100; // CN entre 2 Noeuds consecutifs
|
||||
}
|
||||
else {
|
||||
@@ -251,6 +310,159 @@ GeomAbs_Shape GeomAdaptor_Curve::Continuity() const
|
||||
return GeomAbs_CN;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DefinFPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void DefinFPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurFirst,
|
||||
Standard_Integer &theFPer)
|
||||
{
|
||||
if (theCurFirst >= theLower)
|
||||
{
|
||||
while (theCurFirst >= theUpper)
|
||||
{
|
||||
theCurFirst = theCurFirst - thePeriod;
|
||||
theFPer++;
|
||||
}
|
||||
if (Abs(theUpper - theCurFirst) <= theEps)
|
||||
{
|
||||
theFPer++;
|
||||
theCurFirst = theLower;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (theCurFirst < theLower)
|
||||
{
|
||||
theCurFirst = theCurFirst + thePeriod;
|
||||
if ((Abs(theLower - theCurFirst)) > theEps)
|
||||
{
|
||||
theFPer--;
|
||||
}
|
||||
}
|
||||
|
||||
if (Abs(theUpper - theCurFirst) <= theEps)
|
||||
{
|
||||
theCurFirst = theLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DefinLPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void DefinLPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurLast,
|
||||
Standard_Integer &theLPer)
|
||||
{
|
||||
if (theCurLast >= theLower)
|
||||
{
|
||||
if ((theCurLast >= theUpper) && (Abs(theCurLast - theUpper) <= theEps))
|
||||
{
|
||||
theCurLast = theUpper;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (theCurLast >= theUpper)
|
||||
{
|
||||
theCurLast = theCurLast - thePeriod;
|
||||
theLPer++;
|
||||
}
|
||||
if (Abs(theUpper - theCurLast) <= theEps)
|
||||
{
|
||||
theCurLast = theLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (theCurLast < theLower)
|
||||
{
|
||||
theCurLast = theCurLast + thePeriod;
|
||||
if (Abs(theLower - theCurLast) > theEps)
|
||||
{
|
||||
theLPer--;
|
||||
}
|
||||
}
|
||||
if ((theUpper - theCurLast) <= theEps)
|
||||
{
|
||||
theCurLast = theLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalNbIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
|
||||
const TColStd_Array1OfInteger& theTM,
|
||||
const TColStd_Array1OfInteger& theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Boolean thePeriodicCur,
|
||||
Standard_Integer theNbIntervals,
|
||||
Standard_Real theLower,
|
||||
Standard_Real thePeriod,
|
||||
Standard_Integer theIndex1,
|
||||
Standard_Integer theIndex2)
|
||||
{
|
||||
Standard_Real aNewFirst = theFirst;
|
||||
Standard_Real aNewLast = theLast;
|
||||
if (theIndex1 == 0)
|
||||
{
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
|
||||
thePeriodicCur, 1, theNb, theIndex1, aNewFirst);
|
||||
}
|
||||
if (theIndex2 == 0)
|
||||
{
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLast,
|
||||
thePeriodicCur, 1, theNb, theIndex2, aNewLast);
|
||||
}
|
||||
// Protection against theFirst = UFirst - eps, which located as ULast - eps
|
||||
if (thePeriodicCur && ((aNewLast - aNewFirst) < Precision::PConfusion()))
|
||||
{
|
||||
if (Abs(aNewLast - theLower) < Precision::PConfusion())
|
||||
{
|
||||
aNewLast += thePeriod;
|
||||
}
|
||||
else
|
||||
{
|
||||
aNewFirst -= thePeriod;
|
||||
}
|
||||
}
|
||||
|
||||
if (Abs(aNewFirst - theTK(theIndex1 + 1)) < theEps)
|
||||
{
|
||||
theIndex1++;
|
||||
}
|
||||
if ((aNewLast - theTK(theIndex2)) > theEps)
|
||||
{
|
||||
theIndex2++;
|
||||
}
|
||||
for (Standard_Integer i = 1; i <= theNbInt; i++)
|
||||
{
|
||||
if (theInter(i) > theIndex1 && theInter(i) < theIndex2) theNbIntervals++;
|
||||
}
|
||||
return theNbIntervals;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbIntervals
|
||||
//purpose :
|
||||
@@ -262,11 +474,14 @@ Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
||||
Standard_Integer NbSplit;
|
||||
if (myTypeCurve == GeomAbs_BSplineCurve) {
|
||||
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
|
||||
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
|
||||
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
|
||||
if ( S > Continuity()) {
|
||||
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
|
||||
TColStd_Array1OfInteger Inter(1, LastIndex - FirstIndex + 1);
|
||||
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
|
||||
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
|
||||
|
||||
if(aContPer || aContNotPer) {
|
||||
Standard_Integer Cont;
|
||||
switch ( S) {
|
||||
switch (S) {
|
||||
case GeomAbs_G1:
|
||||
case GeomAbs_G2:
|
||||
throw Standard_DomainError("GeomAdaptor_Curve::NbIntervals");
|
||||
@@ -276,68 +491,168 @@ Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
||||
break;
|
||||
case GeomAbs_C1:
|
||||
case GeomAbs_C2:
|
||||
case GeomAbs_C3:
|
||||
case GeomAbs_CN:
|
||||
case GeomAbs_C3:
|
||||
case GeomAbs_CN:
|
||||
{
|
||||
if (S == GeomAbs_C1) Cont = 1;
|
||||
else if (S == GeomAbs_C2) Cont = 2;
|
||||
else if (S == GeomAbs_C3) Cont = 3;
|
||||
else Cont = myBSplineCurve->Degree();
|
||||
Standard_Integer Degree = myBSplineCurve->Degree();
|
||||
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfInteger Mults(1, NbKnots);
|
||||
myBSplineCurve->Multiplicities(Mults);
|
||||
NbSplit = 1;
|
||||
Standard_Integer Index = FirstIndex;
|
||||
Inter(NbSplit) = Index;
|
||||
Index++;
|
||||
NbSplit++;
|
||||
while (Index < LastIndex)
|
||||
{
|
||||
if ( S == GeomAbs_C1) Cont = 1;
|
||||
else if ( S == GeomAbs_C2) Cont = 2;
|
||||
else if ( S == GeomAbs_C3) Cont = 3;
|
||||
else Cont = myBSplineCurve->Degree();
|
||||
Standard_Integer Degree = myBSplineCurve->Degree();
|
||||
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfInteger Mults (1, NbKnots);
|
||||
myBSplineCurve->Multiplicities (Mults);
|
||||
NbSplit = 1;
|
||||
Standard_Integer Index = FirstIndex;
|
||||
Inter (NbSplit) = Index;
|
||||
Index++;
|
||||
NbSplit++;
|
||||
while (Index < LastIndex)
|
||||
{
|
||||
if (Degree - Mults (Index) < Cont)
|
||||
{
|
||||
Inter (NbSplit) = Index;
|
||||
NbSplit++;
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
Inter (NbSplit) = Index;
|
||||
|
||||
Standard_Integer NbInt = NbSplit-1;
|
||||
|
||||
Standard_Integer Nb = myBSplineCurve->NbKnots();
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
Standard_Real newFirst, newLast;
|
||||
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
|
||||
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1,Nb,Index1,newFirst);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myLast,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1,Nb,Index2,newLast);
|
||||
// Protection against myFirst = UFirst - eps, which located as ULast - eps
|
||||
if (myBSplineCurve->IsPeriodic() && (newLast - newFirst) < Precision::PConfusion())
|
||||
if (Degree - Mults(Index) < Cont)
|
||||
{
|
||||
if (Abs(newLast - myBSplineCurve->FirstParameter()) < Precision::PConfusion())
|
||||
newLast += myBSplineCurve->Period();
|
||||
else
|
||||
newFirst -= myBSplineCurve->Period();
|
||||
Inter(NbSplit) = Index;
|
||||
NbSplit++;
|
||||
}
|
||||
// On decale eventuellement les indices
|
||||
// On utilise une "petite" tolerance, la resolution ne doit
|
||||
// servir que pour les tres longue courbes....(PRO9248)
|
||||
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
|
||||
Precision::PConfusion());
|
||||
if ( Abs(newFirst-TK(Index1+1))< Eps) Index1++;
|
||||
if ( newLast-TK(Index2)> Eps) Index2++;
|
||||
|
||||
myNbIntervals = 1;
|
||||
for ( Standard_Integer i=1; i<=NbInt; i++)
|
||||
if (Inter(i)>Index1 && Inter(i)<Index2) myNbIntervals++;
|
||||
Index++;
|
||||
}
|
||||
break;
|
||||
Inter(NbSplit) = Index;
|
||||
|
||||
Standard_Integer NbInt = NbSplit - 1;
|
||||
|
||||
Standard_Integer Nb = myBSplineCurve->NbKnots();
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
|
||||
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
|
||||
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
|
||||
Precision::PConfusion());
|
||||
|
||||
myNbIntervals = 1;
|
||||
|
||||
if (!myBSplineCurve->IsPeriodic())
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_False, myNbIntervals);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real aCurFirst = myFirst;
|
||||
Standard_Real aCurLast = myLast;
|
||||
Standard_Real aLower = myBSplineCurve->FirstParameter();
|
||||
Standard_Real anUpper = myBSplineCurve->LastParameter();
|
||||
|
||||
if ((Abs(aCurFirst - aLower) < Eps) && (aCurFirst < aLower))
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
}
|
||||
if ((Abs(aCurLast - anUpper) < Eps) && (aCurLast < anUpper))
|
||||
{
|
||||
aCurLast = anUpper;
|
||||
}
|
||||
|
||||
Standard_Real aPeriod = myBSplineCurve->Period();
|
||||
Standard_Integer aLPer = 1; Standard_Integer aFPer = 1;
|
||||
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
}
|
||||
else
|
||||
{
|
||||
DefinFPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurFirst, aFPer);
|
||||
}
|
||||
DefinLPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurLast, aLPer);
|
||||
|
||||
Standard_Real aNewFirst;
|
||||
Standard_Real aNewLast;
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myFirst,
|
||||
Standard_True, 1, Nb, Index1, aNewFirst);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myLast,
|
||||
Standard_True, 1, Nb, Index2, aNewLast);
|
||||
if ((aNewFirst == myFirst && aNewLast == myLast) && (aFPer != aLPer))
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Integer aSumPer = Abs(aLPer - aFPer);
|
||||
|
||||
Standard_Real aFirst = 0;
|
||||
if (aLower < 0 && anUpper == 0)
|
||||
{
|
||||
if (Abs(aCurLast) < Eps)
|
||||
{
|
||||
aCurLast = 0;
|
||||
}
|
||||
aFirst = aLower;
|
||||
}
|
||||
|
||||
if (aSumPer <= 1)
|
||||
{
|
||||
if ((Abs(myFirst - TK(Nb) - aPeriod * (aFPer - 1)) <= Eps) && (myLast < (TK(Nb) + aPeriod * (aLPer - 1))))
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
return myNbIntervals;
|
||||
}
|
||||
if ((Abs(myFirst - aLower) < Eps) && (Abs(myLast - anUpper) < Eps))
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
return myNbIntervals;
|
||||
}
|
||||
}
|
||||
|
||||
if (aSumPer != 0)
|
||||
{
|
||||
Standard_Integer aFInt = 0;
|
||||
Standard_Integer aLInt = 0;
|
||||
Standard_Integer aPInt = NbInt;
|
||||
|
||||
if ((aCurFirst != aPeriod) || ((aCurFirst != anUpper) && (Abs(myFirst) < Eps)))
|
||||
{
|
||||
aFInt = 1;
|
||||
}
|
||||
if ((aCurLast != aLower) && (aCurLast != anUpper))
|
||||
{
|
||||
aLInt = 1;
|
||||
}
|
||||
|
||||
aFInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aCurFirst, anUpper, Eps, Standard_True, aFInt, aLower, aPeriod);
|
||||
|
||||
if (aCurLast == anUpper)
|
||||
{
|
||||
aLInt = NbInt;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Abs(aCurLast - aFirst) > Eps)
|
||||
{
|
||||
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod);
|
||||
}
|
||||
}
|
||||
|
||||
myNbIntervals = aFInt + aLInt + aPInt * (aSumPer - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aCurFirst, aCurLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -373,6 +688,206 @@ Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
||||
return myNbIntervals;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static void WriteIntervals(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Integer theIndex1,
|
||||
const Standard_Integer theIndex2,
|
||||
const Standard_Real theCurPeriod,
|
||||
const Standard_Boolean theFlagForFirst,
|
||||
TColStd_Array1OfReal &theT,
|
||||
TColStd_Array1OfInteger &theFinalIntervals,
|
||||
Standard_Integer &theNbIntervals,
|
||||
Standard_Integer &theCurInt)
|
||||
{
|
||||
if (theFlagForFirst)
|
||||
{
|
||||
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
|
||||
{
|
||||
if (theInter(anId) > theIndex1 && theInter(anId) <= theIndex2)
|
||||
{
|
||||
theNbIntervals++;
|
||||
theFinalIntervals(theNbIntervals) = theInter(anId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
|
||||
{
|
||||
if (theInter(anId) > theIndex1 && theInter(anId) < theIndex2)
|
||||
{
|
||||
theNbIntervals++;
|
||||
theFinalIntervals(theNbIntervals) = theInter(anId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
theFinalIntervals(theNbIntervals + 1) = theIndex2;
|
||||
|
||||
for (Standard_Integer anId = theCurInt; anId <= theNbIntervals + 1; anId++)
|
||||
{
|
||||
theT(anId) = theTK(theFinalIntervals(anId)) + theCurPeriod;
|
||||
theCurInt++;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SpreadInt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SpreadInt(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theTM,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theFPer,
|
||||
const Standard_Integer theLPer,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theLower,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real thePeriod,
|
||||
const Standard_Real theLastParam,
|
||||
const Standard_Real theEps,
|
||||
TColStd_Array1OfReal &theT,
|
||||
Standard_Integer &theNbIntervals)
|
||||
{
|
||||
Standard_Integer anIndex1 = 0;
|
||||
Standard_Integer anIndex2 = 0;
|
||||
Standard_Real aNewFirst, aNewLast;
|
||||
Standard_Integer anUpper;
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
|
||||
Standard_True, 1, theNb, anIndex1, aNewFirst);
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLastParam,
|
||||
Standard_True, 1, theNb, anIndex2, aNewLast);
|
||||
|
||||
if (Abs(aNewFirst - theTK(anIndex1 + 1)) < theEps)
|
||||
{
|
||||
anIndex1++;
|
||||
}
|
||||
if ((aNewLast - theTK(anIndex2)) > theEps)
|
||||
{
|
||||
anIndex2++;
|
||||
}
|
||||
theNbIntervals = 1;
|
||||
|
||||
if (anIndex1 == theNb)
|
||||
{
|
||||
anIndex1 = 1;
|
||||
}
|
||||
|
||||
// Count the max number of boundaries of intervals
|
||||
if (Abs(theLPer - theFPer) > 1)
|
||||
{
|
||||
anUpper = theNb - anIndex1 + anIndex2 + (theLPer - theFPer - 1) * theNb + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
anUpper = theNb - anIndex1 + anIndex2 + 1;
|
||||
}
|
||||
|
||||
if (theLPer == theFPer)
|
||||
{
|
||||
anUpper = theInter.Upper();
|
||||
}
|
||||
TColStd_Array1OfInteger aFinalIntervals(1, anUpper);
|
||||
aFinalIntervals(1) = anIndex1;
|
||||
|
||||
// If first and last are in the same period
|
||||
if ((Abs(theLPer - theFPer) == 0))
|
||||
{
|
||||
Standard_Integer aCurInt = 1;
|
||||
Standard_Real aCurPeriod = theFPer * thePeriod;
|
||||
|
||||
if (theFirst == aNewFirst && theLast == aNewLast)
|
||||
{
|
||||
aCurPeriod = 0;
|
||||
}
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
anIndex2, aCurPeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the first and the last are in neighboring periods
|
||||
if (Abs(theLPer - theFPer) == 1)
|
||||
{
|
||||
Standard_Integer aCurInt = 1;
|
||||
|
||||
if (Abs(theLastParam - theLower) < theEps)
|
||||
{
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// For period with first
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
// For period with last
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// If the first and the last are far apart
|
||||
if (Abs(theLPer - theFPer) > 1)
|
||||
{
|
||||
Standard_Integer aCurInt = 1;
|
||||
|
||||
if (Abs(theLastParam - theLower) < theEps)
|
||||
{
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
Standard_Integer aNbPer = Abs(theLPer - theFPer);
|
||||
Standard_Integer aCurPer = theFPer + 1;
|
||||
|
||||
while (aNbPer > 1)
|
||||
{
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
aNbPer--;
|
||||
aCurPer++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// For period with first
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
Standard_Integer aNbPer = Abs(theLPer - theFPer);
|
||||
Standard_Integer aCurPer = theFPer + 1;
|
||||
while (aNbPer > 1)
|
||||
{
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
aNbPer--;
|
||||
aCurPer++;
|
||||
}
|
||||
// For period with last
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intervals
|
||||
//purpose :
|
||||
@@ -385,106 +900,166 @@ void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
|
||||
Standard_Integer NbSplit;
|
||||
Standard_Real FirstParam = myFirst, LastParam = myLast;
|
||||
|
||||
if (myTypeCurve == GeomAbs_BSplineCurve)
|
||||
{
|
||||
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
|
||||
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
|
||||
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
|
||||
|
||||
if ( S > Continuity()) {
|
||||
Standard_Integer Cont;
|
||||
switch ( S) {
|
||||
case GeomAbs_G1:
|
||||
case GeomAbs_G2:
|
||||
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
|
||||
break;
|
||||
case GeomAbs_C0:
|
||||
myNbIntervals = 1;
|
||||
break;
|
||||
case GeomAbs_C1:
|
||||
case GeomAbs_C2:
|
||||
case GeomAbs_C3:
|
||||
case GeomAbs_CN:
|
||||
{
|
||||
if ( S == GeomAbs_C1) Cont = 1;
|
||||
else if ( S == GeomAbs_C2) Cont = 2;
|
||||
else if ( S == GeomAbs_C3) Cont = 3;
|
||||
else Cont = myBSplineCurve->Degree();
|
||||
Standard_Integer Degree = myBSplineCurve->Degree();
|
||||
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfInteger Mults (1, NbKnots);
|
||||
myBSplineCurve->Multiplicities (Mults);
|
||||
NbSplit = 1;
|
||||
Standard_Integer Index = FirstIndex;
|
||||
Inter (NbSplit) = Index;
|
||||
Index++;
|
||||
NbSplit++;
|
||||
while (Index < LastIndex)
|
||||
{
|
||||
if (Degree - Mults (Index) < Cont)
|
||||
{
|
||||
Inter (NbSplit) = Index;
|
||||
NbSplit++;
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
Inter (NbSplit) = Index;
|
||||
Standard_Integer NbInt = NbSplit-1;
|
||||
// GeomConvert_BSplineCurveKnotSplitting Convector(myBspl, Cont);
|
||||
// Standard_Integer NbInt = Convector.NbSplits()-1;
|
||||
// TColStd_Array1OfInteger Inter(1,NbInt+1);
|
||||
// Convector.Splitting( Inter);
|
||||
|
||||
Standard_Integer Nb = myBSplineCurve->NbKnots();
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
Standard_Real newFirst, newLast;
|
||||
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
|
||||
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1,Nb,Index1,newFirst);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myLast,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1,Nb,Index2,newLast);
|
||||
FirstParam = newFirst;
|
||||
LastParam = newLast;
|
||||
// Protection against myFirst = UFirst - eps, which located as ULast - eps
|
||||
if (myBSplineCurve->IsPeriodic() && (LastParam - FirstParam) < Precision::PConfusion())
|
||||
{
|
||||
if (Abs(LastParam - myBSplineCurve->FirstParameter()) < Precision::PConfusion())
|
||||
LastParam += myBSplineCurve->Period();
|
||||
else
|
||||
FirstParam -= myBSplineCurve->Period();
|
||||
}
|
||||
// On decale eventuellement les indices
|
||||
// On utilise une "petite" tolerance, la resolution ne doit
|
||||
// servir que pour les tres longue courbes....(PRO9248)
|
||||
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
|
||||
Precision::PConfusion());
|
||||
if ( Abs(FirstParam-TK(Index1+1))< Eps) Index1++;
|
||||
if ( LastParam-TK(Index2)> Eps) Index2++;
|
||||
|
||||
myNbIntervals = 1;
|
||||
if (myTypeCurve == GeomAbs_BSplineCurve)
|
||||
{
|
||||
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
|
||||
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
|
||||
TColStd_Array1OfInteger Inter(1, LastIndex - FirstIndex + 1);
|
||||
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
|
||||
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
|
||||
|
||||
TColStd_Array1OfInteger aFinalIntervals(1, Inter.Upper());
|
||||
aFinalIntervals(1) = Index1;
|
||||
for ( Standard_Integer i=1; i<=NbInt; i++) {
|
||||
if (Inter(i) > Index1 && Inter(i)<Index2 ) {
|
||||
myNbIntervals++;
|
||||
aFinalIntervals(myNbIntervals) = Inter(i);
|
||||
}
|
||||
}
|
||||
aFinalIntervals(myNbIntervals + 1) = Index2;
|
||||
|
||||
for (Standard_Integer I=1;I<=myNbIntervals+1;I++) {
|
||||
T(I) = TK(aFinalIntervals(I));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (aContPer || aContNotPer) {
|
||||
Standard_Integer Cont;
|
||||
switch (S) {
|
||||
case GeomAbs_G1:
|
||||
case GeomAbs_G2:
|
||||
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
|
||||
break;
|
||||
case GeomAbs_C0:
|
||||
myNbIntervals = 1;
|
||||
break;
|
||||
case GeomAbs_C1:
|
||||
case GeomAbs_C2:
|
||||
case GeomAbs_C3:
|
||||
case GeomAbs_CN:
|
||||
{
|
||||
if (S == GeomAbs_C1) Cont = 1;
|
||||
else if (S == GeomAbs_C2) Cont = 2;
|
||||
else if (S == GeomAbs_C3) Cont = 3;
|
||||
else Cont = myBSplineCurve->Degree();
|
||||
Standard_Integer Degree = myBSplineCurve->Degree();
|
||||
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfInteger Mults(1, NbKnots);
|
||||
myBSplineCurve->Multiplicities(Mults);
|
||||
NbSplit = 1;
|
||||
Standard_Integer Index = FirstIndex;
|
||||
Inter(NbSplit) = Index;
|
||||
Index++;
|
||||
NbSplit++;
|
||||
while (Index < LastIndex)
|
||||
{
|
||||
if (Degree - Mults(Index) < Cont)
|
||||
{
|
||||
Inter(NbSplit) = Index;
|
||||
NbSplit++;
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
Inter(NbSplit) = Index;
|
||||
Standard_Integer NbInt = NbSplit - 1;
|
||||
// GeomConvert_BSplineCurveKnotSplitting Convector(myBspl, Cont);
|
||||
// Standard_Integer NbInt = Convector.NbSplits()-1;
|
||||
// TColStd_Array1OfInteger Inter(1,NbInt+1);
|
||||
// Convector.Splitting( Inter);
|
||||
|
||||
Standard_Integer Nb = myBSplineCurve->NbKnots();
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
Standard_Real newFirst, newLast;
|
||||
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
|
||||
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
|
||||
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
|
||||
Precision::PConfusion());
|
||||
|
||||
if (!myBSplineCurve->IsPeriodic() || ((Abs(myFirst - myBSplineCurve->FirstParameter()) < Eps) &&
|
||||
(Abs(myLast - myBSplineCurve->LastParameter()) < Eps)))
|
||||
{
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myFirst,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1, Nb, Index1, newFirst);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myLast,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1, Nb, Index2, newLast);
|
||||
FirstParam = newFirst;
|
||||
LastParam = newLast;
|
||||
// Protection against myFirst = UFirst - eps, which located as ULast - eps
|
||||
if (myBSplineCurve->IsPeriodic() && (LastParam - FirstParam) < Precision::PConfusion())
|
||||
{
|
||||
if (Abs(LastParam - myBSplineCurve->FirstParameter()) < Precision::PConfusion())
|
||||
LastParam += myBSplineCurve->Period();
|
||||
else
|
||||
FirstParam -= myBSplineCurve->Period();
|
||||
}
|
||||
// On decale eventuellement les indices
|
||||
// On utilise une "petite" tolerance, la resolution ne doit
|
||||
// servir que pour les tres longue courbes....(PRO9248)
|
||||
|
||||
if (Abs(FirstParam - TK(Index1 + 1)) < Eps) Index1++;
|
||||
if (LastParam - TK(Index2) > Eps) Index2++;
|
||||
|
||||
myNbIntervals = 1;
|
||||
|
||||
TColStd_Array1OfInteger aFinalIntervals(1, Inter.Upper());
|
||||
aFinalIntervals(1) = Index1;
|
||||
for (Standard_Integer i = 1; i <= NbInt; i++) {
|
||||
if (Inter(i) > Index1 && Inter(i) < Index2) {
|
||||
myNbIntervals++;
|
||||
aFinalIntervals(myNbIntervals) = Inter(i);
|
||||
}
|
||||
}
|
||||
aFinalIntervals(myNbIntervals + 1) = Index2;
|
||||
|
||||
for (Standard_Integer I = 1; I <= myNbIntervals + 1; I++) {
|
||||
T(I) = TK(aFinalIntervals(I));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real aFirst = myFirst;
|
||||
Standard_Real aLast = myLast;
|
||||
|
||||
Standard_Real aCurFirst = aFirst;
|
||||
Standard_Real aCurLast = aLast;
|
||||
|
||||
Standard_Real aPeriod = myBSplineCurve->Period();
|
||||
Standard_Real aLower = myBSplineCurve->FirstParameter();
|
||||
Standard_Real anUpper = myBSplineCurve->LastParameter();
|
||||
|
||||
Standard_Integer aLPer = 0; Standard_Integer aFPer = 0;
|
||||
|
||||
if (Abs(myFirst - aLower) <= Eps)
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
aFirst = aCurFirst;
|
||||
}
|
||||
|
||||
if (Abs(myLast - anUpper) <= Eps)
|
||||
{
|
||||
aCurLast = anUpper;
|
||||
aLast = aCurLast;
|
||||
}
|
||||
|
||||
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
}
|
||||
else
|
||||
{
|
||||
DefinFPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurFirst, aFPer);
|
||||
}
|
||||
DefinLPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurLast, aLPer);
|
||||
|
||||
if (myFirst == aLower)
|
||||
{
|
||||
aFPer = 0;
|
||||
}
|
||||
|
||||
SpreadInt(TK, TM, Inter, myBSplineCurve->Degree(), Nb, aFPer, aLPer, NbInt, aLower, myFirst, myLast, aPeriod,
|
||||
aCurLast, Eps, T, myNbIntervals);
|
||||
|
||||
T(T.Lower()) = aFirst;
|
||||
T(T.Lower() + myNbIntervals) = aLast;
|
||||
return;
|
||||
}
|
||||
}
|
||||
T(T.Lower()) = myFirst;
|
||||
T(T.Lower() + myNbIntervals) = myLast;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (myTypeCurve == GeomAbs_OffsetCurve){
|
||||
GeomAbs_Shape BaseS=GeomAbs_C0;
|
||||
|
@@ -132,7 +132,7 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
|
||||
if (SecondCurve->Degree() < Deg) { SecondCurve->IncreaseDegree(Deg); }
|
||||
|
||||
// Declarationd
|
||||
Standard_Real L1, L2, U_de_raccord;
|
||||
Standard_Real L1, L2;
|
||||
Standard_Integer ii, jj;
|
||||
Standard_Real Ratio=1, Ratio1, Ratio2, Delta1, Delta2;
|
||||
Standard_Integer NbP1 = FirstCurve->NbPoles(), NbP2 = SecondCurve->NbPoles();
|
||||
@@ -159,7 +159,6 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
|
||||
Delta1 = 0;
|
||||
Ratio2 = 1/Ratio;
|
||||
Delta2 = Ratio2*SecondCurve->Knot(1) - FirstCurve->Knot(NbK1);
|
||||
U_de_raccord = FirstCurve->LastParameter();
|
||||
}
|
||||
else {
|
||||
// On ne bouge pas la seconde courbe
|
||||
@@ -167,12 +166,11 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
|
||||
Delta1 = Ratio1*FirstCurve->Knot(NbK1) - SecondCurve->Knot(1);
|
||||
Ratio2 = 1;
|
||||
Delta2 = 0;
|
||||
U_de_raccord = SecondCurve->FirstParameter();
|
||||
}
|
||||
|
||||
// Les Noeuds
|
||||
Standard_Real eps;
|
||||
for (ii=1; ii<NbK1; ii++) {
|
||||
for (ii=1; ii<=NbK1; ii++) {
|
||||
Noeuds(ii) = Ratio1*FirstCurve->Knot(ii) - Delta1;
|
||||
if(ii > 1) {
|
||||
eps = Epsilon (Abs(Noeuds(ii-1)));
|
||||
@@ -183,11 +181,6 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
|
||||
}
|
||||
Mults(ii) = FirstCurve->Multiplicity(ii);
|
||||
}
|
||||
Noeuds(NbK1) = U_de_raccord;
|
||||
eps = Epsilon (Abs(Noeuds(NbK1-1)));
|
||||
if(Noeuds(NbK1) - Noeuds(NbK1-1) <= eps) {
|
||||
Noeuds(NbK1) += eps;
|
||||
}
|
||||
Mults(NbK1) = FirstCurve->Degree();
|
||||
for (ii=2, jj=NbK1+1; ii<=NbK2; ii++, jj++) {
|
||||
Noeuds(jj) = Ratio2*SecondCurve->Knot(ii) - Delta2;
|
||||
|
@@ -66,12 +66,14 @@ GeomFill_ConstantBiNormal::GeomFill_ConstantBiNormal(const gp_Dir& BiNormal) : B
|
||||
return copy;
|
||||
}
|
||||
|
||||
void GeomFill_ConstantBiNormal::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_ConstantBiNormal::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
Standard_Boolean isOK = Standard_False;
|
||||
GeomFill_TrihedronLaw::SetCurve(C);
|
||||
if (! C.IsNull()) {
|
||||
frenet->SetCurve(C);
|
||||
if (! C.IsNull()) {
|
||||
isOK = frenet->SetCurve(C);
|
||||
}
|
||||
return isOK;
|
||||
}
|
||||
|
||||
Standard_Boolean GeomFill_ConstantBiNormal::D0(const Standard_Real Param,gp_Vec& Tangent,gp_Vec& Normal,gp_Vec& BiNormal)
|
||||
|
@@ -45,7 +45,9 @@ public:
|
||||
|
||||
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! initialize curve of trihedron law
|
||||
//! @return Standard_True in case if execution end correctly
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
//! Computes Triedrhon on curve at parameter <Param>
|
||||
Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, gp_Vec& Tangent, gp_Vec& Normal, gp_Vec& BiNormal) Standard_OVERRIDE;
|
||||
|
@@ -337,34 +337,36 @@ Handle(GeomFill_TrihedronLaw) GeomFill_CorrectedFrenet::Copy() const
|
||||
return copy;
|
||||
}
|
||||
|
||||
void GeomFill_CorrectedFrenet::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_CorrectedFrenet::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
|
||||
GeomFill_TrihedronLaw::SetCurve(C);
|
||||
if (! C.IsNull()) {
|
||||
if (! C.IsNull())
|
||||
{
|
||||
frenet->SetCurve(C);
|
||||
|
||||
GeomAbs_CurveType type;
|
||||
type = C->GetType();
|
||||
switch (type) {
|
||||
switch (type)
|
||||
{
|
||||
case GeomAbs_Circle:
|
||||
case GeomAbs_Ellipse:
|
||||
case GeomAbs_Hyperbola:
|
||||
case GeomAbs_Parabola:
|
||||
case GeomAbs_Line:
|
||||
{
|
||||
// No probleme isFrenet
|
||||
isFrenet = Standard_True;
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
// We have to search singularities
|
||||
isFrenet = Standard_True;
|
||||
Init();
|
||||
}
|
||||
{
|
||||
// No probleme isFrenet
|
||||
isFrenet = Standard_True;
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
// We have to search singularities
|
||||
isFrenet = Standard_True;
|
||||
Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
return isFrenet;
|
||||
}
|
||||
|
||||
|
||||
@@ -438,16 +440,20 @@ Handle(GeomFill_TrihedronLaw) GeomFill_CorrectedFrenet::Copy() const
|
||||
TLaw = EvolAroundT;
|
||||
//OCC78
|
||||
Standard_Integer iEnd = SeqPoles.Length();
|
||||
HArrPoles = new TColStd_HArray1OfReal(1, iEnd);
|
||||
HArrAngle = new TColStd_HArray1OfReal(1, iEnd);
|
||||
HArrTangent = new TColgp_HArray1OfVec(1, iEnd);
|
||||
HArrNormal = new TColgp_HArray1OfVec(1, iEnd);
|
||||
for(i = 1; i <= iEnd; i++){
|
||||
HArrPoles->ChangeValue(i) = SeqPoles(i);
|
||||
HArrAngle->ChangeValue(i) = SeqAngle(i);
|
||||
HArrTangent->ChangeValue(i) = SeqTangent(i);
|
||||
HArrNormal->ChangeValue(i) = SeqNormal(i);
|
||||
};
|
||||
if (iEnd != 0)
|
||||
{
|
||||
HArrPoles = new TColStd_HArray1OfReal(1, iEnd);
|
||||
HArrAngle = new TColStd_HArray1OfReal(1, iEnd);
|
||||
HArrTangent = new TColgp_HArray1OfVec(1, iEnd);
|
||||
HArrNormal = new TColgp_HArray1OfVec(1, iEnd);
|
||||
for (i = 1; i <= iEnd; i++) {
|
||||
HArrPoles->ChangeValue(i) = SeqPoles(i);
|
||||
HArrAngle->ChangeValue(i) = SeqAngle(i);
|
||||
HArrTangent->ChangeValue(i) = SeqTangent(i);
|
||||
HArrNormal->ChangeValue(i) = SeqNormal(i);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#ifdef DRAW
|
||||
if (Affich) {
|
||||
@@ -612,7 +618,7 @@ Standard_Real GeomFill_CorrectedFrenet::CalcAngleAT(const gp_Vec& Tangent, const
|
||||
Standard_Real angle;
|
||||
gp_Vec Normal_rot, cross;
|
||||
angle = Tangent.Angle(prevTangent);
|
||||
if (Abs(angle) > Precision::Angular()) {
|
||||
if (Abs(angle) > Precision::Angular() && Abs(angle) < M_PI - Precision::Angular()) {
|
||||
cross = Tangent.Crossed(prevTangent).Normalized();
|
||||
Normal_rot = Normal + sin(angle)*cross.Crossed(Normal) +
|
||||
(1 - cos(angle))*cross.Crossed(cross.Crossed(Normal));
|
||||
|
@@ -52,7 +52,9 @@ public:
|
||||
|
||||
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! initialize curve of frenet law
|
||||
//! @return Standard_True in case if execution end correctly
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void SetInterval (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE;
|
||||
|
||||
|
@@ -63,11 +63,11 @@ Handle(GeomFill_LocationLaw) GeomFill_CurveAndTrihedron::Copy() const
|
||||
//Function: SetCurve
|
||||
//Purpose :
|
||||
//==================================================================
|
||||
void GeomFill_CurveAndTrihedron::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_CurveAndTrihedron::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
myCurve = C;
|
||||
myTrimmed = C;
|
||||
myLaw->SetCurve(C);
|
||||
return myLaw->SetCurve(C);
|
||||
}
|
||||
|
||||
const Handle(Adaptor3d_Curve)& GeomFill_CurveAndTrihedron::GetCurve() const
|
||||
|
@@ -52,7 +52,9 @@ public:
|
||||
|
||||
Standard_EXPORT GeomFill_CurveAndTrihedron(const Handle(GeomFill_TrihedronLaw)& Trihedron);
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! initialize curve of trihedron law
|
||||
//! @return Standard_True in case if execution end correctly
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual const Handle(Adaptor3d_Curve)& GetCurve() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -61,33 +61,36 @@ Handle(GeomFill_TrihedronLaw) GeomFill_DiscreteTrihedron::Copy() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GeomFill_DiscreteTrihedron::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_DiscreteTrihedron::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
GeomFill_TrihedronLaw::SetCurve(C);
|
||||
if (! C.IsNull()) {
|
||||
if (! C.IsNull())
|
||||
{
|
||||
GeomAbs_CurveType type;
|
||||
type = C->GetType();
|
||||
switch (type) {
|
||||
switch (type)
|
||||
{
|
||||
case GeomAbs_Circle:
|
||||
case GeomAbs_Ellipse:
|
||||
case GeomAbs_Hyperbola:
|
||||
case GeomAbs_Parabola:
|
||||
case GeomAbs_Line:
|
||||
{
|
||||
// No problem
|
||||
myUseFrenet = Standard_True;
|
||||
myFrenet->SetCurve(C);
|
||||
break;
|
||||
}
|
||||
{
|
||||
// No problem
|
||||
myUseFrenet = Standard_True;
|
||||
myFrenet->SetCurve(C);
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
myUseFrenet = Standard_False;
|
||||
// We have to fill <myKnots> and <myTrihedrons>
|
||||
Init();
|
||||
break;
|
||||
}
|
||||
{
|
||||
myUseFrenet = Standard_False;
|
||||
// We have to fill <myKnots> and <myTrihedrons>
|
||||
Init();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return myUseFrenet;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -51,7 +51,9 @@ public:
|
||||
|
||||
Standard_EXPORT void Init();
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! initialize curve of trihedron law
|
||||
//! @return Standard_True in case if execution end correctly
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
//! compute Trihedron on curve at parameter <Param>
|
||||
Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, gp_Vec& Tangent, gp_Vec& Normal, gp_Vec& BiNormal) Standard_OVERRIDE;
|
||||
|
@@ -117,7 +117,7 @@ Handle(GeomFill_TrihedronLaw) GeomFill_Frenet::Copy() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GeomFill_Frenet::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_Frenet::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
GeomFill_TrihedronLaw::SetCurve(C);
|
||||
if (! C.IsNull()) {
|
||||
@@ -141,6 +141,7 @@ Handle(GeomFill_TrihedronLaw) GeomFill_Frenet::Copy() const
|
||||
}
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -47,7 +47,9 @@ public:
|
||||
|
||||
Standard_EXPORT void Init();
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! initialize curve of frenet law
|
||||
//! @return Standard_True
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
//! compute Triedrhon on curve at parameter <Param>
|
||||
Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, gp_Vec& Tangent, gp_Vec& Normal, gp_Vec& BiNormal) Standard_OVERRIDE;
|
||||
|
@@ -292,7 +292,7 @@ GeomFill_GuideTrihedronAC::GeomFill_GuideTrihedronAC(const Handle(Adaptor3d_Curv
|
||||
//function : SetCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GeomFill_GuideTrihedronAC::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_GuideTrihedronAC::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
myCurve = C;
|
||||
myTrimmed = C;
|
||||
@@ -301,6 +301,7 @@ GeomFill_GuideTrihedronAC::GeomFill_GuideTrihedronAC(const Handle(Adaptor3d_Curv
|
||||
L = myCurveAC->GetLength();
|
||||
// CorrectOrient(myGuide);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -44,7 +44,9 @@ public:
|
||||
|
||||
Standard_EXPORT GeomFill_GuideTrihedronAC(const Handle(Adaptor3d_Curve)& guide);
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! initialize curve of trihedron law
|
||||
//! @return Standard_True
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -197,10 +197,11 @@ GeomFill_GuideTrihedronPlan::GeomFill_GuideTrihedronPlan (const Handle(Adaptor3d
|
||||
//function : SetCurve
|
||||
//purpose : calculation of trihedron
|
||||
//=======================================================================
|
||||
void GeomFill_GuideTrihedronPlan::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_GuideTrihedronPlan::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
myCurve = C;
|
||||
if (!myCurve.IsNull()) Init();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -48,7 +48,9 @@ public:
|
||||
|
||||
Standard_EXPORT GeomFill_GuideTrihedronPlan(const Handle(Adaptor3d_Curve)& theGuide);
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& thePath) Standard_OVERRIDE;
|
||||
//! initialize curve of trihedron law
|
||||
//! @return Standard_True in case if execution end correctly
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& thePath) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -105,13 +105,14 @@ GeomFill_LocationDraft::GeomFill_LocationDraft
|
||||
//Purpose : Calcul des poles sur la surfaces d'arret (intersection
|
||||
// entre la generatrice et la surface en myNbPts points de la section)
|
||||
//==================================================================
|
||||
void GeomFill_LocationDraft::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_LocationDraft::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
myCurve = C;
|
||||
myTrimmed = C;
|
||||
myLaw->SetCurve(C);
|
||||
Standard_Boolean isOK = myLaw->SetCurve(C);
|
||||
|
||||
Prepare();
|
||||
return isOK;
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
|
@@ -46,7 +46,9 @@ public:
|
||||
|
||||
Standard_EXPORT void SetAngle (const Standard_Real Angle);
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! calculation of poles on locking surfaces (the intersection between the generatrixand the surface at the cross - section points myNbPts)
|
||||
//! @return Standard_True in case if execution end correctly
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual const Handle(Adaptor3d_Curve)& GetCurve() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -537,7 +537,7 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
//Purpose : Calcul des poles sur la surface d'arret (intersection
|
||||
// courbe guide / surface de revolution en myNbPts points)
|
||||
//==================================================================
|
||||
void GeomFill_LocationGuide::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_LocationGuide::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
Standard_Real LastAngle;
|
||||
myCurve = C;
|
||||
@@ -550,6 +550,7 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
|
||||
if (rotation) SetRotation(myPoles2d->Value(1,1).X(), LastAngle);
|
||||
}
|
||||
return myStatus == GeomFill_PipeOk;
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
|
@@ -56,7 +56,9 @@ public:
|
||||
|
||||
Standard_EXPORT void EraseRotation();
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! calculating poles on a surface (courbe guide / the surface of rotation in points myNbPts)
|
||||
//! @return Standard_True
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual const Handle(Adaptor3d_Curve)& GetCurve() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -38,9 +38,8 @@ class GeomFill_LocationLaw : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) = 0;
|
||||
//! initialize curve of location law
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) = 0;
|
||||
|
||||
Standard_EXPORT virtual const Handle(Adaptor3d_Curve)& GetCurve() const = 0;
|
||||
|
||||
|
@@ -205,7 +205,7 @@ static Standard_Boolean CheckSense(const TColGeom_SequenceOfCurve& Seq1,
|
||||
//purpose : constructor with no parameters.
|
||||
//=======================================================================
|
||||
|
||||
GeomFill_Pipe::GeomFill_Pipe() : myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
GeomFill_Pipe::GeomFill_Pipe() : myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
@@ -218,7 +218,7 @@ GeomFill_Pipe::GeomFill_Pipe() : myIsDone(Standard_False),myExchUV(Standard_Fals
|
||||
|
||||
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const Standard_Real Radius)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Init(Path, Radius);
|
||||
@@ -232,7 +232,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const Handle(Geom_Curve)& FirstSect,
|
||||
const GeomFill_Trihedron Option)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Init(Path, FirstSect, Option);
|
||||
@@ -246,7 +246,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom2d_Curve)& Path,
|
||||
const Handle(Geom_Surface)& Support,
|
||||
const Handle(Geom_Curve)& FirstSect)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Init(Path, Support, FirstSect);
|
||||
@@ -260,7 +260,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom2d_Curve)& Path,
|
||||
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const Handle(Geom_Curve)& FirstSect,
|
||||
const Handle(Geom_Curve)& LastSect)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Init(Path, FirstSect, LastSect);
|
||||
@@ -274,7 +274,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
|
||||
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const TColGeom_SequenceOfCurve& NSections)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Init(Path, NSections);
|
||||
@@ -288,7 +288,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const Handle(Geom_Curve)& Curve1,
|
||||
const gp_Dir& Direction)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False), myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False), myKPart(Standard_False)
|
||||
{
|
||||
Init(Path, Curve1, Direction);
|
||||
}
|
||||
@@ -301,7 +301,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const Handle(Geom_Curve)& Curve1,
|
||||
const Handle(Geom_Curve)& Curve2,
|
||||
const Standard_Real Radius)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Handle(GeomAdaptor_Curve) AdpPath =
|
||||
@@ -324,7 +324,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Adaptor3d_Curve)& Path,
|
||||
const Handle(Adaptor3d_Curve)& Curve1,
|
||||
const Handle(Adaptor3d_Curve)& Curve2,
|
||||
const Standard_Real Radius)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Init(Path,Curve1,Curve2,Radius);
|
||||
@@ -344,7 +344,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const Handle(Geom_Curve)& FirstSect,
|
||||
const Standard_Boolean byACR,
|
||||
const Standard_Boolean rotat)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
// Path : trajectoire
|
||||
// Guide : courbe guide
|
||||
// FirstSect : section
|
||||
@@ -751,31 +751,37 @@ void GeomFill_Pipe::Init(const Handle(Geom_Curve)& Path,
|
||||
|
||||
if (!TLaw.IsNull()) {
|
||||
myLoc = new (GeomFill_CurveAndTrihedron) (TLaw);
|
||||
myLoc->SetCurve(myAdpPath);
|
||||
TColGeom_SequenceOfCurve SeqC;
|
||||
TColStd_SequenceOfReal SeqP;
|
||||
SeqC.Clear();
|
||||
SeqP.Clear();
|
||||
// sequence des sections
|
||||
GeomFill_SectionPlacement Pl1(myLoc, FirstSect);
|
||||
Pl1.Perform(first,Precision::Confusion());
|
||||
SeqC.Append(Pl1.Section(Standard_False));
|
||||
GeomFill_SectionPlacement Pl2(myLoc, LastSect);
|
||||
Pl2.Perform(first,Precision::Confusion());
|
||||
SeqC.Append(Pl2.Section(Standard_False));
|
||||
// sequence des parametres associes
|
||||
SeqP.Append(first);
|
||||
SeqP.Append(last);
|
||||
|
||||
// verification de l'orientation
|
||||
TColGeom_SequenceOfCurve NewSeq;
|
||||
if (CheckSense(SeqC,NewSeq)) SeqC = NewSeq;
|
||||
if (!(myLoc->SetCurve(myAdpPath)))
|
||||
{
|
||||
myStatus = GeomFill_ImpossibleContact;
|
||||
return;
|
||||
}
|
||||
|
||||
// creation de la NSections
|
||||
Standard_Real deb,fin;
|
||||
deb = SeqC.First()->FirstParameter();
|
||||
fin = SeqC.First()->LastParameter();
|
||||
mySec = new (GeomFill_NSections) (SeqC,SeqP,deb,fin,first,last);
|
||||
TColGeom_SequenceOfCurve SeqC;
|
||||
TColStd_SequenceOfReal SeqP;
|
||||
SeqC.Clear();
|
||||
SeqP.Clear();
|
||||
// sequence of sections
|
||||
GeomFill_SectionPlacement Pl1(myLoc, FirstSect);
|
||||
Pl1.Perform(first, Precision::Confusion());
|
||||
SeqC.Append(Pl1.Section(Standard_False));
|
||||
GeomFill_SectionPlacement Pl2(myLoc, LastSect);
|
||||
Pl2.Perform(first, Precision::Confusion());
|
||||
SeqC.Append(Pl2.Section(Standard_False));
|
||||
// sequence of associated parameters
|
||||
SeqP.Append(first);
|
||||
SeqP.Append(last);
|
||||
|
||||
// orientation verification
|
||||
TColGeom_SequenceOfCurve NewSeq;
|
||||
if (CheckSense(SeqC, NewSeq)) SeqC = NewSeq;
|
||||
|
||||
// creation of the NSections
|
||||
Standard_Real deb, fin;
|
||||
deb = SeqC.First()->FirstParameter();
|
||||
fin = SeqC.First()->LastParameter();
|
||||
mySec = new (GeomFill_NSections) (SeqC, SeqP, deb, fin, first, last);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,6 +837,11 @@ void GeomFill_Pipe::Perform(const Standard_Real Tol,
|
||||
const Standard_Integer DegMax,
|
||||
const Standard_Integer NbMaxSegment)
|
||||
{
|
||||
if (myStatus == GeomFill_ImpossibleContact)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GeomAbs_Shape TheConti;
|
||||
switch (Conti) {
|
||||
case GeomAbs_C0:
|
||||
@@ -884,7 +895,7 @@ void GeomFill_Pipe::Perform(const Standard_Real Tol,
|
||||
App.UDegree(),
|
||||
App.VDegree());
|
||||
myError = App.MaxErrorOnSurf();
|
||||
myIsDone = Standard_True;
|
||||
myStatus = GeomFill_PipeOk;
|
||||
}
|
||||
//else {
|
||||
// throw Standard_ConstructionError("GeomFill_Pipe::Perform : Cannot make a surface");
|
||||
@@ -898,7 +909,7 @@ void GeomFill_Pipe::Perform(const Standard_Real Tol,
|
||||
if (Sweep.IsDone()) {
|
||||
mySurface = Sweep.Surface();
|
||||
myError = Sweep.ErrorOnSurface();
|
||||
myIsDone = Standard_True;
|
||||
myStatus = GeomFill_PipeOk;
|
||||
}
|
||||
//else {
|
||||
// throw Standard_ConstructionError("GeomFill_Pipe::Perform : Cannot make a surface");
|
||||
@@ -975,7 +986,7 @@ Standard_Boolean GeomFill_Pipe::KPartT4()
|
||||
myAdpPath->FirstParameter(),
|
||||
myAdpPath->LastParameter());
|
||||
Ok = Standard_True; //C'est bien un cylindre
|
||||
myIsDone = Standard_True;
|
||||
myStatus = GeomFill_PipeOk;
|
||||
}
|
||||
// ----------- Cas du tore ----------------------------------
|
||||
else if (myAdpPath->GetType() == GeomAbs_Circle &&
|
||||
@@ -1038,7 +1049,7 @@ Standard_Boolean GeomFill_Pipe::KPartT4()
|
||||
myAdpPath->FirstParameter(),myAdpPath->LastParameter(),VV1,VV2);
|
||||
myExchUV = Standard_True;
|
||||
Ok = Standard_True;
|
||||
myIsDone = Standard_True;
|
||||
myStatus = GeomFill_PipeOk;
|
||||
}
|
||||
|
||||
return Ok;
|
||||
@@ -1137,6 +1148,6 @@ void GeomFill_Pipe::ApproxSurf(const Standard_Boolean WithParameters) {
|
||||
App.VDegree());
|
||||
Standard_Real t2d;
|
||||
App.TolReached(myError, t2d);
|
||||
myIsDone = Standard_True;
|
||||
myStatus = GeomFill_PipeOk;
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <GeomFill_Trihedron.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <TColGeom_SequenceOfCurve.hxx>
|
||||
#include <GeomFill_PipeError.hxx>
|
||||
|
||||
class Geom_Surface;
|
||||
class GeomFill_LocationLaw;
|
||||
@@ -249,7 +250,11 @@ public:
|
||||
//! Returns whether approximation was done.
|
||||
Standard_Boolean IsDone() const;
|
||||
|
||||
|
||||
//! Returns execution status
|
||||
GeomFill_PipeError GetStatus() const
|
||||
{
|
||||
return myStatus;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -271,8 +276,7 @@ private:
|
||||
|
||||
Standard_EXPORT Standard_Boolean KPartT4();
|
||||
|
||||
|
||||
Standard_Boolean myIsDone;
|
||||
GeomFill_PipeError myStatus;//!< Execution status
|
||||
Standard_Real myRadius;
|
||||
Standard_Real myError;
|
||||
Handle(Adaptor3d_Curve) myAdpPath;
|
||||
@@ -285,8 +289,6 @@ private:
|
||||
Standard_Boolean myExchUV;
|
||||
Standard_Boolean myKPart;
|
||||
Standard_Boolean myPolynomial;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@@ -70,6 +70,5 @@ inline Standard_Real GeomFill_Pipe::ErrorOnSurf() const
|
||||
//=======================================================================
|
||||
inline Standard_Boolean GeomFill_Pipe::IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
return myStatus == GeomFill_PipeOk;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -24,10 +24,11 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(GeomFill_TrihedronLaw,Standard_Transient)
|
||||
|
||||
void GeomFill_TrihedronLaw::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_TrihedronLaw::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
myCurve = C;
|
||||
myTrimmed = myCurve;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
|
@@ -34,8 +34,9 @@ class GeomFill_TrihedronLaw : public Standard_Transient
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C);
|
||||
//! initialize curve of trihedron law
|
||||
//! @return Standard_True
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const = 0;
|
||||
|
||||
|
@@ -77,38 +77,78 @@ void GeomInt_IntSS::Perform(const Handle(Geom_Surface)& S1,
|
||||
myTolReached2d = myTolReached3d = 0.0;
|
||||
myNbrestr = 0;
|
||||
sline.Clear();
|
||||
Handle(Adaptor3d_TopolTool) dom1 = new Adaptor3d_TopolTool(myHS1);
|
||||
Handle(Adaptor3d_TopolTool) dom2 = new Adaptor3d_TopolTool(myHS2);
|
||||
myLConstruct.Load(dom1,dom2,myHS1,myHS2);
|
||||
|
||||
Standard_Real TolArc = Tol;
|
||||
Standard_Real TolTang = Tol;
|
||||
Standard_Real UVMaxStep = IntPatch_Intersection::DefineUVMaxStep(myHS1, dom1, myHS2, dom2);
|
||||
Standard_Real Deflection = 0.1;
|
||||
if (myHS1->GetType() == GeomAbs_BSplineSurface && myHS2->GetType() == GeomAbs_BSplineSurface)
|
||||
{
|
||||
Deflection /= 10.;
|
||||
}
|
||||
|
||||
Handle(Adaptor3d_TopolTool) dom1 = new Adaptor3d_TopolTool (myHS1);
|
||||
Handle(Adaptor3d_TopolTool) dom2 = new Adaptor3d_TopolTool (myHS2);
|
||||
|
||||
myIntersector.SetTolerances(TolArc,TolTang,UVMaxStep,Deflection);
|
||||
NCollection_Vector< Handle(Adaptor3d_Surface)> aVecHS1;
|
||||
NCollection_Vector< Handle(Adaptor3d_Surface)> aVecHS2;
|
||||
|
||||
if(myHS1 == myHS2) {
|
||||
myIntersector.Perform(myHS1,dom1,TolArc,TolTang);
|
||||
if (myHS1 == myHS2)
|
||||
{
|
||||
aVecHS1.Append (myHS1);
|
||||
aVecHS2.Append (myHS2);
|
||||
}
|
||||
else if (!useStart) {
|
||||
myIntersector.Perform(myHS1,dom1,myHS2,dom2,TolArc,TolTang);
|
||||
}
|
||||
else {
|
||||
myIntersector.Perform(myHS1,dom1,myHS2,dom2,U1,V1,U2,V2,TolArc,TolTang);
|
||||
else
|
||||
{
|
||||
myIntersector.PrepareSurfaces (myHS1, dom1, myHS2, dom2, Tol, aVecHS1, aVecHS2);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
if (myIntersector.IsDone()) {
|
||||
const Standard_Integer nblin = myIntersector.NbLines();
|
||||
for (Standard_Integer i=1; i<= nblin; i++)
|
||||
for (Standard_Integer aNumOfHS1 = 0; aNumOfHS1 < aVecHS1.Length(); aNumOfHS1++)
|
||||
{
|
||||
const Handle(Adaptor3d_Surface)& aHS1 = aVecHS1.Value (aNumOfHS1);
|
||||
|
||||
for (Standard_Integer aNumOfHS2 = 0; aNumOfHS2 < aVecHS2.Length(); aNumOfHS2++)
|
||||
{
|
||||
MakeCurve(i,dom1,dom2,Tol,Approx,ApproxS1,ApproxS2);
|
||||
const Handle(Adaptor3d_Surface)& aHS2 = aVecHS2.Value (aNumOfHS2);
|
||||
|
||||
Handle(Adaptor3d_TopolTool) aDom1 = new Adaptor3d_TopolTool (aHS1);
|
||||
Handle(Adaptor3d_TopolTool) aDom2 = new Adaptor3d_TopolTool (aHS2);
|
||||
|
||||
myLConstruct.Load (aDom1 ,aDom2,
|
||||
Handle(GeomAdaptor_Surface)::DownCast (aHS1),
|
||||
Handle(GeomAdaptor_Surface)::DownCast (aHS2));
|
||||
|
||||
Standard_Real UVMaxStep = IntPatch_Intersection::DefineUVMaxStep (aHS1, aDom1, aHS2, aDom2);
|
||||
|
||||
myIntersector.SetTolerances (TolArc, TolTang, UVMaxStep, Deflection);
|
||||
|
||||
if (aHS1 == aHS2)
|
||||
{
|
||||
myIntersector.Perform (aHS1, aDom1, TolArc, TolTang);
|
||||
}
|
||||
else if (!useStart)
|
||||
{
|
||||
myIntersector.Perform (aHS1, aDom1, aHS2, aDom2, TolArc, TolTang);
|
||||
}
|
||||
else
|
||||
{
|
||||
TopAbs_State aState1 = aDom1->Classify (gp_Pnt2d (U1, V1), Tol);
|
||||
TopAbs_State aState2 = aDom2->Classify (gp_Pnt2d (U2, V2), Tol);
|
||||
|
||||
if ((aState1 == TopAbs_IN || aState1 == TopAbs_ON) &&
|
||||
(aState2 == TopAbs_IN || aState2 == TopAbs_ON))
|
||||
{
|
||||
myIntersector.Perform (aHS1, aDom1, aHS2, aDom2, U1, V1, U2, V2, TolArc, TolTang);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
if (myIntersector.IsDone()) {
|
||||
const Standard_Integer nblin = myIntersector.NbLines();
|
||||
for (Standard_Integer i = 1; i <= nblin; i++)
|
||||
{
|
||||
MakeCurve (i, aDom1, aDom2, Tol, Approx, ApproxS1, ApproxS2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -237,8 +237,8 @@ static Standard_Integer tuyau (Draw_Interpretor& di,
|
||||
|
||||
Pipe.Perform(1.e-4, Standard_False, Cont);
|
||||
if (!Pipe.IsDone()) {
|
||||
di << "GeomFill_Pipe cannot make a surface\n";
|
||||
return 1;
|
||||
di << "Error: GeomFill_Pipe cannot make a surface\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Real Accuracy = Pipe.ErrorOnSurf();
|
||||
|
@@ -941,6 +941,36 @@ static Standard_Integer value (Draw_Interpretor& ,
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : derivative
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer derivative(Draw_Interpretor&,
|
||||
Standard_Integer theArgc,
|
||||
const char** theArgv)
|
||||
{
|
||||
if (theArgc != 9)
|
||||
return 1;
|
||||
|
||||
Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(theArgv[1]);
|
||||
if (aSurf.IsNull())
|
||||
return 1;
|
||||
|
||||
Standard_Real aU = Draw::Atof(theArgv[2]);
|
||||
Standard_Real aV = Draw::Atof(theArgv[3]);
|
||||
Standard_Integer aNu = Draw::Atoi(theArgv[4]);
|
||||
Standard_Integer aNv = Draw::Atoi(theArgv[5]);
|
||||
|
||||
gp_Vec aDeriv = aSurf->DN(aU, aV, aNu, aNv);
|
||||
|
||||
Draw::Set(theArgv[6], aDeriv.X());
|
||||
Draw::Set(theArgv[7], aDeriv.Y());
|
||||
Draw::Set(theArgv[8], aDeriv.Z());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : movepole
|
||||
//purpose :
|
||||
@@ -1851,6 +1881,15 @@ void GeomliteTest::SurfaceCommands(Draw_Interpretor& theCommands)
|
||||
__FILE__,
|
||||
value,g);
|
||||
|
||||
theCommands.Add("sderivative",
|
||||
"sderivative surfname U V NU NV X Y Z\n"
|
||||
" surfname : name of surface\n"
|
||||
" U V : coordinates on probe point on surface\n"
|
||||
" NU NV : order of derivative along U and V\n"
|
||||
" X Y Z : output coordinates of the derivative",
|
||||
__FILE__,
|
||||
derivative, g);
|
||||
|
||||
theCommands.Add("parameters",
|
||||
"parameters surf/curve X Y [Z] Tol U [V] : {X Y Z} point, {U V} output parameter(s)",
|
||||
__FILE__,
|
||||
|
@@ -216,9 +216,9 @@ Handle(Image_PixMap) Graphic3d_TextureRoot::GetImage (const Handle(Image_Support
|
||||
void Graphic3d_TextureRoot::convertToCompatible (const Handle(Image_SupportedFormats)& theSupported,
|
||||
const Handle(Image_PixMap)& theImage)
|
||||
{
|
||||
if (theSupported.IsNull()
|
||||
|| theSupported->IsSupported (theImage->Format())
|
||||
|| theImage.IsNull())
|
||||
if (theImage.IsNull()
|
||||
|| theSupported.IsNull()
|
||||
|| theSupported->IsSupported (theImage->Format()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -3,4 +3,3 @@ IntCurvesFace_Intersector.hxx
|
||||
IntCurvesFace_Intersector.lxx
|
||||
IntCurvesFace_ShapeIntersector.cxx
|
||||
IntCurvesFace_ShapeIntersector.hxx
|
||||
IntCurvesFace_ShapeIntersector.lxx
|
||||
|
@@ -43,6 +43,9 @@
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IntCurvesFace_Intersector, Standard_Transient)
|
||||
|
||||
//
|
||||
static void ComputeSamplePars(const Handle(Adaptor3d_Surface)& Hsurface,
|
||||
const Standard_Integer nbsu,
|
||||
@@ -134,8 +137,6 @@ IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face,
|
||||
done(Standard_False),
|
||||
myReady(Standard_False),
|
||||
nbpnt(0),
|
||||
PtrOnPolyhedron(NULL),
|
||||
PtrOnBndBounding(NULL),
|
||||
myUseBoundTol (UseBToler),
|
||||
myIsParallel(Standard_False)
|
||||
{
|
||||
@@ -201,14 +202,12 @@ IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face,
|
||||
{
|
||||
Handle(TColStd_HArray1OfReal) UPars, VPars;
|
||||
ComputeSamplePars(Hsurface, nbsu, nbsv, UPars, VPars);
|
||||
PtrOnPolyhedron = (IntCurveSurface_ThePolyhedronOfHInter *)
|
||||
new IntCurveSurface_ThePolyhedronOfHInter(Hsurface, UPars->ChangeArray1(),
|
||||
VPars->ChangeArray1());
|
||||
myPolyhedron.reset(new IntCurveSurface_ThePolyhedronOfHInter(Hsurface, UPars->ChangeArray1(),
|
||||
VPars->ChangeArray1()));
|
||||
}
|
||||
else
|
||||
{
|
||||
PtrOnPolyhedron = (IntCurveSurface_ThePolyhedronOfHInter *)
|
||||
new IntCurveSurface_ThePolyhedronOfHInter(Hsurface,nbsu,nbsv,U0,V0,U1,V1);
|
||||
myPolyhedron.reset(new IntCurveSurface_ThePolyhedronOfHInter(Hsurface,nbsu,nbsv,U0,V0,U1,V1));
|
||||
}
|
||||
}
|
||||
myReady = Standard_True;
|
||||
@@ -218,8 +217,8 @@ IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntCurvesFace_Intersector::InternalCall(const IntCurveSurface_HInter &HICS,
|
||||
const Standard_Real parinf,
|
||||
const Standard_Real parsup)
|
||||
const Standard_Real parinf,
|
||||
const Standard_Real parsup)
|
||||
{
|
||||
if(HICS.IsDone() && HICS.NbPoints() > 0) {
|
||||
//Calculate tolerance for 2d classifier
|
||||
@@ -282,7 +281,6 @@ void IntCurvesFace_Intersector::InternalCall(const IntCurveSurface_HInter &HICS,
|
||||
Standard_Real W = HICSW;
|
||||
IntCurveSurface_TransitionOnCurve transition = HICSPointindex.Transition();
|
||||
gp_Pnt pnt = HICSPointindex.Pnt();
|
||||
// state = currentstate;
|
||||
// Modified by skv - Wed Sep 3 16:14:10 2003 OCC578 Begin
|
||||
Standard_Integer anIntState = (currentstate == TopAbs_IN) ? 0 : 1;
|
||||
// Modified by skv - Wed Sep 3 16:14:11 2003 OCC578 End
|
||||
@@ -340,8 +338,8 @@ void IntCurvesFace_Intersector::InternalCall(const IntCurveSurface_HInter &HICS,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntCurvesFace_Intersector::Perform(const gp_Lin& L,
|
||||
const Standard_Real ParMin,
|
||||
const Standard_Real ParMax)
|
||||
const Standard_Real ParMin,
|
||||
const Standard_Real ParMax)
|
||||
{
|
||||
done = Standard_False;
|
||||
if (!myReady)
|
||||
@@ -360,7 +358,7 @@ void IntCurvesFace_Intersector::Perform(const gp_Lin& L,
|
||||
Standard_Real parinf=ParMin;
|
||||
Standard_Real parsup=ParMax;
|
||||
//
|
||||
if(PtrOnPolyhedron == NULL) {
|
||||
if(!myPolyhedron) {
|
||||
HICS.Perform(HLL,Hsurface);
|
||||
}
|
||||
else {
|
||||
@@ -368,7 +366,7 @@ void IntCurvesFace_Intersector::Perform(const gp_Lin& L,
|
||||
Bnd_Box boxLine;
|
||||
bndTool.LinBox
|
||||
(L,
|
||||
((IntCurveSurface_ThePolyhedronOfHInter *)PtrOnPolyhedron)->Bounding(),
|
||||
myPolyhedron->Bounding(),
|
||||
boxLine);
|
||||
if(bndTool.NbSegments() == 0)
|
||||
return;
|
||||
@@ -381,8 +379,8 @@ void IntCurvesFace_Intersector::Perform(const gp_Lin& L,
|
||||
if((psup - pinf)<1e-10) { pinf-=1e-10; psup+=1e-10; }
|
||||
if(nbseg==1) { parinf=pinf; parsup=psup; }
|
||||
else {
|
||||
if(parinf>pinf) parinf = pinf;
|
||||
if(parsup<psup) parsup = psup;
|
||||
if(parinf>pinf) parinf = pinf;
|
||||
if(parsup<psup) parsup = psup;
|
||||
}
|
||||
}
|
||||
if(parinf>ParMax) { return; }
|
||||
@@ -391,28 +389,26 @@ void IntCurvesFace_Intersector::Perform(const gp_Lin& L,
|
||||
if(parsup>ParMax) parsup=ParMax;
|
||||
if(parinf>(parsup-1e-9)) return;
|
||||
IntCurveSurface_ThePolygonOfHInter polygon(HLL,
|
||||
parinf,
|
||||
parsup,
|
||||
2);
|
||||
parinf,
|
||||
parsup,
|
||||
2);
|
||||
#if OPTIMISATION
|
||||
if(PtrOnBndBounding==NULL) {
|
||||
PtrOnBndBounding = (Bnd_BoundSortBox *) new Bnd_BoundSortBox();
|
||||
IntCurveSurface_ThePolyhedronOfHInter *thePolyh=
|
||||
(IntCurveSurface_ThePolyhedronOfHInter *)PtrOnPolyhedron;
|
||||
((Bnd_BoundSortBox *)(PtrOnBndBounding))->
|
||||
Initialize(IntCurveSurface_ThePolyhedronToolOfHInter::Bounding(*thePolyh),
|
||||
IntCurveSurface_ThePolyhedronToolOfHInter::ComponentsBounding(*thePolyh));
|
||||
if(!myBndBounding)
|
||||
{
|
||||
myBndBounding.reset(new Bnd_BoundSortBox());
|
||||
myBndBounding->Initialize(IntCurveSurface_ThePolyhedronToolOfHInter::Bounding(*myPolyhedron),
|
||||
IntCurveSurface_ThePolyhedronToolOfHInter::ComponentsBounding(*myPolyhedron));
|
||||
}
|
||||
HICS.Perform(HLL,
|
||||
polygon,
|
||||
Hsurface,
|
||||
*((IntCurveSurface_ThePolyhedronOfHInter *)PtrOnPolyhedron),
|
||||
*((Bnd_BoundSortBox *)PtrOnBndBounding));
|
||||
polygon,
|
||||
Hsurface,
|
||||
*myPolyhedron,
|
||||
*myBndBounding);
|
||||
#else
|
||||
HICS.Perform(HLL,
|
||||
polygon,
|
||||
Hsurface,
|
||||
*((IntCurveSurface_ThePolyhedronOfHInter *)PtrOnPolyhedron));
|
||||
polygon,
|
||||
Hsurface,
|
||||
*myPolyhedron);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -423,8 +419,8 @@ void IntCurvesFace_Intersector::Perform(const gp_Lin& L,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntCurvesFace_Intersector::Perform(const Handle(Adaptor3d_Curve)& HCu,
|
||||
const Standard_Real ParMin,
|
||||
const Standard_Real ParMax)
|
||||
const Standard_Real ParMin,
|
||||
const Standard_Real ParMax)
|
||||
{
|
||||
done = Standard_False;
|
||||
if (!myReady)
|
||||
@@ -443,10 +439,12 @@ void IntCurvesFace_Intersector::Perform(const Handle(Adaptor3d_Curve)& HCu,
|
||||
Standard_Real parinf=ParMin;
|
||||
Standard_Real parsup=ParMax;
|
||||
|
||||
if(PtrOnPolyhedron == NULL) {
|
||||
if(!myPolyhedron)
|
||||
{
|
||||
HICS.Perform(HCu,Hsurface);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
parinf = IntCurveSurface_TheHCurveTool::FirstParameter(HCu);
|
||||
parsup = IntCurveSurface_TheHCurveTool::LastParameter(HCu);
|
||||
if(parinf<ParMin) parinf = ParMin;
|
||||
@@ -456,26 +454,25 @@ void IntCurvesFace_Intersector::Perform(const Handle(Adaptor3d_Curve)& HCu,
|
||||
nbs = IntCurveSurface_TheHCurveTool::NbSamples(HCu,parinf,parsup);
|
||||
|
||||
IntCurveSurface_ThePolygonOfHInter polygon(HCu,
|
||||
parinf,
|
||||
parsup,
|
||||
nbs);
|
||||
parinf,
|
||||
parsup,
|
||||
nbs);
|
||||
#if OPTIMISATION
|
||||
if(PtrOnBndBounding==NULL) {
|
||||
PtrOnBndBounding = (Bnd_BoundSortBox *) new Bnd_BoundSortBox();
|
||||
IntCurveSurface_ThePolyhedronOfHInter *thePolyh=(IntCurveSurface_ThePolyhedronOfHInter *)PtrOnPolyhedron;
|
||||
((Bnd_BoundSortBox *)(PtrOnBndBounding))->Initialize(IntCurveSurface_ThePolyhedronToolOfHInter::Bounding(*thePolyh),
|
||||
IntCurveSurface_ThePolyhedronToolOfHInter::ComponentsBounding(*thePolyh));
|
||||
if(!myBndBounding) {
|
||||
myBndBounding.reset(new Bnd_BoundSortBox());
|
||||
myBndBounding->Initialize(IntCurveSurface_ThePolyhedronToolOfHInter::Bounding(*myPolyhedron),
|
||||
IntCurveSurface_ThePolyhedronToolOfHInter::ComponentsBounding(*myPolyhedron));
|
||||
}
|
||||
HICS.Perform(HCu,
|
||||
polygon,
|
||||
Hsurface,
|
||||
*((IntCurveSurface_ThePolyhedronOfHInter *)PtrOnPolyhedron),
|
||||
*((Bnd_BoundSortBox *)PtrOnBndBounding));
|
||||
polygon,
|
||||
Hsurface,
|
||||
*myPolyhedron,
|
||||
*myBndBounding);
|
||||
#else
|
||||
HICS.Perform(HCu,
|
||||
polygon,
|
||||
Hsurface,
|
||||
*((IntCurveSurface_ThePolyhedronOfHInter *)PtrOnPolyhedron));
|
||||
polygon,
|
||||
Hsurface,
|
||||
*myPolyhedron);
|
||||
#endif
|
||||
}
|
||||
InternalCall(HICS,parinf,parsup);
|
||||
@@ -483,37 +480,33 @@ void IntCurvesFace_Intersector::Perform(const Handle(Adaptor3d_Curve)& HCu,
|
||||
|
||||
//============================================================================
|
||||
Bnd_Box IntCurvesFace_Intersector::Bounding() const {
|
||||
if(PtrOnPolyhedron !=NULL) {
|
||||
return(((IntCurveSurface_ThePolyhedronOfHInter *)PtrOnPolyhedron)->Bounding());
|
||||
if(myPolyhedron)
|
||||
{
|
||||
return myPolyhedron->Bounding();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Bnd_Box B;
|
||||
return(B);
|
||||
return B;
|
||||
}
|
||||
}
|
||||
TopAbs_State IntCurvesFace_Intersector::ClassifyUVPoint(const gp_Pnt2d& Puv) const {
|
||||
|
||||
TopAbs_State IntCurvesFace_Intersector::ClassifyUVPoint(const gp_Pnt2d& Puv) const
|
||||
{
|
||||
TopAbs_State state = myTopolTool->Classify(Puv,1e-7);
|
||||
return(state);
|
||||
}
|
||||
//============================================================================
|
||||
void IntCurvesFace_Intersector::Destroy() {
|
||||
if(PtrOnPolyhedron !=NULL) {
|
||||
delete (IntCurveSurface_ThePolyhedronOfHInter *)PtrOnPolyhedron;
|
||||
PtrOnPolyhedron = NULL;
|
||||
}
|
||||
if(PtrOnBndBounding !=NULL) {
|
||||
delete (Bnd_BoundSortBox *)PtrOnBndBounding;
|
||||
PtrOnBndBounding=NULL;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
void IntCurvesFace_Intersector::SetUseBoundToler(Standard_Boolean UseBToler)
|
||||
{
|
||||
myUseBoundTol = UseBToler;
|
||||
}
|
||||
void IntCurvesFace_Intersector::SetUseBoundToler(Standard_Boolean UseBToler)
|
||||
{
|
||||
myUseBoundTol = UseBToler;
|
||||
}
|
||||
|
||||
Standard_Boolean IntCurvesFace_Intersector::GetUseBoundToler() const
|
||||
{
|
||||
return myUseBoundTol;
|
||||
}
|
||||
Standard_Boolean IntCurvesFace_Intersector::GetUseBoundToler() const
|
||||
{
|
||||
return myUseBoundTol;
|
||||
}
|
||||
|
||||
IntCurvesFace_Intersector::~IntCurvesFace_Intersector()
|
||||
{
|
||||
}
|
||||
|
@@ -18,14 +18,18 @@
|
||||
#define _IntCurvesFace_Intersector_HeaderFile
|
||||
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <Bnd_BoundSortBox.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <IntCurveSurface_SequenceOfPnt.hxx>
|
||||
#include <IntCurveSurface_ThePolyhedronOfHInter.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <IntCurveSurface_TransitionOnCurve.hxx>
|
||||
#include <TopAbs_State.hxx>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class BRepTopAdaptor_TopolTool;
|
||||
class gp_Lin;
|
||||
class gp_Pnt;
|
||||
@@ -33,8 +37,13 @@ class IntCurveSurface_HInter;
|
||||
class gp_Pnt2d;
|
||||
class Bnd_Box;
|
||||
|
||||
class IntCurvesFace_Intersector
|
||||
DEFINE_STANDARD_HANDLE(IntCurvesFace_Intersector, Standard_Transient)
|
||||
|
||||
|
||||
class IntCurvesFace_Intersector : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(IntCurvesFace_Intersector, Standard_Transient)
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
@@ -123,14 +132,7 @@ public:
|
||||
//! Returns the boundary tolerance flag
|
||||
Standard_EXPORT Standard_Boolean GetUseBoundToler() const;
|
||||
|
||||
Standard_EXPORT void Destroy();
|
||||
~IntCurvesFace_Intersector()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT virtual ~IntCurvesFace_Intersector();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -153,8 +155,8 @@ private:
|
||||
Standard_Boolean myReady;
|
||||
Standard_Integer nbpnt;
|
||||
TopoDS_Face face;
|
||||
Standard_Address PtrOnPolyhedron;
|
||||
Standard_Address PtrOnBndBounding;
|
||||
std::unique_ptr<IntCurveSurface_ThePolyhedronOfHInter> myPolyhedron;
|
||||
std::unique_ptr<Bnd_BoundSortBox> myBndBounding;
|
||||
Standard_Boolean myUseBoundTol;
|
||||
Standard_Boolean myIsParallel; //Curve is "parallel" face surface
|
||||
//This case is recognized only for some pairs
|
||||
|
@@ -30,202 +30,186 @@
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
//-- ================================================================================
|
||||
IntCurvesFace_ShapeIntersector::IntCurvesFace_ShapeIntersector() {
|
||||
nbfaces=0;
|
||||
done=Standard_False;
|
||||
PtrJetons=NULL;
|
||||
PtrJetonsIndex=NULL;
|
||||
|
||||
IntCurvesFace_ShapeIntersector::IntCurvesFace_ShapeIntersector()
|
||||
: myIsDone(Standard_False),
|
||||
myNbFaces(0)
|
||||
{
|
||||
}
|
||||
//-- ================================================================================
|
||||
void IntCurvesFace_ShapeIntersector::Load(const TopoDS_Shape& shape,
|
||||
const Standard_Real tol) {
|
||||
PtrJetons=NULL;
|
||||
PtrJetonsIndex=NULL;
|
||||
if(nbfaces) {
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void IntCurvesFace_ShapeIntersector::Load(const TopoDS_Shape& theShape,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
TopExp_Explorer Ex;
|
||||
Standard_Integer i;
|
||||
for(nbfaces=0,i=0,Ex.Init(shape,TopAbs_FACE); Ex.More(); i++,Ex.Next()) {
|
||||
nbfaces++;
|
||||
TopoDS_Face currentface = TopoDS::Face(Ex.Current());
|
||||
PtrIntersector.Append((void *)(new IntCurvesFace_Intersector(currentface,tol)));
|
||||
}
|
||||
for(myNbFaces = 0, i = 0, Ex.Init(theShape, TopAbs_FACE); Ex.More(); ++i, Ex.Next())
|
||||
{
|
||||
++myNbFaces;
|
||||
TopoDS_Face aCurrentFace = TopoDS::Face(Ex.Current());
|
||||
myIntersector.Append(new IntCurvesFace_Intersector(aCurrentFace, theTol));
|
||||
}
|
||||
}
|
||||
//-- ================================================================================
|
||||
void IntCurvesFace_ShapeIntersector::Destroy() {
|
||||
if(PtrJetons) {
|
||||
delete ((Standard_Integer *)PtrJetons);
|
||||
PtrJetons=NULL;
|
||||
}
|
||||
if(PtrJetonsIndex) {
|
||||
delete ((Standard_Integer *)PtrJetonsIndex);
|
||||
PtrJetonsIndex=NULL;
|
||||
}
|
||||
for(Standard_Integer i=1; i<=nbfaces; i++) {
|
||||
IntCurvesFace_Intersector *Ptr = (IntCurvesFace_Intersector *)PtrIntersector.ChangeValue(i);
|
||||
delete Ptr;
|
||||
}
|
||||
done=Standard_False;
|
||||
nbfaces=0;
|
||||
PtrIntersector.Clear();
|
||||
IndexPt.Clear(); IndexFace.Clear(); IndexIntPnt.Clear();IndexPar.Clear();
|
||||
}
|
||||
//-- ================================================================================
|
||||
void IntCurvesFace_ShapeIntersector::Perform(const gp_Lin& L,
|
||||
const Standard_Real ParMin,
|
||||
const Standard_Real ParMax) {
|
||||
done = Standard_False;
|
||||
for(Standard_Integer i=1; i<=nbfaces; i++) {
|
||||
IntCurvesFace_Intersector *Ptr = (IntCurvesFace_Intersector *)PtrIntersector.ChangeValue(i);
|
||||
Ptr->Perform(L,ParMin,ParMax);
|
||||
|
||||
void IntCurvesFace_ShapeIntersector::Perform(const gp_Lin& theL,
|
||||
const Standard_Real theParMin,
|
||||
const Standard_Real theParMax)
|
||||
{
|
||||
myIsDone = Standard_False;
|
||||
for(Standard_Integer i = 1; i <= myNbFaces; ++i)
|
||||
{
|
||||
myIntersector.ChangeValue(i)->Perform(theL, theParMin, theParMax);
|
||||
}
|
||||
SortResult();
|
||||
}
|
||||
//-- ================================================================================
|
||||
void IntCurvesFace_ShapeIntersector::PerformNearest(const gp_Lin& L,
|
||||
const Standard_Real ParMin,
|
||||
const Standard_Real _ParMax) {
|
||||
|
||||
Standard_Integer i;
|
||||
Standard_Integer* _PtrJetons=(Standard_Integer *)PtrJetons;
|
||||
Standard_Integer* _PtrJetonsIndex=(Standard_Integer *)PtrJetonsIndex;
|
||||
|
||||
|
||||
if(nbfaces>2) {
|
||||
if(PtrJetons==NULL) {
|
||||
PtrJetons = (void *) new Standard_Integer [nbfaces];
|
||||
PtrJetonsIndex = (void *) new Standard_Integer [nbfaces];
|
||||
Standard_Integer *Ptr =(Standard_Integer *)PtrJetons;
|
||||
Standard_Integer *PtrI=(Standard_Integer *)PtrJetonsIndex;
|
||||
for(i=0;i<nbfaces;i++) {
|
||||
Ptr[i]=0;
|
||||
PtrI[i]=i+1;
|
||||
}
|
||||
_PtrJetons=(Standard_Integer *)PtrJetons;
|
||||
_PtrJetonsIndex=(Standard_Integer *)PtrJetonsIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer Indexface=-1;
|
||||
Standard_Real ParMax=_ParMax;
|
||||
|
||||
|
||||
done = Standard_False;
|
||||
for(Standard_Integer ii=1; ii<=nbfaces; ii++) {
|
||||
if(_PtrJetons) {
|
||||
i=_PtrJetonsIndex[ii-1];
|
||||
}
|
||||
else {
|
||||
i=ii;
|
||||
}
|
||||
|
||||
IntCurvesFace_Intersector *Ptr = (IntCurvesFace_Intersector *)PtrIntersector.ChangeValue(i);
|
||||
if(ParMin<ParMax) {
|
||||
Ptr->Perform(L,ParMin,ParMax);
|
||||
if(Ptr->IsDone()) {
|
||||
Standard_Integer n=Ptr->NbPnt();
|
||||
for(Standard_Integer j=1;j<=n;j++) {
|
||||
Standard_Real w=Ptr->WParameter(j);
|
||||
if(w<ParMax) {
|
||||
ParMax=w;
|
||||
Indexface=ii-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
done = Standard_False;
|
||||
return;
|
||||
void IntCurvesFace_ShapeIntersector::PerformNearest(const gp_Lin& theL,
|
||||
const Standard_Real theParMin,
|
||||
const Standard_Real theParMax)
|
||||
{
|
||||
Standard_Integer i = 0;
|
||||
if(myNbFaces > 2)
|
||||
{
|
||||
if (myPtrNums.IsEmpty())
|
||||
{
|
||||
myPtrNums = TColStd_HArray1OfInteger(0, myNbFaces - 1);
|
||||
myPtrIndexNums = TColStd_HArray1OfInteger(0, myNbFaces - 1);
|
||||
for(; i < myNbFaces; ++i)
|
||||
{
|
||||
myPtrNums.ChangeValue(i) = 0;
|
||||
myPtrIndexNums.ChangeValue(i) = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(PtrJetons && Indexface>=0) {
|
||||
_PtrJetons[Indexface]++;
|
||||
|
||||
|
||||
Standard_Integer anIndexFace = -1;
|
||||
Standard_Real aParMax=theParMax;
|
||||
myIsDone = Standard_False;
|
||||
for(Standard_Integer ii = 1; ii <= myNbFaces; ++ii)
|
||||
{
|
||||
if (!myPtrNums.IsEmpty())
|
||||
{
|
||||
i = myPtrIndexNums.Value(ii - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
i = ii;
|
||||
}
|
||||
Handle(IntCurvesFace_Intersector) anIntersector = myIntersector.ChangeValue(i);
|
||||
if(theParMin < aParMax)
|
||||
{
|
||||
anIntersector->Perform(theL, theParMin,aParMax);
|
||||
if(anIntersector->IsDone())
|
||||
{
|
||||
Standard_Integer n = anIntersector->NbPnt();
|
||||
for(Standard_Integer j = 1; j <= n; ++j)
|
||||
{
|
||||
Standard_Real w = anIntersector->WParameter(j);
|
||||
if(w < aParMax)
|
||||
{
|
||||
aParMax = w;
|
||||
anIndexFace = ii - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myIsDone = Standard_False;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!myPtrNums.IsEmpty() && anIndexFace >= 0)
|
||||
{
|
||||
myPtrNums.ChangeValue(anIndexFace) += 1;
|
||||
Standard_Integer im1;
|
||||
for(im1=Indexface-1,i=Indexface; i>=1 && _PtrJetons[i]>_PtrJetons[i-1]; i--,im1--) {
|
||||
Standard_Integer t=_PtrJetonsIndex[i];
|
||||
_PtrJetonsIndex[i]=_PtrJetonsIndex[im1];
|
||||
_PtrJetonsIndex[im1]=t;
|
||||
t=_PtrJetons[i];
|
||||
_PtrJetons[i]=_PtrJetons[im1];
|
||||
_PtrJetons[im1]=t;
|
||||
for (im1 = anIndexFace - 1, i = anIndexFace; i >= 1 && myPtrNums.Value(i) > myPtrNums.Value(im1); --i, --im1)
|
||||
{
|
||||
std::swap(myPtrIndexNums.ChangeValue(i), myPtrIndexNums.ChangeValue(im1));
|
||||
std::swap(myPtrNums.ChangeValue(i), myPtrNums.ChangeValue(im1));
|
||||
}
|
||||
//--for(Standard_Integer dd=0; dd<nbfaces;dd++) { if(_PtrJetons[dd]) { printf("\n<%3d %3d %3d>",dd,_PtrJetons[dd],_PtrJetonsIndex[dd]); } }
|
||||
//--printf("\n");
|
||||
}
|
||||
SortResult();
|
||||
}
|
||||
|
||||
void IntCurvesFace_ShapeIntersector::Perform(const Handle(Adaptor3d_Curve)& theHCurve,
|
||||
const Standard_Real theParMin,
|
||||
const Standard_Real theParMax)
|
||||
{
|
||||
myIsDone = Standard_False;
|
||||
for(Standard_Integer i = 1; i <= myNbFaces; ++i)
|
||||
{
|
||||
Handle(IntCurvesFace_Intersector) anIntersector = myIntersector.ChangeValue(i);
|
||||
anIntersector->Perform(theHCurve, theParMin, theParMax);
|
||||
}
|
||||
SortResult();
|
||||
}
|
||||
//-- ================================================================================
|
||||
void IntCurvesFace_ShapeIntersector::Perform(const Handle(Adaptor3d_Curve)& HCu,
|
||||
const Standard_Real ParMin,
|
||||
const Standard_Real ParMax) {
|
||||
done = Standard_False;
|
||||
for(Standard_Integer i=1; i<=nbfaces; i++) {
|
||||
IntCurvesFace_Intersector *Ptr = (IntCurvesFace_Intersector *)PtrIntersector.ChangeValue(i);
|
||||
Ptr->Perform(HCu,ParMin,ParMax);
|
||||
}
|
||||
SortResult();
|
||||
}
|
||||
//-- ================================================================================
|
||||
//-- PtrIntersector : Sequence d addresses
|
||||
//-- IndexPt : 1 2 3 .... n points avant le tri
|
||||
//-- IndexFace : Numero de la face (de l intersector) du point IndexPt(i)
|
||||
//-- IndexIntPnt : Numero du point IndexPt(i) dans l'intersector IndexFace(IndexPt(i))
|
||||
//-- IndexPar : W parameter du point IndexPt(i)
|
||||
//-- myIntersector : Sequence of the addresses
|
||||
//-- myIndexPt : 1 2 3 .... n Points before the sorting
|
||||
//-- myNumberFace : Number of the face (of the intersector) of the point myIndexPt(i)
|
||||
//-- myNumberIntPnt : Number of the point myIndexPt(i) of the intersection myNumberFace(myIndexPt(i))
|
||||
//-- myIndexPar : Parameter W of point myIndexPt(i)
|
||||
//--
|
||||
//-- En resume, pour chaque point indice par K = IndexPt(i) on a
|
||||
//-- * la face a laquelle il appartient : IndexFace(K)
|
||||
//-- * le numero du point dans l'intersecteur FaceCurve : IndexIntPnt(K)
|
||||
//-- * le parametre W du point sur la courbe : IndexPar(K)
|
||||
//-- To sum up, for each point index of K = myIndexPt(i) on a
|
||||
//-- * the face to which it belongs : myNumberFace(K)
|
||||
//-- * the number of the point in the intersection for FaceCurve : myNumberIntPnt(K)
|
||||
//-- * the parameter W of the point on the curve : myIndexPar(K)
|
||||
//--
|
||||
//-- SortResult Trie les points par ordre croissant de W
|
||||
//-- (remet a jour le tableau d index TabPt(.))
|
||||
//-- SortResult Sorts the points in ascending order of W
|
||||
//-- (updating the index table TabPt(.))
|
||||
//--
|
||||
//-- ================================================================================
|
||||
void IntCurvesFace_ShapeIntersector::SortResult() {
|
||||
done = Standard_True;
|
||||
Standard_Integer nbpnt=0;
|
||||
IndexPt.Clear(); IndexFace.Clear(); IndexIntPnt.Clear();IndexPar.Clear();
|
||||
//-- -----------------------------------------------------
|
||||
//-- r e c u p e r a t i o n d e s r e s u l t a t s
|
||||
//--
|
||||
for(Standard_Integer f=1; f<=nbfaces; f++) {
|
||||
IntCurvesFace_Intersector *Ptr = (IntCurvesFace_Intersector *)PtrIntersector.ChangeValue(f);
|
||||
if(Ptr->IsDone()) {
|
||||
Standard_Integer n=Ptr->NbPnt();
|
||||
for(Standard_Integer j=1;j<=n;j++) {
|
||||
IndexPt.Append(++nbpnt);
|
||||
IndexFace.Append(f);
|
||||
IndexIntPnt.Append(j);
|
||||
IndexPar.Append(Ptr->WParameter(j));
|
||||
void IntCurvesFace_ShapeIntersector::SortResult()
|
||||
{
|
||||
myIsDone = Standard_True;
|
||||
Standard_Integer aNbPnt=0;
|
||||
myIndexPt.Clear();
|
||||
myIndexFace.Clear();
|
||||
myIndexIntPnt.Clear();
|
||||
myIndexPar.Clear();
|
||||
|
||||
//Retrieval of the results
|
||||
for(Standard_Integer f = 1; f <= myNbFaces; ++f)
|
||||
{
|
||||
Handle(IntCurvesFace_Intersector) anIntersector = myIntersector.ChangeValue(f);
|
||||
if(anIntersector->IsDone())
|
||||
{
|
||||
Standard_Integer n = anIntersector->NbPnt();
|
||||
for(Standard_Integer j = 1; j <= n; ++j)
|
||||
{
|
||||
myIndexPt.Append(++aNbPnt);
|
||||
myIndexFace.Append(f);
|
||||
myIndexIntPnt.Append(j);
|
||||
myIndexPar.Append(anIntersector->WParameter(j));
|
||||
}
|
||||
}
|
||||
else {
|
||||
done = Standard_False;
|
||||
else
|
||||
{
|
||||
myIsDone = Standard_False;
|
||||
return;
|
||||
}
|
||||
}
|
||||
//-- -----------------------------------------------------
|
||||
//-- t r i s e l o n l e p a r a m e t r e w
|
||||
//--
|
||||
Standard_Boolean triok;
|
||||
do {
|
||||
triok=Standard_True;
|
||||
for(Standard_Integer ind0=1;ind0<nbpnt;ind0++) {
|
||||
Standard_Integer ind =IndexPt(ind0);
|
||||
Standard_Integer indp1=IndexPt(ind0+1);
|
||||
if(IndexPar(ind) > IndexPar(indp1)) {
|
||||
IndexPt(ind0) =indp1;
|
||||
IndexPt(ind0+1)=ind;
|
||||
triok=Standard_False;
|
||||
|
||||
//Sort according to parameter w
|
||||
Standard_Boolean isOK;
|
||||
do
|
||||
{
|
||||
isOK = Standard_True;
|
||||
for(Standard_Integer ind0 = 1; ind0 < aNbPnt; ind0++)
|
||||
{
|
||||
Standard_Integer ind = myIndexPt(ind0);
|
||||
Standard_Integer indp1 = myIndexPt(ind0 + 1);
|
||||
if(myIndexPar(ind) > myIndexPar(indp1))
|
||||
{
|
||||
myIndexPt(ind0) = indp1;
|
||||
myIndexPt(ind0 + 1) = ind;
|
||||
isOK = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
while(triok==Standard_False);
|
||||
while(!isOK);
|
||||
}
|
||||
|
||||
IntCurvesFace_ShapeIntersector::~IntCurvesFace_ShapeIntersector()
|
||||
{
|
||||
}
|
||||
//-- ================================================================================
|
||||
//-- Creation le 28 jan 98
|
||||
//--
|
||||
|
@@ -23,12 +23,12 @@
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Address.hxx>
|
||||
#include <BRepTopAdaptor_SeqOfPtr.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <IntCurveSurface_TransitionOnCurve.hxx>
|
||||
#include <IntCurvesFace_Intersector.hxx>
|
||||
#include <TopAbs_State.hxx>
|
||||
|
||||
class Adaptor3d_Curve;
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
//! segment L and the loaded shape.
|
||||
//!
|
||||
//! PInf is the smallest parameter on the line
|
||||
//! PSup is the highest parammter on the line
|
||||
//! PSup is the highest parameter on the line
|
||||
//!
|
||||
//! For an infinite line PInf and PSup can be
|
||||
//! +/- RealLast.
|
||||
@@ -62,92 +62,102 @@ public:
|
||||
//! segment L and the loaded shape.
|
||||
//!
|
||||
//! PInf is the smallest parameter on the line
|
||||
//! PSup is the highest parammter on the line
|
||||
//! PSup is the highest parameter on the line
|
||||
//!
|
||||
//! For an infinite line PInf and PSup can be
|
||||
//! +/- RealLast.
|
||||
Standard_EXPORT void PerformNearest (const gp_Lin& L, const Standard_Real PInf, const Standard_Real PSup);
|
||||
|
||||
//! same method for a HCurve from Adaptor3d.
|
||||
//! PInf an PSup can also be - and + INF.
|
||||
//! PInf an PSup can also be -INF and +INF.
|
||||
Standard_EXPORT void Perform (const Handle(Adaptor3d_Curve)& HCu, const Standard_Real PInf, const Standard_Real PSup);
|
||||
|
||||
//! True is returned when the intersection have been computed.
|
||||
Standard_Boolean IsDone() const;
|
||||
|
||||
Standard_Integer NbPnt() const;
|
||||
//! True when the intersection has been computed.
|
||||
Standard_Boolean IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
//! Returns the number of the intersection points
|
||||
Standard_Integer NbPnt() const
|
||||
{
|
||||
return myIndexPt.Length();
|
||||
}
|
||||
|
||||
//! Returns the U parameter of the ith intersection point
|
||||
//! on the surface.
|
||||
Standard_Real UParameter (const Standard_Integer I) const;
|
||||
|
||||
Standard_Real UParameter (const Standard_Integer I) const
|
||||
{
|
||||
Handle(IntCurvesFace_Intersector) anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
|
||||
return anIntAdaptor->UParameter(myIndexIntPnt(myIndexPt(I)));
|
||||
}
|
||||
|
||||
//! Returns the V parameter of the ith intersection point
|
||||
//! on the surface.
|
||||
Standard_Real VParameter (const Standard_Integer I) const;
|
||||
Standard_Real VParameter (const Standard_Integer I) const
|
||||
{
|
||||
Handle(IntCurvesFace_Intersector) anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
|
||||
return anIntAdaptor->VParameter(myIndexIntPnt(myIndexPt(I)));
|
||||
}
|
||||
|
||||
//! Returns the parameter of the ith intersection point
|
||||
//! on the line.
|
||||
Standard_Real WParameter (const Standard_Integer I) const;
|
||||
Standard_Real WParameter (const Standard_Integer I) const
|
||||
{
|
||||
Handle(IntCurvesFace_Intersector) anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
|
||||
return anIntAdaptor->WParameter(myIndexIntPnt(myIndexPt(I)));
|
||||
}
|
||||
|
||||
//! Returns the geometric point of the ith intersection
|
||||
//! between the line and the surface.
|
||||
const gp_Pnt& Pnt (const Standard_Integer I) const;
|
||||
const gp_Pnt& Pnt (const Standard_Integer I) const
|
||||
{
|
||||
Handle(IntCurvesFace_Intersector) anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
|
||||
return anIntAdaptor->Pnt(myIndexIntPnt(myIndexPt(I)));
|
||||
}
|
||||
|
||||
//! Returns the ith transition of the line on the surface.
|
||||
IntCurveSurface_TransitionOnCurve Transition (const Standard_Integer I) const;
|
||||
IntCurveSurface_TransitionOnCurve Transition (const Standard_Integer I) const
|
||||
{
|
||||
Handle(IntCurvesFace_Intersector) anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
|
||||
return anIntAdaptor->Transition(myIndexIntPnt(myIndexPt(I)));
|
||||
}
|
||||
|
||||
//! Returns the ith state of the point on the face.
|
||||
//! The values can be either TopAbs_IN
|
||||
//! ( the point is in the face)
|
||||
//! or TopAbs_ON
|
||||
//! ( the point is on a boundary of the face).
|
||||
TopAbs_State State (const Standard_Integer I) const;
|
||||
TopAbs_State State(const Standard_Integer I) const
|
||||
{
|
||||
Handle(IntCurvesFace_Intersector) anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
|
||||
return anIntAdaptor->State(myIndexIntPnt(myIndexPt(I)));
|
||||
}
|
||||
|
||||
//! Returns the significant face used to determine
|
||||
//! the intersection.
|
||||
const TopoDS_Face& Face (const Standard_Integer I) const;
|
||||
const TopoDS_Face& Face(const Standard_Integer I) const
|
||||
{
|
||||
Handle(IntCurvesFace_Intersector) anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
|
||||
return anIntAdaptor->Face();
|
||||
}
|
||||
|
||||
//! Internal method. Sort the result on the Curve
|
||||
//! parameter.
|
||||
Standard_EXPORT void SortResult();
|
||||
|
||||
Standard_EXPORT void Destroy();
|
||||
~IntCurvesFace_ShapeIntersector()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT virtual ~IntCurvesFace_ShapeIntersector();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Boolean done;
|
||||
Standard_Integer nbfaces;
|
||||
Standard_Address PtrJetons;
|
||||
Standard_Address PtrJetonsIndex;
|
||||
BRepTopAdaptor_SeqOfPtr PtrIntersector;
|
||||
TColStd_SequenceOfInteger IndexPt;
|
||||
TColStd_SequenceOfInteger IndexFace;
|
||||
TColStd_SequenceOfInteger IndexIntPnt;
|
||||
TColStd_SequenceOfReal IndexPar;
|
||||
|
||||
|
||||
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Integer myNbFaces;
|
||||
TColStd_Array1OfInteger myPtrNums;
|
||||
TColStd_Array1OfInteger myPtrIndexNums;
|
||||
NCollection_Sequence<Handle(IntCurvesFace_Intersector)> myIntersector;
|
||||
TColStd_SequenceOfInteger myIndexPt;
|
||||
TColStd_SequenceOfInteger myIndexFace;
|
||||
TColStd_SequenceOfInteger myIndexIntPnt;
|
||||
TColStd_SequenceOfReal myIndexPar;
|
||||
};
|
||||
|
||||
|
||||
#include <IntCurvesFace_ShapeIntersector.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntCurvesFace_ShapeIntersector_HeaderFile
|
||||
|
@@ -1,71 +0,0 @@
|
||||
// Created on: 1998-01-28
|
||||
// Created by: Laurent BUCHARD
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IntCurvesFace_Intersector.hxx>
|
||||
|
||||
|
||||
inline Standard_Integer IntCurvesFace_ShapeIntersector::NbPnt() const {
|
||||
return(IndexPt.Length());
|
||||
}
|
||||
|
||||
inline Standard_Real IntCurvesFace_ShapeIntersector::UParameter(const Standard_Integer i) const {
|
||||
IntCurvesFace_Intersector *Ptr =
|
||||
(IntCurvesFace_Intersector *)(PtrIntersector(IndexFace(IndexPt(i))));
|
||||
return(Ptr->UParameter(IndexIntPnt(IndexPt(i))));
|
||||
}
|
||||
|
||||
inline Standard_Real IntCurvesFace_ShapeIntersector::VParameter(const Standard_Integer i) const {
|
||||
IntCurvesFace_Intersector *Ptr =
|
||||
(IntCurvesFace_Intersector *)(PtrIntersector(IndexFace(IndexPt(i))));
|
||||
return(Ptr->VParameter(IndexIntPnt(IndexPt(i))));
|
||||
}
|
||||
|
||||
inline Standard_Real IntCurvesFace_ShapeIntersector::WParameter(const Standard_Integer i) const {
|
||||
IntCurvesFace_Intersector *Ptr =
|
||||
(IntCurvesFace_Intersector *)(PtrIntersector(IndexFace(IndexPt(i))));
|
||||
return(Ptr->WParameter(IndexIntPnt(IndexPt(i))));
|
||||
}
|
||||
|
||||
inline const gp_Pnt& IntCurvesFace_ShapeIntersector::Pnt(const Standard_Integer i) const {
|
||||
IntCurvesFace_Intersector *Ptr =
|
||||
(IntCurvesFace_Intersector *)(PtrIntersector(IndexFace(IndexPt(i))));
|
||||
return(Ptr->Pnt(IndexIntPnt(IndexPt(i))));
|
||||
}
|
||||
|
||||
inline IntCurveSurface_TransitionOnCurve IntCurvesFace_ShapeIntersector::Transition(const Standard_Integer i) const {
|
||||
IntCurvesFace_Intersector *Ptr =
|
||||
(IntCurvesFace_Intersector *)(PtrIntersector(IndexFace(IndexPt(i))));
|
||||
return(Ptr->Transition(IndexIntPnt(IndexPt(i))));
|
||||
}
|
||||
|
||||
inline TopAbs_State IntCurvesFace_ShapeIntersector::State(const Standard_Integer i) const {
|
||||
IntCurvesFace_Intersector *Ptr =
|
||||
(IntCurvesFace_Intersector *)(PtrIntersector(IndexFace(IndexPt(i))));
|
||||
return(Ptr->State(IndexIntPnt(IndexPt(i))));
|
||||
}
|
||||
|
||||
|
||||
inline const TopoDS_Face& IntCurvesFace_ShapeIntersector::Face(const Standard_Integer i) const {
|
||||
IntCurvesFace_Intersector *Ptr =
|
||||
(IntCurvesFace_Intersector *)(PtrIntersector(IndexFace(IndexPt(i))));
|
||||
return(Ptr->Face());
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntCurvesFace_ShapeIntersector::IsDone() const {
|
||||
return(done);
|
||||
}
|
||||
|
||||
|
@@ -1923,3 +1923,72 @@ Standard_Real IntPatch_Intersection::DefineUVMaxStep(
|
||||
return anUVMaxStep;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : splitCone
|
||||
//purpose : Splits cone by the apex
|
||||
//=======================================================================
|
||||
static void splitCone(
|
||||
const Handle(Adaptor3d_Surface)& theS,
|
||||
const Handle(Adaptor3d_TopolTool)& theD,
|
||||
const Standard_Real theTol,
|
||||
NCollection_Vector< Handle(Adaptor3d_Surface)>& theVecHS)
|
||||
{
|
||||
if (theS->GetType() != GeomAbs_Cone)
|
||||
{
|
||||
throw Standard_NoSuchObject("IntPatch_Intersection : Surface is not Cone");
|
||||
}
|
||||
|
||||
gp_Cone aCone = theS->Cone();
|
||||
|
||||
Standard_Real aU0, aV0;
|
||||
Adaptor3d_TopolTool::GetConeApexParam (aCone, aU0, aV0);
|
||||
|
||||
TopAbs_State aState = theD->Classify (gp_Pnt2d (aU0, aV0), theTol);
|
||||
|
||||
if (aState == TopAbs_IN || aState == TopAbs_ON)
|
||||
{
|
||||
const Handle(Adaptor3d_Surface) aHSDn = theS->VTrim (theS->FirstVParameter(), aV0, Precision::PConfusion());
|
||||
const Handle(Adaptor3d_Surface) aHSUp = theS->VTrim (aV0, theS->LastVParameter(), Precision::PConfusion());
|
||||
|
||||
theVecHS.Append (aHSDn);
|
||||
theVecHS.Append (aHSUp);
|
||||
}
|
||||
else
|
||||
{
|
||||
theVecHS.Append (theS);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PrepareSurfaces
|
||||
//purpose : Prepares surfaces for intersection
|
||||
//=======================================================================
|
||||
void IntPatch_Intersection::PrepareSurfaces(
|
||||
const Handle(Adaptor3d_Surface)& theS1,
|
||||
const Handle(Adaptor3d_TopolTool)& theD1,
|
||||
const Handle(Adaptor3d_Surface)& theS2,
|
||||
const Handle(Adaptor3d_TopolTool)& theD2,
|
||||
const Standard_Real theTol,
|
||||
NCollection_Vector< Handle(Adaptor3d_Surface)>& theVecHS1,
|
||||
NCollection_Vector< Handle(Adaptor3d_Surface)>& theVecHS2)
|
||||
{
|
||||
if ((theS1->GetType() == GeomAbs_Cone) && (Abs (M_PI / 2. - Abs (theS1->Cone().SemiAngle())) < theTol))
|
||||
{
|
||||
splitCone (theS1, theD1, theTol, theVecHS1);
|
||||
}
|
||||
else
|
||||
{
|
||||
theVecHS1.Append (theS1);
|
||||
}
|
||||
|
||||
if ((theS2->GetType() == GeomAbs_Cone) && (Abs (M_PI / 2. - Abs (theS2->Cone().SemiAngle())) < theTol))
|
||||
{
|
||||
splitCone (theS2, theD2, theTol, theVecHS2);
|
||||
}
|
||||
else
|
||||
{
|
||||
theVecHS2.Append (theS2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <IntPatch_SequenceOfLine.hxx>
|
||||
#include <IntSurf_ListOfPntOn2S.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
|
||||
class Adaptor3d_TopolTool;
|
||||
|
||||
@@ -149,6 +150,15 @@ public:
|
||||
const Handle(Adaptor3d_Surface)& theS2,
|
||||
const Handle(Adaptor3d_TopolTool)& theD2);
|
||||
|
||||
//! Prepares surfaces for intersection
|
||||
Standard_EXPORT static void PrepareSurfaces(
|
||||
const Handle(Adaptor3d_Surface)& theS1,
|
||||
const Handle(Adaptor3d_TopolTool)& theD1,
|
||||
const Handle(Adaptor3d_Surface)& theS2,
|
||||
const Handle(Adaptor3d_TopolTool)& theD2,
|
||||
const Standard_Real Tol,
|
||||
NCollection_Vector< Handle(Adaptor3d_Surface)>& theSeqHS1,
|
||||
NCollection_Vector< Handle(Adaptor3d_Surface)>& theSeqHS2);
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -400,8 +400,15 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
|
||||
|
||||
//Normalizing factor. If it is less than 1.0 then the range will be expanded.
|
||||
//This is no good for computation. Therefore, it is limited.
|
||||
const Standard_Real deltau = mySRangeU.IsVoid() ? UM - Um : Max(mySRangeU.Delta(), 1.0);
|
||||
const Standard_Real deltav = mySRangeV.IsVoid() ? VM - Vm : Max(mySRangeV.Delta(), 1.0);
|
||||
//Do not limit this factor in case of highly anisotropic parametrization
|
||||
//(parametric space is considerably larger in one direction than another).
|
||||
const Standard_Boolean isHighlyAnisotropic = Max(tolu, tolv) > 1000. * Min(tolu, tolv);
|
||||
const Standard_Real deltau = mySRangeU.IsVoid() ? UM - Um
|
||||
: (isHighlyAnisotropic ? mySRangeU.Delta()
|
||||
: Max(mySRangeU.Delta(), 1.0));
|
||||
const Standard_Real deltav = mySRangeV.IsVoid() ? VM - Vm
|
||||
: (isHighlyAnisotropic ? mySRangeV.Delta()
|
||||
: Max(mySRangeV.Delta(), 1.0));
|
||||
|
||||
Up/=deltau; UV1/=deltau;
|
||||
Vp/=deltav; UV2/=deltav;
|
||||
|
@@ -184,6 +184,7 @@ Standard_Boolean LDOMBasicString::equals (const LDOMBasicString& anOther) const
|
||||
case LDOM_AsciiDocClear:
|
||||
case LDOM_AsciiHashed:
|
||||
{
|
||||
errno = 0;
|
||||
long aLongOther = strtol ((const char *) anOther.myVal.ptr, NULL, 10);
|
||||
return (errno == 0 && aLongOther == long(myVal.i));
|
||||
}
|
||||
@@ -197,6 +198,7 @@ Standard_Boolean LDOMBasicString::equals (const LDOMBasicString& anOther) const
|
||||
{
|
||||
case LDOM_Integer:
|
||||
{
|
||||
errno = 0;
|
||||
long aLong = strtol ((const char *) myVal.ptr, NULL, 10);
|
||||
return (errno == 0 && aLong == long(anOther.myVal.i));
|
||||
}
|
||||
@@ -273,6 +275,7 @@ LDOMBasicString::operator TCollection_ExtendedString () const
|
||||
buf[1] = ptr[1];
|
||||
buf[2] = ptr[2];
|
||||
buf[3] = ptr[3];
|
||||
errno = 0;
|
||||
aResult[j++] = Standard_ExtCharacter (strtol (&buf[0], NULL, 16));
|
||||
if (errno) {
|
||||
delete [] aResult;
|
||||
@@ -306,6 +309,7 @@ Standard_Boolean LDOMBasicString::GetInteger (Standard_Integer& aResult) const
|
||||
case LDOM_AsciiHashed:
|
||||
{
|
||||
char * ptr;
|
||||
errno = 0;
|
||||
long aValue = strtol ((const char *)myVal.ptr, &ptr, 10);
|
||||
if (ptr == myVal.ptr || errno == ERANGE || errno == EINVAL)
|
||||
return Standard_False;
|
||||
|
@@ -69,7 +69,8 @@ protected:
|
||||
{
|
||||
protected:
|
||||
Iterator()
|
||||
: myICurBlock (0),
|
||||
: myVector (nullptr),
|
||||
myICurBlock (0),
|
||||
myIEndBlock (0),
|
||||
myCurIndex (0),
|
||||
myEndIndex (0) {}
|
||||
|
@@ -14,8 +14,9 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <OSD_Chronometer.hxx>
|
||||
|
||||
#include <Standard_ProgramError.hxx>
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
#ifndef _WIN32
|
||||
@@ -182,6 +183,19 @@ OSD_Chronometer::~OSD_Chronometer()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetThisThreadOnly
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void OSD_Chronometer::SetThisThreadOnly (Standard_Boolean theIsThreadOnly)
|
||||
{
|
||||
if (!myIsStopped)
|
||||
{
|
||||
throw Standard_ProgramError ("OSD_Chronometer::SetThreadOnly() called for started Timer");
|
||||
}
|
||||
myIsThreadOnly = theIsThreadOnly;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Reset
|
||||
//purpose :
|
||||
|
@@ -91,6 +91,14 @@ public:
|
||||
return aSysTime;
|
||||
}
|
||||
|
||||
//! Return TRUE if current thread CPU time should be measured,
|
||||
//! and FALSE to measure all threads CPU time; FALSE by default,
|
||||
Standard_Boolean IsThisThreadOnly() const { return myIsThreadOnly; }
|
||||
|
||||
//! Set if current thread (TRUE) or all threads (FALSE) CPU time should be measured.
|
||||
//! Will raise exception if Timer is in started state.
|
||||
Standard_EXPORT void SetThisThreadOnly (Standard_Boolean theIsThreadOnly);
|
||||
|
||||
//! Returns the current CPU user time in a variable.
|
||||
//! The chronometer can be running (laps Time) or stopped.
|
||||
void Show (Standard_Real& theUserSeconds) const { theUserSeconds = UserTimeCPU(); }
|
||||
|
@@ -114,6 +114,7 @@ void OSD_Directory::Build (const OSD_Protection& theProtect)
|
||||
_osd_wnt_set_error (myError, OSD_WDirectory);
|
||||
}
|
||||
#else
|
||||
errno = 0;
|
||||
TCollection_AsciiString aBuffer;
|
||||
mode_t anInternalProt = (mode_t )theProtect.Internal();
|
||||
myPath.SystemName (aBuffer);
|
||||
|
@@ -805,7 +805,9 @@ Bnd_Box OpenGl_View::MinMaxValues (const Standard_Boolean theToIncludeAuxiliary)
|
||||
Bnd_Box aBox = base_type::MinMaxValues (theToIncludeAuxiliary);
|
||||
|
||||
// make sure that stats overlay isn't clamped on hardware with unavailable depth clamping
|
||||
if (myRenderParams.ToShowStats && !myWorkspace->GetGlContext()->arbDepthClamp)
|
||||
if (theToIncludeAuxiliary
|
||||
&& myRenderParams.ToShowStats
|
||||
&& !myWorkspace->GetGlContext()->arbDepthClamp)
|
||||
{
|
||||
Bnd_Box aStatsBox (gp_Pnt (float(myWindow->Width() / 2.0), float(myWindow->Height() / 2.0), 0.0),
|
||||
gp_Pnt (float(myWindow->Width() / 2.0), float(myWindow->Height() / 2.0), 0.0));
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -192,9 +192,12 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
void GetTrimmedResult(const Handle(Geom_Curve)& theProjCurve);
|
||||
|
||||
Standard_Boolean BuildParabolaByApex(Handle(Geom_Curve)& theGeomParabolaPtr);
|
||||
Standard_Boolean BuildHyperbolaByApex(Handle(Geom_Curve)& theGeomParabolaPtr);
|
||||
|
||||
|
||||
void BuildByApprox(const Standard_Real theLimitParameter);
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -3093,6 +3093,80 @@ static Standard_Integer OCC30391(Draw_Interpretor& theDI,
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OCC29745
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Integer OCC29745(Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
|
||||
{
|
||||
if (theArgc != 5)
|
||||
{
|
||||
theDI << "Usage : OCC29745 curve2d/3d continuity t1 t2";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(Geom_Curve) aC3d;
|
||||
Handle(Geom2d_Curve) aC2d;
|
||||
|
||||
aC3d = DrawTrSurf::GetCurve(theArgv[1]);
|
||||
if (aC3d.IsNull())
|
||||
{
|
||||
aC2d = DrawTrSurf::GetCurve2d(theArgv[1]);
|
||||
if (aC2d.IsNull())
|
||||
{
|
||||
theDI << "Null curve" << "\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer i = Draw::Atoi(theArgv[2]);
|
||||
GeomAbs_Shape aCont = GeomAbs_C0;
|
||||
if (i <= 0)
|
||||
aCont = GeomAbs_C0;
|
||||
else if (i == 1)
|
||||
aCont = GeomAbs_C1;
|
||||
else if (i == 2)
|
||||
aCont = GeomAbs_C2;
|
||||
else if (i == 3)
|
||||
aCont = GeomAbs_C3;
|
||||
else if (i >= 4)
|
||||
aCont = GeomAbs_CN;
|
||||
|
||||
Standard_Real t1 = Draw::Atof(theArgv[3]);
|
||||
Standard_Real t2 = Draw::Atof(theArgv[4]);
|
||||
|
||||
GeomAdaptor_Curve aGAC3d;
|
||||
Geom2dAdaptor_Curve aGAC2d;
|
||||
Standard_Integer aNbInts;
|
||||
if (aC2d.IsNull())
|
||||
{
|
||||
aGAC3d.Load(aC3d, t1, t2);
|
||||
aNbInts = aGAC3d.NbIntervals(aCont);
|
||||
}
|
||||
else
|
||||
{
|
||||
aGAC2d.Load(aC2d, t1, t2);
|
||||
aNbInts = aGAC2d.NbIntervals(aCont);
|
||||
}
|
||||
|
||||
TColStd_HArray1OfReal anInters(1, aNbInts + 1);
|
||||
if (aC2d.IsNull())
|
||||
{
|
||||
aGAC3d.Intervals(anInters, aCont);
|
||||
}
|
||||
else
|
||||
{
|
||||
aGAC2d.Intervals(anInters, aCont);
|
||||
}
|
||||
|
||||
theDI << "NbIntervals: " << aNbInts << "; ";
|
||||
for (i = anInters.Lower(); i <= anInters.Upper(); ++i)
|
||||
{
|
||||
theDI << anInters(i) << " ";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <Standard_Mutex.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
#include <BinLDrivers.hxx>
|
||||
@@ -4298,6 +4372,8 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
||||
theCommands.Add("OCC29807", "OCC29807 surface1 surface2 u1 v1 u2 v2", __FILE__, OCC29807, group);
|
||||
theCommands.Add("OCC29311", "OCC29311 shape counter nbiter: check performance of OBB calculation", __FILE__, OCC29311, group);
|
||||
theCommands.Add("OCC30391", "OCC30391 result face LenBeforeUfirst LenAfterUlast LenBeforeVfirst LenAfterVlast", __FILE__, OCC30391, group);
|
||||
theCommands.Add("OCC29745", "OCC29745 spreading of intervals of continuity on periodic curves",
|
||||
__FILE__, OCC29745, group);
|
||||
theCommands.Add("OCC29195", "OCC29195 [nbRep] doc1 [doc2 [doc3 [doc4]]]", __FILE__, OCC29195, group);
|
||||
theCommands.Add("OCC30435", "OCC30435 result curve inverse nbit", __FILE__, OCC30435, group);
|
||||
theCommands.Add("OCC30747", "OCC30747: create a closed curve", __FILE__, OCC30747, group);
|
||||
|
@@ -38,18 +38,11 @@
|
||||
#include <set>
|
||||
#include <typeinfo>
|
||||
#include <vector>
|
||||
#include <random>
|
||||
|
||||
//! Size of test data sets.
|
||||
const int THE_TEST_SIZE = 5000;
|
||||
|
||||
namespace {
|
||||
// Auxiliary class to use in std::random_shuffle()
|
||||
struct RandomGenerator {
|
||||
RandomGenerator () { srand(1); }
|
||||
ptrdiff_t operator () (ptrdiff_t upper) const { return rand() % upper; }
|
||||
};
|
||||
}
|
||||
|
||||
template<class CollectionType, class StlType>
|
||||
struct CollectionFiller
|
||||
{
|
||||
@@ -951,11 +944,13 @@ void TestPerformanceRandomIterator(Draw_Interpretor& di)
|
||||
aTimer.Reset();
|
||||
aTimer.Start();
|
||||
{
|
||||
RandomGenerator aRandomGen;
|
||||
std::random_device ran_dev;
|
||||
std::mt19937 gen(ran_dev());
|
||||
gen.seed(0x03ac38f2);
|
||||
for (Standard_Integer anIdx = 0; anIdx < 10; ++anIdx)
|
||||
{
|
||||
std::sort (aVector->begin(), aVector->end());
|
||||
std::random_shuffle (aVector->begin(), aVector->end(), aRandomGen);
|
||||
std::sort (aVector->begin(), aVector->end());
|
||||
std::shuffle (aVector->begin(), aVector->end(), gen);
|
||||
}
|
||||
}
|
||||
aTimer.Stop();
|
||||
@@ -965,11 +960,13 @@ void TestPerformanceRandomIterator(Draw_Interpretor& di)
|
||||
aTimer.Reset();
|
||||
aTimer.Start();
|
||||
{
|
||||
RandomGenerator aRandomGen;
|
||||
std::random_device ran_dev;
|
||||
std::mt19937 gen(ran_dev());
|
||||
gen.seed(0x03ac38f2);
|
||||
for (Standard_Integer anIdx = 0; anIdx < 10; ++anIdx)
|
||||
{
|
||||
std::sort (aCollec->begin(), aCollec->end());
|
||||
std::random_shuffle (aCollec->begin(), aCollec->end(), aRandomGen);
|
||||
std::sort (aCollec->begin(), aCollec->end());
|
||||
std::shuffle (aCollec->begin(), aCollec->end(), gen);
|
||||
}
|
||||
}
|
||||
aTimer.Stop();
|
||||
@@ -981,7 +978,7 @@ void TestPerformanceRandomIterator(Draw_Interpretor& di)
|
||||
|
||||
// check that result is the same
|
||||
if ( ! std::equal (aVector->begin(), aVector->end(), aCollec->begin()) )
|
||||
di << "Error: sequences are not the same at the end!\n";
|
||||
di << "Error: sequences are not the same at the end (random iterator)!\n";
|
||||
|
||||
delete aVector;
|
||||
delete aCollec;
|
||||
@@ -1033,7 +1030,7 @@ void TestPerformanceForwardIterator(Draw_Interpretor& di)
|
||||
|
||||
// check that result is the same
|
||||
if ( ! std::equal (aVector->begin(), aVector->end(), aCollec->begin()) )
|
||||
di << "Error: sequences are not the same at the end!\n";
|
||||
di << "Error: sequences are not the same at the end (forward iterator)!\n";
|
||||
|
||||
delete aVector;
|
||||
delete aCollec;
|
||||
@@ -1085,7 +1082,7 @@ void TestPerformanceBidirIterator(Draw_Interpretor& di)
|
||||
|
||||
// check that result is the same
|
||||
if ( ! std::equal (aVector->begin(), aVector->end(), aCollec->begin()) )
|
||||
di << "Error: sequences are not the same at the end!\n";
|
||||
di << "Error: sequences are not the same at the end (bidir iterator)!\n";
|
||||
|
||||
delete aVector;
|
||||
delete aCollec;
|
||||
@@ -1115,7 +1112,7 @@ void TestPerformanceMapAccess(Draw_Interpretor& di)
|
||||
aTimer.Reset();
|
||||
aTimer.Start();
|
||||
{
|
||||
for (Standard_Integer anIdx = 0; anIdx < 10000; ++anIdx)
|
||||
for (size_t anIdx = 0; anIdx < 10000; ++anIdx)
|
||||
{
|
||||
if (aSet.find (aVec[anIdx + 1000]) == aSet.end())
|
||||
aResult = Standard_False;
|
||||
@@ -1136,7 +1133,7 @@ void TestPerformanceMapAccess(Draw_Interpretor& di)
|
||||
aTimer.Reset();
|
||||
aTimer.Start();
|
||||
{
|
||||
for (Standard_Integer anIdx = 0; anIdx < 10000; ++anIdx)
|
||||
for (size_t anIdx = 0; anIdx < 10000; ++anIdx)
|
||||
{
|
||||
if (!aCollec->Contains (aVec[anIdx + 1000]))
|
||||
aResult = Standard_False;
|
||||
|
@@ -43,12 +43,14 @@
|
||||
|
||||
#ifdef HAVE_RAPIDJSON
|
||||
//#define RAPIDJSON_ASSERT
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/prettywriter.h>
|
||||
#include <rapidjson/stringbuffer.h>
|
||||
#include <rapidjson/istreamwrapper.h>
|
||||
#include <rapidjson/ostreamwrapper.h>
|
||||
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
typedef rapidjson::Document::ValueType RWGltf_JsonValue;
|
||||
#endif
|
||||
|
||||
|
@@ -14,8 +14,11 @@
|
||||
#ifndef _RWGltf_GltfOStreamWriter_HeaderFile
|
||||
#define _RWGltf_GltfOStreamWriter_HeaderFile
|
||||
|
||||
// disable warnings, occures in rapidjson
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <rapidjson/prettywriter.h>
|
||||
#include <rapidjson/ostreamwrapper.h>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
//! rapidjson::Writer wrapper for forward declaration.
|
||||
class RWGltf_GltfOStreamWriter : public rapidjson::Writer<rapidjson::OStreamWrapper>
|
||||
|
@@ -42,6 +42,8 @@ public:
|
||||
|
||||
BVHThread()
|
||||
: OSD_Thread(),
|
||||
myPool(nullptr),
|
||||
myMutex(),
|
||||
myToCatchFpe (Standard_False)
|
||||
{
|
||||
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <BRepTopAdaptor_TopolTool.hxx>
|
||||
#include <GC_MakeCircle.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <GCE2d_MakeLine.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2dConvert.hxx>
|
||||
@@ -1614,9 +1615,6 @@ void ShapeUpgrade_UnifySameDomain::UnionPCurves(const TopTools_SequenceOfShape&
|
||||
if (isFound)
|
||||
continue;
|
||||
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface (aFirstEdge, aFace, aFirst, aLast);
|
||||
|
||||
aFaceSeq.Append (aFace);
|
||||
}
|
||||
|
||||
@@ -1661,6 +1659,9 @@ void ShapeUpgrade_UnifySameDomain::UnionPCurves(const TopTools_SequenceOfShape&
|
||||
|
||||
if (aPCurveSeq.IsEmpty()) {
|
||||
Handle(Geom2d_Curve) aCopyPCurve = Handle(Geom2d_Curve)::DownCast(aPCurve->Copy());
|
||||
if (aCopyPCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
|
||||
aCopyPCurve = (Handle(Geom2d_TrimmedCurve)::DownCast(aCopyPCurve))->BasisCurve();
|
||||
|
||||
aPCurveSeq.Append(aCopyPCurve);
|
||||
aFirstsSeq.Append(aFirst);
|
||||
aLastsSeq.Append(aLast);
|
||||
@@ -1735,6 +1736,9 @@ void ShapeUpgrade_UnifySameDomain::UnionPCurves(const TopTools_SequenceOfShape&
|
||||
else
|
||||
{
|
||||
Handle(Geom2d_Curve) aCopyPCurve = Handle(Geom2d_Curve)::DownCast(aPCurve->Copy());
|
||||
if (aCopyPCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
|
||||
aCopyPCurve = (Handle(Geom2d_TrimmedCurve)::DownCast(aCopyPCurve))->BasisCurve();
|
||||
|
||||
aPCurveSeq.Append(aCopyPCurve);
|
||||
aFirstsSeq.Append(aFirst);
|
||||
aLastsSeq.Append(aLast);
|
||||
@@ -1855,57 +1859,53 @@ void ShapeUpgrade_UnifySameDomain::UnionPCurves(const TopTools_SequenceOfShape&
|
||||
}
|
||||
}
|
||||
|
||||
//Reparametrize 3d curve if needed
|
||||
//Reparametrize pcurves if needed
|
||||
if (!ResPCurves.IsEmpty())
|
||||
{
|
||||
if (Abs (aFirst3d - ResFirsts(1)) > aMaxTol ||
|
||||
Abs (aLast3d - ResLasts(1)) > aMaxTol)
|
||||
for (Standard_Integer ii = 1; ii <= ResPCurves.Length(); ii++)
|
||||
{
|
||||
GeomAdaptor_Curve aGAcurve (aCurve);
|
||||
GeomAbs_CurveType aType = aGAcurve.GetType();
|
||||
if (aType == GeomAbs_Line)
|
||||
if (Abs (aFirst3d - ResFirsts(ii)) > aMaxTol ||
|
||||
Abs (aLast3d - ResLasts(ii)) > aMaxTol)
|
||||
{
|
||||
gp_Lin aLin = aGAcurve.Line();
|
||||
gp_Dir aDir = aLin.Direction();
|
||||
gp_Pnt aPnt = aGAcurve.Value (aFirst3d);
|
||||
gp_Vec anOffset = -aDir;
|
||||
anOffset *= ResFirsts(1);
|
||||
aPnt.Translate (anOffset);
|
||||
Handle(Geom_Line) aLine = new Geom_Line (aPnt, aDir);
|
||||
aBuilder.UpdateEdge (theEdge, aLine, aTolEdge);
|
||||
aBuilder.Range(theEdge, ResFirsts(1), ResLasts(1));
|
||||
}
|
||||
else if (aType == GeomAbs_Circle)
|
||||
{
|
||||
gp_Circ aCirc = aGAcurve.Circle();
|
||||
Standard_Real aRadius = aCirc.Radius();
|
||||
gp_Ax2 aPosition = aCirc.Position();
|
||||
gp_Ax1 anAxis = aPosition.Axis();
|
||||
Standard_Real anOffset = aFirst3d - ResFirsts(1);
|
||||
aPosition.Rotate (anAxis, anOffset);
|
||||
Handle(Geom_Circle) aCircle = new Geom_Circle (aPosition, aRadius);
|
||||
aBuilder.UpdateEdge (theEdge, aCircle, aTolEdge);
|
||||
aBuilder.Range(theEdge, ResFirsts(1), ResLasts(1));
|
||||
}
|
||||
else //general case
|
||||
{
|
||||
for (Standard_Integer ii = 1; ii <= ResPCurves.Length(); ii++)
|
||||
Geom2dAdaptor_Curve aGAcurve (ResPCurves(ii));
|
||||
GeomAbs_CurveType aType = aGAcurve.GetType();
|
||||
if (aType == GeomAbs_Line)
|
||||
{
|
||||
if (Abs (aFirst3d - ResFirsts(ii)) > Precision::Confusion() ||
|
||||
Abs (aLast3d - ResLasts(ii)) > Precision::Confusion())
|
||||
{
|
||||
Handle(Geom2d_TrimmedCurve) aTrPCurve =
|
||||
new Geom2d_TrimmedCurve (ResPCurves(ii), ResFirsts(ii), ResLasts(ii));
|
||||
Handle(Geom2d_BSplineCurve) aBSplinePCurve = Geom2dConvert::CurveToBSplineCurve(aTrPCurve);
|
||||
TColStd_Array1OfReal aKnots (1, aBSplinePCurve->NbKnots());
|
||||
aBSplinePCurve->Knots (aKnots);
|
||||
BSplCLib::Reparametrize (aFirst3d, aLast3d, aKnots);
|
||||
aBSplinePCurve->SetKnots (aKnots);
|
||||
ResPCurves(ii) = aBSplinePCurve;
|
||||
}
|
||||
gp_Lin2d aLin2d = aGAcurve.Line();
|
||||
gp_Dir2d aDir2d = aLin2d.Direction();
|
||||
gp_Pnt2d aPnt2d = aGAcurve.Value(ResFirsts(ii));
|
||||
gp_Vec2d anOffset = -aDir2d;
|
||||
anOffset *= aFirst3d;
|
||||
aPnt2d.Translate (anOffset);
|
||||
Handle(Geom2d_Line) aNewLine2d = new Geom2d_Line (aPnt2d, aDir2d);
|
||||
ResPCurves(ii) = aNewLine2d;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aType == GeomAbs_Circle)
|
||||
{
|
||||
gp_Circ2d aCirc2d = aGAcurve.Circle();
|
||||
Standard_Real aRadius = aCirc2d.Radius();
|
||||
gp_Ax22d aPosition = aCirc2d.Position();
|
||||
gp_Pnt2d aLocation = aCirc2d.Location();
|
||||
Standard_Real anOffset = ResFirsts(ii) - aFirst3d;
|
||||
aPosition.Rotate (aLocation, anOffset);
|
||||
Handle(Geom2d_Circle) aNewCircle2d = new Geom2d_Circle (aPosition, aRadius);
|
||||
ResPCurves(ii) = aNewCircle2d;
|
||||
}
|
||||
else //general case
|
||||
{
|
||||
Handle(Geom2d_TrimmedCurve) aTrPCurve =
|
||||
new Geom2d_TrimmedCurve (ResPCurves(ii), ResFirsts(ii), ResLasts(ii));
|
||||
Handle(Geom2d_BSplineCurve) aBSplinePCurve = Geom2dConvert::CurveToBSplineCurve(aTrPCurve);
|
||||
TColStd_Array1OfReal aKnots (1, aBSplinePCurve->NbKnots());
|
||||
aBSplinePCurve->Knots (aKnots);
|
||||
BSplCLib::Reparametrize (aFirst3d, aLast3d, aKnots);
|
||||
aBSplinePCurve->SetKnots (aKnots);
|
||||
ResPCurves(ii) = aBSplinePCurve;
|
||||
}
|
||||
ResFirsts(ii) = aFirst3d;
|
||||
ResLasts(ii) = aLast3d;
|
||||
} //if ranges > aMaxTol
|
||||
} //for (Standard_Integer ii = 1; ii <= ResPCurves.Length(); ii++)
|
||||
}
|
||||
|
||||
for (Standard_Integer j = 1; j <= ResPCurves.Length(); j++)
|
||||
|
@@ -151,166 +151,192 @@ static Handle(StepGeom_TrimmedCurve) MakeTrimmedCurve (const Handle(StepGeom_Cur
|
||||
}
|
||||
|
||||
Standard_Boolean TopoDSToStep_WireframeBuilder::
|
||||
GetTrimmedCurveFromEdge(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& aFace,
|
||||
MoniTool_DataMapOfShapeTransient& aMap,
|
||||
Handle(TColStd_HSequenceOfTransient)& curveList) const
|
||||
GetTrimmedCurveFromEdge(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
MoniTool_DataMapOfShapeTransient& theMap,
|
||||
Handle(TColStd_HSequenceOfTransient)& theCurveList) const
|
||||
{
|
||||
if (theEdge.Orientation() == TopAbs_INTERNAL ||
|
||||
theEdge.Orientation() == TopAbs_EXTERNAL ) {
|
||||
if (theEdge.Orientation() == TopAbs_INTERNAL ||
|
||||
theEdge.Orientation() == TopAbs_EXTERNAL )
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout <<"Warning: TopoDSToStep_WireframeBuilder::GetTrimmedCurveFromEdge: Edge is internal or external; dropped" << std::endl;
|
||||
#endif
|
||||
return Standard_False;
|
||||
}
|
||||
//szv#4:S4163:12Mar99 SGI warns
|
||||
TopoDS_Shape sh = theEdge.Oriented(TopAbs_FORWARD);
|
||||
TopoDS_Edge anEdge = TopoDS::Edge ( sh );
|
||||
TopoDS_Shape aSh = theEdge.Oriented(TopAbs_FORWARD);
|
||||
TopoDS_Edge anEdge = TopoDS::Edge ( aSh );
|
||||
|
||||
// resulting curve
|
||||
Handle(StepGeom_Curve) Gpms;
|
||||
|
||||
if ( aMap.IsBound(anEdge)) {
|
||||
Gpms = Handle(StepGeom_Curve)::DownCast ( aMap.Find(anEdge) );
|
||||
if ( Gpms.IsNull() ) return Standard_False;
|
||||
//?? curveList->Append(Gpms);
|
||||
return Standard_True;
|
||||
Handle(StepGeom_Curve) aSGC;
|
||||
if (const Handle(Standard_Transient)* aTransient = theMap.Seek(anEdge))
|
||||
{
|
||||
aSGC = Handle(StepGeom_Curve)::DownCast(*aTransient);
|
||||
}
|
||||
|
||||
BRepAdaptor_Curve CA;
|
||||
try {
|
||||
BRepAdaptor_Curve aCA;
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
CA.Initialize (anEdge);
|
||||
aCA.Initialize (anEdge);
|
||||
}
|
||||
catch (Standard_NullObject const&) {
|
||||
catch (Standard_NullObject const&)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// Vertices
|
||||
TopoDS_Vertex Vfirst, Vlast;
|
||||
Handle(StepGeom_CartesianPoint) pmsP1, pmsP2;
|
||||
for (TopoDS_Iterator It(anEdge);It.More();It.Next()) {
|
||||
// Translates the Edge Vertices
|
||||
TopoDS_Vertex V = TopoDS::Vertex(It.Value());
|
||||
gp_Pnt gpP = BRep_Tool::Pnt(V);
|
||||
if ( V.Orientation() == TopAbs_FORWARD ) {
|
||||
Vfirst = V;
|
||||
TopoDS_Vertex aVFirst, aVLast;
|
||||
Handle(StepGeom_CartesianPoint) aSGCP1, aSGCP2;
|
||||
for (TopExp_Explorer anExp(anEdge, TopAbs_VERTEX); anExp.More(); anExp.Next())
|
||||
{
|
||||
TopoDS_Vertex aVertex = TopoDS::Vertex(anExp.Value());
|
||||
gp_Pnt aGpP = BRep_Tool::Pnt(aVertex);
|
||||
if (aVertex.Orientation() == TopAbs_FORWARD)
|
||||
{
|
||||
aVFirst = aVertex;
|
||||
// 1.point for trimming
|
||||
GeomToStep_MakeCartesianPoint gtpP(gpP);
|
||||
pmsP1 = gtpP.Value();
|
||||
GeomToStep_MakeCartesianPoint aGTSMCP(aGpP);
|
||||
aSGCP1 = aGTSMCP.Value();
|
||||
}
|
||||
if ( V.Orientation() == TopAbs_REVERSED ) {
|
||||
Vlast = V;
|
||||
if (aVertex.Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
aVLast = aVertex;
|
||||
// 2.point for trimming
|
||||
GeomToStep_MakeCartesianPoint gtpP(gpP);
|
||||
pmsP2 = gtpP.Value();
|
||||
GeomToStep_MakeCartesianPoint aGTSMCP(aGpP);
|
||||
aSGCP2 = aGTSMCP.Value();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------
|
||||
// Translate 3D representation of the Edge
|
||||
// ---------------------------------------
|
||||
|
||||
|
||||
// Handle(Geom_Curve) C = CA.Curve().Curve();
|
||||
|
||||
// UPDATE FMA 26-02-96
|
||||
// General remark : this full code should be deaply reworked
|
||||
// Too many objects are not used !
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom_Curve) aC = BRep_Tool::Curve(anEdge, aFirst, aLast);
|
||||
|
||||
Standard_Real First, Last;
|
||||
Handle(Geom_Curve) C = BRep_Tool::Curve(anEdge, First, Last);
|
||||
if ( ! C.IsNull() ) {
|
||||
if (C->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
|
||||
C = Handle(Geom_TrimmedCurve)::DownCast(C)->BasisCurve();
|
||||
GeomToStep_MakeCurve gtpC(C);
|
||||
|
||||
if(!gtpC.IsDone())
|
||||
if (!aC.IsNull())
|
||||
{
|
||||
if (aC->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
|
||||
{
|
||||
aC = Handle(Geom_TrimmedCurve)::DownCast(aC)->BasisCurve();
|
||||
}
|
||||
GeomToStep_MakeCurve aGTSMC(aC);
|
||||
if (!aGTSMC.IsDone())
|
||||
{
|
||||
return Standard_False;
|
||||
|
||||
Handle(StepGeom_Curve) pmsC = gtpC.Value();
|
||||
}
|
||||
Handle(StepGeom_Curve) aPMSC = aGTSMC.Value();
|
||||
|
||||
// trim the curve
|
||||
Standard_Real trim1 = CA.FirstParameter();
|
||||
Standard_Real trim2 = CA.LastParameter();
|
||||
/* //:j1 abv 22 Oct 98: radians are used in the produced STEP file (at least by default)
|
||||
if(C->IsKind(STANDARD_TYPE(Geom_Circle)) ||
|
||||
C->IsKind(STANDARD_TYPE(Geom_Ellipse))) {
|
||||
Standard_Real fact = 180. / M_PI;
|
||||
trim1 = trim1 * fact;
|
||||
trim2 = trim2 * fact;
|
||||
Standard_Real aTrim1 = aCA.FirstParameter();
|
||||
Standard_Real aTrim2 = aCA.LastParameter();
|
||||
|
||||
if (aVFirst.IsNull() && aVLast.IsNull() && Precision::IsInfinite(aFirst) && Precision::IsInfinite(aLast))
|
||||
{
|
||||
GeomToStep_MakeCurve aCurveMaker(aC);
|
||||
if (aCurveMaker.IsDone())
|
||||
{
|
||||
aSGC = aCurveMaker.Value();
|
||||
theCurveList->Append(aSGC);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
*/
|
||||
Gpms = MakeTrimmedCurve (pmsC, pmsP1, pmsP2, trim1, trim2, Standard_True );
|
||||
// (anEdge.Orientation() == TopAbs_FORWARD));
|
||||
if (aVFirst.IsNull())
|
||||
{
|
||||
GeomToStep_MakeCartesianPoint aGTSMCP(aCA.Value(aFirst));
|
||||
aSGCP1 = aGTSMCP.Value();
|
||||
}
|
||||
if (aVLast.IsNull())
|
||||
{
|
||||
GeomToStep_MakeCartesianPoint aGTSMCP(aCA.Value(aLast));
|
||||
aSGCP2 = aGTSMCP.Value();
|
||||
}
|
||||
|
||||
/* //:j1 abv 22 Oct 98: radians are used in the produced STEP file (at least by default)
|
||||
if(C->IsKind(STANDARD_TYPE(Geom_Circle)) ||
|
||||
C->IsKind(STANDARD_TYPE(Geom_Ellipse))) {
|
||||
Standard_Real fact = 180. / M_PI;
|
||||
trim1 = trim1 * fact;
|
||||
trim2 = trim2 * fact;
|
||||
}
|
||||
*/
|
||||
aSGC = MakeTrimmedCurve(aPMSC, aSGCP1, aSGCP2, aTrim1, aTrim2, Standard_True);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
|
||||
// -------------------------
|
||||
// a 3D Curve is constructed
|
||||
// -------------------------
|
||||
|
||||
Standard_Boolean iaplan = Standard_False;
|
||||
if ( ! aFace.IsNull() ) {
|
||||
Standard_Real cf, cl;
|
||||
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(anEdge, aFace, cf, cl);
|
||||
Handle(Geom_Surface) S = BRep_Tool::Surface(aFace);
|
||||
if (S->IsKind(STANDARD_TYPE(Geom_Plane)) &&
|
||||
C2d->IsKind(STANDARD_TYPE(Geom2d_Line))) iaplan = Standard_True;
|
||||
Standard_Boolean aIPlan = Standard_False;
|
||||
if (!theFace.IsNull())
|
||||
{
|
||||
Standard_Real aCF, aCL;
|
||||
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(anEdge, theFace, aCF, aCL);
|
||||
Handle(Geom_Surface) aS = BRep_Tool::Surface(theFace);
|
||||
if (aS->IsKind(STANDARD_TYPE(Geom_Plane)) && aC2d->IsKind(STANDARD_TYPE(Geom2d_Line)))
|
||||
{
|
||||
aIPlan = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
// to be modified : cf and cl are the topological trimming parameter
|
||||
// these are computed after ! (U1 and U2) -> cf and cl instead
|
||||
if (iaplan) {
|
||||
gp_Pnt Pnt1 = CA.Value(CA.FirstParameter()), Pnt2 = CA.Value(CA.LastParameter());
|
||||
gp_Vec V ( Pnt1, Pnt2 );
|
||||
Standard_Real length = V.Magnitude();
|
||||
if ( length >= Precision::Confusion() ) {
|
||||
Handle(Geom_Line) L = new Geom_Line(Pnt1, gp_Dir(V));
|
||||
GeomToStep_MakeLine gtpL(L);
|
||||
Gpms = gtpL.Value();
|
||||
Gpms = MakeTrimmedCurve (gtpL.Value(), pmsP1, pmsP2, 0, length, Standard_True );
|
||||
// (anEdge.Orientation() == TopAbs_FORWARD));
|
||||
if (aIPlan)
|
||||
{
|
||||
gp_Pnt aPnt1 = aCA.Value(aCA.FirstParameter()), aPnt2 = aCA.Value(aCA.LastParameter());
|
||||
gp_Vec aV(aPnt1, aPnt2);
|
||||
Standard_Real aLength = aV.Magnitude();
|
||||
if (aLength >= Precision::Confusion())
|
||||
{
|
||||
Handle(Geom_Line) aL = new Geom_Line(aPnt1, gp_Dir(aV));
|
||||
GeomToStep_MakeLine aGTSML(aL);
|
||||
aSGC = aGTSML.Value();
|
||||
aSGC = MakeTrimmedCurve(aGTSML.Value(), aSGCP1, aSGCP2, 0, aLength, Standard_True);
|
||||
}
|
||||
#ifdef OCCT_DEBUG
|
||||
else std::cout << "Warning: TopoDSToStep_WireframeBuilder::GetTrimmedCurveFromEdge: Null-length curve not mapped" << std::endl;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
TColgp_Array1OfPnt Points(1,Nbpt);
|
||||
TColStd_Array1OfReal Knots(1,Nbpt);
|
||||
TColStd_Array1OfInteger Mult(1,Nbpt);
|
||||
Standard_Real U1 = CA.FirstParameter();
|
||||
Standard_Real U2 = CA.LastParameter();
|
||||
for ( Standard_Integer i=1; i<=Nbpt; i++ ) {
|
||||
Standard_Real U = U1 + (i-1)*(U2 - U1)/(Nbpt - 1);
|
||||
gp_Pnt P = CA.Value(U);
|
||||
Points.SetValue(i,P);
|
||||
Knots.SetValue(i,U);
|
||||
Mult.SetValue(i,1);
|
||||
else
|
||||
{
|
||||
TColgp_Array1OfPnt aPoints(1, Nbpt);
|
||||
TColStd_Array1OfReal aKnots(1, Nbpt);
|
||||
TColStd_Array1OfInteger aMult(1, Nbpt);
|
||||
Standard_Real aU1 = aCA.FirstParameter();
|
||||
Standard_Real aU2 = aCA.LastParameter();
|
||||
for (Standard_Integer i = 1; i <= Nbpt; i++)
|
||||
{
|
||||
Standard_Real aU = aU1 + (i - 1) * (aU2 - aU1) / (Nbpt - 1);
|
||||
gp_Pnt aP = aCA.Value(aU);
|
||||
aPoints.SetValue(i, aP);
|
||||
aKnots.SetValue(i, aU);
|
||||
aMult.SetValue(i, 1);
|
||||
}
|
||||
Points.SetValue(1, BRep_Tool::Pnt(Vfirst));
|
||||
Points.SetValue(Nbpt, BRep_Tool::Pnt(Vlast));
|
||||
Mult.SetValue(1,2);
|
||||
Mult.SetValue(Nbpt,2);
|
||||
Handle(Geom_Curve) Bs =
|
||||
new Geom_BSplineCurve(Points, Knots, Mult, 1);
|
||||
GeomToStep_MakeCurve gtpC(Bs);
|
||||
Gpms = gtpC.Value();
|
||||
aPoints.SetValue(1, BRep_Tool::Pnt(aVFirst));
|
||||
aPoints.SetValue(Nbpt, BRep_Tool::Pnt(aVLast));
|
||||
aMult.SetValue(1, 2);
|
||||
aMult.SetValue(Nbpt, 2);
|
||||
Handle(Geom_Curve) aBSCurve = new Geom_BSplineCurve(aPoints, aKnots, aMult, 1);
|
||||
GeomToStep_MakeCurve aGTSMC(aBSCurve);
|
||||
aSGC = aGTSMC.Value();
|
||||
}
|
||||
}
|
||||
if( Gpms.IsNull() ) return Standard_False;
|
||||
|
||||
aMap.Bind(anEdge, Gpms);
|
||||
curveList->Append(Gpms);
|
||||
if (aSGC.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
theMap.Bind(anEdge, aSGC);
|
||||
theCurveList->Append(aSGC);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean TopoDSToStep_WireframeBuilder::
|
||||
GetTrimmedCurveFromFace(const TopoDS_Face& aFace,
|
||||
MoniTool_DataMapOfShapeTransient& aMap,
|
||||
Handle(TColStd_HSequenceOfTransient)& aCurveList) const
|
||||
MoniTool_DataMapOfShapeTransient& aMap,
|
||||
Handle(TColStd_HSequenceOfTransient)& aCurveList) const
|
||||
{
|
||||
TopoDS_Shape curShape;
|
||||
TopoDS_Edge curEdge;
|
||||
|
@@ -27,27 +27,37 @@ CommitCommand D0
|
||||
SaveAs D0 ${docname}
|
||||
Close D0
|
||||
|
||||
set whole_time [lindex [time {
|
||||
Open ${docname} D1
|
||||
Close D1
|
||||
} 20] 0]
|
||||
# Computes the elapsed time of open and close document with a given arguments (as text).
|
||||
# It launches 10 iteration, 10 actions in each. Returns time of average time of the minimum-time iteration.
|
||||
proc action_time args {
|
||||
global docname
|
||||
set min_time 1000000
|
||||
for {set iter 0} {$iter < 10} {incr iter} {
|
||||
set iter_time [lindex [time {
|
||||
Open ${docname} D {*}$args
|
||||
Close D
|
||||
} 10] 0]
|
||||
puts "Iteration time $iter_time mcs"
|
||||
if {$iter_time < $min_time} {
|
||||
set min_time $iter_time
|
||||
}
|
||||
}
|
||||
|
||||
return $min_time
|
||||
}
|
||||
|
||||
set whole_time [action_time]
|
||||
puts "Whole document open time $whole_time mcs"
|
||||
|
||||
set quater_time [lindex [time {
|
||||
Open ${docname} D2 -read0:2
|
||||
Close D2
|
||||
} 20] 0]
|
||||
set quater_time [action_time -read0:2]
|
||||
puts "Quater of document open time $quater_time mcs"
|
||||
|
||||
# Check that open of quater of the document is at least twice faster than open of whole.
|
||||
if { [expr $quater_time * 2] > $whole_time } {
|
||||
# Check that open of quater of the document is significantly faster than open of whole.
|
||||
if { [expr $quater_time * 1.5] > $whole_time } {
|
||||
puts "Error : loading of quater of the document content too slow relatively to the whole document load"
|
||||
}
|
||||
|
||||
set four_quaters_time [lindex [time {
|
||||
Open ${docname} D3 -read0:1 -read0:2 -read0:3 -read0:4
|
||||
Close D3
|
||||
} 20] 0]
|
||||
set four_quaters_time [action_time -read0:1 -read0:2 -read0:3 -read0:4]
|
||||
puts "Four quaters of document open time $four_quaters_time mcs"
|
||||
|
||||
# Check that open of four quaters of the document is not too much slower than opening of the whole document.
|
||||
@@ -69,6 +79,7 @@ if {![catch {Attributes D4 0:1:1:13}] || ![catch {Attributes D4 0:1:3:14}] || ![
|
||||
puts "Error : loading of document skipping arrays and sub-trees contains invalid attributes list"
|
||||
}
|
||||
|
||||
# check for appending arrays to the document from the file
|
||||
set append_arrays_time [lindex [time {
|
||||
Open ${docname} D4 -append -readTDataStd_IntegerArray -read0:2 -read0:3
|
||||
}] 0]
|
||||
|
@@ -9,14 +9,15 @@
|
||||
009 modalg_5
|
||||
010 modalg_6
|
||||
011 modalg_7
|
||||
012 moddata_1
|
||||
013 moddata_2
|
||||
014 moddata_3
|
||||
015 step
|
||||
016 caf
|
||||
017 mesh
|
||||
018 heal
|
||||
019 stlvrml
|
||||
020 splitshape
|
||||
021 splitshape_1
|
||||
022 filling
|
||||
012 modalg_8
|
||||
013 moddata_1
|
||||
014 moddata_2
|
||||
015 moddata_3
|
||||
016 step
|
||||
017 caf
|
||||
018 mesh
|
||||
019 heal
|
||||
020 stlvrml
|
||||
021 splitshape
|
||||
022 splitshape_1
|
||||
023 filling
|
||||
|
20
tests/bugs/heal/bug32719
Normal file
20
tests/bugs/heal/bug32719
Normal file
@@ -0,0 +1,20 @@
|
||||
puts "============================================================"
|
||||
puts "OCC32719: UnifySameDomain result has incorrect triangulation"
|
||||
puts "============================================================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32719.brep] a
|
||||
|
||||
unifysamedom result a
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -t -solid 4 -shell 4 -face 20 -wire 20 -edge 32 -vertex 16
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 6.e-6} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
checkprops result -s 0.0222593 -v 5.17261e-05
|
24
tests/bugs/modalg_5/bug23820_1
Normal file
24
tests/bugs/modalg_5/bug23820_1
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
#############################################################
|
||||
## OCC23820: Test of the wire projection on the complicated
|
||||
## shell of several faces without parameter
|
||||
#############################################################
|
||||
|
||||
pload MODELING
|
||||
|
||||
vertex v1 297.706909179688 19.969066619873 9.07486343383789
|
||||
vertex v2 282.750762939453 24.8436107635498 6.85506725311279
|
||||
vertex v3 284.397491455078 7.2792820930481 -0.00160308415070176
|
||||
vertex v4 301.926666259766 5.67953395843506 0.0583421923220158
|
||||
edge e1 v1 v2
|
||||
edge e2 v2 v3
|
||||
edge e3 v3 v4
|
||||
edge e4 v4 v1
|
||||
wire w e1 e2 e3 e4
|
||||
|
||||
restore [locate_data_file bug23820_non_planar.brep] shell
|
||||
|
||||
nproject result w shell
|
||||
|
||||
checknbshapes result -vertex 24 -edge 14 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 39
|
||||
checkprops result -l 83.0174
|
24
tests/bugs/modalg_5/bug23820_2
Normal file
24
tests/bugs/modalg_5/bug23820_2
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
#############################################################
|
||||
## OCC23820: Test of the wire projection on the complicated
|
||||
## shell of several faces with a certain parameter
|
||||
#############################################################
|
||||
|
||||
pload MODELING
|
||||
|
||||
vertex v1 297.706909179688 19.969066619873 9.07486343383789
|
||||
vertex v2 282.750762939453 24.8436107635498 6.85506725311279
|
||||
vertex v3 284.397491455078 7.2792820930481 -0.00160308415070176
|
||||
vertex v4 301.926666259766 5.67953395843506 0.0583421923220158
|
||||
edge e1 v1 v2
|
||||
edge e2 v2 v3
|
||||
edge e3 v3 v4
|
||||
edge e4 v4 v1
|
||||
wire w e1 e2 e3 e4
|
||||
|
||||
restore [locate_data_file bug23820_non_planar.brep] shell
|
||||
|
||||
nproject result w shell -d 2.0
|
||||
|
||||
checknbshapes result -vertex 12 -edge 6 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 19
|
||||
checkprops result -l 73.9585
|
45
tests/bugs/modalg_5/bug24657
Normal file
45
tests/bugs/modalg_5/bug24657
Normal file
@@ -0,0 +1,45 @@
|
||||
puts "============"
|
||||
puts "0024657: 2dintersect returns different number of intersect points"
|
||||
puts "==========="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug24657.brep] a
|
||||
|
||||
explode a e
|
||||
|
||||
# Initialize two 2d pcurves
|
||||
pcurve p4 a_4 a
|
||||
pcurve p5 a_5 a
|
||||
|
||||
# Recieve an output strings of the intersection operation
|
||||
set inter1 [2dintersect p4 p5 -tol 1.e-7]
|
||||
set inter2 [2dintersect p5 p4 -tol 1.e-7]
|
||||
|
||||
# Check if the number of intersections is equal to 1
|
||||
set int1 [regexp -all {Intersection point} ${inter1}]
|
||||
set int2 [regexp -all {Intersection point} ${inter2}]
|
||||
|
||||
if { ${int1} != ${int2} || ${int1} != 1} {
|
||||
puts "Error : The intersection points number is different!"
|
||||
}
|
||||
|
||||
# Verify the coordinates of the intersection points
|
||||
regexp -all {Intersection point 1 : ([-0-9.+eE]+) ([-0-9.+eE]+)} $inter1 full x1 y1
|
||||
regexp -all {Intersection point 1 : ([-0-9.+eE]+) ([-0-9.+eE]+)} $inter2 full x2 y2
|
||||
if { [expr abs($x1 - $x2)] > 1.e-7 || [expr abs($y1 - $y2) ] > 1.e-7} {
|
||||
puts "Error : The intersection points do not match!"
|
||||
}
|
||||
|
||||
regexp -all {parameter on the fist: ([-0-9.+eE]+) parameter on the second: ([-0-9.+eE]+)} $inter1 full par11 par12
|
||||
regexp -all {parameter on the fist: ([-0-9.+eE]+) parameter on the second: ([-0-9.+eE]+)} $inter2 full par21 par22
|
||||
|
||||
if { [expr abs($par11 - $par22)] > 1.e-7 || [expr abs($par21 - $par12) ] > 1.e-7} {
|
||||
puts "Error : The intersection points parameters do not match!"
|
||||
}
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
|
||||
xwd ${imagedir}/${test_image}.png
|
@@ -20,15 +20,15 @@ compound vl v1l vnl vol vil result
|
||||
|
||||
set nbshapes_expected "
|
||||
Number of shapes in shape
|
||||
VERTEX : 103
|
||||
EDGE : 52
|
||||
VERTEX : 109
|
||||
EDGE : 55
|
||||
WIRE : 0
|
||||
FACE : 0
|
||||
SHELL : 0
|
||||
SOLID : 0
|
||||
COMPSOLID : 0
|
||||
COMPOUND : 1
|
||||
SHAPE : 156
|
||||
SHAPE : 165
|
||||
"
|
||||
|
||||
checknbshapes result -ref ${nbshapes_expected} -t -m "HLRToShape"
|
||||
|
@@ -11,7 +11,7 @@ circle c 1 0 0 150
|
||||
set res1 [OCC27884 c 400 0]
|
||||
regexp {Improving time: +([-0-9.+eE]+) %} $res1 full time1
|
||||
|
||||
if { $time1 <= 5 } {
|
||||
if { $time1 <= 4 } {
|
||||
puts "Error: algorithm slowed down"
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ if { $time1 <= 5 } {
|
||||
set res2 [OCC27884 c 250 1]
|
||||
regexp {Improving time: +([-0-9.+eE]+) %} $res2 full time2
|
||||
|
||||
if { $time2 <= 5 } {
|
||||
if { $time2 <= 3 } {
|
||||
puts "Error: algorithm slowed down"
|
||||
}
|
||||
|
||||
|
11
tests/bugs/modalg_7/bug31361
Normal file
11
tests/bugs/modalg_7/bug31361
Normal file
@@ -0,0 +1,11 @@
|
||||
puts "================================================="
|
||||
puts "0031361: Modeling algorithms - A crash arise when building tube"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
puts "REQUIRED ALL: Error: GeomFill_Pipe cannot make a surface"
|
||||
|
||||
circle c1 0 0 0 10
|
||||
circle c2 0 100 0 10
|
||||
beziercurve curve 4 0 0 0 100 0 0 100 100 0 0 100 0
|
||||
tuyau t curve c1 c2
|
26
tests/bugs/modalg_7/bug32066
Normal file
26
tests/bugs/modalg_7/bug32066
Normal file
@@ -0,0 +1,26 @@
|
||||
puts "======================================================="
|
||||
puts "0032066: Modeling Algorithms - Incorrect result of Boolean CUT operation"
|
||||
puts "======================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32066_solid.brep] s
|
||||
|
||||
restore [locate_data_file bug32066_hole_2547.brep] h1
|
||||
restore [locate_data_file bug32066_hole_2562.brep] h2
|
||||
restore [locate_data_file bug32066_hole_2563.brep] h3
|
||||
restore [locate_data_file bug32066_hole_2564.brep] h4
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects s
|
||||
baddtools h1 h2 h3 h4
|
||||
bfillds
|
||||
|
||||
bbop r 2
|
||||
|
||||
checkshape r
|
||||
|
||||
checknbshapes r -wire 73 -face 65 -shell 1 -solid 1 -t
|
||||
checkprops r -s 3.45489e+07 -v 1.54742e+08
|
||||
|
||||
checkview -display r -2d -path ${imagedir}/${test_image}.png
|
43
tests/bugs/modalg_7/bug32863
Normal file
43
tests/bugs/modalg_7/bug32863
Normal file
@@ -0,0 +1,43 @@
|
||||
puts "================================================="
|
||||
puts "0032863: Cone surface returns wrong v derivative "
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
cone c 0.2 2.0
|
||||
|
||||
set u 5.23290599890759
|
||||
set v 5.06498283391571
|
||||
|
||||
# reference data
|
||||
svalue c $u $v x y z dux duy duz dvx dvy dvz d2ux d2uy d2uz d2vx d2vy d2vz d2uvx d2uvy d2uvz
|
||||
set dxRef [list [dval x] [dval dux] [dval dvx] [dval d2ux] [dval d2uvx] [dval d2vx]]
|
||||
set dyRef [list [dval y] [dval duy] [dval dvy] [dval d2uy] [dval d2uvy] [dval d2vy]]
|
||||
set dzRef [list [dval z] [dval duz] [dval dvz] [dval d2uz] [dval d2uvz] [dval d2vz]]
|
||||
|
||||
# compute derivatives till the second order
|
||||
puts "======================================="
|
||||
set tolerance 1.e-7
|
||||
for {set order 1} {$order <= 2} {incr order} {
|
||||
for {set nv 0} {$nv <= $order} {incr nv} {
|
||||
set nu [expr $order - $nv]
|
||||
|
||||
set offset [expr $order * ($order + 1) / 2 + $nv]
|
||||
set ref_dx [lindex $dxRef $offset]
|
||||
set ref_dy [lindex $dyRef $offset]
|
||||
set ref_dz [lindex $dzRef $offset]
|
||||
|
||||
sderivative c $u $v $nu $nv dx dy dz
|
||||
set dx [dval dx]
|
||||
set dy [dval dy]
|
||||
set dz [dval dz]
|
||||
|
||||
puts ""
|
||||
puts "Order of derivative: Nu = $nu, Nv = $nv"
|
||||
puts "Expected ($ref_dx, $ref_dy, $ref_dz)"
|
||||
puts "Actual ($dx, $dy, $dz)"
|
||||
checkreal "dX " $dx $ref_dx $tolerance $tolerance
|
||||
checkreal "dY " $dy $ref_dy $tolerance $tolerance
|
||||
checkreal "dZ " $dz $ref_dz $tolerance $tolerance
|
||||
puts "======================================="
|
||||
}
|
||||
}
|
25
tests/bugs/modalg_7/bug32874_1
Normal file
25
tests/bugs/modalg_7/bug32874_1
Normal file
@@ -0,0 +1,25 @@
|
||||
puts "================================================="
|
||||
puts "0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
set distExpected 10
|
||||
circle c1 0 0 0 100
|
||||
circle c2 0 0 0 100+$distExpected
|
||||
|
||||
set nbSteps 72
|
||||
for {set i 1} {$i < $nbSteps} {incr i} {
|
||||
trim cc1 c1 0 2.*pi/$nbSteps*$i
|
||||
trim cc2 c2 0 2.*pi/$nbSteps*$i
|
||||
|
||||
set extr [extrema cc1 cc2]
|
||||
if {[regexp {Infinite number of extremas, distance = ([-0-9.+eE]+)} $extr full dist]} {
|
||||
if {[expr abs($dist - $distExpected)] < 1.e-7} {
|
||||
puts "OK"
|
||||
} else {
|
||||
puts "Error: wrong distance $dist instead of $distExpected expected"
|
||||
}
|
||||
} else {
|
||||
puts "Error: non-parallel curves"
|
||||
}
|
||||
}
|
29
tests/bugs/modalg_7/bug32874_2
Normal file
29
tests/bugs/modalg_7/bug32874_2
Normal file
@@ -0,0 +1,29 @@
|
||||
puts "================================================="
|
||||
puts "0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
set distExpected 3.5
|
||||
circle c1 0 0 0 100
|
||||
circle c2 0 0 0 100+$distExpected
|
||||
|
||||
set start {0.0 0.5*pi pi 1.5*pi 2.0*pi}
|
||||
set delta {pi/4.0 pi/3.0 pi/2.0 0.55*pi 0.99*pi pi 1.1*pi}
|
||||
|
||||
foreach f $start {
|
||||
foreach d $delta {
|
||||
trim cc1 c1 $f $f+$d
|
||||
trim cc2 c2 $f $f+$d
|
||||
|
||||
set extr [extrema cc1 cc2]
|
||||
if {[regexp {Infinite number of extremas, distance = ([-0-9.+eE]+)} $extr full dist]} {
|
||||
if {[expr abs($dist - $distExpected)] < 1.e-7} {
|
||||
puts "OK"
|
||||
} else {
|
||||
puts "Error: wrong distance $dist instead of $distExpected expected"
|
||||
}
|
||||
} else {
|
||||
puts "Error: non-parallel curves"
|
||||
}
|
||||
}
|
||||
}
|
30
tests/bugs/modalg_7/bug32874_3
Normal file
30
tests/bugs/modalg_7/bug32874_3
Normal file
@@ -0,0 +1,30 @@
|
||||
puts "================================================="
|
||||
puts "0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
set radius 0.001
|
||||
set distExpected 0.00001
|
||||
circle c1 0 0 0 $radius
|
||||
circle c2 0 0 0 $radius+$distExpected
|
||||
|
||||
set start {0.0 0.5*pi pi 1.5*pi 2.0*pi}
|
||||
set delta {pi/4.0 pi/3.0 pi/2.0 0.55*pi 0.99*pi pi 1.1*pi}
|
||||
|
||||
foreach f $start {
|
||||
foreach d $delta {
|
||||
trim cc1 c1 $f $f+$d
|
||||
trim cc2 c2 $f $f+$d
|
||||
|
||||
set extr [extrema cc1 cc2]
|
||||
if {[regexp {Infinite number of extremas, distance = ([-0-9.+eE]+)} $extr full dist]} {
|
||||
if {[expr abs($dist - $distExpected)] < 1.e-7} {
|
||||
puts "OK"
|
||||
} else {
|
||||
puts "Error: wrong distance $dist instead of $distExpected expected"
|
||||
}
|
||||
} else {
|
||||
puts "Error: non-parallel curves"
|
||||
}
|
||||
}
|
||||
}
|
30
tests/bugs/modalg_7/bug32874_4
Normal file
30
tests/bugs/modalg_7/bug32874_4
Normal file
@@ -0,0 +1,30 @@
|
||||
puts "================================================="
|
||||
puts "0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
set radius 0.001
|
||||
set distExpected 1000.0
|
||||
circle c1 0 0 0 $radius
|
||||
circle c2 0 0 0 $radius+$distExpected
|
||||
|
||||
set start {0.0 0.5*pi pi 1.5*pi 2.0*pi}
|
||||
set delta {pi/4.0 pi/3.0 pi/2.0 0.55*pi 0.99*pi pi 1.1*pi}
|
||||
|
||||
foreach f $start {
|
||||
foreach d $delta {
|
||||
trim cc1 c1 $f $f+$d
|
||||
trim cc2 c2 $f $f+$d
|
||||
|
||||
set extr [extrema cc1 cc2]
|
||||
if {[regexp {Infinite number of extremas, distance = ([-0-9.+eE]+)} $extr full dist]} {
|
||||
if {[expr abs($dist - $distExpected)] < 1.e-7} {
|
||||
puts "OK"
|
||||
} else {
|
||||
puts "Error: wrong distance $dist instead of $distExpected expected"
|
||||
}
|
||||
} else {
|
||||
puts "Error: non-parallel curves"
|
||||
}
|
||||
}
|
||||
}
|
30
tests/bugs/modalg_7/bug32874_5
Normal file
30
tests/bugs/modalg_7/bug32874_5
Normal file
@@ -0,0 +1,30 @@
|
||||
puts "================================================="
|
||||
puts "0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
set radius 1000.0
|
||||
set distExpected 1.e-5
|
||||
circle c1 0 0 0 $radius
|
||||
circle c2 0 0 0 $radius-$distExpected
|
||||
|
||||
set start {0.0 0.5*pi pi 1.5*pi 2.0*pi}
|
||||
set delta {pi/4.0 pi/3.0 pi/2.0 0.55*pi 0.99*pi pi 1.1*pi}
|
||||
|
||||
foreach f $start {
|
||||
foreach d $delta {
|
||||
trim cc1 c1 $f $f+$d
|
||||
trim cc2 c2 $f $f+$d
|
||||
|
||||
set extr [extrema cc1 cc2]
|
||||
if {[regexp {Infinite number of extremas, distance = ([-0-9.+eE]+)} $extr full dist]} {
|
||||
if {[expr abs($dist - $distExpected)] < 1.e-7} {
|
||||
puts "OK"
|
||||
} else {
|
||||
puts "Error: wrong distance $dist instead of $distExpected expected"
|
||||
}
|
||||
} else {
|
||||
puts "Error: non-parallel curves"
|
||||
}
|
||||
}
|
||||
}
|
19
tests/bugs/modalg_8/bug30160
Normal file
19
tests/bugs/modalg_8/bug30160
Normal file
@@ -0,0 +1,19 @@
|
||||
puts "================================================="
|
||||
puts "0030160: DBRep_IsoBuilder builds wrong isolines for planar faces"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file OCC1477_bsplinewire_c0.brep] sp
|
||||
restore [locate_data_file OCC1477_profile1_circle.brep] pr
|
||||
wire pr pr
|
||||
|
||||
mksweep sp
|
||||
addsweep pr -T -R
|
||||
buildsweep res -R -S
|
||||
checkshape res
|
||||
|
||||
explode res f
|
||||
renamevar res_4 result
|
||||
isos result 50
|
||||
checkprops result -s 208.267
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
37
tests/bugs/moddata_3/bug29745
Normal file
37
tests/bugs/moddata_3/bug29745
Normal file
@@ -0,0 +1,37 @@
|
||||
puts "================================================================="
|
||||
puts "OCC29745: Modeling Data - GeomAdaptor_Surface::VIntervals fails on periodic surfaces"
|
||||
puts "================================================================="
|
||||
puts ""
|
||||
|
||||
pload QAcommands
|
||||
|
||||
restore [locate_data_file bug29745_1] bc
|
||||
restore [locate_data_file bug29745_2] bc1
|
||||
|
||||
|
||||
set ref1 {NbIntervals: 2; 0 0.5 1 }
|
||||
set data1 [OCC29745 bc1 1 0 1]
|
||||
|
||||
if {[string compare $ref1 $data1] == 0} {
|
||||
puts "OCC29745 OK"
|
||||
} else {
|
||||
puts "OCC29745 Faulty"
|
||||
}
|
||||
|
||||
set ref2 {NbIntervals: 3; 0.10000000000000001 0.5 1 1.1000000000000001 }
|
||||
set data2 [OCC29745 bc1 1 0.1 1.1]
|
||||
|
||||
if {[string compare $ref2 $data2] == 0} {
|
||||
puts "OCC29745 OK"
|
||||
} else {
|
||||
puts "OCC29745 Faulty"
|
||||
}
|
||||
|
||||
set ref3 {NbIntervals: 3; 0 4.1887902047863896 6.2831853071795898 7 }
|
||||
set data3 [OCC29745 bc 1 0 7]
|
||||
|
||||
if {[string compare $ref3 $data3] == 0} {
|
||||
puts "OCC29745 OK"
|
||||
} else {
|
||||
puts "OCC29745 Faulty"
|
||||
}
|
26
tests/bugs/moddata_3/bug31661_1
Normal file
26
tests/bugs/moddata_3/bug31661_1
Normal file
@@ -0,0 +1,26 @@
|
||||
puts ""
|
||||
puts "=========================================================================="
|
||||
puts "OCC31661: Modeling Data - Algorithm crashes when projecting parabola or hyperbola to plane"
|
||||
puts "=========================================================================="
|
||||
puts ""
|
||||
|
||||
parabola p 0 0 0 1 1 1 2 0 -2 10
|
||||
plane pln 0 0 0 0 0 1
|
||||
projonplane r p pln 0
|
||||
|
||||
if {![regexp {Parabola} [dump r]]} {
|
||||
puts "ERROR: Projected curve is not a parabola"
|
||||
}
|
||||
|
||||
trim p p -100 100
|
||||
projonplane rp p pln 0
|
||||
|
||||
if {![regexp {Parabola} [dump rp]]} {
|
||||
puts "ERROR: Projected curve is not a parabola"
|
||||
}
|
||||
|
||||
checklength rp -l 408.40363195229503
|
||||
bounds rp t1 t2
|
||||
checkreal t1 [dval t1] -91.077748943768597 1.e-7 1.e-7
|
||||
checkreal t2 [dval t2] 72.221567418462357 1.e-7 1.e-7
|
||||
|
26
tests/bugs/moddata_3/bug31661_2
Normal file
26
tests/bugs/moddata_3/bug31661_2
Normal file
@@ -0,0 +1,26 @@
|
||||
puts ""
|
||||
puts "=========================================================================="
|
||||
puts "OCC31661: Modeling Data - Algorithm crashes when projecting parabola or hyperbola to plane"
|
||||
puts "=========================================================================="
|
||||
puts ""
|
||||
|
||||
hyperbola h 0 0 0 1 1 1 2 0 -2 10 10
|
||||
plane pln 0 0 0 0 0 1
|
||||
projonplane rh h pln 0
|
||||
|
||||
if {![regexp {Hyperbola} [dump rh]]} {
|
||||
puts "ERROR: Projected curve is not a hyperbola"
|
||||
}
|
||||
|
||||
trim h h -5 5
|
||||
projonplane rh h pln 0
|
||||
|
||||
if {![regexp {Hyperbola} [dump rh]]} {
|
||||
puts "ERROR: Projected curve is not a hyperbola"
|
||||
}
|
||||
|
||||
checklength rh -l 1664.3732976598988
|
||||
bounds rh t1 t2
|
||||
checkreal t1 [dval t1] -5.23179933356147 1.e-7 1.e-7
|
||||
checkreal t2 [dval t2] 4.76820064934972 1.e-7 1.e-7
|
||||
|
13
tests/bugs/step/bug32817_1
Normal file
13
tests/bugs/step/bug32817_1
Normal file
@@ -0,0 +1,13 @@
|
||||
puts "================"
|
||||
puts "0032817: Data Exchange - Step export - writing untrimmed Curve"
|
||||
puts "================"
|
||||
|
||||
pload XDE
|
||||
|
||||
catch {Close D}
|
||||
XNewDoc D
|
||||
line l1 0 0 0 0 1 0
|
||||
mkedge e1 l1
|
||||
XAddShape D e1
|
||||
WriteStep D $imagedir/${casename}.stp
|
||||
file delete $imagedir/${casename}.stp
|
13
tests/bugs/step/bug32817_2
Normal file
13
tests/bugs/step/bug32817_2
Normal file
@@ -0,0 +1,13 @@
|
||||
puts "================"
|
||||
puts "0032817: Data Exchange - Step export - writing untrimmed Curve"
|
||||
puts "================"
|
||||
|
||||
pload XDE
|
||||
|
||||
catch {Close D}
|
||||
XNewDoc D
|
||||
line l1 0 0 0 0 1 0
|
||||
mkedge e1 l1 10 2e+100
|
||||
XAddShape D e1
|
||||
WriteStep D $imagedir/${casename}.stp
|
||||
file delete $imagedir/${casename}.stp
|
13
tests/bugs/step/bug32817_3
Normal file
13
tests/bugs/step/bug32817_3
Normal file
@@ -0,0 +1,13 @@
|
||||
puts "================"
|
||||
puts "0032817: Data Exchange - Step export - writing untrimmed Curve"
|
||||
puts "================"
|
||||
|
||||
pload XDE
|
||||
|
||||
catch {Close D}
|
||||
XNewDoc D
|
||||
line l1 0 0 0 1 1 0
|
||||
mkedge e1 l1 -2e+100 10
|
||||
XAddShape D e1
|
||||
WriteStep D $imagedir/${casename}.stp
|
||||
file delete $imagedir/${casename}.stp
|
@@ -4,7 +4,7 @@ puts "====================================="
|
||||
puts ""
|
||||
|
||||
set viewname ""
|
||||
set length 6.34984
|
||||
set length 6.34983
|
||||
|
||||
restore [locate_data_file bug27341_hlrsave.brep] a
|
||||
COMPUTE_HLR $viewname $algotype
|
||||
|
@@ -1,4 +1,4 @@
|
||||
puts "TODO OCC30286 ALL: Error : The length of result shape is 1736.91, expected 1704.87"
|
||||
puts "TODO OCC30286 ALL: Error : The length of result shape is 1736.86, expected 1704.87"
|
||||
|
||||
set viewname "vright"
|
||||
set length 1704.87
|
||||
|
@@ -4,7 +4,7 @@ puts "============"
|
||||
puts ""
|
||||
|
||||
set viewname "vfront"
|
||||
set length 484.485
|
||||
set length 484.427
|
||||
|
||||
restore [locate_data_file bug25908_hlr-bspline-clone2-tcl-h1.brep] a
|
||||
COMPUTE_HLR $viewname $algotype
|
||||
|
@@ -4,7 +4,7 @@ puts "============"
|
||||
puts ""
|
||||
|
||||
set viewname "vback"
|
||||
set length 544.616
|
||||
set length 544.507
|
||||
|
||||
restore [locate_data_file bug25908_hlr-bspline-clone2-tcl-h1.brep] a
|
||||
COMPUTE_HLR $viewname $algotype
|
||||
|
@@ -1,4 +1,4 @@
|
||||
puts "TODO OCC30286 ALL: Error : The length of result shape is 227257, expected 11."
|
||||
puts "TODO OCC30286 ALL: Error : The length of result shape is"
|
||||
|
||||
puts "========================================================================"
|
||||
puts "OCC27979: Parasolid converted BREP shows weird lines on hidden line Algo"
|
||||
|
@@ -8,38 +8,61 @@ puts ""
|
||||
|
||||
restore [locate_data_file bug24772_s1.draw] s1
|
||||
restore [locate_data_file bug24772_s2.draw] s2
|
||||
restore [locate_data_file bug24772_s3.draw] s3
|
||||
|
||||
smallview +X+Y
|
||||
fit
|
||||
zoom 6
|
||||
|
||||
set bug_info [intersect r s1 s2]
|
||||
# case of unmatched axes
|
||||
set bug_info_1 [intersect r1 s1 s2]
|
||||
|
||||
if {[llength $bug_info] != 4} {
|
||||
# puts "ERROR: OCC24722 is reproduced."
|
||||
# case of matched axes
|
||||
set bug_info_2 [intersect r2 s2 s3]
|
||||
|
||||
if {[llength $bug_info_1] != 3} {
|
||||
puts "ERROR: OCC24722 is reproduced."
|
||||
} else {
|
||||
# snapshot r_1
|
||||
# snapshot r1_1
|
||||
clear
|
||||
display s1
|
||||
display s2
|
||||
display r_1
|
||||
xwd $imagedir/${casename}_r_1.png
|
||||
# snapshot r_2
|
||||
display r1_1
|
||||
xwd $imagedir/${casename}_r1_1.png
|
||||
# snapshot r1_2
|
||||
clear
|
||||
display s1
|
||||
display s2
|
||||
display r_2
|
||||
xwd $imagedir/${casename}_r_2.png
|
||||
# snapshot r_3
|
||||
display r1_2
|
||||
xwd $imagedir/${casename}_r1_2.png
|
||||
# snapshot r1_3
|
||||
clear
|
||||
display s1
|
||||
display s2
|
||||
display r_3
|
||||
xwd $imagedir/${casename}_r_3.png
|
||||
# snapshot r_4
|
||||
clear
|
||||
display s1
|
||||
display s2
|
||||
display r_4
|
||||
xwd $imagedir/${casename}_r_4.png
|
||||
display r1_3
|
||||
xwd $imagedir/${casename}_r1_3.png
|
||||
}
|
||||
|
||||
|
||||
if {[llength $bug_info_2] != 3} {
|
||||
puts "ERROR: OCC24722 is reproduced."
|
||||
} else {
|
||||
# snapshot r2_1
|
||||
clear
|
||||
display s2
|
||||
display s3
|
||||
display r2_1
|
||||
xwd $imagedir/${casename}_r2_1.png
|
||||
# snapshot r2_2
|
||||
clear
|
||||
display s2
|
||||
display s3
|
||||
display r2_2
|
||||
xwd $imagedir/${casename}_r2_2.png
|
||||
# snapshot r2_3
|
||||
clear
|
||||
display s2
|
||||
display s3
|
||||
display r2_3
|
||||
xwd $imagedir/${casename}_r2_3.png
|
||||
}
|
||||
|
@@ -1,10 +1,8 @@
|
||||
puts "=========="
|
||||
puts "OCC27626"
|
||||
puts "OCC27626: Attempt to display shape in 3d leads to very long calculation loop"
|
||||
puts "=========="
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Attempt to display shape in 3d leads to very long calculation loop
|
||||
#######################################################################
|
||||
|
||||
pload XDE
|
||||
igesread [locate_data_file bug27626_badfil.igs] a *
|
||||
|
||||
@@ -12,15 +10,9 @@ tclean a
|
||||
vinit
|
||||
vsetdispmode 1
|
||||
|
||||
dchrono h restart
|
||||
#
|
||||
# DISPLAY OPERATION ----- START
|
||||
#
|
||||
dchrono h -restart
|
||||
vdisplay a
|
||||
#
|
||||
# DISPLAY OPERATION ----- FINISH
|
||||
#
|
||||
dchrono h stop counterv display
|
||||
dchrono h -stop -counter display
|
||||
|
||||
vfit
|
||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -35,18 +35,18 @@ donly b1_4
|
||||
fit
|
||||
display b2_1
|
||||
|
||||
dchrono h restart
|
||||
dchrono h -restart
|
||||
bopcurves b1_4 b2_1 -2d
|
||||
dchrono h stop bopcurves counter bopcurves
|
||||
dchrono h -stop -counter bopcurves
|
||||
|
||||
checkview -screenshot -2d -path ${imagedir}/${test_image}_1.png
|
||||
|
||||
mksurface s1 b1_4
|
||||
mksurface s2 b2_1
|
||||
|
||||
dchrono h2 restart
|
||||
dchrono h2 -restart
|
||||
set CurveNumb [intersect resi s1 s2]
|
||||
dchrono h2 stop counter CurveNumb
|
||||
dchrono h2 -stop -counter CurveNumb
|
||||
|
||||
if { [llength ${CurveNumb}] < 1 } {
|
||||
puts "Error : Bad intersection"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user