#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp.hxx>
+#include <TColStd_Array1OfReal.hxx>
#define Us3 0.3333333333333333333333333333
void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
{
- Standard_Integer i;
+ Standard_Integer i, j;
gp_XYZ V1, V2;
gp_Pnt MiddlePoint, CurrentPoint, LastPoint;
Standard_Real Du, Dusave, MiddleU, L1, L2;
Standard_Boolean IsLine = Standard_True;
Standard_Integer NbPoints = 3;
if (minNbPnts > 3) NbPoints = minNbPnts;
- Du = (lastu-firstu)/NbPoints;
- MiddleU = firstu + Du;
- for (i = 2; i < NbPoints; i++) {
- D0 (C, MiddleU, MiddlePoint);
- V2 = MiddlePoint.XYZ();
- V2.Subtract (CurrentPoint.XYZ());
- L2 = V2.Modulus ();
- if (L2 > LTol) {
- if (((V2.CrossMagnitude (V1))/(L1*L2)) >= ATol) {
- //C'etait une singularite
- IsLine = Standard_False;
- break;
- }
- if (minNbPnts > 2) {
- parameters.Append (MiddleU);
- points .Append (MiddlePoint);
+ ////
+ Standard_Integer NbInterv = const_cast<TheCurve*>(&C)->NbIntervals(GeomAbs_CN);
+ TColStd_Array1OfReal Intervs(1, NbInterv+1);
+ const_cast<TheCurve*>(&C)->Intervals(Intervs, GeomAbs_CN);
+ Standard_Real param = 0.;
+ for (i = 1; i <= NbInterv; i++)
+ {
+ // Avoid usage intervals out of [firstu, lastu].
+ if ((Intervs(i+1) < firstu) ||
+ (Intervs(i) > lastu))
+ {
+ continue;
+ }
+ // Fix border points in applicable intervals, to avoid be out of target interval.
+ if ((Intervs(i) < firstu) &&
+ (Intervs(i+1) > firstu))
+ {
+ Intervs(i) = firstu;
+ }
+ if ((Intervs(i) < lastu) &&
+ (Intervs(i+1) > lastu))
+ {
+ Intervs(i + 1) = lastu;
+ }
+
+ Standard_Real delta = (Intervs(i+1) - Intervs(i))/NbPoints;
+ for (j = 1; j <= NbPoints; j++)
+ {
+ param = Intervs(i) + j*delta;
+ D0 (C, param, MiddlePoint);
+ V2 = MiddlePoint.XYZ();
+ V2.Subtract (CurrentPoint.XYZ());
+ L2 = V2.Modulus ();
+ if (L2 > LTol) {
+ if (((V2.CrossMagnitude (V1))/(L1*L2)) >= ATol) {
+ //C'etait une singularite
+ IsLine = Standard_False;
+ break;
+ }
+ if (minNbPnts > 2) {
+ parameters.Append (param);
+ points .Append (MiddlePoint);
+ }
}
}
- MiddleU += Du;
+ if (!IsLine)
+ break;
}
+ ////
if (IsLine) {
//C'etait une droite (plusieurs poles alignes), Calcul termine :
parameters.Append (lastu);
parameters.Remove (i);
pointsLength--;
}
- Du = Dusave;
+ //Du = Dusave;
+ EvaluateDu (C, param, MiddlePoint, Du, NotDone);
}
}
else {
--- /dev/null
+puts "========"
+puts "OCC24959"
+puts "========"
+puts ""
+####################################################
+## GCPnts_TangentialDeflection does not implement functionality by its meaning in case of BSpline with local splash
+####################################################
+
+bsplinesurf s 2 4 0.0 3 0.34 1 0.67 1 1.0 3 1 2 0.0 2 1.0 2 10 0 0 1 6 0 0 1 4 0 0 1 2 0 0 1 0 0 0 1 10 5 0 1 6 5 0 1 4 5 0 1 1.5 9 0 1 0 5 0 1
+mkface result s
+incmesh result 1
+set tri_info [trinfo result]
+
+set tri 0
+set nod 0
+regexp { +([-0-9.+eE]+) +triangles} $tri_info full tri
+regexp { +([-0-9.+eE]+) +nodes} $tri_info full nod
+if { ${tri} < 90 || ${nod} < 54 } {
+ puts "Error: Bad meshing"
+} else {
+ puts "OK: Good meshing"
+}
+
+vdisplay result
+vsetdispmode 1
+vtop
+vfit
+set only_screen 1
--- /dev/null
+puts "========"
+puts "OCC24959"
+puts "========"
+puts ""
+####################################################
+## GCPnts_TangentialDeflection does not implement functionality by its meaning in case of BSpline with local splash
+####################################################
+
+bsplinesurf s 2 12 0.0 3 0.1 1 0.2 1 0.3 1 0.4 1 0.5 1 0.525 1 0.55 1 0.575 1 0.8 1 0.9 1 1.0 3 1 2 0.0 2 1.0 2 16 0 0 1 14 0 0 1 12 0 0 1 10 0 0 1 8 0 0 1 6 0 0 1 4 0 0 1 2 0 0 1 0 0 0 1 -2 0 0 1 -4 0 0 1 -6 0 0 1 -8 0 0 1 16 5 0 1 14 5 0 1 12 5 0 1 10 5 0 1 8 5 0 1 6 5 0 1 4 5 0 1 1.5 9 0 1 0 5 0 1 -2 5 0 1 -4 5 0 1 -6 5 0 1 -8 5 0 1
+
+mkface result s
+incmesh result 1
+set tri_info [trinfo result]
+
+set tri 0
+set nod 0
+regexp { +([-0-9.+eE]+) +triangles} $tri_info full tri
+regexp { +([-0-9.+eE]+) +nodes} $tri_info full nod
+if { ${tri} < 76 || ${nod} < 50 } {
+ puts "Error: Bad meshing"
+} else {
+ puts "OK: Good meshing"
+}
+
+vdisplay result
+vsetdispmode 1
+vtop
+vfit
+set only_screen 1