diff --git a/src/common/tiglcommonfunctions.cpp b/src/common/tiglcommonfunctions.cpp index 48feaa706..351467787 100644 --- a/src/common/tiglcommonfunctions.cpp +++ b/src/common/tiglcommonfunctions.cpp @@ -42,6 +42,9 @@ #include "CTiglRelativelyPositionedComponent.h" #include "CTiglProjectPointOnCurveAtAngle.h" #include "CTiglBSplineAlgorithms.h" +#include "CTiglPointsToBSplineInterpolation.h" +#include "CFunctionToBspline.h" +#include "tiglmathfunctions.h" #include "Standard_Version.hxx" @@ -119,6 +122,7 @@ #include + #include #include #include @@ -127,6 +131,7 @@ #include "Debugging.h" + namespace { struct IsSame @@ -1173,6 +1178,155 @@ TopoDS_Wire BuildWireFromEdges(const TopoDS_Shape& edges) return result; } +namespace +{ + class Circle : public tigl::MathFunc3d + { + public: + Circle(double radius): tigl::MathFunc3d(), m_radius(radius) {} + + double valueX(double t) override + { + return 0.; + } + + double valueY(double t) override + { + return m_radius*std::cos(t); + } + + double valueZ(double t) override + { + return m_radius*std::sin(t); + } + + private: + double m_radius; + }; +} //anonymos namespace + +opencascade::handle ApproximateArcOfCircleToRationalBSpline(double radius, double uMin, double uMax, + double tol, double y_position, double z_position) +{ + if(radius==0){ + throw tigl::CTiglError("Invalid geometry. Radius must be != 0."); + } + if(Abs(uMax-uMin)< tol){ + throw tigl::CTiglError("Invalid geometry: Curve length must not be Zero."); + } + if(Abs(uMax-uMin)>(2.*M_PI)) + { + throw tigl::CTiglError("Invalid geometry: Curve cannot be traversed more than once."); + } + + Circle circle(radius); + int degree = 3; + + auto curve = tigl::CFunctionToBspline(circle, uMin, uMax, degree, tol).Curve(); + curve->Translate(gp_Vec(0.,y_position,z_position)); + + return curve; +} + +TopoDS_Wire BuildWireRectangle(const double heightToWidthRatio, const double cornerRadius, const double tol) +{ + if(cornerRadius<0.||cornerRadius>0.5){ + throw tigl::CTiglError("Invalid input for corner radius. Must be in range: 0 <= cornerRadius <= 0.5"); + } + + std::vector curves; + + // build half upper line from gp_points + std::vector linePntsUpperRightHalf; + linePntsUpperRightHalf.push_back(gp_Pnt(0.,0.,0.5*heightToWidthRatio)); + linePntsUpperRightHalf.push_back(gp_Pnt(0.,0.5-cornerRadius,0.5*heightToWidthRatio)); + opencascade::handle lowerLineRightHalf = + tigl::CTiglPointsToBSplineInterpolation(linePntsUpperRightHalf).Curve(); + curves.push_back(lowerLineRightHalf); + + if (!(cornerRadius == 0.0)){ + //build upper right arc + double y0 = 0.5 - cornerRadius; + double z0 = 0.5 * heightToWidthRatio - cornerRadius; + auto arcCurve = ApproximateArcOfCircleToRationalBSpline(cornerRadius, 0., M_PI/2., tol, y0, z0); + arcCurve->Reverse(); + curves.push_back(arcCurve); + } + + // build right line from gp_Pnts + std::vector linePnts_right; + linePnts_right.push_back(gp_Pnt(0., 0.5, 0.5 * heightToWidthRatio - cornerRadius)); + linePnts_right.push_back(gp_Pnt(0., 0.5, -0.5 * heightToWidthRatio + cornerRadius)); + opencascade::handle rightLine = tigl::CTiglPointsToBSplineInterpolation(linePnts_right).Curve(); + curves.push_back(rightLine); + + if (!(cornerRadius == 0.0)){ + //build lower right arc + double y0 = 0.5 - cornerRadius; + double z0 = - 0.5 * heightToWidthRatio + cornerRadius; + auto arcCurve = ApproximateArcOfCircleToRationalBSpline(cornerRadius, M_PI*(3./2.), M_PI*2., tol, y0, z0); + arcCurve->Reverse(); + curves.push_back(arcCurve); + } + + // build lower line from gp_points + std::vector linePnts_lower; + linePnts_lower.push_back(gp_Pnt(0.,(0.5-cornerRadius),-0.5*heightToWidthRatio)); + linePnts_lower.push_back(gp_Pnt(0.,(-0.5+cornerRadius),-0.5*heightToWidthRatio)); + opencascade::handle lowerLine = tigl::CTiglPointsToBSplineInterpolation(linePnts_lower).Curve(); + + curves.push_back(lowerLine); + + if (!(cornerRadius == 0.)){ + // build lower left arc + double y0 = - 0.5 + cornerRadius; + double z0 = -0.5 * heightToWidthRatio + cornerRadius; + auto arcCurve = ApproximateArcOfCircleToRationalBSpline(cornerRadius, M_PI, M_PI*(3./2.), tol, y0, z0); + arcCurve->Reverse(); + curves.push_back(arcCurve); + } + + //build left line from gp_points + std::vector linePnts_left; + linePnts_left.push_back(gp_Pnt(0.,-0.5,-0.5 * heightToWidthRatio + cornerRadius)); + linePnts_left.push_back(gp_Pnt(0.,-0.5,0.5 * heightToWidthRatio - cornerRadius)); + opencascade::handle leftLine = tigl::CTiglPointsToBSplineInterpolation(linePnts_left).Curve(); + curves.push_back(leftLine); + + if (!(cornerRadius == 0.)) { + // build upper left arc + double y0 = - 0.5 + cornerRadius; + double z0 = 0.5 * heightToWidthRatio - cornerRadius; + auto arcCurve = ApproximateArcOfCircleToRationalBSpline(cornerRadius, M_PI/2., M_PI, tol, y0, z0); + arcCurve->Reverse(); + curves.push_back(arcCurve); + } + + // build half upper line from gp_points + std::vector linePntsUpperLeftHalf; + linePntsUpperLeftHalf.push_back(gp_Pnt(0.,-(0.5-cornerRadius),0.5*heightToWidthRatio)); + linePntsUpperLeftHalf.push_back(gp_Pnt(0.,0.,0.5*heightToWidthRatio)); + opencascade::handle upperLineLeftHalf = + tigl::CTiglPointsToBSplineInterpolation(linePntsUpperLeftHalf).Curve(); + curves.push_back(upperLineLeftHalf); + + opencascade::handle curve = tigl::CTiglBSplineAlgorithms::concatCurves(curves); + + // workaround for lofting algorithm not working with curves of degree '1' (i.e. concatenated lines) + // if guide curves are involved, the lofter doesn't generate a valid geometry without thowing an error + // This only occurs if the cornerRadius is zero and the profile is a rectangle, which in theory could + // just have degree 1. + if ((curve->Degree())<2){ + curve->IncreaseDegree(2); + } + + TopoDS_Wire wire; + if (!curve.IsNull()) { + wire = BuildWireFromEdges(BRepBuilderAPI_MakeEdge(curve).Edge()); + } + return wire; +} + void BuildWiresFromConnectedEdges(const TopoDS_Shape& shape, TopTools_ListOfShape& wireList) { // get list of edges from passed shape diff --git a/src/common/tiglcommonfunctions.h b/src/common/tiglcommonfunctions.h index 5dd8e42e7..487597107 100644 --- a/src/common/tiglcommonfunctions.h +++ b/src/common/tiglcommonfunctions.h @@ -46,6 +46,8 @@ #include #include "UniquePtr.h" + + typedef std::map ShapeMap; // helper function for std::find @@ -270,6 +272,34 @@ TIGL_EXPORT TopoDS_Wire BuildWire(const gp_Pnt& p1, const gp_Pnt& p2); // Method for building a wire out of the edges from the passed geometry TIGL_EXPORT TopoDS_Wire BuildWireFromEdges(const TopoDS_Shape& edges); +/** + * @brief ApproximateArcOfCircleToRationalBSpline The result of this function is a non-rational + * B-Spline curve that approximates an arc of circle in the y-z plane. + * Its center is given by the y- and z-position. + * The angle is given in rad. + * The direction of rotation is counter-clockwise, starting with alpha=0 on the positive y-axis, with z=0. + * @param cornerRadius Radius of the circle + * @param uMin Starting parameter in rad. Range: [0,2*Pi] + * @param uMax + * @param tol Tolerance + * @param y_position + * @param z_position + * @return opencascade::handle + */ +TIGL_EXPORT opencascade::handle ApproximateArcOfCircleToRationalBSpline(double cornerRadius, double uMin = 0, double uMax = M_PI/4 , + double tol = 1e-6, double y_position = 0., double z_position = 0.); + +/** + * @brief BuildWireRectangle Builds a rectangular wire in (y,z) - plane with width 1, center of coordinate + * system is the center of the rectangle + * @param heightToWidthRatio + * @param cornerRadius + * @param tol + * @return TopoDS_Wire + */ +TIGL_EXPORT TopoDS_Wire BuildWireRectangle(const double heightToWidthRatio, const double cornerRadius=0.0, + const double tol=Precision::Approximation()); + // Returns a list of wires built from all connected edges in the passed shape TIGL_EXPORT void BuildWiresFromConnectedEdges(const TopoDS_Shape& shape, TopTools_ListOfShape& wireList); @@ -359,7 +389,7 @@ TIGL_EXPORT double NormalizeAngleDeg(double angleDeg); // Creates a linear spaces array but with some additional breaking points // If the breaking points are very close to a point, the point will be replaced // Else, the breaking point will be inserted -TIGL_EXPORT std::vector LinspaceWithBreaks(double umin, double umax, size_t n_values, const std::vector& breaks); +TIGL_EXPORT std::vector LinspaceWithBreaks(double umin, double umax, size_t n_values, const std::vector& breaks = {}); // Transforms a shape accourding to the given coordinate transformation TIGL_EXPORT TopoDS_Shape TransformedShape(const tigl::CTiglTransformation& transformationToGlobal, TiglCoordinateSystem cs, const TopoDS_Shape& shape); diff --git a/src/fuselage/CCPACSFuselageProfile.cpp b/src/fuselage/CCPACSFuselageProfile.cpp index e92153d0e..c099a1466 100644 --- a/src/fuselage/CCPACSFuselageProfile.cpp +++ b/src/fuselage/CCPACSFuselageProfile.cpp @@ -175,71 +175,101 @@ TopoDS_Wire CCPACSFuselageProfile::GetWire(bool forceClosed) const // fuselage profile element transformation. void CCPACSFuselageProfile::BuildWires(WireCache& cache) const { - if (!m_pointList_choice1) - throw CTiglError("Currently only fuselage profiles defined by pointList are supported."); - if (GetNumPoints() < 2) { - throw CTiglError("Number of points is less than 2 in CCPACSFuselageProfile::BuildWire", TIGL_ERROR); + if(m_pointList_choice1){ + BuildWiresPointList(cache); + return; } - - auto points = m_pointList_choice1->AsVector(); - auto params = m_pointList_choice1->GetParamsAsMap(); - auto kinks = m_pointList_choice1->GetKinksAsVector(); - if (mirrorSymmetry) { - SymmetrizeFuselageProfile(points, params, kinks); + if(m_standardProfile_choice3){ + if(m_standardProfile_choice3->GetRectangle_choice1()){ + BuildWiresRectangle(cache); + return; + } } + throw CTiglError("Currently only fuselage profiles defined by pointList and rectangular fuselage profiles are supported."); +} - // Build the B-Spline - auto occPoints = OccArray(points); +// Builds the fuselage profile wire from point list. +void CCPACSFuselageProfile::BuildWiresPointList(WireCache& cache) const +{ + if (GetNumPoints() < 2) { + throw CTiglError("Number of points is less than 2 in CCPACSFuselageProfile::BuildWire", TIGL_ERROR); + } - // we always want to include the endpoint, if it's the same as the startpoint - // we use the middle to enforce closing of the spline - gp_Pnt pStart = points.front().Get_gp_Pnt(); - gp_Pnt pEnd = points.back().Get_gp_Pnt(); + auto points = m_pointList_choice1->AsVector(); + auto params = m_pointList_choice1->GetParamsAsMap(); + auto kinks = m_pointList_choice1->GetKinksAsVector(); + if (mirrorSymmetry) { + SymmetrizeFuselageProfile(points, params, kinks); + } - // this check allows some tolerance, based on the absolute size of the profile - if (pStart.Distance(pEnd) < 0.005 * CTiglBSplineAlgorithms::scale(occPoints->Array1())) { - gp_Pnt pMiddle = 0.5 * (pStart.XYZ() + pEnd.XYZ()); - occPoints->SetValue(occPoints->Lower(), pMiddle); - occPoints->SetValue(occPoints->Upper(), pMiddle); - } + // Build the B-Spline + auto occPoints = OccArray(points); - // Here, the B-spline is reparameterized based on the CPACS profile after setting it up at first for accuracy reasons - // Also, a tolerance is passed used for knot insertion and removal during the reparameterization algorithm - CTiglInterpolatePointsWithKinks interp(occPoints, kinks, params, 0.5, 3, CTiglInterpolatePointsWithKinks::Algo::InterpolateFirstThenReparametrize, 1e-8); - auto spline = interp.Curve(); + // we always want to include the endpoint, if it's the same as the startpoint + // we use the middle to enforce closing of the spline + gp_Pnt pStart = points.front().Get_gp_Pnt(); + gp_Pnt pEnd = points.back().Get_gp_Pnt(); - if (mirrorSymmetry) { - double umin = spline->FirstParameter(); - double umax = spline->LastParameter(); - spline = CTiglBSplineAlgorithms::trimCurve(spline, umin, 0.5 * (umin + umax)); - CTiglBSplineAlgorithms::reparametrizeBSpline(*spline, umin, umax); - } + // this check allows some tolerance, based on the absolute size of the profile + if (pStart.Distance(pEnd) < 0.005 * CTiglBSplineAlgorithms::scale(occPoints->Array1())) { + gp_Pnt pMiddle = 0.5 * (pStart.XYZ() + pEnd.XYZ()); + occPoints->SetValue(occPoints->Lower(), pMiddle); + occPoints->SetValue(occPoints->Upper(), pMiddle); + } - // Reparamaterization based on a ParamMap defined in the CPACS file within CTiglInterpolatePointsWithKinks does not get along with reparametrizeBSplineNiceKnots. - // The geometry is changed in a way that is not acceptable anymore. However out of performance reasons, the feature should not be rejected in the most cases. - // Due to those conflicts, the function is only called, when there are no parameters defined in the CPACS file: - if (params.empty()) { - // we reparametrize the spline to get better performing lofts. - // there might be a small accuracy loss though. - spline = CTiglBSplineAlgorithms::reparametrizeBSplineNiceKnots(spline).curve; - } - - // Create wires - TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(spline).Edge(); - BRepBuilderAPI_MakeWire builder1(edge); - TopoDS_Wire tempWireOriginal = builder1.Wire(); - - BRepBuilderAPI_MakeWire builder2(edge); - if (!spline->IsClosed()) { - builder2.Add(BRepBuilderAPI_MakeEdge(spline->EndPoint(), spline->StartPoint())); - } - TopoDS_Wire tempWireClosed = builder2.Wire(); - if (tempWireClosed.IsNull() == Standard_True || tempWireOriginal.IsNull() == Standard_True) { - throw CTiglError("TopoDS_Wire is null in CCPACSFuselageProfile::BuildWire", TIGL_ERROR); - } + // Here, the B-spline is reparameterized based on the CPACS profile after setting it up at first for accuracy reasons + // Also, a tolerance is passed used for knot insertion and removal during the reparameterization algorithm + CTiglInterpolatePointsWithKinks interp(occPoints, kinks, params, 0.5, 3, CTiglInterpolatePointsWithKinks::Algo::InterpolateFirstThenReparametrize, 1e-8); + auto spline = interp.Curve(); - cache.closed = tempWireClosed; - cache.original = tempWireOriginal; + if (mirrorSymmetry) { + double umin = spline->FirstParameter(); + double umax = spline->LastParameter(); + spline = CTiglBSplineAlgorithms::trimCurve(spline, umin, 0.5 * (umin + umax)); + CTiglBSplineAlgorithms::reparametrizeBSpline(*spline, umin, umax); + } + + // Reparamaterization based on a ParamMap defined in the CPACS file within CTiglInterpolatePointsWithKinks does not get along with reparametrizeBSplineNiceKnots. + // The geometry is changed in a way that is not acceptable anymore. However out of performance reasons, the feature should not be rejected in the most cases. + // Due to those conflicts, the function is only called, when there are no parameters defined in the CPACS file: + if (params.empty()) { + // we reparametrize the spline to get better performing lofts. + // there might be a small accuracy loss though. + spline = CTiglBSplineAlgorithms::reparametrizeBSplineNiceKnots(spline).curve; + } + + // Create wires + TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(spline).Edge(); + BRepBuilderAPI_MakeWire builder1(edge); + TopoDS_Wire tempWireOriginal = builder1.Wire(); + + BRepBuilderAPI_MakeWire builder2(edge); + if (!spline->IsClosed()) { + builder2.Add(BRepBuilderAPI_MakeEdge(spline->EndPoint(), spline->StartPoint())); + } + TopoDS_Wire tempWireClosed = builder2.Wire(); + if (tempWireClosed.IsNull() == Standard_True || tempWireOriginal.IsNull() == Standard_True) { + throw CTiglError("TopoDS_Wire is null in CCPACSFuselageProfile::BuildWire", TIGL_ERROR); + } + + cache.closed = tempWireClosed; + cache.original = tempWireOriginal; +} + +//Builds the fuselage profile wire from heightToWidthRatio and cornerRadius with a tolerance of 1e-3 for the wire +void CCPACSFuselageProfile::BuildWiresRectangle(WireCache& cache) const +{ + if(!m_standardProfile_choice3->GetRectangle_choice1()){ + throw CTiglError("CCPACSFuselageProfile::BuildWire", TIGL_ERROR); + } + //Get Paramenters + auto& rectangle_profile = *m_standardProfile_choice3->GetRectangle_choice1(); + double heightToWidthRatio = rectangle_profile.GetHeightToWidthRatio().GetValue(); + double radius = (rectangle_profile.GetCornerRadius())? *rectangle_profile.GetCornerRadius() : 0. ; + //Build wire + TopoDS_Wire wire = BuildWireRectangle(heightToWidthRatio,radius, 1e-3); + cache.closed = wire; + cache.original = wire; } // Transforms a point by the fuselage profile transformation @@ -276,31 +306,44 @@ gp_Pnt CCPACSFuselageProfile::GetPoint(double zeta) const void CCPACSFuselageProfile::BuildDiameterPoints(DiameterPointsCache& cache) const { - if (!m_pointList_choice1) - throw CTiglError("No pointlist specified"); - const std::vector& coordinates = m_pointList_choice1->AsVector(); - - if (mirrorSymmetry) { - cache.start = coordinates[0].Get_gp_Pnt(); - cache.end = coordinates[coordinates.size() - 1].Get_gp_Pnt(); - } - else { - // compute starting diameter point - gp_Pnt firstPnt = coordinates[0].Get_gp_Pnt(); - gp_Pnt lastPnt = coordinates[coordinates.size() - 1].Get_gp_Pnt(); - double x = (firstPnt.X() + lastPnt.X()) / 2.; - double y = (firstPnt.Y() + lastPnt.Y()) / 2.; - double z = (firstPnt.Z() + lastPnt.Z()) / 2.; - cache.start = gp_Pnt(x, y, z); - - // find the point with the max dist to starting point - cache.end = cache.start; - for (std::vector::const_iterator it = coordinates.begin(); it != coordinates.end(); ++it) { - gp_Pnt point = it->Get_gp_Pnt(); - if (cache.start.Distance(point) > cache.start.Distance(cache.end)) { - cache.end = point; + if (m_pointList_choice1){ + const std::vector& coordinates = m_pointList_choice1->AsVector(); + if (mirrorSymmetry) { + cache.start = coordinates[0].Get_gp_Pnt(); + cache.end = coordinates[coordinates.size() - 1].Get_gp_Pnt(); + } + else { + // compute starting diameter point + gp_Pnt firstPnt = coordinates[0].Get_gp_Pnt(); + gp_Pnt lastPnt = coordinates[coordinates.size() - 1].Get_gp_Pnt(); + double x = (firstPnt.X() + lastPnt.X()) / 2.; + double y = (firstPnt.Y() + lastPnt.Y()) / 2.; + double z = (firstPnt.Z() + lastPnt.Z()) / 2.; + cache.start = gp_Pnt(x, y, z); + + // find the point with the max dist to starting point + cache.end = cache.start; + for (std::vector::const_iterator it = coordinates.begin(); it != coordinates.end(); ++it) { + gp_Pnt point = it->Get_gp_Pnt(); + if (cache.start.Distance(point) > cache.start.Distance(cache.end)) { + cache.end = point; + } } } + } else if (m_standardProfile_choice3) + { + if(m_standardProfile_choice3->GetRectangle_choice1()) + { + //Get Paramenters + auto& rectangle_profile = *m_standardProfile_choice3->GetRectangle_choice1(); + double heightToWidthRatio = rectangle_profile.GetHeightToWidthRatio().GetValue(); + cache.start = gp_Pnt(0., 0, 0.5 * heightToWidthRatio); + cache.end = gp_Pnt(0., 0, -0.5 * heightToWidthRatio); + } else { + throw CTiglError("Unknown or unsupported profile type"); + } + } else { + throw CTiglError("Unknown or unsupported profile type"); } } diff --git a/src/fuselage/CCPACSFuselageProfile.h b/src/fuselage/CCPACSFuselageProfile.h index 22dea1e97..d38895557 100644 --- a/src/fuselage/CCPACSFuselageProfile.h +++ b/src/fuselage/CCPACSFuselageProfile.h @@ -90,6 +90,12 @@ class CCPACSFuselageProfile : public generated::CPACSProfileGeometry // fuselage profile transformation. void BuildWires(WireCache& cache) const; + //Builds the fuselage profile wires from point list + void BuildWiresPointList(WireCache& cache) const; + + //Builds the fuselage profile wires from height to width ratio and corner radius + void BuildWiresRectangle(WireCache& cache) const; + // Helper function to determine the "diameter" (the wing profile chord line equivalent) // which is defined as the line intersecting Point1 and Point2 // diff --git a/src/geometry/CTiglPointsToBSplineInterpolation.cpp b/src/geometry/CTiglPointsToBSplineInterpolation.cpp index 37adbcf40..1709cca94 100644 --- a/src/geometry/CTiglPointsToBSplineInterpolation.cpp +++ b/src/geometry/CTiglPointsToBSplineInterpolation.cpp @@ -20,6 +20,7 @@ #include "CTiglError.h" #include "CTiglBSplineAlgorithms.h" +#include "tiglcommonfunctions.h" #include #include @@ -76,6 +77,11 @@ CTiglPointsToBSplineInterpolation::CTiglPointsToBSplineInterpolation(const Handl } } +CTiglPointsToBSplineInterpolation::CTiglPointsToBSplineInterpolation(const std::vector& points, + unsigned int maxDegree, bool continuousIfClosed) + : CTiglPointsToBSplineInterpolation(OccArray(points), maxDegree, continuousIfClosed) +{} + CTiglPointsToBSplineInterpolation::CTiglPointsToBSplineInterpolation(const Handle(TColgp_HArray1OfPnt) & points, const std::vector& parameters, unsigned int maxDegree, bool continuousIfClosed) @@ -101,6 +107,12 @@ CTiglPointsToBSplineInterpolation::CTiglPointsToBSplineInterpolation(const Handl } } +CTiglPointsToBSplineInterpolation::CTiglPointsToBSplineInterpolation(const std::vector& points, + const std::vector& parameters, + unsigned int maxDegree, bool continuousIfClosed) + : CTiglPointsToBSplineInterpolation(OccArray(points), parameters, maxDegree, continuousIfClosed) +{} + Handle(Geom_BSplineCurve) CTiglPointsToBSplineInterpolation::Curve() const { int degree = static_cast(Degree()); diff --git a/src/geometry/CTiglPointsToBSplineInterpolation.h b/src/geometry/CTiglPointsToBSplineInterpolation.h index ec6f0332d..874e81caa 100644 --- a/src/geometry/CTiglPointsToBSplineInterpolation.h +++ b/src/geometry/CTiglPointsToBSplineInterpolation.h @@ -39,10 +39,16 @@ class CTiglPointsToBSplineInterpolation TIGL_EXPORT CTiglPointsToBSplineInterpolation(const Handle(TColgp_HArray1OfPnt) & points, unsigned int maxDegree = 3, bool continuousIfClosed = false); + TIGL_EXPORT CTiglPointsToBSplineInterpolation(const std::vector& points, unsigned int maxDegree = 3, + bool continuousIfClosed = false); + TIGL_EXPORT CTiglPointsToBSplineInterpolation(const Handle(TColgp_HArray1OfPnt) & points, const std::vector& parameters, unsigned int maxDegree = 3, bool continuousIfClosed = false); + TIGL_EXPORT CTiglPointsToBSplineInterpolation(const std::vector& points, const std::vector& parameters, unsigned int maxDegree = 3, + bool continuousIfClosed = false); + /// Returns the interpolation curve TIGL_EXPORT Handle(Geom_BSplineCurve) Curve() const; diff --git a/tests/unittests/TestData/simpletest_standard_profile_rectangle_circle_guides.cpacs.xml b/tests/unittests/TestData/simpletest_standard_profile_rectangle_circle_guides.cpacs.xml new file mode 100644 index 000000000..7820d8fc9 --- /dev/null +++ b/tests/unittests/TestData/simpletest_standard_profile_rectangle_circle_guides.cpacs.xml @@ -0,0 +1,619 @@ + + +
+ Cpacs2Test + Simple Wing for unit testing + Martin Siggel + 2012-10-09T15:12:47 + 0.5.0 + 3.2 + + + Converted to cpacs 3.0 using cpacs2to3 - does not include structure update + cpacs2to3 + 2018-01-15T09:22:57 + 0.2 + 3.0 + + + Added missing UIDs. + fix_errors.py + 2019-04-29T20:48:26 + 0.3.0 + 3.0 + + + Converted to CPACS 3.1 using cpacs2to3 + cpacs2to3 + 2020-04-26T02:01:33 + 0.4.0 + 3.1 + + + Converted to CPACS 3.2 using cpacs2to3 + cpacs2to3 + 2021-04-23T18:02:00 + 0.5.0 + 3.2 + + +
+ + + + Cpacs2Test + + 1 + 1 + + 0 + 0 + 0 + + + + + name + description + + + 1.0 + 0.5 + 0.5 + + + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + + + +
+ D150_Fuselage_1Section1 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0 + 0 + 0 + + + + + D150_Fuselage_1Section1 + fuselageCircleProfileuID + + + 1.0 + 1.0 + 1.0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section2 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0.5 + 0 + 0 + + + + + D150_Fuselage_1Section2 + fuselageRectangleProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section3 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0 + 0 + 0 + + + + + D150_Fuselage_1Section3 + fuselageRectangle1ProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ + + D150_Fuselage_1Positioning1 + -0.5 + 90 + 0 + D150_Fuselage_1Section1ID + + + D150_Fuselage_1Positioning3 + 2 + 90 + 0 + D150_Fuselage_1Section1ID + D150_Fuselage_1Section3ID + + + + + D150_Fuselage_1Segment2 + D150_Fuselage_1Section1IDElement1 + + + D150_Fuselage_1_Segment2_guide0 + guideCurveProfileFuselage + 0 + 0 + + + D150_Fuselage_1_Segment2_guide1 + guideCurveProfileFuselage + 0.333 + 0.333 + + + D150_Fuselage_1_Segment2_guide2 + guideCurveProfileFuselage + 0.666 + 0.666 + + + D150_Fuselage_1_Segment2_guide3 + guideCurveProfileFuselage + 1 + 1 + + + D150_Fuselage_1Section2IDElement1 + + + D150_Fuselage_1Segment3 + D150_Fuselage_1Section2IDElement1 + + + D150_Fuselage_1_Segment3_guide0 + guideCurveProfileFuselage + D150_Fuselage_1_Segment2_guide0 + 0 + + + D150_Fuselage_1_Segment3_guide1 + guideCurveProfileFuselage + D150_Fuselage_1_Segment2_guide1 + 0.333 + + + D150_Fuselage_1_Segment3_guide2 + guideCurveProfileFuselage + D150_Fuselage_1_Segment2_guide2 + 0.666 + + + D150_Fuselage_1_Segment3_guide3 + guideCurveProfileFuselage + D150_Fuselage_1_Segment2_guide3 + 1 + + + D150_Fuselage_1Section3IDElement1 + + +
+
+ + + Wing + SimpleFuselage + This wing has been generated to test CATIA2CPACS. + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + +
+ Cpacs2Test - Wing Section 1 + Cpacs2Test - Wing Section 1 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 1 Main Element + Cpacs2Test - Wing Section 1 Main Element + NACA0012 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 2 + Cpacs2Test - Wing Section 2 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 2 Main Element + Cpacs2Test - Wing Section 2 Main Element + NACA0012 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 3 + Cpacs2Test - Wing Section 3 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test - Wing Section 3 Main Element + NACA0012 + + + 0.5 + 0.5 + 0.5 + + + 0 + 0 + 0 + + + 0.5 + 0 + 0 + + + + +
+
+ + + Cpacs2Test - Wing Section 1 Positioning + Cpacs2Test - Wing Section 1 Positioning + 0 + 0 + 0 + Cpacs2Test_Wing_Sec1 + + + Cpacs2Test - Wing Section 2 Positioning + Cpacs2Test - Wing Section 2 Positioning + 1 + 0 + 0 + Cpacs2Test_Wing_Sec1 + Cpacs2Test_Wing_Sec2 + + + Cpacs2Test - Wing Section 3 Positioning + Cpacs2Test - Wing Section 3 Positioning + 1 + 0 + 0 + Cpacs2Test_Wing_Sec2 + Cpacs2Test_Wing_Sec3 + + + + + Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element + Cpacs2Test_Wing_Sec1_El1 + Cpacs2Test_Wing_Sec2_El1 + + + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test_Wing_Sec2_El1 + Cpacs2Test_Wing_Sec3_El1 + + + + + Wing_CS1 + Cpacs2Test_Wing_Sec1_El1 + Cpacs2Test_Wing_Sec3_El1 + + + + + MySkinMat + 0.0 + + + + + + + MyCellMat + 0.0 + + + + 0.8 + 0.8 + + + 1.0 + 1.0 + + + + 0 + WING_CS1 + + + 0 + WING_CS1 + + + + + 0.5 + WING_CS1 + + + 0.5 + WING_CS1 + + + + + + + + + MySkinMat + + + + + + +
+
+
+
+ + + + NACA0.00.00.12 + NACA 4 Series Profile + + 1.0;0.9875;0.975;0.9625;0.95;0.9375;0.925;0.9125;0.9;0.8875;0.875;0.8625;0.85;0.8375;0.825;0.8125;0.8;0.7875;0.775;0.7625;0.75;0.7375;0.725;0.7125;0.7;0.6875;0.675;0.6625;0.65;0.6375;0.625;0.6125;0.6;0.5875;0.575;0.5625;0.55;0.5375;0.525;0.5125;0.5;0.4875;0.475;0.4625;0.45;0.4375;0.425;0.4125;0.4;0.3875;0.375;0.3625;0.35;0.3375;0.325;0.3125;0.3;0.2875;0.275;0.2625;0.25;0.2375;0.225;0.2125;0.2;0.1875;0.175;0.1625;0.15;0.1375;0.125;0.1125;0.1;0.0875;0.075;0.0625;0.05;0.0375;0.025;0.0125;0.0;0.0125;0.025;0.0375;0.05;0.0625;0.075;0.0875;0.1;0.1125;0.125;0.1375;0.15;0.1625;0.175;0.1875;0.2;0.2125;0.225;0.2375;0.25;0.2625;0.275;0.2875;0.3;0.3125;0.325;0.3375;0.35;0.3625;0.375;0.3875;0.4;0.4125;0.425;0.4375;0.45;0.4625;0.475;0.4875;0.5;0.5125;0.525;0.5375;0.55;0.5625;0.575;0.5875;0.6;0.6125;0.625;0.6375;0.65;0.6625;0.675;0.6875;0.7;0.7125;0.725;0.7375;0.75;0.7625;0.775;0.7875;0.8;0.8125;0.825;0.8375;0.85;0.8625;0.875;0.8875;0.9;0.9125;0.925;0.9375;0.95;0.9625;0.975;0.9875;1.0 + 0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0 + -0.00126;-0.0030004180415;-0.00471438572941;-0.00640256842113;-0.00806559133343;-0.00970403933653;-0.0113184567357;-0.0129093470398;-0.0144771727147;-0.0160223549226;-0.0175452732434;-0.0190462653789;-0.0205256268372;-0.0219836105968;-0.0234204267471;-0.024836242105;-0.0262311798047;-0.0276053188583;-0.0289586936852;-0.0302912936071;-0.0316030623052;-0.0328938972373;-0.0341636490097;-0.0354121207001;-0.0366390671268;-0.0378441940595;-0.0390271573644;-0.0401875620783;-0.0413249614032;-0.042438855614;-0.043528690869;-0.0445938579126;-0.0456336906587;-0.04664746464;-0.0476343953088;-0.0485936361694;-0.0495242767241;-0.0504253402064;-0.0512957810767;-0.0521344822472;-0.0529402520006;-0.0537118205596;-0.0544478362583;-0.0551468612564;-0.0558073667285;-0.0564277274483;-0.0570062156697;-0.0575409941929;-0.0580301084765;-0.0584714776309;-0.0588628840933;-0.059201961739;-0.0594861821311;-0.0597128385384;-0.059879027262;-0.0599816256958;-0.060017266394;-0.059982306219;-0.05987278938;-0.0596844028137;-0.059412421875;-0.059051643633;-0.0585963041308;-0.0580399746271;-0.0573754299024;-0.0565944788455;-0.0556877432118;-0.054644363746;-0.0534516022043;-0.0520942903127;-0.0505540468987;-0.0488081315259;-0.0468277042382;-0.0445750655553;-0.0419990347204;-0.0390266537476;-0.0355468568262;-0.0313738751622;-0.0261471986426;-0.0189390266528;0.0;0.0189390266528;0.0261471986426;0.0313738751622;0.0355468568262;0.0390266537476;0.0419990347204;0.0445750655553;0.0468277042382;0.0488081315259;0.0505540468987;0.0520942903127;0.0534516022043;0.054644363746;0.0556877432118;0.0565944788455;0.0573754299024;0.0580399746271;0.0585963041308;0.059051643633;0.059412421875;0.0596844028137;0.05987278938;0.059982306219;0.060017266394;0.0599816256958;0.059879027262;0.0597128385384;0.0594861821311;0.059201961739;0.0588628840933;0.0584714776309;0.0580301084765;0.0575409941929;0.0570062156697;0.0564277274483;0.0558073667285;0.0551468612564;0.0544478362583;0.0537118205596;0.0529402520006;0.0521344822472;0.0512957810767;0.0504253402064;0.0495242767241;0.0485936361694;0.0476343953088;0.04664746464;0.0456336906587;0.0445938579126;0.043528690869;0.042438855614;0.0413249614032;0.0401875620783;0.0390271573644;0.0378441940595;0.0366390671268;0.0354121207001;0.0341636490097;0.0328938972373;0.0316030623052;0.0302912936071;0.0289586936852;0.0276053188583;0.0262311798047;0.024836242105;0.0234204267471;0.0219836105968;0.0205256268372;0.0190462653789;0.0175452732434;0.0160223549226;0.0144771727147;0.0129093470398;0.0113184567357;0.00970403933653;0.00806559133343;0.00640256842113;0.00471438572941;0.0030004180415;0.00126 + + + + + + Circle + Profile build up from set of Points on Circle where may Dimensions are 1..-1 + + 0.0;0.0;0.0;0.0;0.0 + 0.0;1.0;0.0;-1.0;0.0 + 1.0;0.0;-1.0;0.0;1.0 + + + + Rectangle + Standard Profile Type Rectangle + + + 0.5 + + + + + Rectangle1 + Standard Profile Type Rectangle + + + 0.5 + 0.14 + + + + + + + GuideCurveProfileFuselage + + 0.0 + 0.5 + 0.0 + + + + +
+ + + + halfCube + 10.0 + 1. + + + +
diff --git a/tests/unittests/TestData/simpletest_standard_profile_rectangle_circle_kink.cpacs.xml b/tests/unittests/TestData/simpletest_standard_profile_rectangle_circle_kink.cpacs.xml new file mode 100644 index 000000000..a70eaf189 --- /dev/null +++ b/tests/unittests/TestData/simpletest_standard_profile_rectangle_circle_kink.cpacs.xml @@ -0,0 +1,734 @@ + + +
+ Cpacs2Test + Simple Wing with 4 guide curves for testing + Martin Siggel + 2020-10-12T12:26:00 + 0.5.0 + 3.2 + + + Converted to CPACS 3.2 using cpacs2to3 + cpacs2to3 + 2021-04-23T18:02:03 + 0.5.0 + 3.2 + + +
+ + + + Cpacs2Test + + 1 + 1 + + 0 + 0 + 0 + + + + + name + description + + + 1.0 + 0.5 + 0.5 + + + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + + + +
+ D150_Fuselage_1Section1 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0 + 0 + 0 + + + + + D150_Fuselage_1Section1 + fuselageCircle1ProfileuID + + + 1.0 + 1.0 + 1.0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section2 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0.01 + 0 + 0 + + + + + D150_Fuselage_1Section2 + fuselageCircleProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section3 + + + 1.0 + 3.0 + 3.0 + + + 0.0 + 0.0 + 0.0 + + + 1 + 0 + 0 + + + + + D150_Fuselage_1Section3 + fuselageRectangleProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0.5 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section3 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0 + 0 + 0 + + + + + D150_Fuselage_1Section3 + fuselageRectangle1ProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0.9 + 0 + 0 + + + + +
+
+ + + D150_Fuselage_1Positioning1 + -0.5 + 90 + 0 + D150_Fuselage_1Section1ID + + + D150_Fuselage_1Positioning3 + 2 + 90 + 0 + D150_Fuselage_1Section1ID + D150_Fuselage_1Section4ID + + + + + D150_Fuselage_1Segment2 + D150_Fuselage_1Section1IDElement1 + D150_Fuselage_1Section2IDElement1 + + + D150_Fuselage_1Segment3 + D150_Fuselage_1Section2IDElement1 + D150_Fuselage_1Section3IDElement1 + + + D150_Fuselage_1Segment4 + D150_Fuselage_1Section3IDElement1 + D150_Fuselage_1Section4IDElement1 + + +
+
+ + + Wing + SimpleFuselage + This wing has been generated to test CATIA2CPACS. + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + +
+ Cpacs2Test - Wing Section 1 + Cpacs2Test - Wing Section 1 + + + 1 + 1 + 2.5 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 1 Main Element + Cpacs2Test - Wing Section 1 Main Element + NACA0012 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 2 + Cpacs2Test - Wing Section 2 + + + 1 + 2 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 2 Main Element + Cpacs2Test - Wing Section 2 Main Element + NACA0012 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 3 + Cpacs2Test - Wing Section 3 + + + 1 + 1 + 0.5 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test - Wing Section 3 Main Element + NACA0012 + + + 0.5 + 0.5 + 0.5 + + + 0 + 0 + 0 + + + 0.5 + 0 + 0 + + + + +
+
+ + + Cpacs2Test - Wing Section 1 Positioning + Cpacs2Test - Wing Section 1 Positioning + 0 + 0 + 0 + Cpacs2Test_Wing_Sec1 + + + Cpacs2Test - Wing Section 2 Positioning + Cpacs2Test - Wing Section 2 Positioning + 0.8 + 0 + 0 + Cpacs2Test_Wing_Sec1 + Cpacs2Test_Wing_Sec2 + + + Cpacs2Test - Wing Section 3 Positioning + Cpacs2Test - Wing Section 3 Positioning + 1 + 0 + 0 + Cpacs2Test_Wing_Sec2 + Cpacs2Test_Wing_Sec3 + + + + + Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element + Cpacs2Test_Wing_Sec1_El1 + Cpacs2Test_Wing_Sec2_El1 + + + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + S1_UPPER_GUIDE + 0.5 + 0.5 + + + Lower Trailing Edge GuideCurve from GuideCurveModel - Wing Section 1 Main Element to GuideCurveModel - Wing Section 2 Main Element + Lower Trailing Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + S1_TE_LOWER_GUIDE + -1.0 + -1.0 + + + Leading Edge GuideCurve from GuideCurveModel - Wing Section 1 Main Element to GuideCurveModel - Wing Section 2 Main Element + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 2 Main Element + S1_LE_GUIDE + 0.0 + 0.0 + + + Upper Trailing Edge GuideCurve from GuideCurveModel - Wing Section 1 Main Element to GuideCurveModel - Wing Section 2 Main Element + Upper Trailing Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 2 Main Element + S1_TE_UPPER_GUIDE + 1.0 + 1.0 + + + + + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test_Wing_Sec2_El1 + Cpacs2Test_Wing_Sec3_El1 + + + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + S2_UPPER_GUIDE + C1 from previous + Wing_Seg_1_2_GuideCurve_Upper + 0.5 + + + Lower Trailing Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + Lower Trailing Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + S2_TE_LOWER_GUIDE + Wing_Seg_1_2_GuideCurve_TrailingEdgeLower + -1.0 + + + Upper Trailing Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + Upper Trailing Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + S2_TE_UPPER_GUIDE + Wing_Seg_1_2_GuideCurve_TrailingEdgeUpper + 1.0 + + + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + S2_LE_GUIDE + C1 from previous + Wing_Seg_1_2_GuideCurve_LeadingEdge + 0.0 + + + + + + + Wing_CS1 + Cpacs2Test_Wing_Sec1_El1 + Cpacs2Test_Wing_Sec3_El1 + + + + + MySkinMat + 0.0 + + + + + + + MyCellMat + 0.0 + + + + 0.8 + 0.8 + + + 1.0 + 1.0 + + + + 0 + WING_CS1 + + + 0 + WING_CS1 + + + + + 0.5 + WING_CS1 + + + 0.5 + WING_CS1 + + + + + + + + + MySkinMat + + + + + + +
+
+
+
+ + + + NACA0.00.00.12 + NACA 4 Series Profile + + 1.0;0.9875;0.975;0.9625;0.95;0.9375;0.925;0.9125;0.9;0.8875;0.875;0.8625;0.85;0.8375;0.825;0.8125;0.8;0.7875;0.775;0.7625;0.75;0.7375;0.725;0.7125;0.7;0.6875;0.675;0.6625;0.65;0.6375;0.625;0.6125;0.6;0.5875;0.575;0.5625;0.55;0.5375;0.525;0.5125;0.5;0.4875;0.475;0.4625;0.45;0.4375;0.425;0.4125;0.4;0.3875;0.375;0.3625;0.35;0.3375;0.325;0.3125;0.3;0.2875;0.275;0.2625;0.25;0.2375;0.225;0.2125;0.2;0.1875;0.175;0.1625;0.15;0.1375;0.125;0.1125;0.1;0.0875;0.075;0.0625;0.05;0.0375;0.025;0.0125;0.0;0.0125;0.025;0.0375;0.05;0.0625;0.075;0.0875;0.1;0.1125;0.125;0.1375;0.15;0.1625;0.175;0.1875;0.2;0.2125;0.225;0.2375;0.25;0.2625;0.275;0.2875;0.3;0.3125;0.325;0.3375;0.35;0.3625;0.375;0.3875;0.4;0.4125;0.425;0.4375;0.45;0.4625;0.475;0.4875;0.5;0.5125;0.525;0.5375;0.55;0.5625;0.575;0.5875;0.6;0.6125;0.625;0.6375;0.65;0.6625;0.675;0.6875;0.7;0.7125;0.725;0.7375;0.75;0.7625;0.775;0.7875;0.8;0.8125;0.825;0.8375;0.85;0.8625;0.875;0.8875;0.9;0.9125;0.925;0.9375;0.95;0.9625;0.975;0.9875;1.0 + 0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0 + -0.00126;-0.0030004180415;-0.00471438572941;-0.00640256842113;-0.00806559133343;-0.00970403933653;-0.0113184567357;-0.0129093470398;-0.0144771727147;-0.0160223549226;-0.0175452732434;-0.0190462653789;-0.0205256268372;-0.0219836105968;-0.0234204267471;-0.024836242105;-0.0262311798047;-0.0276053188583;-0.0289586936852;-0.0302912936071;-0.0316030623052;-0.0328938972373;-0.0341636490097;-0.0354121207001;-0.0366390671268;-0.0378441940595;-0.0390271573644;-0.0401875620783;-0.0413249614032;-0.042438855614;-0.043528690869;-0.0445938579126;-0.0456336906587;-0.04664746464;-0.0476343953088;-0.0485936361694;-0.0495242767241;-0.0504253402064;-0.0512957810767;-0.0521344822472;-0.0529402520006;-0.0537118205596;-0.0544478362583;-0.0551468612564;-0.0558073667285;-0.0564277274483;-0.0570062156697;-0.0575409941929;-0.0580301084765;-0.0584714776309;-0.0588628840933;-0.059201961739;-0.0594861821311;-0.0597128385384;-0.059879027262;-0.0599816256958;-0.060017266394;-0.059982306219;-0.05987278938;-0.0596844028137;-0.059412421875;-0.059051643633;-0.0585963041308;-0.0580399746271;-0.0573754299024;-0.0565944788455;-0.0556877432118;-0.054644363746;-0.0534516022043;-0.0520942903127;-0.0505540468987;-0.0488081315259;-0.0468277042382;-0.0445750655553;-0.0419990347204;-0.0390266537476;-0.0355468568262;-0.0313738751622;-0.0261471986426;-0.0189390266528;0.0;0.0189390266528;0.0261471986426;0.0313738751622;0.0355468568262;0.0390266537476;0.0419990347204;0.0445750655553;0.0468277042382;0.0488081315259;0.0505540468987;0.0520942903127;0.0534516022043;0.054644363746;0.0556877432118;0.0565944788455;0.0573754299024;0.0580399746271;0.0585963041308;0.059051643633;0.059412421875;0.0596844028137;0.05987278938;0.059982306219;0.060017266394;0.0599816256958;0.059879027262;0.0597128385384;0.0594861821311;0.059201961739;0.0588628840933;0.0584714776309;0.0580301084765;0.0575409941929;0.0570062156697;0.0564277274483;0.0558073667285;0.0551468612564;0.0544478362583;0.0537118205596;0.0529402520006;0.0521344822472;0.0512957810767;0.0504253402064;0.0495242767241;0.0485936361694;0.0476343953088;0.04664746464;0.0456336906587;0.0445938579126;0.043528690869;0.042438855614;0.0413249614032;0.0401875620783;0.0390271573644;0.0378441940595;0.0366390671268;0.0354121207001;0.0341636490097;0.0328938972373;0.0316030623052;0.0302912936071;0.0289586936852;0.0276053188583;0.0262311798047;0.024836242105;0.0234204267471;0.0219836105968;0.0205256268372;0.0190462653789;0.0175452732434;0.0160223549226;0.0144771727147;0.0129093470398;0.0113184567357;0.00970403933653;0.00806559133343;0.00640256842113;0.00471438572941;0.0030004180415;0.00126 + + + + + + Circle + Profile build up from set of Points on Circle where may Dimensions are 1..-1 + + 0.0;0.0;0.0;0.0;0.0 + 0.0;1.0;0.0;-1.0;0.0 + 1.0;0.0;-1.0;0.0;1.0 + + + + Circle1 + Profile build up from set of Points on Circle where may Dimensions are 1..-1 + + 0.0;0.0;0.0;0.0;0.0 + 0.0;1.0;0.0;-1.0;0.0 + 1.0;0.0;-1.0;0.0;1.0 + 1;3 + + 1;3 + 0.25;0.75 + + + + + Rectangle + Standard Profile Type Rectangle + + + 0.5 + + + + + Rectangle1 + Standard Profile Type Rectangle + + + 1 + 0.14 + + + + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + 0;0;0 + 0.1;0.5;0.9 + 0;0;0 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + 0 + 0.5 + 0 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + 0 + 0.5 + 0.01 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + 0;0;0 + 0.1;0.5;0.9 + 0;0;0 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + 0;0;0 + 0.1;0.5;0.9 + 0;0;0 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + -0.2 + 0.5 + 0 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + -0.05 + 0.5 + -0.03 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + 0;0;0 + 0.1;0.5;0.9 + 0;0;0 + + + + +
+ + + + halfCube + 10.0 + 1. + + + +
diff --git a/tests/unittests/testFuselageStandardProfileRectangle.cpp b/tests/unittests/testFuselageStandardProfileRectangle.cpp new file mode 100644 index 000000000..3b2cd82f2 --- /dev/null +++ b/tests/unittests/testFuselageStandardProfileRectangle.cpp @@ -0,0 +1,175 @@ +/* +* Copyright (C) 2022 German Aerospace Center +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "CTiglMakeLoft.h" +#include "test.h" +#include "tigl.h" +#include "Debugging.h" +#include "tiglcommonfunctions.h" +#include "BRepBuilderAPI_Transform.hxx" +#include +#include "CCPACSConfigurationManager.h" +#include "CCPACSConfiguration.h" +#include "CNamedShape.h" + +class FuselageStandardProfile : public ::testing::Test +{ +protected: + static void SetUpTestCase() + { + // Test case on standardProfile, mixed profiles: rectangle, rectangle with rounded corners, circle, circle with kinks + + const char* filename = "TestData/simpletest_standard_profile_rectangle_circle_kink.cpacs.xml"; + ReturnCode tixiRet; + TiglReturnCode tiglRet; + + tiglHandle = -1; + tixiHandle = -1; + + tixiRet = tixiOpenDocument(filename, &tixiHandle); + ASSERT_TRUE (tixiRet == SUCCESS); + tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "", &tiglHandle); + ASSERT_TRUE(tiglRet == TIGL_SUCCESS); + + // Test case on standardProfile rectangle with guide curves + + const char* filename1 = "TestData/simpletest_standard_profile_rectangle_circle_guides.cpacs.xml"; + ReturnCode tixiRet1; + TiglReturnCode tiglRet1; + + tiglHandle1 = -1; + tixiHandle1 = -1; + + tixiRet1 = tixiOpenDocument(filename1, &tixiHandle1); + ASSERT_TRUE (tixiRet1 == SUCCESS); + tiglRet1 = tiglOpenCPACSConfiguration(tixiHandle1, "", &tiglHandle1); + ASSERT_TRUE(tiglRet1 == TIGL_SUCCESS); + + // Test case on standardProfile, invalid elements + + ReturnCode tixiRet2; + TiglReturnCode tiglRet2; + + tiglHandle2 = -1; + tixiHandle2 = -1; + + tixiRet2 = tixiOpenDocument(filename1, &tixiHandle2); + ASSERT_TRUE (tixiRet2 == SUCCESS); + tiglRet2 = tiglOpenCPACSConfiguration(tixiHandle2, "", &tiglHandle2); + ASSERT_TRUE(tiglRet2 == TIGL_SUCCESS); + + } + + static void TearDownTestCase() + { + ASSERT_TRUE(tiglCloseCPACSConfiguration(tiglHandle) == TIGL_SUCCESS); + ASSERT_TRUE(tixiCloseDocument(tixiHandle) == SUCCESS); + tiglHandle = -1; + tixiHandle = -1; + + ASSERT_TRUE(tiglCloseCPACSConfiguration(tiglHandle1) == TIGL_SUCCESS); + ASSERT_TRUE(tixiCloseDocument(tixiHandle1) == SUCCESS); + tiglHandle1 = -1; + tixiHandle1 = -1; + + ASSERT_TRUE(tiglCloseCPACSConfiguration(tiglHandle2) == TIGL_SUCCESS); + ASSERT_TRUE(tixiCloseDocument(tixiHandle2) == SUCCESS); + tiglHandle2 = -1; + tixiHandle2 = -1; + + } + + void SetUp() override {} + void TearDown() override {} + + + static TixiDocumentHandle tixiHandle; + static TiglCPACSConfigurationHandle tiglHandle; + + static TixiDocumentHandle tixiHandle1; + static TiglCPACSConfigurationHandle tiglHandle1; + + static TixiDocumentHandle tixiHandle2; + static TiglCPACSConfigurationHandle tiglHandle2; + +}; + +TixiDocumentHandle FuselageStandardProfile::tixiHandle = 0; +TiglCPACSConfigurationHandle FuselageStandardProfile::tiglHandle = 0; +TixiDocumentHandle FuselageStandardProfile::tixiHandle1 = 0; +TiglCPACSConfigurationHandle FuselageStandardProfile::tiglHandle1 = 0; +TixiDocumentHandle FuselageStandardProfile::tixiHandle2 = 0; +TiglCPACSConfigurationHandle FuselageStandardProfile::tiglHandle2 = 0; + + + +TEST_F(FuselageStandardProfile, BuildFuselageMixedProfilesWithKinks_ValidValues) +{ + // read configuration + tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance(); + tigl::CCPACSConfiguration& config = manager.GetConfiguration(tiglHandle); + tigl::CTiglUIDManager& uidmgr = config.GetUIDManager(); + auto fuselage = config.GetFuselage(1).GetLoft(); + ASSERT_TRUE(BRepCheck_Analyzer(fuselage->Shape()).IsValid()); +} + +TEST_F(FuselageStandardProfile, BuildFuselageMixedProfilesWithGuides_ValidValues) +{ + // read configuration + tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance(); + tigl::CCPACSConfiguration& config = manager.GetConfiguration(tiglHandle1); + tigl::CTiglUIDManager& uidmgr = config.GetUIDManager(); + auto fuselage = config.GetFuselage(1).GetLoft(); + ASSERT_TRUE(BRepCheck_Analyzer(fuselage->Shape()).IsValid()); +} + +TEST_F(FuselageStandardProfile, BuildFuselageMixedProfilesWithGuides_InvalidInput) +{ + tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance(); + //add invalid element + tixiCreateElementAtIndex(tixiHandle2, "/cpacs/vehicles/profiles/fuselageProfiles", "fuselageProfile", 1); + tixiCreateElement(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]", "invalidType"); + tixiAddTextAttribute(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]", "uID", "std2"); + + // change uid of one segment to invalid profile type + tixiUpdateTextElement(tixiHandle2, "/cpacs/vehicles/aircraft/model/fuselages/fuselage[1]/sections/section[1]/elements/element[1]/profileUID", "std2"); + tiglOpenCPACSConfiguration(tixiHandle2, "", &tiglHandle2); + tigl::CCPACSConfiguration& config1 = manager.GetConfiguration(tiglHandle2); + + // fuselage cannot be build with invalid profile + ASSERT_THROW(config1.GetFuselage(1).GetLoft(),tigl::CTiglError); + + //add point list profile with 2 elements + tixiCreateElementAtIndex(tixiHandle2, "/cpacs/vehicles/profiles/fuselageProfiles", "fuselageProfile", 1); + tixiCreateElement(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]", "pointList"); + tixiAddTextAttribute(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]", "uID", "pls"); + tixiCreateElement(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]/pointList", "x"); + tixiAddTextAttribute(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]/x", "mapType", "vector"); + tixiAddTextElement(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]","x", "1.0;0.9"); + tixiCreateElement(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]/pointList", "y"); + tixiAddTextAttribute(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]/y", "mapType", "vector"); + tixiAddTextElement(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]","y", "0.0;0.0"); + tixiCreateElement(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]/pointList", "z"); + tixiAddTextAttribute(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]/z", "mapType", "vector"); + tixiAddTextElement(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]","z", "1.0;0.9"); + + // change uid of one segment to profile type with only two points in point list + tixiUpdateTextElement(tixiHandle2, "/cpacs/vehicles/aircraft/model/fuselages/fuselage[1]/sections/section[1]/elements/element[1]/profileUID", "pls"); + tiglOpenCPACSConfiguration(tixiHandle2, "", &tiglHandle2); + tigl::CCPACSConfiguration& config2 = manager.GetConfiguration(tiglHandle2); + // fuselage cannot be build with invalid profile + ASSERT_THROW(config2.GetFuselage(1).GetLoft(),tigl::CTiglError); + +} diff --git a/tests/unittests/testctiglbsplinealgorithms.cpp b/tests/unittests/testctiglbsplinealgorithms.cpp index b1fd81b6e..cc8dbafaa 100644 --- a/tests/unittests/testctiglbsplinealgorithms.cpp +++ b/tests/unittests/testctiglbsplinealgorithms.cpp @@ -87,11 +87,28 @@ TEST(TiglBSplineAlgorithms, testComputeParamsBSplineCurve) ASSERT_NEAR(parameters[3], right_parameters(4), 1e-15); } -TEST(TiglBSplineAlgorithms, testComputeParamsBSplineSurface) +TEST(TiglBSplineAlgorithms, testCTiglPointsToBSplineInterpolation) { - // test for method computeParamsBSplineSurf - - // TODO + // create a curve with parameters + std::vector curvePnts(5); + curvePnts.at(0) = (gp_Pnt(0., 0., 1.)); + curvePnts.at(1) = (gp_Pnt(0., 0.1, 1.2)); + curvePnts.at(2) = (gp_Pnt(0., 0.2, 1.7)); + curvePnts.at(3) = (gp_Pnt(0., 0.1, 1.5)); + curvePnts.at(0) = (gp_Pnt(0., 0.3, 1.9)); + std::vector params = { 0.1, 0.3, 0.4, 0.5,0.9}; + auto curve = tigl::CTiglPointsToBSplineInterpolation(curvePnts, params).Curve(); + std::vector curvePnts1(5); + curve->D0(0.1,curvePnts1[0]); + curve->D0(0.3,curvePnts1[1]); + curve->D0(0.4,curvePnts1[2]); + curve->D0(0.5,curvePnts1[3]); + curve->D0(0.9,curvePnts1[4]); + ASSERT_TRUE(curvePnts1[0].IsEqual(curvePnts[0], 1e-5)); + ASSERT_TRUE(curvePnts1[1].IsEqual(curvePnts[1], 1e-5)); + ASSERT_TRUE(curvePnts1[2].IsEqual(curvePnts[2], 1e-5)); + ASSERT_TRUE(curvePnts1[3].IsEqual(curvePnts[3], 1e-5)); + ASSERT_TRUE(curvePnts1[4].IsEqual(curvePnts[4], 1e-5)); } TEST(TiglBSplineAlgorithms, testCreateCommonKnotsVectorCurve) diff --git a/tests/unittests/tiglCommonFunctions.cpp b/tests/unittests/tiglCommonFunctions.cpp index cd6161c63..101b55c98 100644 --- a/tests/unittests/tiglCommonFunctions.cpp +++ b/tests/unittests/tiglCommonFunctions.cpp @@ -15,6 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include "CTiglMakeLoft.h" +#include "Debugging.h" #include "tigl.h" #include "tiglcommonfunctions.h" #include "test.h" @@ -28,6 +31,8 @@ #include #include #include +#include +#include #include #include @@ -138,6 +143,67 @@ TEST(TiglCommonFunctions, tiglCheckPointInside_api) } +TEST(TiglCommonFuctions, ApproximateArcOfCircleToRationalBSpline) +{ + //test valid curves + auto arcCurve1 = ApproximateArcOfCircleToRationalBSpline(2., 0., 5., 1.e-5, 0., 0.); + auto arcCurve2 = ApproximateArcOfCircleToRationalBSpline(1., 0.3, 5., 1.e-5, 0., 0.); + ASSERT_TRUE(GetLength(BRepBuilderAPI_MakeEdge(arcCurve1))>0.); + ASSERT_TRUE(!arcCurve1.IsNull()); + ASSERT_EQ(arcCurve1->Degree(),3); + ASSERT_TRUE(!arcCurve2.IsNull()); + ASSERT_EQ(arcCurve2->Degree(),3); + ASSERT_NO_THROW(ApproximateArcOfCircleToRationalBSpline(1., 0., 2*M_PI, 1.e-5, 0., 0.)); + ASSERT_NO_THROW(ApproximateArcOfCircleToRationalBSpline(1., 0., M_PI/2., 1.e-5, 0., 0.)); + //test invalid curves + //radius zero + ASSERT_THROW(ApproximateArcOfCircleToRationalBSpline(0., 0.3, 0.3, 1.e-5, 0., 0.), tigl::CTiglError); + //no span + ASSERT_THROW(ApproximateArcOfCircleToRationalBSpline(1., 0.3, 0.3, 1.e-5, 0., 0.), tigl::CTiglError); + ASSERT_THROW(ApproximateArcOfCircleToRationalBSpline(1., 0.0, 0.0, 1.e-5, 0., 0.), tigl::CTiglError); + //multiple traversion + ASSERT_THROW(ApproximateArcOfCircleToRationalBSpline(1., 0., 20., 1.e-5, 0., 0.), tigl::CTiglError); + +} + +TEST(TiglCommonFunctions, BuildWireRectangle_CornerRadiusZero) +{ + auto wire = BuildWireRectangle(1., 0.); + ASSERT_TRUE(wire.Closed()); + auto trafo = gp_Trsf(); + auto vec = gp_Vec(-1.,0.,0.); + trafo.SetTranslation(vec); + auto wire2 = BRepBuilderAPI_Transform(wire, trafo).Shape(); + ASSERT_TRUE(wire2.Closed()); + auto loft = CTiglMakeLoft(); + loft.addProfiles(wire); + loft.addProfiles(wire2); + ASSERT_TRUE(BRepCheck_Analyzer(loft.Shape()).IsValid()); + + +} + +TEST(TiglCommonFunctions, BuildWireRectangle_CornerRadiusOK) +{ + auto wire = BuildWireRectangle(0.5, 0.14); + ASSERT_TRUE(wire.Closed()); + auto trafo = gp_Trsf(); + auto vec = gp_Vec(-1.,0.,0.); + trafo.SetTranslation(vec); + auto wire2 = BRepBuilderAPI_Transform(wire, trafo).Shape(); + ASSERT_TRUE(wire2.Closed()); + auto loft = CTiglMakeLoft(); + loft.addProfiles(wire); + loft.addProfiles(wire2); + ASSERT_TRUE(BRepCheck_Analyzer(loft.Shape()).IsValid()); +} + +TEST(TiglCommonFunctions, BuildWireRectangle_CornerRadiusInvalid) +{ + ASSERT_THROW(BuildWireRectangle(0.5, 1.), tigl::CTiglError); + ASSERT_THROW(BuildWireRectangle(0.5, -1.), tigl::CTiglError); +} + TEST(TiglCommonFunctions, LinspaceWithBreaks) { std::vector breaks;