mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0025976: Conversion of an offset face from a spline into a spline face hangs-up the application
Tests-case for issue #25976
This commit is contained in:
parent
0a512187fd
commit
7331b4eec9
@ -86,7 +86,7 @@ typedef Handle(Geom_BSplineSurface) Handle(BSplineSurface);
|
|||||||
typedef Handle(Geom_SurfaceOfRevolution) Handle(SurfaceOfRevolution);
|
typedef Handle(Geom_SurfaceOfRevolution) Handle(SurfaceOfRevolution);
|
||||||
typedef Handle(Geom_SurfaceOfLinearExtrusion) Handle(SurfaceOfLinearExtrusion);
|
typedef Handle(Geom_SurfaceOfLinearExtrusion) Handle(SurfaceOfLinearExtrusion);
|
||||||
typedef Handle(Geom_RectangularTrimmedSurface)
|
typedef Handle(Geom_RectangularTrimmedSurface)
|
||||||
Handle(RectangularTrimmedSurface);
|
Handle(RectangularTrimmedSurface);
|
||||||
|
|
||||||
|
|
||||||
typedef TColStd_Array1OfReal Array1OfReal;
|
typedef TColStd_Array1OfReal Array1OfReal;
|
||||||
@ -137,9 +137,9 @@ Handle(BSplineSurface) BSplineSurfaceBuilder
|
|||||||
VMults (i) = Convert.VMultiplicity (i);
|
VMults (i) = Convert.VMultiplicity (i);
|
||||||
}
|
}
|
||||||
TheSurface = new BSplineSurface (Poles, Weights, UKnots, VKnots,
|
TheSurface = new BSplineSurface (Poles, Weights, UKnots, VKnots,
|
||||||
UMults, VMults, UDegree, VDegree,
|
UMults, VMults, UDegree, VDegree,
|
||||||
Convert.IsUPeriodic(),
|
Convert.IsUPeriodic(),
|
||||||
Convert.IsVPeriodic());
|
Convert.IsVPeriodic());
|
||||||
return TheSurface;
|
return TheSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,12 +150,12 @@ Handle(BSplineSurface) BSplineSurfaceBuilder
|
|||||||
|
|
||||||
Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
||||||
(const Handle(BSplineSurface)& S,
|
(const Handle(BSplineSurface)& S,
|
||||||
const Standard_Integer FromUK1,
|
const Standard_Integer FromUK1,
|
||||||
const Standard_Integer ToUK2,
|
const Standard_Integer ToUK2,
|
||||||
const Standard_Integer FromVK1,
|
const Standard_Integer FromVK1,
|
||||||
const Standard_Integer ToVK2,
|
const Standard_Integer ToVK2,
|
||||||
const Standard_Boolean SameUOrientation,
|
const Standard_Boolean SameUOrientation,
|
||||||
const Standard_Boolean SameVOrientation )
|
const Standard_Boolean SameVOrientation )
|
||||||
{
|
{
|
||||||
Standard_Integer FirstU = S->FirstUKnotIndex ();
|
Standard_Integer FirstU = S->FirstUKnotIndex ();
|
||||||
Standard_Integer FirstV = S->FirstVKnotIndex ();
|
Standard_Integer FirstV = S->FirstVKnotIndex ();
|
||||||
@ -167,12 +167,12 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
Standard_Integer FirstVK = Min (FromVK1, ToVK2);
|
Standard_Integer FirstVK = Min (FromVK1, ToVK2);
|
||||||
Standard_Integer LastVK = Max (FromVK1, ToVK2);
|
Standard_Integer LastVK = Max (FromVK1, ToVK2);
|
||||||
if (FirstUK < FirstU || LastUK > LastU ||
|
if (FirstUK < FirstU || LastUK > LastU ||
|
||||||
FirstVK < FirstV || LastVK > LastV) { Standard_DomainError::Raise(); }
|
FirstVK < FirstV || LastVK > LastV) { Standard_DomainError::Raise(); }
|
||||||
|
|
||||||
Handle(BSplineSurface) S1= Handle(BSplineSurface)::DownCast(S->Copy());
|
Handle(BSplineSurface) S1= Handle(BSplineSurface)::DownCast(S->Copy());
|
||||||
|
|
||||||
S1->Segment(S1->UKnot(FirstUK),S1->UKnot(LastUK),
|
S1->Segment(S1->UKnot(FirstUK),S1->UKnot(LastUK),
|
||||||
S1->VKnot(FirstVK),S1->VKnot(LastVK));
|
S1->VKnot(FirstVK),S1->VKnot(LastVK));
|
||||||
|
|
||||||
if (S->IsUPeriodic()) {
|
if (S->IsUPeriodic()) {
|
||||||
if (!SameUOrientation) S1->UReverse();
|
if (!SameUOrientation) S1->UReverse();
|
||||||
@ -197,10 +197,10 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
|
|
||||||
Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
||||||
(const Handle(BSplineSurface)& S,
|
(const Handle(BSplineSurface)& S,
|
||||||
const Standard_Integer FromK1,
|
const Standard_Integer FromK1,
|
||||||
const Standard_Integer ToK2,
|
const Standard_Integer ToK2,
|
||||||
const Standard_Boolean USplit,
|
const Standard_Boolean USplit,
|
||||||
const Standard_Boolean SameOrientation )
|
const Standard_Boolean SameOrientation )
|
||||||
{
|
{
|
||||||
if (FromK1 == ToK2) Standard_DomainError::Raise();
|
if (FromK1 == ToK2) Standard_DomainError::Raise();
|
||||||
|
|
||||||
@ -216,9 +216,9 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
if (FirstUK < FirstU || LastUK > LastU) Standard_DomainError::Raise();
|
if (FirstUK < FirstU || LastUK > LastU) Standard_DomainError::Raise();
|
||||||
|
|
||||||
S1->Segment( S1->UKnot(FirstUK),
|
S1->Segment( S1->UKnot(FirstUK),
|
||||||
S1->UKnot(LastUK),
|
S1->UKnot(LastUK),
|
||||||
S1->VKnot(S1->FirstVKnotIndex()),
|
S1->VKnot(S1->FirstVKnotIndex()),
|
||||||
S1->VKnot(S1->LastVKnotIndex()));
|
S1->VKnot(S1->LastVKnotIndex()));
|
||||||
|
|
||||||
if (S->IsUPeriodic()) {
|
if (S->IsUPeriodic()) {
|
||||||
if (!SameOrientation) S1->UReverse();
|
if (!SameOrientation) S1->UReverse();
|
||||||
@ -237,9 +237,9 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
if (FirstVK < FirstV || LastVK > LastV) Standard_DomainError::Raise();
|
if (FirstVK < FirstV || LastVK > LastV) Standard_DomainError::Raise();
|
||||||
|
|
||||||
S1->Segment( S1->UKnot(S1->FirstUKnotIndex()),
|
S1->Segment( S1->UKnot(S1->FirstUKnotIndex()),
|
||||||
S1->UKnot(S1->LastUKnotIndex()),
|
S1->UKnot(S1->LastUKnotIndex()),
|
||||||
S1->VKnot(FirstVK),
|
S1->VKnot(FirstVK),
|
||||||
S1->VKnot(LastVK));
|
S1->VKnot(LastVK));
|
||||||
|
|
||||||
|
|
||||||
if (S->IsVPeriodic()) {
|
if (S->IsVPeriodic()) {
|
||||||
@ -260,14 +260,14 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
|
|
||||||
Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
||||||
(const Handle(BSplineSurface)& S,
|
(const Handle(BSplineSurface)& S,
|
||||||
const Standard_Real FromU1,
|
const Standard_Real FromU1,
|
||||||
const Standard_Real ToU2,
|
const Standard_Real ToU2,
|
||||||
const Standard_Real FromV1,
|
const Standard_Real FromV1,
|
||||||
const Standard_Real ToV2,
|
const Standard_Real ToV2,
|
||||||
// const Standard_Real ParametricTolerance,
|
// const Standard_Real ParametricTolerance,
|
||||||
const Standard_Real ,
|
const Standard_Real ,
|
||||||
const Standard_Boolean SameUOrientation,
|
const Standard_Boolean SameUOrientation,
|
||||||
const Standard_Boolean SameVOrientation )
|
const Standard_Boolean SameVOrientation )
|
||||||
{
|
{
|
||||||
Standard_Real FirstU = Min( FromU1, ToU2);
|
Standard_Real FirstU = Min( FromU1, ToU2);
|
||||||
Standard_Real LastU = Max( FromU1, ToU2);
|
Standard_Real LastU = Max( FromU1, ToU2);
|
||||||
@ -302,11 +302,11 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
|
|
||||||
Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
||||||
(const Handle(BSplineSurface)& S,
|
(const Handle(BSplineSurface)& S,
|
||||||
const Standard_Real FromParam1,
|
const Standard_Real FromParam1,
|
||||||
const Standard_Real ToParam2,
|
const Standard_Real ToParam2,
|
||||||
const Standard_Boolean USplit,
|
const Standard_Boolean USplit,
|
||||||
const Standard_Real ParametricTolerance,
|
const Standard_Real ParametricTolerance,
|
||||||
const Standard_Boolean SameOrientation )
|
const Standard_Boolean SameOrientation )
|
||||||
{
|
{
|
||||||
if (Abs (FromParam1 - ToParam2) <= Abs(ParametricTolerance)) {
|
if (Abs (FromParam1 - ToParam2) <= Abs(ParametricTolerance)) {
|
||||||
Standard_DomainError::Raise();
|
Standard_DomainError::Raise();
|
||||||
@ -355,7 +355,7 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface
|
Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface
|
||||||
(const Handle(Surface)& Sr)
|
(const Handle(Surface)& Sr)
|
||||||
{
|
{
|
||||||
Standard_Real U1, U2, V1, V2;
|
Standard_Real U1, U2, V1, V2;
|
||||||
@ -367,12 +367,12 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
|
|
||||||
//If the surface Sr is infinite stop the computation
|
//If the surface Sr is infinite stop the computation
|
||||||
if (Precision::IsNegativeInfinite(UFirst) ||
|
if (Precision::IsNegativeInfinite(UFirst) ||
|
||||||
Precision::IsPositiveInfinite(ULast) ||
|
Precision::IsPositiveInfinite(ULast) ||
|
||||||
Precision::IsNegativeInfinite(VFirst) ||
|
Precision::IsNegativeInfinite(VFirst) ||
|
||||||
Precision::IsPositiveInfinite(VLast) ) {
|
Precision::IsPositiveInfinite(VLast) ) {
|
||||||
Standard_DomainError::Raise("");
|
Standard_DomainError::Raise("");
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(Geom_BSplineSurface) TheSurface;
|
Handle(Geom_BSplineSurface) TheSurface;
|
||||||
Handle(Surface) S;
|
Handle(Surface) S;
|
||||||
Handle(Geom_OffsetSurface) OffsetSur;
|
Handle(Geom_OffsetSurface) OffsetSur;
|
||||||
@ -387,29 +387,29 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
|
|
||||||
if (S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
|
if (S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
|
||||||
Handle(Geom_RectangularTrimmedSurface) Strim =
|
Handle(Geom_RectangularTrimmedSurface) Strim =
|
||||||
Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
|
Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
|
||||||
|
|
||||||
Handle(Geom_Surface) Surf = Strim->BasisSurface();
|
Handle(Geom_Surface) Surf = Strim->BasisSurface();
|
||||||
UFirst = U1; ULast = U2; VFirst = V1; VLast = V2;
|
UFirst = U1; ULast = U2; VFirst = V1; VLast = V2;
|
||||||
if (Surf->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
|
if (Surf->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
|
||||||
Handle(Geom_OffsetSurface) OffsetSur =
|
Handle(Geom_OffsetSurface) OffsetSur =
|
||||||
Handle(Geom_OffsetSurface)::DownCast(Surf);
|
Handle(Geom_OffsetSurface)::DownCast(Surf);
|
||||||
|
|
||||||
S = OffsetSur->Surface();
|
S = OffsetSur->Surface();
|
||||||
if (!S.IsNull()) {
|
if (!S.IsNull()) {
|
||||||
Surf = S;
|
Surf = S;
|
||||||
}
|
}
|
||||||
else S = Surf;
|
else S = Surf;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Surf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
|
if (Surf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
|
||||||
Handle(Geom_RectangularTrimmedSurface) Strim = new
|
Handle(Geom_RectangularTrimmedSurface) Strim = new
|
||||||
(Geom_RectangularTrimmedSurface) (Surf,
|
(Geom_RectangularTrimmedSurface) (Surf,
|
||||||
UFirst, ULast,
|
UFirst, ULast,
|
||||||
VFirst, VLast);
|
VFirst, VLast);
|
||||||
return SurfaceToBSplineSurface(Strim);
|
return SurfaceToBSplineSurface(Strim);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Surf->IsKind(STANDARD_TYPE(Geom_Plane))) {
|
if (Surf->IsKind(STANDARD_TYPE(Geom_Plane))) {
|
||||||
TColgp_Array2OfPnt Poles (1, 2, 1, 2);
|
TColgp_Array2OfPnt Poles (1, 2, 1, 2);
|
||||||
Poles (1, 1) = Strim->Value (U1, V1);
|
Poles (1, 1) = Strim->Value (U1, V1);
|
||||||
@ -431,12 +431,12 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
Standard_Integer UDegree = 1;
|
Standard_Integer UDegree = 1;
|
||||||
Standard_Integer VDegree = 1;
|
Standard_Integer VDegree = 1;
|
||||||
TheSurface = new Geom_BSplineSurface (Poles, UKnots, VKnots, UMults,
|
TheSurface = new Geom_BSplineSurface (Poles, UKnots, VKnots, UMults,
|
||||||
VMults, UDegree, VDegree);
|
VMults, UDegree, VDegree);
|
||||||
}
|
}
|
||||||
else if (Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
|
else if (Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
|
||||||
Handle(Geom_CylindricalSurface) TheElSurf=
|
Handle(Geom_CylindricalSurface) TheElSurf=
|
||||||
Handle(Geom_CylindricalSurface)::DownCast(Surf);
|
Handle(Geom_CylindricalSurface)::DownCast(Surf);
|
||||||
|
|
||||||
gp_Cylinder Cyl = TheElSurf->Cylinder();
|
gp_Cylinder Cyl = TheElSurf->Cylinder();
|
||||||
if (Strim->IsUClosed()) {
|
if (Strim->IsUClosed()) {
|
||||||
Convert_CylinderToBSplineSurface Convert (Cyl, VFirst, VLast);
|
Convert_CylinderToBSplineSurface Convert (Cyl, VFirst, VLast);
|
||||||
@ -444,15 +444,15 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Convert_CylinderToBSplineSurface
|
Convert_CylinderToBSplineSurface
|
||||||
Conv (Cyl, UFirst, ULast, VFirst, VLast);
|
Conv (Cyl, UFirst, ULast, VFirst, VLast);
|
||||||
TheSurface = BSplineSurfaceBuilder (Conv);
|
TheSurface = BSplineSurfaceBuilder (Conv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (Surf->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
|
else if (Surf->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
|
||||||
Handle(Geom_ConicalSurface) TheElSurf =
|
Handle(Geom_ConicalSurface) TheElSurf =
|
||||||
Handle(Geom_ConicalSurface)::DownCast(Surf);
|
Handle(Geom_ConicalSurface)::DownCast(Surf);
|
||||||
gp_Cone Co = TheElSurf->Cone();
|
gp_Cone Co = TheElSurf->Cone();
|
||||||
if (Strim->IsUClosed()) {
|
if (Strim->IsUClosed()) {
|
||||||
Convert_ConeToBSplineSurface Convert (Co, VFirst, VLast);
|
Convert_ConeToBSplineSurface Convert (Co, VFirst, VLast);
|
||||||
@ -460,39 +460,39 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Convert_ConeToBSplineSurface
|
Convert_ConeToBSplineSurface
|
||||||
Convert (Co, UFirst, ULast, VFirst, VLast);
|
Convert (Co, UFirst, ULast, VFirst, VLast);
|
||||||
TheSurface = BSplineSurfaceBuilder (Convert);
|
TheSurface = BSplineSurfaceBuilder (Convert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (Surf->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
|
else if (Surf->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
|
||||||
Handle(Geom_SphericalSurface) TheElSurf =
|
Handle(Geom_SphericalSurface) TheElSurf =
|
||||||
Handle(Geom_SphericalSurface)::DownCast(Surf);
|
Handle(Geom_SphericalSurface)::DownCast(Surf);
|
||||||
gp_Sphere Sph = TheElSurf->Sphere();
|
gp_Sphere Sph = TheElSurf->Sphere();
|
||||||
//OCC217
|
//OCC217
|
||||||
if (Strim->IsUClosed()) {
|
if (Strim->IsUClosed()) {
|
||||||
//if (Strim->IsVClosed()) {
|
//if (Strim->IsVClosed()) {
|
||||||
//Convert_SphereToBSplineSurface Convert (Sph, UFirst, ULast);
|
//Convert_SphereToBSplineSurface Convert (Sph, UFirst, ULast);
|
||||||
Convert_SphereToBSplineSurface Convert (Sph, VFirst, VLast, Standard_False);
|
Convert_SphereToBSplineSurface Convert (Sph, VFirst, VLast, Standard_False);
|
||||||
TheSurface = BSplineSurfaceBuilder (Convert);
|
TheSurface = BSplineSurfaceBuilder (Convert);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Convert_SphereToBSplineSurface
|
Convert_SphereToBSplineSurface
|
||||||
Convert (Sph, UFirst, ULast, VFirst, VLast);
|
Convert (Sph, UFirst, ULast, VFirst, VLast);
|
||||||
TheSurface = BSplineSurfaceBuilder (Convert);
|
TheSurface = BSplineSurfaceBuilder (Convert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (Surf->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
|
else if (Surf->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
|
||||||
Handle(Geom_ToroidalSurface) TheElSurf =
|
Handle(Geom_ToroidalSurface) TheElSurf =
|
||||||
Handle(Geom_ToroidalSurface)::DownCast(Surf);
|
Handle(Geom_ToroidalSurface)::DownCast(Surf);
|
||||||
|
|
||||||
gp_Torus Tr = TheElSurf->Torus();
|
gp_Torus Tr = TheElSurf->Torus();
|
||||||
if (Strim->IsUClosed()) {
|
if (Strim->IsUClosed()) {
|
||||||
Convert_TorusToBSplineSurface Convert (Tr, VFirst, VLast,
|
Convert_TorusToBSplineSurface Convert (Tr, VFirst, VLast,
|
||||||
Standard_False);
|
Standard_False);
|
||||||
TheSurface = BSplineSurfaceBuilder (Convert);
|
TheSurface = BSplineSurfaceBuilder (Convert);
|
||||||
}
|
}
|
||||||
else if (Strim->IsVClosed()) {
|
else if (Strim->IsVClosed()) {
|
||||||
@ -501,25 +501,25 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Convert_TorusToBSplineSurface
|
Convert_TorusToBSplineSurface
|
||||||
Convert (Tr, UFirst, ULast, VFirst, VLast);
|
Convert (Tr, UFirst, ULast, VFirst, VLast);
|
||||||
TheSurface = BSplineSurfaceBuilder (Convert);
|
TheSurface = BSplineSurfaceBuilder (Convert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (Surf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
|
else if (Surf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
|
||||||
Handle(Geom_SurfaceOfRevolution) Revol =
|
Handle(Geom_SurfaceOfRevolution) Revol =
|
||||||
Handle(Geom_SurfaceOfRevolution)::DownCast(Surf);
|
Handle(Geom_SurfaceOfRevolution)::DownCast(Surf);
|
||||||
|
|
||||||
Handle(Geom_Curve) Meridian = Revol->BasisCurve();
|
Handle(Geom_Curve) Meridian = Revol->BasisCurve();
|
||||||
Handle(Geom_BSplineCurve) C;
|
Handle(Geom_BSplineCurve) C;
|
||||||
if (Strim->IsVClosed()) {
|
if (Strim->IsVClosed()) {
|
||||||
C = GeomConvert::CurveToBSplineCurve (Meridian);
|
C = GeomConvert::CurveToBSplineCurve (Meridian);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Handle(Geom_TrimmedCurve) CT =
|
Handle(Geom_TrimmedCurve) CT =
|
||||||
new Geom_TrimmedCurve( Meridian, VFirst, VLast);
|
new Geom_TrimmedCurve( Meridian, VFirst, VLast);
|
||||||
C = GeomConvert::CurveToBSplineCurve (CT);
|
C = GeomConvert::CurveToBSplineCurve (CT);
|
||||||
}
|
}
|
||||||
Standard_Integer NbUPoles, NbUKnots;
|
Standard_Integer NbUPoles, NbUKnots;
|
||||||
Standard_Integer NbVPoles, NbVKnots;
|
Standard_Integer NbVPoles, NbVKnots;
|
||||||
@ -536,30 +536,30 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
Standard_Integer nbUSpans;
|
Standard_Integer nbUSpans;
|
||||||
Standard_Real AlfaU;
|
Standard_Real AlfaU;
|
||||||
if (Strim->IsUPeriodic()) {
|
if (Strim->IsUPeriodic()) {
|
||||||
NbUKnots = 4;
|
NbUKnots = 4;
|
||||||
nbUSpans = 3;
|
nbUSpans = 3;
|
||||||
AlfaU = M_PI / 3.;
|
AlfaU = M_PI / 3.;
|
||||||
NbUPoles = 6;
|
NbUPoles = 6;
|
||||||
periodic = Standard_True;
|
periodic = Standard_True;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Nombre de spans : ouverture maximale = 150 degres ( = PI / 1.2 rds)
|
// Nombre de spans : ouverture maximale = 150 degres ( = PI / 1.2 rds)
|
||||||
nbUSpans =
|
nbUSpans =
|
||||||
(Standard_Integer)IntegerPart( 1.2 * (ULast - UFirst) / M_PI) + 1;
|
(Standard_Integer)IntegerPart( 1.2 * (ULast - UFirst) / M_PI) + 1;
|
||||||
AlfaU = (ULast - UFirst) / ( nbUSpans * 2);
|
AlfaU = (ULast - UFirst) / ( nbUSpans * 2);
|
||||||
NbUPoles = 2 * nbUSpans + 1;
|
NbUPoles = 2 * nbUSpans + 1;
|
||||||
NbUKnots = nbUSpans + 1;
|
NbUKnots = nbUSpans + 1;
|
||||||
}
|
}
|
||||||
// Compute Knots and Mults
|
// Compute Knots and Mults
|
||||||
TColStd_Array1OfReal UKnots(1, NbUKnots);
|
TColStd_Array1OfReal UKnots(1, NbUKnots);
|
||||||
TColStd_Array1OfInteger UMults( 1, NbUKnots);
|
TColStd_Array1OfInteger UMults( 1, NbUKnots);
|
||||||
Standard_Integer i,j;
|
Standard_Integer i,j;
|
||||||
for ( i = 1; i <= NbUKnots; i++) {
|
for ( i = 1; i <= NbUKnots; i++) {
|
||||||
UKnots(i) = UFirst + (i-1) * 2 * AlfaU;
|
UKnots(i) = UFirst + (i-1) * 2 * AlfaU;
|
||||||
UMults(i) = 2;
|
UMults(i) = 2;
|
||||||
}
|
}
|
||||||
if (!periodic) {
|
if (!periodic) {
|
||||||
UMults(1)++; UMults(NbUKnots)++;
|
UMults(1)++; UMults(NbUKnots)++;
|
||||||
}
|
}
|
||||||
NbVKnots = C->NbKnots();
|
NbVKnots = C->NbKnots();
|
||||||
TColStd_Array1OfReal VKnots(1, NbVKnots);
|
TColStd_Array1OfReal VKnots(1, NbVKnots);
|
||||||
@ -573,51 +573,51 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
gp_Trsf Trsf;
|
gp_Trsf Trsf;
|
||||||
|
|
||||||
for ( i = 1; i<= NbUPoles; i+=2) {
|
for ( i = 1; i<= NbUPoles; i+=2) {
|
||||||
Trsf.SetRotation( Revol->Axis(), UFirst + (i-1)*AlfaU);
|
Trsf.SetRotation( Revol->Axis(), UFirst + (i-1)*AlfaU);
|
||||||
for ( j = 1; j <= NbVPoles; j++) {
|
for ( j = 1; j <= NbVPoles; j++) {
|
||||||
NewPoles(i,j) = Poles(j).Transformed(Trsf);
|
NewPoles(i,j) = Poles(j).Transformed(Trsf);
|
||||||
NewWeights(i,j) = Weights(j);
|
NewWeights(i,j) = Weights(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gp_GTrsf Aff;
|
gp_GTrsf Aff;
|
||||||
Aff.SetAffinity( Revol->Axis(), 1/Cos(AlfaU));
|
Aff.SetAffinity( Revol->Axis(), 1/Cos(AlfaU));
|
||||||
gp_XYZ coord;
|
gp_XYZ coord;
|
||||||
for ( j= 1; j<= NbVPoles; j++) {
|
for ( j= 1; j<= NbVPoles; j++) {
|
||||||
coord = Poles(j).XYZ();
|
coord = Poles(j).XYZ();
|
||||||
Aff.Transforms(coord);
|
Aff.Transforms(coord);
|
||||||
Poles(j).SetXYZ(coord);
|
Poles(j).SetXYZ(coord);
|
||||||
}
|
}
|
||||||
for ( i = 2; i<= NbUPoles; i+=2) {
|
for ( i = 2; i<= NbUPoles; i+=2) {
|
||||||
Trsf.SetRotation( Revol->Axis(), UFirst + (i-1)*AlfaU);
|
Trsf.SetRotation( Revol->Axis(), UFirst + (i-1)*AlfaU);
|
||||||
for ( j = 1; j <= NbVPoles; j++) {
|
for ( j = 1; j <= NbVPoles; j++) {
|
||||||
NewPoles(i,j) = Poles(j).Transformed(Trsf);
|
NewPoles(i,j) = Poles(j).Transformed(Trsf);
|
||||||
NewWeights(i,j) = Weights(j) * Cos(AlfaU);
|
NewWeights(i,j) = Weights(j) * Cos(AlfaU);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TheSurface = new Geom_BSplineSurface(NewPoles, NewWeights,
|
TheSurface = new Geom_BSplineSurface(NewPoles, NewWeights,
|
||||||
UKnots, VKnots,
|
UKnots, VKnots,
|
||||||
UMults, VMults,
|
UMults, VMults,
|
||||||
2 , C->Degree(),
|
2 , C->Degree(),
|
||||||
periodic, C->IsPeriodic());
|
periodic, C->IsPeriodic());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (Surf->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
|
else if (Surf->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
|
||||||
Handle(Geom_SurfaceOfLinearExtrusion) Extru =
|
Handle(Geom_SurfaceOfLinearExtrusion) Extru =
|
||||||
Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(Surf);
|
Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(Surf);
|
||||||
|
|
||||||
Handle(Geom_Curve) Meridian = Extru->BasisCurve();
|
Handle(Geom_Curve) Meridian = Extru->BasisCurve();
|
||||||
Handle(Geom_BSplineCurve) C;
|
Handle(Geom_BSplineCurve) C;
|
||||||
if (Strim->IsUClosed()) {
|
if (Strim->IsUClosed()) {
|
||||||
C = GeomConvert::CurveToBSplineCurve (Meridian);
|
C = GeomConvert::CurveToBSplineCurve (Meridian);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Handle(Geom_TrimmedCurve) CT =
|
Handle(Geom_TrimmedCurve) CT =
|
||||||
new Geom_TrimmedCurve( Meridian, UFirst, ULast);
|
new Geom_TrimmedCurve( Meridian, UFirst, ULast);
|
||||||
C = GeomConvert::CurveToBSplineCurve (CT);
|
C = GeomConvert::CurveToBSplineCurve (CT);
|
||||||
}
|
}
|
||||||
TColgp_Array2OfPnt Poles ( 1, C->NbPoles(), 1, 2);
|
TColgp_Array2OfPnt Poles ( 1, C->NbPoles(), 1, 2);
|
||||||
TColStd_Array2OfReal Weights( 1, C->NbPoles(), 1, 2);
|
TColStd_Array2OfReal Weights( 1, C->NbPoles(), 1, 2);
|
||||||
@ -630,27 +630,27 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
VKnots(2) = VLast;
|
VKnots(2) = VLast;
|
||||||
TColStd_Array1OfInteger VMults ( 1, 2);
|
TColStd_Array1OfInteger VMults ( 1, 2);
|
||||||
VMults.Init(2);
|
VMults.Init(2);
|
||||||
|
|
||||||
gp_Vec D( Extru->Direction());
|
gp_Vec D( Extru->Direction());
|
||||||
gp_Vec DV1 = VFirst * D;
|
gp_Vec DV1 = VFirst * D;
|
||||||
gp_Vec DV2 = VLast * D;
|
gp_Vec DV2 = VLast * D;
|
||||||
for (Standard_Integer i = 1; i <= C->NbPoles(); i++) {
|
for (Standard_Integer i = 1; i <= C->NbPoles(); i++) {
|
||||||
Poles(i,1) = C->Pole(i).Translated(DV1);
|
Poles(i,1) = C->Pole(i).Translated(DV1);
|
||||||
Poles(i,2) = C->Pole(i).Translated(DV2);
|
Poles(i,2) = C->Pole(i).Translated(DV2);
|
||||||
Weights(i,1) = Weights(i,2) = C->Weight(i);
|
Weights(i,1) = Weights(i,2) = C->Weight(i);
|
||||||
}
|
}
|
||||||
TheSurface = new Geom_BSplineSurface(Poles, Weights, UKnots, VKnots,
|
TheSurface = new Geom_BSplineSurface(Poles, Weights, UKnots, VKnots,
|
||||||
UMults, VMults,
|
UMults, VMults,
|
||||||
C->Degree(), 1,
|
C->Degree(), 1,
|
||||||
C->IsPeriodic(), Standard_False);
|
C->IsPeriodic(), Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (Surf->IsKind(STANDARD_TYPE(Geom_BezierSurface))) {
|
else if (Surf->IsKind(STANDARD_TYPE(Geom_BezierSurface))) {
|
||||||
|
|
||||||
Handle(Geom_BezierSurface) SBez =
|
Handle(Geom_BezierSurface) SBez =
|
||||||
Handle(Geom_BezierSurface)::DownCast(Surf->Copy());
|
Handle(Geom_BezierSurface)::DownCast(Surf->Copy());
|
||||||
|
|
||||||
SBez->Segment (U1, U2, V1, V2);
|
SBez->Segment (U1, U2, V1, V2);
|
||||||
Standard_Integer NbUPoles = SBez->NbUPoles();
|
Standard_Integer NbUPoles = SBez->NbUPoles();
|
||||||
Standard_Integer NbVPoles = SBez->NbVPoles();
|
Standard_Integer NbVPoles = SBez->NbVPoles();
|
||||||
@ -674,33 +674,33 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
TColStd_Array2OfReal Weights (1, NbUPoles, 1, NbVPoles);
|
TColStd_Array2OfReal Weights (1, NbUPoles, 1, NbVPoles);
|
||||||
SBez->Weights (Weights);
|
SBez->Weights (Weights);
|
||||||
TheSurface = new Geom_BSplineSurface (Poles, Weights, UKnots, VKnots,
|
TheSurface = new Geom_BSplineSurface (Poles, Weights, UKnots, VKnots,
|
||||||
UMults, VMults,
|
UMults, VMults,
|
||||||
UDegree, VDegree);
|
UDegree, VDegree);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TheSurface = new Geom_BSplineSurface (Poles, UKnots, VKnots,
|
TheSurface = new Geom_BSplineSurface (Poles, UKnots, VKnots,
|
||||||
UMults, VMults,
|
UMults, VMults,
|
||||||
UDegree, VDegree);
|
UDegree, VDegree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (Surf->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) {
|
else if (Surf->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) {
|
||||||
Handle(Geom_BSplineSurface) BS =
|
Handle(Geom_BSplineSurface) BS =
|
||||||
Handle(Geom_BSplineSurface)::DownCast(Surf->Copy());
|
Handle(Geom_BSplineSurface)::DownCast(Surf->Copy());
|
||||||
Standard_Real umin, umax, vmin, vmax;
|
Standard_Real umin, umax, vmin, vmax;
|
||||||
BS->Bounds(umin, umax, vmin, vmax);
|
BS->Bounds(umin, umax, vmin, vmax);
|
||||||
if (!BS->IsUPeriodic()) {
|
if (!BS->IsUPeriodic()) {
|
||||||
if (U1 < umin)
|
if (U1 < umin)
|
||||||
U1 = umin;
|
U1 = umin;
|
||||||
if (U2 > umax)
|
if (U2 > umax)
|
||||||
U2 = umax;
|
U2 = umax;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BS->IsVPeriodic()) {
|
if (!BS->IsVPeriodic()) {
|
||||||
if (V1 < vmin)
|
if (V1 < vmin)
|
||||||
V1 = vmin;
|
V1 = vmin;
|
||||||
if (V2 > vmax)
|
if (V2 > vmax)
|
||||||
V2 = vmax;
|
V2 = vmax;
|
||||||
}
|
}
|
||||||
BS->Segment (U1, U2, V1, V2);
|
BS->Segment (U1, U2, V1, V2);
|
||||||
TheSurface = BS;
|
TheSurface = BS;
|
||||||
@ -712,46 +712,46 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
GeomAbs_Shape cont;
|
GeomAbs_Shape cont;
|
||||||
GeomAdaptor_Surface AS(Sr);
|
GeomAdaptor_Surface AS(Sr);
|
||||||
if (AS.NbUIntervals(GeomAbs_C2) > 1 || AS.NbVIntervals(GeomAbs_C2) > 1 )
|
if (AS.NbUIntervals(GeomAbs_C2) > 1 || AS.NbVIntervals(GeomAbs_C2) > 1 )
|
||||||
cont=GeomAbs_C1;
|
cont=GeomAbs_C1;
|
||||||
else
|
else
|
||||||
cont=GeomAbs_C2;
|
cont=GeomAbs_C2;
|
||||||
MaxSeg = 4*(AS.NbUIntervals(GeomAbs_CN)+1)*(AS.NbVIntervals(GeomAbs_CN)+1);
|
MaxSeg = 4*(AS.NbUIntervals(GeomAbs_CN)+1)*(AS.NbVIntervals(GeomAbs_CN)+1);
|
||||||
GeomConvert_ApproxSurface BSpS(Sr, Tol3d, cont, cont,
|
GeomConvert_ApproxSurface BSpS(Sr, Tol3d, cont, cont,
|
||||||
MaxDegree, MaxDegree, MaxSeg, 1);
|
MaxDegree, MaxDegree, MaxSeg, 1);
|
||||||
TheSurface = BSpS.Surface();
|
TheSurface = BSpS.Surface();
|
||||||
}
|
}
|
||||||
} // Fin du cas Rectangular::TrimmedSurface
|
} // Fin du cas Rectangular::TrimmedSurface
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if (S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
|
if (S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
|
||||||
Handle(Geom_SphericalSurface) TheElSurf =
|
Handle(Geom_SphericalSurface) TheElSurf =
|
||||||
Handle(Geom_SphericalSurface)::DownCast(S);
|
Handle(Geom_SphericalSurface)::DownCast(S);
|
||||||
|
|
||||||
gp_Sphere Sph = TheElSurf->Sphere();
|
gp_Sphere Sph = TheElSurf->Sphere();
|
||||||
Convert_SphereToBSplineSurface Convert(Sph);
|
Convert_SphereToBSplineSurface Convert(Sph);
|
||||||
TheSurface = BSplineSurfaceBuilder(Convert);
|
TheSurface = BSplineSurfaceBuilder(Convert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (S->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
|
else if (S->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
|
||||||
Handle(Geom_ToroidalSurface) TheElSurf =
|
Handle(Geom_ToroidalSurface) TheElSurf =
|
||||||
Handle(Geom_ToroidalSurface)::DownCast(S);
|
Handle(Geom_ToroidalSurface)::DownCast(S);
|
||||||
|
|
||||||
gp_Torus Tr = TheElSurf->Torus();
|
gp_Torus Tr = TheElSurf->Torus();
|
||||||
Convert_TorusToBSplineSurface Convert(Tr);
|
Convert_TorusToBSplineSurface Convert(Tr);
|
||||||
TheSurface = BSplineSurfaceBuilder(Convert);
|
TheSurface = BSplineSurfaceBuilder(Convert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (S->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
|
else if (S->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
|
||||||
|
|
||||||
Handle(Geom_SurfaceOfRevolution) Revol =
|
Handle(Geom_SurfaceOfRevolution) Revol =
|
||||||
Handle(Geom_SurfaceOfRevolution)::DownCast(S);
|
Handle(Geom_SurfaceOfRevolution)::DownCast(S);
|
||||||
|
|
||||||
Handle(Geom_Curve) Meridian = Revol->BasisCurve();
|
Handle(Geom_Curve) Meridian = Revol->BasisCurve();
|
||||||
Handle(Geom_BSplineCurve) C
|
Handle(Geom_BSplineCurve) C
|
||||||
= GeomConvert::CurveToBSplineCurve (Meridian);
|
= GeomConvert::CurveToBSplineCurve (Meridian);
|
||||||
|
|
||||||
Standard_Integer NbUPoles, NbUKnots;
|
Standard_Integer NbUPoles, NbUKnots;
|
||||||
Standard_Integer NbVPoles, NbVKnots;
|
Standard_Integer NbVPoles, NbVKnots;
|
||||||
@ -775,8 +775,8 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
TColStd_Array1OfInteger UMults( 1, NbUKnots);
|
TColStd_Array1OfInteger UMults( 1, NbUKnots);
|
||||||
Standard_Integer i,j;
|
Standard_Integer i,j;
|
||||||
for ( i = 1; i <= NbUKnots; i++) {
|
for ( i = 1; i <= NbUKnots; i++) {
|
||||||
UKnots(i) = UFirst + (i-1) * 2 * AlfaU;
|
UKnots(i) = UFirst + (i-1) * 2 * AlfaU;
|
||||||
UMults(i) = 2;
|
UMults(i) = 2;
|
||||||
}
|
}
|
||||||
NbVKnots = C->NbKnots();
|
NbVKnots = C->NbKnots();
|
||||||
TColStd_Array1OfReal VKnots(1, NbVKnots);
|
TColStd_Array1OfReal VKnots(1, NbVKnots);
|
||||||
@ -790,41 +790,41 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
gp_Trsf Trsf;
|
gp_Trsf Trsf;
|
||||||
|
|
||||||
for ( i = 1; i<= NbUPoles; i+=2) {
|
for ( i = 1; i<= NbUPoles; i+=2) {
|
||||||
Trsf.SetRotation( Revol->Axis(), UFirst + (i-1)*AlfaU);
|
Trsf.SetRotation( Revol->Axis(), UFirst + (i-1)*AlfaU);
|
||||||
for ( j = 1; j <= NbVPoles; j++) {
|
for ( j = 1; j <= NbVPoles; j++) {
|
||||||
NewPoles(i,j) = Poles(j).Transformed(Trsf);
|
NewPoles(i,j) = Poles(j).Transformed(Trsf);
|
||||||
NewWeights(i,j) = Weights(j);
|
NewWeights(i,j) = Weights(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gp_GTrsf Aff;
|
gp_GTrsf Aff;
|
||||||
Aff.SetAffinity( Revol->Axis(), 1/Cos(AlfaU));
|
Aff.SetAffinity( Revol->Axis(), 1/Cos(AlfaU));
|
||||||
gp_XYZ coord;
|
gp_XYZ coord;
|
||||||
for ( j= 1; j<= NbVPoles; j++) {
|
for ( j= 1; j<= NbVPoles; j++) {
|
||||||
coord = Poles(j).XYZ();
|
coord = Poles(j).XYZ();
|
||||||
Aff.Transforms(coord);
|
Aff.Transforms(coord);
|
||||||
Poles(j).SetXYZ(coord);
|
Poles(j).SetXYZ(coord);
|
||||||
}
|
}
|
||||||
for ( i = 2; i<= NbUPoles; i+=2) {
|
for ( i = 2; i<= NbUPoles; i+=2) {
|
||||||
Trsf.SetRotation( Revol->Axis(), UFirst + (i-1)*AlfaU);
|
Trsf.SetRotation( Revol->Axis(), UFirst + (i-1)*AlfaU);
|
||||||
for ( j = 1; j <= NbVPoles; j++) {
|
for ( j = 1; j <= NbVPoles; j++) {
|
||||||
NewPoles(i,j) = Poles(j).Transformed(Trsf);
|
NewPoles(i,j) = Poles(j).Transformed(Trsf);
|
||||||
NewWeights(i,j) = Weights(j) * Cos(AlfaU);
|
NewWeights(i,j) = Weights(j) * Cos(AlfaU);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TheSurface = new Geom_BSplineSurface(NewPoles, NewWeights,
|
TheSurface = new Geom_BSplineSurface(NewPoles, NewWeights,
|
||||||
UKnots, VKnots,
|
UKnots, VKnots,
|
||||||
UMults, VMults,
|
UMults, VMults,
|
||||||
2 , C->Degree(),
|
2 , C->Degree(),
|
||||||
periodic, C->IsPeriodic());
|
periodic, C->IsPeriodic());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (S->IsKind(STANDARD_TYPE(Geom_BezierSurface))) {
|
else if (S->IsKind(STANDARD_TYPE(Geom_BezierSurface))) {
|
||||||
|
|
||||||
Handle(Geom_BezierSurface) SBez =
|
Handle(Geom_BezierSurface) SBez =
|
||||||
Handle(Geom_BezierSurface)::DownCast(S);
|
Handle(Geom_BezierSurface)::DownCast(S);
|
||||||
|
|
||||||
Standard_Integer NbUPoles = SBez->NbUPoles();
|
Standard_Integer NbUPoles = SBez->NbUPoles();
|
||||||
Standard_Integer NbVPoles = SBez->NbVPoles();
|
Standard_Integer NbVPoles = SBez->NbVPoles();
|
||||||
Standard_Integer UDegree = SBez->UDegree();
|
Standard_Integer UDegree = SBez->UDegree();
|
||||||
@ -844,16 +844,16 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
VMults (2) = VDegree + 1;
|
VMults (2) = VDegree + 1;
|
||||||
SBez->Poles (Poles);
|
SBez->Poles (Poles);
|
||||||
if (SBez->IsURational() || SBez->IsVRational()) {
|
if (SBez->IsURational() || SBez->IsVRational()) {
|
||||||
TColStd_Array2OfReal Weights (1, NbUPoles, 1, NbVPoles);
|
TColStd_Array2OfReal Weights (1, NbUPoles, 1, NbVPoles);
|
||||||
SBez->Weights (Weights);
|
SBez->Weights (Weights);
|
||||||
TheSurface = new Geom_BSplineSurface (Poles, Weights, UKnots, VKnots,
|
TheSurface = new Geom_BSplineSurface (Poles, Weights, UKnots, VKnots,
|
||||||
UMults, VMults,
|
UMults, VMults,
|
||||||
UDegree, VDegree);
|
UDegree, VDegree);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TheSurface = new Geom_BSplineSurface (Poles, UKnots, VKnots,
|
TheSurface = new Geom_BSplineSurface (Poles, UKnots, VKnots,
|
||||||
UMults, VMults,
|
UMults, VMults,
|
||||||
UDegree, VDegree);
|
UDegree, VDegree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,16 +863,31 @@ Handle(BSplineSurface) GeomConvert::SplitBSplineSurface
|
|||||||
|
|
||||||
else { // In other cases => Approx
|
else { // In other cases => Approx
|
||||||
Standard_Real Tol3d=1.e-4;
|
Standard_Real Tol3d=1.e-4;
|
||||||
Standard_Integer MaxDegree =14, MaxSeg;
|
Standard_Integer MaxDegree = 14, MaxSeg;
|
||||||
GeomAbs_Shape cont;
|
GeomAbs_Shape ucont = GeomAbs_C0, vcont = GeomAbs_C0;
|
||||||
GeomAdaptor_Surface AS(Sr);
|
GeomAdaptor_Surface AS(Sr);
|
||||||
if (AS.NbUIntervals(GeomAbs_C2) > 1 || AS.NbVIntervals(GeomAbs_C2) > 1 )
|
//
|
||||||
cont=GeomAbs_C1;
|
if (Sr->IsCNu(2))
|
||||||
else
|
{
|
||||||
cont=GeomAbs_C2;
|
ucont=GeomAbs_C2;
|
||||||
|
}
|
||||||
|
else if(Sr->IsCNu(1))
|
||||||
|
{
|
||||||
|
ucont=GeomAbs_C1;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (Sr->IsCNv(2))
|
||||||
|
{
|
||||||
|
vcont=GeomAbs_C2;
|
||||||
|
}
|
||||||
|
else if(Sr->IsCNv(1))
|
||||||
|
{
|
||||||
|
vcont=GeomAbs_C1;
|
||||||
|
}
|
||||||
|
//
|
||||||
MaxSeg = 4*(AS.NbUIntervals(GeomAbs_CN)+1)*(AS.NbVIntervals(GeomAbs_CN)+1);
|
MaxSeg = 4*(AS.NbUIntervals(GeomAbs_CN)+1)*(AS.NbVIntervals(GeomAbs_CN)+1);
|
||||||
GeomConvert_ApproxSurface BSpS(Sr,Tol3d,cont,cont,
|
GeomConvert_ApproxSurface BSpS(Sr, Tol3d, ucont, vcont,
|
||||||
MaxDegree,MaxDegree,MaxSeg,1);
|
MaxDegree, MaxDegree, MaxSeg, 1);
|
||||||
TheSurface = BSpS.Surface();
|
TheSurface = BSpS.Surface();
|
||||||
}
|
}
|
||||||
} // Fin du cas direct
|
} // Fin du cas direct
|
||||||
|
13
tests/bugs/modalg_5/bug25976
Normal file
13
tests/bugs/modalg_5/bug25976
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC25976"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
##########################################################################################
|
||||||
|
# Conversion of an offset face from a spline into a spline face hangs-up the application
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
smallview
|
||||||
|
restore [locate_data_file OCC25976-copiedFace.brep] f
|
||||||
|
nurbsconvert r f
|
||||||
|
fit
|
||||||
|
set only_screen_axo 1
|
Loading…
x
Reference in New Issue
Block a user